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.
Posted on 2015/11/23, in DevOps, Microsoft Azure and tagged Cloud, Continuous Delivery, DevOps, Docker, Linux, Microsoft Azure, Ubuntu. Bookmark the permalink. 1 Comment.
Pingback: Continuous Integration and Delivery with Docker Trusted Registry on Microsoft Azure | Imagine - Experiment - Realize