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,570 points
4,125 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
• 52,360 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 26, 2020 in Jenkins by MD
• 95,440 points
7,066 views
+2 votes
5 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 27, 2018 in DevOps & Agile by DragonLord999
• 8,450 points
3,458 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
27,360 views
+3 votes
7 answers

Is it possible to shift or move jobs between two jenkins servers?

Hi, You can copy Jobs in between your ...READ MORE

answered Dec 16, 2020 in Jenkins by MD
• 95,440 points
44,382 views
webinar REGISTER FOR FREE WEBINAR X
REGISTER NOW
webinar_success Thank you for registering Join Edureka Meetup community for 100+ Free Webinars each month JOIN MEETUP GROUP