#90DaysOfDevOps - Day 24
Task 1: Using Jenkins and Docker with GitHub Webhooks
Fork this repository: https://github.com/LondheShubham153/node-todo-cicd.git
Create a connection to your Jenkins job and your GitHub Repository via GitHub Integration.
To use the GitHub webhook, add the git URL in Jenkins.
Select 'GitHub hook trigger for GITScm polling' in Jenkins.
Add the build steps to start the container and save the project.
- Read About GitHub WebHooks and make sure you have a CICD setup.
Go to the settings of your project and in the Webhooks section, 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'.
Now, make any changes and commit them.
In Jenkins, check that one build will be created after you commit.
So, GitHub webhooks are used to trigger a build in Jenkins whenever someone commits to the project.
Task 2: Using Jenkins and docker-compose with GitHub Webhooks
- In the Execute shell run the application using Docker compose.
Add the URL of the GitHub project where you have a docker-compose file.
Select 'GitHub hook trigger for GITScm polling' in Jenkins.
Add the build steps to start the container and save the project.
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'.
- You will have to make a Docker Compose file for this Project.
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.
Here, you can see that the build was started due to GitHub push.
Here, we can verify that our app is running.
Thankyou!