Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save john24rel/efb1f96a2b496033abf598289a984e0d to your computer and use it in GitHub Desktop.
Save john24rel/efb1f96a2b496033abf598289a984e0d 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