Explore Courses Blog Tutorials Interview Questions
0 votes
in DevOps and Agile by (29.3k points)

I am trying to do a poc of Jenkins pipeline as code. I am using the Github organization folder plugin to scan Github orgs and create jobs per branch. Is there a way to explicitly define the names for the pipeline jobs that get from Jenkins file? I also want to add some descriptions for the jobs

1 Answer

0 votes
by (50.2k points)

For setting, name and description to the Jenkins pipeline can be given from Jenkins file for that make sure about the usage of currentBuild inside the node part.


currentBuild.displayName = "$yournamevariable-$another"

    currentBuild.description = "$yourdescriptionvariable-$another"


This will help to rename your file and description your builds but in the question, we have to rename the jobs which we need some permissions for those permissions you need to follow the commands.

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

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


This will let you change the name and description of a job from a Jenkins file.

Browse Categories