Skip to content

AEM 6.3 — GitLab CI

Screen Shot 2018-06-18 at 6.19.57 PM

SYNOPSIS:

  • Building a AEM multi-module project using AEM Maven Archetype.
  • Placing the project under version control Git.
  • Adding the project to GitLab.
  • Modify the parent POM file to add distribution management [Artifactory].
  • Modify the Maven settings file to include the Artifactory details.
  • Create a YAML configuration file under the root of the project.
  • Define CI pipeline stages and CD deployments in the YAML conf file.
  • Upload the generated artifacts to Artifactory.
  • Deliver the artifacts to various Environments [IT, UAT, Stage, Prod].

GUIDE:

Step-01: Generate AEM Multi-Module Archetype Project

mvn org.apache.maven.plugins:maven-archetype-plugin:2.4:generate 
 -DarchetypeGroupId=com.adobe.granite.archetypes 
 -DarchetypeArtifactId=aem-project-archetype 
 -DarchetypeVersion=13 
 -DarchetypeCatalog=https://repo.adobe.com/nexus/content/groups/public/<span id="mce_SELREST_start" style="overflow:hidden;line-height:0;"></span>

Step-02: Placing the Project Under Version Control


$ git init

$ git add .

$ git commit -m "Initial Commit"

Step-03: Create a Project on GitLab and add the existing project to GitLab


$ git remote add origin [email protected]:root/kkmvnaem.git

$ git push -u origin master

Pushing the changes from Local to DEV ENV
Pushing the changes from Local to DEV ENV

Step-04: Modify the parent POM file to add distribution management [Artifactory] and settings.xml to include credentials for Artifactory

Artifactory Settings in Settngs XML and POM XML files
Artifactory Settings in Settings XML and POM XML files

Step-05: Create a YAML configuration file under the root of the project

Screen Shot 2018-07-04 at 8.25.40 PM

Step-06: Define CI pipeline stages and CD deployments in the YAML conf file

Docker Image and Maven Options
Docker Image and Maven Options, Creating Local repository when the Docker container is created and copying settings.xml file
Local Cache for the Gitlab Pipeline
Local Cache for the Gitlab Pipeline, we shall cache .m2/repository inside the container, so we can use this for further build processes
GitLab CI Stages
GitLab CI Stages, here we define our CI stages
Gitlab CI Build Stage
Gitlab CI Build Stage, here we shall build AEM maven and package the artifacts
Deploying to Artifactory
Deploying to Artifacts Artifactory, these will be used later to deploy in different ENV
Artifacts uploaded to Artifactory
Artifacts uploaded to Artifactory, since we are building SNAPSHOTS, we can find the artifacts at lib-snapshot-local
Deploy Stage
Deploy Stage, where a SHELL script is triggered to fetch the latest build from Artifactory and deploy it the respective AEM ENV

Step-07: Automatic Triggering of CI-CD Pipeline

DEV Build triggered
DEV build triggered once the change is pushed to DEV branch
Screen Shot 2018-07-04 at 8.12.00 PM
DEV build triggered once the change is pushed to DEV branch
DEV Build OUTPUT
DEV Build complete and the .m2/repository is cached and will be available for the next stage
Upload the Artifacts to Artifactory
Upload the Artifacts to Artifactory
OUTPUT - Upload the Artifacts to Artifactory
OUTPUT – Upload the Artifacts to Artifactory and the cache is created and the .m2/repository is available for next stage
Manual Deployment to ENV
Manual Deployment to ENV, Build is successful but CICD pipeline awaits manual trigger for installing the JAR and ZIP files to AEM
Triggering the Deployment to IT ENV
Triggering the Deployment to IT ENV
Triggering the Deployment to IT ENV
Triggering the Deployment to IT ENV
Script to Trigger the Deployment
Script to Trigger the Deployment
OUTPUT - Triggering the Deployment to IT ENV
OUTPUT from Triggering the Deployment to IT ENV, artifacts successfully installed to AEM

Step-08: Verifying the package and Bundle installation on AEM

Package Deployed to AEM
Package Deployed to AEM, verifying package from the CRX package Manager
Bundle installation verified
Bundle installation verified from the Felix web console

Shashi View All

A passionate devops and automation engineer

Leave a comment