-
Notifications
You must be signed in to change notification settings - Fork 86
/
Copy pathre-run-triggers.groovy
31 lines (27 loc) · 1.03 KB
/
re-run-triggers.groovy
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
import static org.jenkinsci.plugins.github.pullrequest.utils.JobHelper.ghPRTriggerFromJob
import static com.github.kostyasha.github.integration.branch.utils.JobHelper.ghBranchTriggerFromJob
import com.github.kostyasha.github.integration.branch.GitHubBranchTrigger
import org.jenkinsci.plugins.github.pullrequest.GitHubPRTrigger
Jenkins.instance.getAllItems(Job.class).each{ job ->
GitHubPRTrigger prTrigger = ghPRTriggerFromJob(job)
if (prTrigger != null) {
println "Running GH PR trigger for " + job.getFullName()
try {
prTrigger.run()
} catch (Throwable error) {
println "ERROR: failed to run branch trigger for " + job.getFullName()
print error
}
}
GitHubBranchTrigger branchTrigger = ghBranchTriggerFromJob(job)
if (branchTrigger != null) {
println "Running GH Branch trigger for " + job.getFullName()
try {
branchTrigger.run()
} catch (Throwable error) {
println "ERROR: failed to run branch trigger for " + job.getFullName()
print error
}
}
}
println ""