Build variables

The following build variables control actions in the build phase and can inherit and override values from the Global variables. Insert these variables in the build stage of the .magento.env.yaml file:

1
2
3
stage:
  build:
    BUILD_VARIABLE_NAME: value

For more information about customizing the build and deploy process:

The following variables were removed in v2.2:

  • skip_di_clearing
  • skip_di_compilation

SCD_USE_BALER

  • DefaultNot set
  • Version—Magento 2.3.0 and later

Baler scans your generated JavaScript code and creates an optimized JavaScript bundle. Deploying the optimized bundle to your site can reduce the number of network requests when loading your site and improve page load times.

Set to true to run Baler after performing static content deployment.

1
2
3
stage:
  build:
    SCD_USE_BALER: true

You must install and configure the Baler module before using this feature. See Optimize JavaScript and HTML content. Because Baler is currently in alpha release, we do not recommend using it in Production environments.

ERROR_REPORT_DIR_NESTING_LEVEL

  • Default1
  • Version—Magento 2.1.4 and later

Set the level of directory nesting for saving error report files to avoid filling the report directory with tens of thousands of files, which makes it difficult to manage and review the data. This setting defaults to 1. Typically, you do not need to change the default value unless you have problems managing error report files in the <magento_root>/var/report/ directory.

1
2
3
stage:
  build:
    ERROR_REPORT_DIR_NESTING_LEVEL: 2

SCD_COMPRESSION_LEVEL

  • Default6
  • Version—Magento 2.1.4 and later

Specifies which gzip compression level (0 to 9) to use when compressing static content; 0 disables compression.

1
2
3
stage:
  build:
    SCD_COMPRESSION_LEVEL: 4

SCD_COMPRESSION_TIMEOUT

  • Default600
  • Version—Magento 2.1.4 and later

When the time it takes to compress the static assets exceeds the compression timeout limit, it interrupts the deployment process. Set the maximum execution time, in seconds, for the static content compression command.

1
2
3
stage:
  build:
    SCD_COMPRESSION_TIMEOUT: 800

SCD_MATRIX

  • DefaultNot set
  • Version—Magento 2.1.4 and later

You can configure multiple locales per theme. This customization helps speed up the build process by reducing the number of unnecessary theme files. For example, you can build the magento/backend theme in English and a custom theme in other languages.

The following example builds the magento/backend theme with three locales:

1
2
3
4
5
6
7
8
stage:
  build:
    SCD_MATRIX:
      "magento/backend":
        language:
          - en_US
          - fr_FR
          - af_ZA

Also, you can choose to not deploy a theme:

1
2
3
4
stage:
  build:
    SCD_MATRIX:
      "magento/backend": [ ]

SCD_MAX_EXECUTION_TIME

  • DefaultNot set
  • Version—Magento 2.2.0 and later

Allows you to increase the maximum expected execution time for static content deployment.

By default, Magento Commerce sets the maximum expected execution to 400 seconds, but in some scenarios you might need more time to complete the static content deployment for a Cloud project.

1
2
3
stage:
  build:
    SCD_MAX_EXECUTION_TIME: 3600

SCD_STRATEGY

  • Defaultquick
  • Version—Magento 2.2.0 and later

Customize the deployment strategy for static content. See Deploy static view files.

Use these options only if you have more than one locale:

  • standard—deploys all static view files for all packages.
  • quick—minimizes deployment time. This is the default command option, if not specified.
  • compact—conserves disk space on the server. In Magento version 2.2.4 and earlier, this setting overrides the value for scd_threads with a value of 1.
1
2
3
stage:
  build:
    SCD_STRATEGY: "compact"

SCD_THREADS

  • Default—Automatic
  • Version—Magento 2.1.4 and later

Sets the number of threads for static content deployment. The default value is set based on the detected CPU thread count and does not exceed a value of 4. Increasing the number of threads speeds up static content deployment; decreasing the number of threads slows it down. You can set the thread value, for example:

1
2
3
stage:
  build:
    SCD_THREADS: 2

To further reduce deployment time, we recommend using Configuration Management with the scd-dump command to move static deployment into the build phase.

SKIP_SCD

  • DefaultNot set
  • Version—Magento 2.1.4 and later

Set to true to skip static content deployment during the build phase.

If you already deploy static content during the build phase with Configuration Management, you can skip static content deployment for a quick build test.

On the build phase, we recommend setting SKIP_SCD: false so that the static content build occurs during the build phase where the process will not impact site deployment or cause unnecessary site downtime. See Static content deployment.

1
2
3
stage:
  build:
    SKIP_SCD: false

VERBOSE_COMMANDS

  • DefaultNot set
  • Version—Magento 2.1.4 and later

Enables or disables the Symfony debug verbosity level for your logs. Choose the level of detail provided in the logs: -v, -vv, or -vvv.

1
2
3
stage:
  build:
    VERBOSE_COMMANDS: "-vv"