Automated Testing & Production Environment | Jenkins | Docker

Automated Testing & Production Environment | Jenkins | Docker

In this task the most interesting thing to do was launching a docker container inside another docker container. We had to create a container image that has Jenkins installed using Dockerfile.

No alt text provided for this image

After we build the image and the run the following command to launch a conatainer ,it launches a conatiner on which the jenkins is running on the specified port ie. 8082

No alt text provided for this image
No alt text provided for this image
No alt text provided for this image

After this we need to create a job chain ie. job 1, job 2 , job 3 using build pipeline in Jenkins. The task for the first job is to pull the file from the GitHub repository automatically when some developer pushes the file to the GitHub . For this purpose we used the post-commit file which automatically triggers Jenkins whenever a file is pushed.

No alt text provided for this image

The first job works on remote triggers and copies the file recieved from the GitHub repositiory to the specified project folder.

No alt text provided for this image

As soon as the first job is built stably , it triggers our next job that is our job 2 whose task is to launch the container from the respective image which has the required software installed. For this purpose we have constructed the python code which triggers the dockerfile and buils the image .

No alt text provided for this image
No alt text provided for this image

And after the image is build ,our job2 launches a new container with the respective interpreter installed and running.

No alt text provided for this image

A new job is created which tests whether the application is running successfully or not and if the application is not running it sends an email to the developer regarding the issue. For this we have used the concept of error codes by delibeartely sending an error code so that when the job fails when the container is not running it triggers the post build action of sending and email and the mail is sent to the developer successfully.

No alt text provided for this image

The Email plugin is setup in the following manner

No alt text provided for this image

Job 4 just monitors the containers and if it is not present then launches it again.

No alt text provided for this image

This is the build pipeline veiw

No alt text provided for this image

Do leave your valuable feedbacks . For any queries or correction feel free to contact


要查看或添加评论,请登录

Khushi Thareja的更多文章

社区洞察

其他会员也浏览了