Sunday, February 26, 2017

Importing jobs from one jenkins installation to another

Using Job import plugin, we can import Jenkins job from another machine to our machines. This is useful in migrating jobs from one setup to another or a new Jenkins setup. 

Below are the steps to copy jobs from one Jenkins set up to another.

  • We require Job Import plugin to be installed to import job from one machine to another. In case plugin is not installed, Go to Manage Jenkins > Manage Plugins. 
  • Click on Available tab and search for Job import plugin.

  • Select the checkbox and click on Install without restart.
  • Once Jenkins is installed, Job Import plugin will be displayed in the menu.
  • Next to import the jobs from another Jenkins URL, click on Job Import plugin
  • Provide the Remote Jenkins URL and credential to connect to Jenkins and click on Query!
  • Once we click on Query!, Jenkins job will be displayed from the remote Jenkins.
  • Select jobs to be imported and click on import.
  • Jobs will be imported once user clicks on Import.

Saturday, February 25, 2017

How to run Jenkins on port other than 8080

By default Jenkins start at port 8080, but at times port 8080 is already used by some other application. We can run Jenkins on port other than 8080 by following below steps:
  • In case jenkins is running through command prompt, we can start jenkins to run at port 9090 or any other port using below command:
java -jar jenkins.war --httpPort=9090
  • To change the port permanently, follow below steps:
    • Go to jenkins home folder. The jenkins home folder is usually at C:\Program Files (x86)\Jenkins in case jenkins is installed from microsoft installer (MSI) file or it can be c:\Users\<UserName>\.jenkins folder.
    • Open the jenkins.xml file.
    • Change the port number in the file to the required port number.
    • Save the file.
    • Restart the window service for jenkins.

Friday, February 24, 2017

Jenkins - Cloning an existing job in jenkins

We can clone an existing job in Jenkins using the steps below. Copying a Jenkins job is useful in case there is minor changes in the two job configurations.

Steps to be followed:
  • In Jenkins, we can see all the existing jobs in the dashboard and option to create a new job by clicking on New Item
Jenkins - cloning existing job
  • On clicking on new Item, a new page will be displayed to select project type and name of the item. Provide the name for the item.

Jenkins - cloning existing job
  •  In the bottom of the page, there is a option to copy from existing item. Provide the existing job name and click on OK.
Jenkins - cloning existing job
  •  The new job will be created and displayed in the dashboard. Make necessary changes in the job and save.
Jenkins - cloning existing job