In this post we’ll learn how jenkins interprets the code and build the pipeline.
Depending upon the code commited by developer in Github Jenkins will download the code and execute it based upon the format of the code either python or php etc.
Lets look at the pipeline of jenkins.
1. Jenkins copy code from the Github .
2. Code Interpreter
3. Checking the status of the code and Notify using email if execution failed.
4. Relaunch the code if failed else continue.
First I have to setup Jenkins .So I have create a Dockerfile which has Jenkins and docker installed in docker.
docker build -t userprashant/jenkins:v1 /lw_task2 docker run -it -p 8096:8080 --name jenkins_os userprashant/jenkins:v1
After that copy the password of jenkins and paste at the start of jenkins login via IP:port alloted.
Job 1: Copy code from Github.
Job 2: Interpret the type of code and execute it.
Job Chaining is done .
Here if the code is in python then will be executed in python . If the code is in php then it will be hosted in Apache server using httpd image. Similarly , we can install as many softwares to run code depending upon the format of the code.
Job 3: Checking the status, if failed notify by sending email.
Here I am checking the status of the php code.
Here if the code will run then exit 1 i.e , successfully executed. Else notify the failed status via email. Follow the following steps to configure E-mail notification.
Go to Manage Jenkins > Configuration
Job 4: Relaunch the code if failed else continue.
My Jobs.
My Build Pipeline.
If you have any queries post them in comment section below.