Setup CI Server
Setup CI Server
Dependent on | By | Documentation |
---|---|---|
CI server provisioning | IT Operations | Prepare Infrastructure |
Maven repository setup | DevOps | Setup Maven Repository |
Source code preparation | Tech Lead | Prepare Source Code |
Overview
A Continuous Integration (CI) server is a core requirement for team-based development. There are a number of excellent CI servers that are available. Elastic Path uses Jenkins for internal projects.
The objectives of this step are to:
- Automatically build all projects that were committed to source control in Prepare Source Code
- Deploy the resulting artifacts to the Maven repository manager so they can be shared with the construction team.
- See Jenkins Setup for detailed instructions on how to install and configure Jenkins.
- Then follow Jenkins Job Setup to create Jenkins jobs.
CI jobs
At this time, we only need to setup CI jobs on the primary development branch (e.g. develop in Git, trunk in SVN). Prior to release it will also be necessary to setup CI on the release branch.
The jobs and associated commands to be automated are:
Job Name | Description | Maven command | |||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
Commerce Engine Build |
| Root POM: commerce-engine/pom.xml mvn -B -U -e clean deploy -DskipAllTests | |||||||||||||
Commerce Engine Tests |
| Root POM: commerce-engine/pom.xml mvn -B -U -e clean install | |||||||||||||
Extensions Build |
| Root POM: extensions/pom.xml mvn -B -U -e clean deploy | |||||||||||||
EP AEM Commerce Build |
| Root POM: ep-aem-commerce/pom.xml mvn -B -U -e clean deploy | |||||||||||||
Geometrixx Demo Build |
| Root POM: geometrixx-demo/pom.xml mvn -B -U -e clean deploy | |||||||||||||
CM Client Build |
| Root POM: cmclient/pom.xml mvn -B -U -e clean deploy -Pmulti-platform | |||||||||||||
Deployment Package |
| Root POM: extensions/packager/pom.xml. mvn -B -U -e clean deploy | |||||||||||||
Deploy to Dev Team Server |
| Root POM: devops/pom.xml -B -U -e clean package After Maven has completed, the CI server should execute the following script ssh $DEPLOYER_USER@$DEPLOYER_HOST """ cd ~/ rm -rf target && rm -rf deploy && mkdir deploy """ scp $WORKSPACE/pusher-package/target/*.zip $DEPLOYER_USER@$DEPLOYER_HOST:deploy ssh $DEPLOYER_USER@$DEPLOYER_HOST """ cd deploy chmod +x *.zip && unzip *pusher-package*.zip """ ssh $DEPLOYER_USER@$DEPLOYER_HOST """ cd deploy/the-pusher* chmod +x PushDeploy.sh && ./PushDeploy.sh -p ../*deployment-package*.zip -f ../environments/dev/pusher.conf -f ../environments/dev/database.properties -d $DATA_POPULATION_COMMAND """ where the following parameters are supplied by the CI job:
|
Notes
- A valid settings.xml is required to build projects. The recommended practice is to use maven/ci-settings.xml in the devops project and check this out from SCM at the beginning of each job.
- You can choose to add the following profiles to each of the maven commands:
- pass-build-even-if-tests-fail - Using Jenkins, if a test fails then the build does not fail. This is useful because the build will continue running and it will find all test failures. The build will turn unstable instead of passing or failing.
- pass-build-even-if-code-compliance-fails - Same logic as (a) but with regards to code compliance/code checking rules.
Distribution management
In order to deploy artifacts to your Maven repository you need a settings.xml file with the repository URLs and credentials to match the distribution management defined for EP projects, as shown below:
The <distributionManagement> is defined as:
<distributionManagement> <repository> <id>ep-releases</id> <url>${ep.releases.repository.url}</url> </repository> <snapshotRepository> <id>ep-snapshots</id> <url>${ep.snapshots.repository.url}</url> </snapshotRepository> </distributionManagement>
Configure ci-settings.xml
To configure Maven for CI builds and distribution management, replace the following tokens in devops/maven/ci-settings.xml and commit to source control.
Token | Description |
---|---|
PROJECT_REPOSITORY_GROUP_URL | The URL of the project repository group used as the project mirror. |
PROJECT_RELEASE_REPOSITORY_URL | The URL of the project EP Releases Repository |
PROJECT_SNAPSHOT_REPOSITORY_URL | The URL of the project EP Snapshots Repository |
MAVEN_DEPLOYER_USER_NAME | The username for the Maven repository account used for deployment |
MAVEN_DEPLOYER_PASSWORD | The password for the Maven repository account used for deployment Note: See the Maven How to encrypt server passwords if you wish to use encrypted passwords in your ci-settings.xml. |