Skip to content

Instantly share code, notes, and snippets.

@queil
Created July 14, 2020 13:35
Show Gist options
  • Save queil/2362be4c2452ea6d8da21ad22d5eae36 to your computer and use it in GitHub Desktop.
Save queil/2362be4c2452ea6d8da21ad22d5eae36 to your computer and use it in GitHub Desktop.
Jenkins: run all the jobs matching a regex
// This can be executed in the master node script console
Jenkins.instance.getAllItems(AbstractItem.class)
.findAll {job -> job.fullName.matches("^(a|b).*/master")}
.each { job ->
def actions = [new CauseAction(new Cause.UserIdCause()), new ParametersAction(new BooleanParameterValue("X", true))] as Action[]
job.scheduleBuild2(0, actions)
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment