Forked from nextrevision/jenkinsBuildWithParams.groovy
Created
April 2, 2021 00:57
-
-
Save john24rel/efb1f96a2b496033abf598289a984e0d to your computer and use it in GitHub Desktop.
Builds Jenkins jobs matching a certain regex with optional parameters
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 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