Created
June 21, 2019 04:56
-
-
Save ykhandelwal913/3eb60d092689afaf1ac90f8a22751a22 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import hudson.model.labels.* | |
Jenkins.instance.getAllItems(Job.class).each{ | |
//println it.name + " - " + it.class + " - " + it.getAssignedLabelString() | |
if(it.class.simpleName == 'FreeStyleProject') { | |
jobLabelString = it.getAssignedLabelString() | |
println it.name + " - " + jobLabelString | |
//if(jobLabelString.contains('Slave-')){ | |
//if(jobLabelString == "Build_Farm"){ | |
// it.assignedLabel = new LabelAtom('TESTFARM') | |
// it.save() | |
//} | |
} | |
else if(it.class.simpleName == 'WorkflowJob') { | |
jobLabelString = it.getDefinition().getScript() | |
println it.name + " - " + jobLabelString | |
} else if (it.class == 'com.tikal.jenkins.plugins.multijob.MultiJobProject'){ | |
println "nothing" | |
} | |
else { | |
//throw new Exception("Don't know how to handle class: ${it.getClass()}") | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment