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.

Prerequisites

  • Microsoft Azure Subscription
  • Followed steps in all prior posts
  • Write permission on Git repository (Forking the Git project will be the easiest way)

Setup Sequence

  • 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

Summary

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.

About Manesh

Manesh is a software consultant and solutions architect specializing in cloud, data, Linux and devops in the azure realm with key focus on hybrid workloads. He has been working on Azure technologies since its inception and has helped many enterprises to onboard and adapt to Azure cloud, build solutions for datacenter scale / high consumer applications and services. Currently, he is Microsoft certified for Developing Microsoft Azure Solutions (70-532), Implementing Microsoft Azure Infrastructure Solutions(70-533) and Architecting Microsoft Azure Solutions (70-534).

Posted on 2015/11/25, in DevOps, Microsoft Azure and tagged , , , , , , . Bookmark the permalink. 2 Comments.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

hyper-v.nu

My views on technology

yungchou

witnessing a clear cloudy day

Virtualization and some coffee

My views on technology

Thomas Maurer

Cloud and Virtualization

Cloud Administrator

Begin Your Journey to the Cloud with the Cloud Administrator

%d bloggers like this: