How do I clone a job in jenkins?

2019-01-16 05:37发布

Jenkins has the Gerrit Plugin in place so that when we do checkins to gerrit, Jenkins performs a build and if it succeeds, then the modification in gerrit is verified. If the build fails then it is not. My understanding is that this is accomplished through jobs set up in Jenkins. We have now created a new branch (git) and I guess I need to clone the existing jobs pointing to the other branch so that this same workflow occurs and builds are performed on every commit. Can somebody explain how I would clone these jobs. I don't seem to see a way to do it through the UI nor can I even see a way to list the jobs out through the UI.

10条回答
可以哭但决不认输i
2楼-- · 2019-01-16 06:05

Create a new Item and go to the last you'll find option to copy from existing, just write your current job name and you will have clone of that project to work with.

查看更多
放荡不羁爱自由
3楼-- · 2019-01-16 06:09

In my case, I had to copy over a job from one jenkins instance to another.

So first I looked under the directory structure of the old Jenkins (the job/directory name; also noted the config.xml) and then under the directory structure of the new jenkins where I then created a directory with same name/job and copied over the config.xml under this newly created dir.

Then under, "Manage Jenkins", I hit "Reload Configuration from Disk". Thats it.

查看更多
萌系小妹纸
4楼-- · 2019-01-16 06:17

To copy an existing job, go to http://your-jenkins/newJob and use the "Copy existing job" option. Enter the name of the existing job - Jenkins will verify whether it exists.

The default tab on the front page of Jenkins should list all existing jobs, but maybe your predecessor deleted the tab. You can create a new tab listing all jobs from http://your-jenkins/newView.

查看更多
ら.Afraid
5楼-- · 2019-01-16 06:17
叛逆
6楼-- · 2019-01-16 06:20

You can also use the Copy project link plugin.

This will add a link on the left side panel of your project:

enter image description here

Following screen will ask for the new Job name:

enter image description here

查看更多
姐就是有狂的资本
7楼-- · 2019-01-16 06:21

You can clone a job:

  1. Click on 'New Item' link
  2. Give a new name for your job
  3. Select radio button 'Copy existing Item'
  4. Give the job name that you want to clone
  5. Click 'OK'

Finally, you have your new job, which reflects all features of your cloned one.

查看更多
登录 后发表回答