Rename jobs from jenkins file

+1 vote

I am trying to do a poc of jenkins pipeline as code. Is there a way to explicitly define the names for the pipeline jobs that get from Jenkinsfile? I also want to add some descriptions for the jobs

Jul 3, 2018 in Jenkins by Hannah
• 18,410 points
1,656 views

3 answers to this question.

0 votes

Following script in pipeline will do that(this requires appropriate permissions)

item = Jenkins.instance.getItemByFullName("originalJobName")

item.setDescription("This description was changed by script")

item.save()

item.renameTo("newJobName")

answered Jul 3, 2018 by Kalgi
• 51,970 points
0 votes

You can rename selected job through jenkins UI by following these steps:

job>configure>Advanced Project Options>Display Name

Other way is to rename the directory on the Jenkins/hudson server and then restart the Jenkins.

answered Oct 25, 2018 by John
Thanks!! Nice hidden feature that is very handy.
Thank you for your contribution to the Edureka Community.

Kindly register yourself on the Edureka community so that you can get points for every contribution ( answer/question/upvote/downvote/ comment).

Top contributors win exciting merchandise.

Cheers!
0 votes

Go to the Configure screen and edit the Project name field right on top. Then click on Save and confirm by clicking on Yes.

answered Oct 25, 2018 by Laila

Related Questions In Jenkins

0 votes
0 answers
0 votes
1 answer

How to update Jenkins from a war file?

Hi@akhtar, You need to replace the Jenkins.war file. ...READ MORE

answered Oct 25 in Jenkins by MD
• 78,020 points
24 views
+2 votes
5 answers
0 votes
2 answers
+15 votes
2 answers

Git management technique when there are multiple customers and need multiple customization?

Consider this - In 'extended' Git-Flow, (Git-Multi-Flow, ...READ MORE

answered Mar 26, 2018 in DevOps & Agile by DragonLord999
• 8,450 points
804 views
+2 votes
1 answer
+5 votes
5 answers

Jenkins properties file

Follow these steps: 1. Install ‘EnvInject’ plug-in in the Jenkins ...READ MORE

answered Aug 2, 2018 in Jenkins by lina
• 8,220 points
16,691 views
+2 votes
6 answers