In my previous articles (Jenkins Part I and Jenkins Part II) I have already described how to install Jenkins, how to Setup User account on Jenkins, how to Configure Nodes on Jenkins. In this article we will see how to configure a job on Jenkins. Basically the job will deploy an application from Github on a configured node. We will configure a simple Job in this part. We will just clone a github repository in a node using Jenkins. But in our later articles we will discuss about critical deployments.
We will complete this in three steps.
- Install required Plugin
- Configure Job
- Build the Job and verify
Step 1 (Install required Plugin)
If we are using GIT as our Sour Code Management then we have to install plugin for it. The git plugin will help use to deploy the codes on a node. It’s very simple to configure. To install a plugin follow the steps as described below
Click on Manage Jenkins > Click on Manage Plugins > Click on Available Tab > Filter the Git Plugins > Chose the Git Plugin > Click on install without restart. > Chose Restart Jenkins when installation is complete option.
Step 2 (Configure Job)
Now we will create a Job for deploying an application on our previously configured server from github. To Create a new job Click on New Job > Give a Name to the Job > Choose “Build a free-style software project” option > Click on “Ok”
After getting the new window Check the option “Restrict where this project can be run“. You will get a text box to enter a node name where the build will be taken place (Setup a node following the steps in my previous article). Write the node name in my case it’s “www.linuxfunda.com“. If you will not check this option then Jenkins will clone your repository in Master it self.
Chose the Git Radio button from the “Source Code Management” section and write the Github Repository URL. In my case it’s “ https://github.com/tapasprivate/tapasprivate.git “. I have described how to add Credentials in my previous article. Add the appropriate credential for the github account. Specify the branch name if you want any specific branch to clone else it will clone “master” branch of the repository. There are also other advance options are available like git submodules which we will discuss in later articles.
Step 3 (Build the Job and Verify)
Now we have done with the configuration of the job. Save the Configuration and build the job. SSH to your node where you took the build. Go to the Workspace path and verify that your files are there from github. In my next article we will configure a job with shell script.
Share and Enjoy
Latest posts by Tapas Mishra (see all)
- Working with Docker – II - December 16, 2016
- Working with Docker – I - November 28, 2016
- How to work with Chef using Oracle VirtualBox and Vagrant on a Windows host – Part II - November 30, 2014