Created
March 8, 2016 16:58
-
-
Save rodrigozrusso/3d3d0dd997d5cd8c54ff to your computer and use it in GitHub Desktop.
Assign label to all jobs in jenkins
This file contains 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.* | |
import hudson.model.labels.* | |
import hudson.maven.* | |
import hudson.tasks.* | |
import hudson.plugins.git.* | |
hudsonInstance = hudson.model.Hudson.instance | |
allItems = hudsonInstance.allItems | |
buildableItems = allItems.findAll{ job -> job instanceof BuildableItemWithBuildWrappers } | |
buildableItems.each { item -> | |
boolean shouldSave = false | |
item.allJobs.each { job -> | |
job.assignedLabel = new LabelAtom('<label-name>') | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment