Magento  Integration with Jenkins
Magento Integration with Jenkins
suranjan horrow no responses

Before deploying codes to the production server, the codes need to be fully tested. Testers check the codes by running different test cases. It is a very long process. First the developers push their codes to the repository. Then the testers fetch the codes and run the codes in their own environment. If something wrong with the codes, they notify it to the developers. Developers fix their codes and again push it to the repository. Codes are not deployed to the production server unless they pass the test cases.

Jenkins can automate the whole process and save time required by manual testing. Testers can set their test cases in the Jenkins Job. The testing job can be triggered any time. Tester can set a fix time when the job will be triggered. For example Tester can set 9 p.m for job to be started. So at 9 p.m Jenkins will fetch the code from the repository and run the test and tell every one the result. Testers do not have to manually fetch the code and copy in their testing environment and finally test it. Jenkins will do the job in a sequence.

In this tutorial, I will show you how to setup a automated testing job in Jenkins. It will fetch module codes from repository and install the module in the existinging magento server.

I am using ant to use in the build process. Ant will read build.xml file and perform action according to the file.

Suppose, my git repository is So I will put my build.xml file in the repository. I have already setup a magento server. When the build is triggered, then Jenkins will fetch contents from git repository and copy the files in the magento server and run some commands to install the module.

Below is the build.xml file. I have divided the tasks in 4 parts. First part will fetch the files and copy it to the magento server. Next two part it will execute some command in magento server and at last casperjs will run some test cases.

I have already copied the public key in the target magento server, so when I run the commands remotely it will not ask for any password.

Create a Job in Jenkins

Open Jenkins dashboard and select New Item.

Select Freestyle project and choose a job name.

In source code management select git and give your repository url. If your repository is private provide the credential.

In Build Triggers select how you want to trigger the build. If you want to do it manually you can leave the fields.

In Build Environment select Delete workspace before build starts

In add build step select invoke ant. In Build File parameter write build.xml. 

In post-build actions select E-mail notification and give recipients email address. If the build is unsuccessful, mail will be sent to the given recipients.

After setting up all the parameters save the configuration. I have successfully created a job. Now it’s time to trigger the job. Go to Jenkins dashboard and select your job. click Build Now. After that build process will be start. You can view the ongoing build process through the output console.


If you want to detect where the build failed, you can view it in the console output. If you have any doubts regarding the setup, you can ask me in the comment.



Leave A Response

Your email address will not be published. Required fields are marked *

Please verify that you are not a robot.