AEM deployment’s with jenkins

In this article, I am going to explaing how to deploy aem packages using Jenkins, The Jenkins can be used as a continuous integratiion server using which we can deploy packages automatically on either author or publish instances of a AEM development and qa envrionment’s, I dont recommed to install it on production envrionment, we can do lot of things with Jenkins, we can configure notifications when build fails and also using plugin’s we can connect to different version control systems such GIT, SVN etc…

Here, I am going to cover how to deploy AEM builds using Jenkins, the first thing which we  need to do is download and install Jenkins from this link

Once the Jenkins is installed then the next step is go to dashboard of Jenkins and install plugins as part of this I have installed Maven plugin

In the dashboard left navigation there is an item called “Manage Jenkins”click on this, on the Manage Jenkins screen you will find Mangage Plugins link

one

In the Manage plugins screen go to the the available tabs and select  Maven integration plugin and click on “Download now and install after restart”, you need to restart Jenkins server to see changes, then the next step is configuring global tools

Global Tool Configuration :

Using global tool configuration we can configure tools such as JDK, Maven, GIT, SVN etc…which is applicable for all jobs which are configured in Jenkins server

Configure JDK :

Here, I have mapped to JAVA_HOME but if you want you can install using install automatically by selecting JDK version

jdkconfiguration

Configure GIT :

I have a local GIT setup so pointed out to local file system path

gitconfiguration

Maven Installtion :

You can install either using local file system or using install automatically

mavenconfiguration

Once gobale tools configurations is completed then, we need to create a job to build and deploy code into author and publish environments, this we can do using new item option on left navgation of Jenkins dashboard, the job name here I am using is “dev-aemtoolkit” and type of project you need to select is Maven Project

jenkinsjob

All my source code is in GIT Hub so I have selected GitHub Project on the general tab and in the textbox enter github project url

Then go to the source code management and enter repository url and select admin credentials, you can specify branch in branch specifier, here I am connecting to master branch, if you want to connect to development branch then use “*/development”

sourcecodemg

In the Build triggers section select “Build whenever a SNAPSHOT dependency is built” checkbox and then in the Build Goals and Options section enter below command

clean install -X -P autoInstallPackage -Dcrx.host=localhost -Dcrx.port=4503 -Dcrx.user=admin -Dcrx.password=admin -Dvault.timeout=60

If you are connecting to remote machine then you need to change localhost to remote server IP Address and click on save

In the Build Settings Email Notification section enter recipents email address and click on save

buildsettings

Once the configuration is completed then go to the dashboard and select the job and click on Build now, if the build is success then you wll see blue color ball symbol other wise symbol will be in red, you can see logs by clicking on these symbol’s

keysandstrokes-jenkins

 

The final step is go to the package manager and check for aemtoolkit package 🙂

 

  • How can we set a step to clear the cache after the Jenkins build?

    Regards,
    Cookie