Setup Jenkins Job with Git Source

 

This is the fourth 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/20/setup-jenkins-slave-on-microsoft-azure-for-cicd-with-dtr/. You can find all posts in this series at https://manesh.me/2015/11/15/continuous-integration-and-delivery-with-docker-trusted-registry-on-microsoft-azure/.

Prerequisites

  • Microsoft Azure Subscription

Setup Sequence

  • Install and Configure GitHub plugin
  • Setup Build Job

Install and Configure GitHub plugin

Open browser and navigate to http://mme-j-master.southcentralus.cloudapp.azure.com:8080/

Click on Manage Jenkins

Click on Manage Plugins

Click Available, type GitHub in the filter, choose GitHub Plugin from the results, and click Download now and install after restart

Wait for install and upgrade of plugins to be complete.

Setup Build Job

From Jenkins dashboard, click New Item, provide item name ‘dtr-cicd‘, choose Freestyle project and click OK

For the project details, provide following information and click Save

  • GitHub Project: https://github.com/mikegcoleman/hello-jenkins/
  • Restrict where this project can be run (Choose this option and provide docker as label expression)
    • docker
  • Source Code Management: Git
  • Repository URL: https://github.com/mikegcoleman/hello-jenkins.git
  • Build > Add Build Step > Execute Shell

    #build docker image

    sudo docker build –pull=true -t mme-dtr.southcentralus.cloudapp.azure.com/hello-jenkins:$GIT_COMMIT .

     

    #test docker image

    sudo docker run -i –rm mme-dtr.southcentralus.cloudapp.azure.com/hello-jenkins:$GIT_COMMIT ./script/test

     

    #push docker image

    sudo docker push mme-dtr.southcentralus.cloudapp.azure.com/hello-jenkins:$GIT_COMMIT

Click on Build Now from the job page.

You should see that project builds successfully. J

Note: You can configure build schedule to be initiated when a change is pushed to GitHub.

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/23, in DevOps, Microsoft Azure and tagged , , , , , , . Bookmark the permalink. 1 Comment.

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: