Build environment build-environment
Learn about Cloud Manager’s build environment and how it builds and tests your code.
Build environment details build-environment-details
Cloud Manager builds and tests your code using a specialized build environment.
- The build environment is Linux-based, derived from Ubuntu 22.04.
- Apache Maven 3.9.4 is installed.
- ÃÛ¶¹ÊÓƵ recommends users update their Maven repositories to use HTTPS instead of HTTP.
- The Java versions installed are Oracle JDK 11.0.22 and Oracle JDK 8u401.
-
There are some additional system packages installed which are necessary.
bzip2
unzip
libpng
imagemagick
graphicsmagick
-
Other packages may be installed at build time as described in the section Installing Additional System Packages.
-
Each build runs in a clean environment, with the build container retaining no state between executions.
-
Maven is always run with the following three commands.
mvn --batch-mode org.apache.maven.plugins:maven-dependency-plugin:3.1.2:resolve-plugins
mvn --batch-mode org.apache.maven.plugins:maven-clean-plugin:3.1.0:clean -Dmaven.clean.failOnError=false
mvn --batch-mode org.jacoco:jacoco-maven-plugin:prepare-agent package
-
Maven is configured at a system level with a
settings.xml
file, which automatically includes the public ÃÛ¶¹ÊÓƵ artifact repository using a profile namedadobe-public
. (See for more details).
jacoco-maven-plugin
, the version used must be at least 0.7.5.201505241946
.HTTPS Maven repositories https-maven
Cloud Manager release 2023.10.0 began a rolling update to the build environment (completing with release 2023.12.0), which included an update to Maven 3.8.8. A significant change introduced in Maven 3.8.1 was a security enhancement aimed at mitigating potential vulnerabilities. Specifically, Maven now disables all insecure http://*
mirrors by default, as outlined in the .
As a result of this security enhancement, some users may face issues during the build step, particularly when downloading artifacts from Maven repositories that use insecure HTTP connections.
To ensure a smooth experience with the updated version, ÃÛ¶¹ÊÓƵ recommends that users update their Maven repositories to use HTTPS instead of HTTP. This adjustment aligns with the industry’s growing shift towards secure communication protocols and helps maintain a secure and reliable build process.
Use a specific Java version
The Cloud Manager build process uses the Oracle 8 JDK to build projects by default, but AEM Cloud Service customers should set the Maven execution JDK version to 11.
Set the Maven JDK version
ÃÛ¶¹ÊÓƵ recommends that you set the JDK version for the entire Maven execution to 11
in a .cloudmanager/java-version file
.
To do so, create a file named .cloudmanager/java-version
in the git repository branch used by the pipeline. Edit the file so that it contains only the text, 11
. While Cloud Manager also accepts a value of 8
, this version is no longer supported for AEM Cloud Service projects. Any other value is ignored. When 11
is specified, Oracle 11 is used and the JAVA_HOME
environment variable is set to /usr/lib/jvm/jdk-11.0.22
.
Environment variables - standard environment-variables
You may find it necessary to vary the build process based on information about the program or pipeline.
For instance, if JavaScript minification occurs at build time using a tool like gulp, different minification levels may be preferred for various environments. A development build might use a lighter minification level compared to staging and production.
To support this, Cloud Manager adds these standard environment variables to the build container for every execution.
CM_BUILD
true
BRANCH
CM_PIPELINE_ID
CM_PIPELINE_NAME
CM_PROGRAM_ID
CM_PROGRAM_NAME
ARTIFACTS_VERSION
CM_AEM_PRODUCT_VERSION
Environment variables - pipeline pipeline-variables
Your build process might require specific configuration variables that should not be stored in the Git repository. Additionally, you may need to adjust these variables between pipeline executions using the same branch.
See also Configure Pipeline Variables for more information.
Install additional system packages installing-additional-system-packages
Some builds require additional system packages to function fully. For example, a build may invoke a Python or Ruby script and must have an appropriate language interpreter installed. This installation process can be managed by calling the in your pom.xml
to invoke APT. This execution should generally be wrapped in a Cloud Manager-specific Maven profile. This example installs Python.
<profile>
<id>install-python</id>
<activation>
<property>
<name>env.CM_BUILD</name>
</property>
</activation>
<build>
<plugins>
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>exec-maven-plugin</artifactId>
<version>1.6.0</version>
<executions>
<execution>
<id>apt-get-update</id>
<phase>validate</phase>
<goals>
<goal>exec</goal>
</goals>
<configuration>
<executable>apt-get</executable>
<arguments>
<argument>update</argument>
</arguments>
</configuration>
</execution>
<execution>
<id>install-python</id>
<phase>validate</phase>
<goals>
<goal>exec</goal>
</goals>
<configuration>
<executable>apt-get</executable>
<arguments>
<argument>install</argument>
<argument>-y</argument>
<argument>--no-install-recommends</argument>
<argument>python</argument>
</arguments>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
</build>
</profile>
This same technique can be used to install language-specific packages, for example, using gem
for RubyGems or pip
for Python Packages.