Task 6 of devops AL
1. Create container image that’s has Jenkins installed using dockerfile Or You can use the Jenkins Server on RHEL 8/7
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. Job2 ( Seed Job ) : Pull the Github repo automatically when some developers push repo to Github.
5. Further on jobs should be pipeline using written code using Groovy language by the developer
6. Job1 :
1. By looking at the code or program file, Jenkins should automatically start the respective language interpreter installed image container to deploy code on top of Kubernetes ( eg. If code is of PHP, then Jenkins should start the container that has PHP already installed )
2. Expose your pod so that testing team could perform the testing on the pod
3. Make the data to remain persistent using PVC ( If server collects some data like logs, other user information )
7. Job3 : Test your app if it is working or not.
8. Job4 : if app is not working , then send email to developer with error messages and redeploy the application after code is being edited by the developer
solution:
- Seed Job: This job is configured with a github-webhook. It will download the groovy script pushed by developers and create jobs according to the script and views it as required by the operations team.
- The 3 jobs will be automatically created as we have configured it in the groovy script and they are as follows :
- Job1: Download and interpret the code from Github, build the image using given Dockerfile and push it to Dockerhub.
- Job2: Deploy and expose your webserver on Kubernetes so testing can be performed accordingly.
- Job3: Send status to the team as per the result of the build and deployment status.
- Before we move forward these Plugins are required to be installed:
- Job DSL
- Script Security Plugin
- GitHub plugin
- Workspace Cleanup Plugin (to clean workspace before every build)
- CloudBees Docker Build and Publish plugin
- Email Extension Plugin
- Build Pipeline Plugin
The Seed Job: this will download the groovy script file from the GitHub and it will run the file.
now in job2 kubernetes will fetch this image from the dockerhub and use it to create pods and launch the website created by the developer in it and expose it so the it is accessible from anywhere.
Now if you check the pods created by the kubernetes…
# kubectl get all
now if you will check http://<minikube ip>:<exposed port>
you can see the sample website launched through the kubernetes.
thank you for reading