Hey Everyone,
Today I made another project for this automation world. Basically, it's an integration of 4 technology: Git, Github, Jenkins, docker. and also some basic Linux used in this project.
Agenda!!!
I made an automated system so that whenever a developer is put our code GitHub (with the help of git as shown in my last task{task-1}). So that it automatically copies from Github to our system and also at a time as from the code seen they launch a suitable environment for that and also check that the launch container and the website is working perfectly or not.
So for this, I divide the task in jobs of Jenkins.
For Jenkins setup, I also use a separate environment for this environment ready. Here I again, use docker and built our image manually with the help of the Dockerfile concept.
Here is the code:
After the setup of Jenkins. I build a pipeline for jobs. So that the next job is run after the successful end of the first job. To view these jobs graphically I set a build pipeline view plugin. In the end, you see...
Before creating any Job first you should configure Jenkins for ssh. Because the docker is not installed in my Jenkins image. For this go to Manage Jenkins > Configure system. Like that:
Here,
Hostname: Your host IP.
Port: 22(by default)
Credentials: Your host user and password
That's all...
So after set that you start building our project.
JOB1
First, copy the code from GitHub and paste it in the host machine.
here in cp cmd
-r: recursive
-f; forcefully
*: for all data
JOB 2 Start an environment after knowing what type of file it is.
JOB3
Check the site is working or not
For this here I use status code help if
status code: 200 ----> working good
other than 200 ----> error/issue
By chance, if error/issue comes so it mails to the developer automatically.
But for this, you first configure the mail services as same as ssh services.
JOB4
Basically, job4 is not part of the pipeline because here I want to monitor the environment for every minute.
Here poll SCM is a trigger so that if I use * * * * *. So it checks every minute the environment is active or not.
And to build a pipeline...
Use Build trigger: build after other projectors build.
Pipeline graphical view:
Here my 3rd job runs perfectly so that's why 4th job did not run.
I will again come with a new project stay tunned with me...
Thank you for reading...
Thanks for sharing this information. I really like your blog post very much. You have really shared a informative and interesting blog post with people.. graphic design
ReplyDeleteI wanted to jot down a small note to be able to appreciate you for the superb pointers you are placing on this website.Effluent treatment of water
ReplyDelete