Task -2 DevOps Assembly Lines

Prathmesh Mandve
3 min readJul 24, 2020

Task Overview :

1. Create container image that’s has Jenkins installed using dockerfile

2. When we launch this image, it should automatically starts Jenkins service in the container.

3. Create a job chain of job1, job2, job3 and job4 using build pipeline plugin in Jenkins

4. Job1 : Pull the Github repo automatically when some developers push repo to Github.

5. Job2 : By looking at the code or program file, Jenkins should automatically start the respective language interpreter installed image container to deploy code ( eg. If code is of PHP, then Jenkins should start the container that has PHP already installed ).

6. Job3 : Test your app if it is working or not.

7. Job4 : if app is not working , then send email to developer with error messages.

8. Create One extra job job5 for monitor : If container where app is running. fails due to any reson then this job should automatically start the container again.

Step 1 :

First we have to create container image that’s has Jenkins installed using dockerfile.

Dockerfile

For building the container image command is :

docker build -t os1:v1 /task2/

In this process we have to use container inside the container concept. So we can use docker service here.

docker run -dit -v /var/run/docker.sock:/var/run/docker.sock -v $(which docker):/usr/bin/docker -v /task2.:/codetask2  --name  container1 os1:v1

Now we have to pull the GitHub whenever developer push the code.

Step 2 :

In this step Jenkins should automatically start the respective language interpreter by reading the code or program file and after that install PHP if the code is in PHP format image container to deploy code.

Step 3 :

If due to any reason the container not launched then Jenkins will have to send the developer an email notification.

and also we have set to email notification.

Step 4 :

In this step if any of the container will be stopped then Jenkins will have to keep checking and automatically launch the new container again.

So we have to create one extra job for monitoring by doing this if the container that has website fails the this new job will automatically run the new container again.

Here we are at the end of the task. Thanks for reading.

--

--