Maven Scripts
The Self-Managed Commerce build tools include Maven shell scripts that can perform Self-Managed Commerce builds and run Self-Managed Commerce tests.
Prerequisite: Configure the Build Environment
The scripts are designed to be run in an suitably configured environment. For more information, see Configure the Build Environment.
General Usage
For each of the Maven scripts, the basic usage is the same.
- Establish a shell session on the build host.
- Clone the Self-Managed Commerce source code project
ep-commerce
from your organization Git repository. - Checkout the
ep-commerce
branch that you want to build. - Change directory to
devops/build_tools
. - Invoke the script.
Build the Source Tree
The devops/build_tools/build_source_tree.sh
shell script will perform a source code build and create all of the required artifacts. The script can optionally deploy artifacts to a remote repository management system, such as Sonatype Nexus. This script is typically run to prepare the maven environment prior to building container images or running application tests.
cd devops/build_tools
./build_source_tree.sh
Script options
Additional options are available that allow you to control the behaviour of the script.
Deploying artifacts to a remote repository
By default, the build_source_tree.sh
shell script create artifacts in the local Maven repository. If you are intending to deploy artifacts to a remote Maven repository, use the --deploy
option:
# Build the source tree with the deploy option.
# The resulting artifacts are deployed to the repository manager (eg: Sonatype Nexus)
cd devops/build_tools
./build_source_tree.sh --deploy
note
Deploying artifacts to a remote Maven repository requires a suitably configured Maven settings.xml configuration file on the build host.
Build the Container Image Layout
Use the devops/build_tools/build_container_layout.sh
shell script to assemble the application artifacts in a structure suitable for building container images.
note
The source tree must be built before you create the container layout. Run the build_source_tree.sh
script before running build_container_layout.sh
.
cd devops/build_tools
# Prepreq: build the source tree and create application artifacts
./build_source_tree.sh
# Build the container layout: assemble the artifacts in a structure suitable for building container images.
./build_container_layout.sh
Output
After the script completes, a local folder containing the files required to build Self Managed Commerce container images will exist. The folder is also zipped up as a Maven artifact. You can then use the contents of that folder to build Self Managed Commerce container images.
- The folder can be found under
extensions/packager/ext-container-layout/target/container-layout
. - The zip file of the folder can be found at
extensions/packager/ext-container-layout/target/ext-container-layout.zip
.
tip
The next step, after building the container layout, is to build the Commerce application container images. For more information, see Build Application Images.
For information about the relationship between the Self-Managed Commerce application images, the base images, and the deployment package, see Self-Managed Commerce Deployment Artifacts.
Script options
Additional options are available that allow you to control the behaviour of the script.
Deploying the zip file artifact to a remote repository
By default, the build_container_layout.sh
shell script create the artifacts locally. You can optionally deploy have Maven deploy the zip file artifact to a remote Maven repository, as a way to persist it and to make it available to other processes.
# Build the container layout with the deploy option.
# The resulting ext-container-layout.zip zip file is also deployed to
# and available at the repository manager (eg: Sonatype Nexus)
cd devops/build_tools
./build_container_layout.sh --deploy
note
Deploying artifacts to a remote Maven repository requires a suitably configured Maven settings.xml configuration file on the build host.
Run Extensions Tests
Use the included devops/build_tools/run_extensions_tests.sh
shell script to build the Self-Managed Commerce source code and run Commerce extensions tests in a single operation.
cd devops/build_tools
./run_extensions_tests.sh
Script options
Additional options are available that allow you to control the behaviour of the script.
Fail immediately upon first test failure
By default, the run_extensions_tests.sh
script will report failures at the end of the test process. If you would like the script to exit immediately when a test failure occurs, use the --fail-fast
option:
# The script will exit with an error after the first test failure
cd devops/build_tools
./run_extensions_tests.sh --fail-fast
Build Deployment Package
note
The devops/build_tools/build_deployment_package.sh
shell script is deprecated. If your goal is to build application container images then use the build_container_layout.sh
script instead. See Building Container Image Layout above.
The devops/build_tools/build_deployment_package.sh
shell script is used to build the Self-Managed Commerce source code and create the deployment package Zip file. Older containerization tools required the deployment package as an input, but the current generation of tools do not.
# Build the source tree and deployment package.
# The resulting artifacts will exist locally in the build environment.
cd devops/build_tools
./build_deployment_package.sh
Output
After the script completes, the deployment package Zip file can be found under extensions/packager/ext-deployment-package/target/
.
tip
For information about the relationship between the Self-Managed Commerce application images, the base images, and the deployment package, see Self-Managed Commerce Deployment Artifacts.
Script options
Additional options are available that allow you to control the behaviour of the script.
Deploying artifacts to a remote repository
By default, the build_deployment_package.sh
shell script create artifacts in the local Maven repository. If you are intending to deploy artifacts to a remote Maven repository, use the --deploy
option:
# Build the source tree and deployment package with the deploy option.
# The resulting artifacts are also deployed to the repository manager (eg: Sonatype Nexus)
cd devops/build_tools
./build_deployment_package.sh --deploy
note
Deploying artifacts to a remote Maven repository requires a suitably configured Maven settings.xml configuration file on the build host.