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,060 points
1,308 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,890 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
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

+2 votes
5 answers
0 votes
2 answers
0 votes
1 answer

Ansible or Jenkins pipelines for bigger jobs

Well, you are indeed well aware of ...READ MORE

answered Jun 16, 2018 in Jenkins by shubham
• 6,910 points
307 views
+13 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,420 points
541 views
0 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,200 points
14,126 views
+1 vote
6 answers