Build and deploy

The .magento.env.yaml file centralizes the management of build and deploy actions across all of your environments, including Pro Staging and Production, using environment variables.

Unlike other YAML configuration files, such as .magento.app.yaml, .magento/routes.yaml, and .magento/services.yaml, you can use the .magento.env.yaml file to manage configuration settings without opening a support ticket.

If you want to configure unique actions in each environment, you must modify this file in each environment branch.

The .magento.env.yaml file includes the following sections:

  • stage—Accommodates the following stages of deployment:
    • global—Controls actions in both the build, deploy, and post-deploy phases. You can override these settings in the build, deploy, and post-deploy sections.
    • build—Controls actions in the build phase only. If you do not specify settings in this section, the build phase uses settings from the global section. Settings in the build_options.ini file override settings in this section.
    • deploy—Controls actions in the deploy phase only. If you do not specify settings in this section, the deploy phase uses settings from the global section.
    • post-deploy—Controls actions after deploying your application and after the container begins accepting connections.
  • log—Controls notifications, including notification types and level of detail.
    • slack—Configure a message to send to a Slack bot.
    • email—Configure an email to send to one or more email recipients.
    • logging handlers—Configure hardware and software application messages sent to a remote logging server.

The latest sample of the .magento.env.yaml file is in the magento-cloud template repository. You can find a detailed definition for each variable in the following reference topics:

  • Application—variables control administrative credentials
  • Cloud—variables specific to Magento Commerce (Cloud)
  • Global—variables control actions in the following stages:
    • Build—variables control build actions
    • Deploy—variables control deploy actions
    • Post-deploy—variables control actions after deploy