Created
July 6, 2021 07:21
-
-
Save rhodrid/930687751f3570b3353551be3905f047 to your computer and use it in GitHub Desktop.
rebuild.groovy
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 hudson.model.* | |
import jenkins.model.Jenkins | |
def jobName = '<folder-name>/<job-name>' | |
def job = Jenkins.instance.getItemByFullName(jobName) | |
// Make a list of jobs to rebuild. type: int e.g. [2210, 2211] | |
def myList = [<build-number-1>, <build-number-2>] | |
for(int item : myList) { | |
def my_job = job.getBuildByNumber(item) | |
def actions = my_job.getActions(ParametersAction) | |
println(my_job) | |
job.scheduleBuild2(0, actions.toArray(new ParametersAction[actions.size()])) | |
println("\n") | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment