Project 3: Complete Jenkins CI/CD Project using Docker/docker-compose with GitHub WebHooks
Task 1: Complete the CI/CD project using Jenkins and Docker with GitHub WebHooks
Fork this repository
Create a connection to your Jenkins job and your GitHub Repository via GitHub Integration
Select 'GitHub hook trigger for GITScm polling' in Jenkins in Build Triggers.
Add the steps in Build Steps to build the image then, create and run the container. Save the project.
Read About GitHub WebHooks and make sure you have CICD setup.
Go to the settings of your project and to the Webhooks section. Then, Click on 'Add webhook'. In the payload URL, add the public IP address with the port on which you are accessing Jenkins and 'github-webhook/'.
Keep the other options like those given in the screenshot and click on 'Add webhook'.
Ensure that the webhooks connection created is showing a green tick.
You are good to go!
To get the CICD in action, make any changes and commit them.
In Jenkins, check the build is created as soon as we commit changes in GitHub. We can see the first line where it says "Started by GitHub push by ashmisinha"
Here you go! We can access our node-todo-app.
Task 2: Complete CI/CD project using Jenkins and docker-compose with GitHub WebHooks
Setup the GitHub project
Add the build trigger:
In the Execute shell run the application using Docker compose
Add the shell command in Build Steps:
Go to the settings of your project and in the Webhooks section, Click on 'Add webhook'. In payload URL, add the public IP address with the port on which you are accessing Jenkins and 'github-webhook/'.
Keep the other options like those given in the above tasks' screenshot and click on 'Add webhook'.
In the GitHub URL that we have added above, make some changes to the project and you will see that a new build will be done in Jenkins.
It triggered as soon as we committed changes in the code.
Run the project and give yourself a treat ๐ค
Thank you for being with me till the end of this project. ๐ฉโ๐ป
Subscribe to my newsletter
Read articles from Ashmi Sinha directly inside your inbox. Subscribe to the newsletter, and don't miss out.
Written by