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
• 14,090 points
535 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
• 39,200 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,890 points
212 views
+2 votes
6 answers
+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,380 points
112 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,100 points
6,840 views
+1 vote
5 answers

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

There are some Jenkins plugins out there ...READ MORE

answered Oct 25, 2018 in Jenkins by akaash
628 views