Setup Jenkins Job to start on Git Commit
This is the fifth post in the series of ‘Continuous Integration and Delivery with Docker Trusted Registry on Microsoft Azure’. This is a step by step guidance for implementing http://www.docker.com/sites/default/files/UseCase/RA_CI%20with%20Docker_08.25.2015.pdf on Microsoft Azure.
You can read the previous post in this series at https://manesh.me/2015/11/15/continuous-integration-and-delivery-with-docker-trusted-registry-on-microsoft-azure/. In the previous post, we have created a job in Jenkins to have on-demand start based on Git source repository. In this post, we will explore, how we can setup Git/Jenkins to work together to invoke the job for every check-in. To configure and try out this post, you will need write permission to Git repository. I am using a forked repository https://github.com/Manesh-R/hello-jenkins, for this post.
- Microsoft Azure Subscription
- Followed steps in all prior posts
- Write permission on Git repository (Forking the Git project will be the easiest way)
- Configure GitHub Service Hook
- Configure Build Trigger on Git Commit
- Test build trigger with a commit to Git repository
Configure GitHub Service Hook
Open browser and navigate to your GitHub repository (https://github.com/Manesh-R/hello-jenkins). Note that you need admin permissions on the repository.
Click on Settings, then Webhooks & services and then Add service
Search for Jenkins and click on Jenkins (GitHub plugin)
Update Jenkins hook URL, keep service Active and click Add service.
Now for every commit to the repository, service hook will send notification to Jenkins.
Configure Build Trigger on Git commit
Open browser and navigate to http://mme-j-master.southcentralus.cloudapp.azure.com:8080/
Click on job dtr-cicd.
Click on Configure
In project details select Build when a change is pushed to GitHub in Build Triggers and click Save.
Test build trigger with a commit to Git repository
Open browser and navigate to https://github.com/Manesh-R/hello-jenkins/edit/master/README.md
Make a minor modification to the file content and commit changes directly to master.
Now you should see a build automatically triggering on Jenkins server based on the service hook notification. J
With this we have gone through the complete cycle of setting up a continuous integration / delivery pipeline using Docker & Jenkins on Microsoft Azure. If you have any questions, add a comment to the posts. Also, if you are interested in getting notified for new blog posts, follow me on Twitter – http://www.twitter.com/ManeshRavendran.