Created
November 23, 2016 16:19
-
-
Save nextrevision/e660293aa4b870891862a2d566a482eb to your computer and use it in GitHub Desktop.
Builds Jenkins jobs matching a certain regex with optional parameters
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 jenkins.model.* | |
def matchedJobs = Jenkins.instance.items.findAll { job -> | |
job.name =~ /job_regex_here/ | |
} | |
matchedJobs.each { job -> | |
println job.name | |
// without parameters | |
//job.scheduleBuild(new Cause.UserIdCause()) | |
// with parameters | |
//def params = [new StringParameterValue('PARAM1', 'value1')] | |
//job.scheduleBuild2(0, new Cause.UserIdCause(), new ParametersAction(params)) | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment