Skip to content

Instantly share code, notes, and snippets.

@nextrevision
Created November 23, 2016 16:19
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save nextrevision/e660293aa4b870891862a2d566a482eb to your computer and use it in GitHub Desktop.
Save nextrevision/e660293aa4b870891862a2d566a482eb to your computer and use it in GitHub Desktop.
Builds Jenkins jobs matching a certain regex with optional parameters
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