Configuring environment variables

2 minute read
On this page

If your build environment is fairly constant, you might want to use environment variables to avoid respecifying values for each build. Environment variables function the same way as command-line options, but command-line options take precedence over environment variables.

Because eMake environment variables are propagated automatically to Agents, most commands running on an Agent will run with the correct environment without modifications.

However, two important exceptions exist.

  • As described in Configuring Tools , if tools are installed on the cluster host in different locations from the build system, the PATH variable (and other variables that reference tool locations) on the build system must be modified to include the locations for the cluster tools.

  • Generally, differences between the build system and cluster hosts might indicate it is undesirable to override environment variables with eMake values. In this case, use the --emake-exclude-env command-line option or the EMAKE_EXCLUDE_ENV environment variable.

For example, consider a build system environment variable called LICENSE_SERVER that normally contains the license server name that the system should contact to obtain a tools license. If this variable is machine-specific, eMake overrides the correct machine-specific value on the cluster hosts with the value from the build system. To ensure eMake does not override LICENSE_SERVER with the value from the build system, use the option, --emake-exclude-env, when running eMake:

--emake-exclude-env=LICENSE_SERVER

You can specify more than one value by separating them with commas:

--emake-exclude-env=LICENSE_SERVER,TOOLS_SERVER

Some variables are almost always used to describe the local machine state, so eMake always excludes them from mirroring. These variables are:

TMP TEMP TMPDIR

For Windows, this list also includes:

COMSPEC SYSTEMROOT

Configuring ccache

The only configuration required to use ccache with CloudBees Build Acceleration is to set the CCACHE_NOSTATS environment variable. If you do not set this environment variable, the entire build becomes serialized because ccache continuously writes to a statistics file throughout the build. To learn more about ccache, refer to https://ccache.dev/.