File tree Expand file tree Collapse file tree 2 files changed +29
-0
lines changed
src/main/java/org/jenkinsci/plugins/ghprb/jobdsl Expand file tree Collapse file tree 2 files changed +29
-0
lines changed Original file line number Diff line number Diff line change 1+ package org .jenkinsci .plugins .ghprb .jobdsl ;
2+
3+ import javaposse .jobdsl .dsl .Context ;
4+
5+ class GhprbCancelBuildsOnUpdateContext implements Context {
6+ private Boolean overrideGlobal ;
7+
8+ public Boolean getOverrideGlobal () {
9+ return overrideGlobal ;
10+ }
11+
12+ /**
13+ * sets the overrideGlobal value
14+ */
15+ public void overrideGlobal (Boolean overrideGlobal ) {
16+ this .overrideGlobal = overrideGlobal ;
17+ }
18+ }
Original file line number Diff line number Diff line change 33import javaposse .jobdsl .dsl .Context ;
44import javaposse .jobdsl .plugin .ContextExtensionPoint ;
55import org .jenkinsci .plugins .ghprb .extensions .GhprbExtension ;
6+ import org .jenkinsci .plugins .ghprb .extensions .build .GhprbCancelBuildsOnUpdate ;
67import org .jenkinsci .plugins .ghprb .extensions .comments .GhprbBuildStatus ;
78import org .jenkinsci .plugins .ghprb .extensions .status .GhprbSimpleStatus ;
89
@@ -40,6 +41,16 @@ void buildStatus(Runnable closure) {
4041 extensions .add (new GhprbBuildStatus (context .getCompletedStatus ()));
4142 }
4243
44+ /**
45+ * Overrides global settings for cancelling builds when a PR was updated
46+ */
47+ void cancelBuildsOnUpdate (Runnable closure ) {
48+ GhprbCancelBuildsOnUpdateContext context = new GhprbCancelBuildsOnUpdateContext ();
49+ ContextExtensionPoint .executeInContext (closure , context );
50+
51+ extensions .add (new GhprbCancelBuildsOnUpdate (context .getOverrideGlobal ()));
52+ }
53+
4354 public List <GhprbExtension > getExtensions () {
4455 return extensions ;
4556 }
You can’t perform that action at this time.
0 commit comments