Jenkins job Automation
In this blog we learn, how to create multiple jobs on Jenkins use automation concept and deploy web page.
In this automation concept we create a Docker-file for the web-server and write code push the GitHub and and use Jenkins create a automate job and run the web server, fallow the step to create automate job……..
Step 1:- Create Dockerfile for web server.
Step 2:- Push the code on GitHub.
step 3:- Create a manual Jenkins job to create multiple jobs.
Step 4:- In this step create automate job.
step 5:- In this step copy the code on Github and run the dockerfile create docker image and run the docker image to run web server and deploy the code on web server.
Step 1:-
In this step use docker file concept create a docker image for the web server.
FROM
creates a layer from the Cantos Docker image.
COPY
adds files from your Docker client’s current directory.
RUN
builds your application with make
.
CMD
specifies what command to run within the container.
Step 2:-
Fallow the below link create repository and push the repository on GitHub.
https://medium.com/@neeteeshyadav98/integration-with-git-github-cec65fb4ec3f
Step3:-
In this step create a first Jenkins job to create multiple job.
step 4:-
In this step first go to manage Jenkins, then go next step manage Jenkins and install the Job DSL pugins.
Successful installed plugin then go to job and go to configure option and click the option.Go to build option and click the Process job DSLs
Then follow the above option go to Use the provided Dsl Script.
Write script use Groovy programming language.
Write code for job description.
write GitHub repository link.
write code for triggers the job.
write code for copy the file github and build docker image and and deploy the web-server.
job 2 create automatically and fill the all the blocks.
when run the first job automatic write description on the description block, and fill the GitHub link on the project URL.
Automatic fill the triggers in the poll SCM.
Write the command for run the docker image and copy the link and run the server.
when the job2 run output look like.