Skip to content

Commit 872b0f8

Browse files
committed
Set commit status to 'canceled' only when user aborts build from UI
1 parent 0580618 commit 872b0f8

File tree

2 files changed

+9
-2
lines changed

2 files changed

+9
-2
lines changed

pom.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -190,7 +190,7 @@
190190
<dependency>
191191
<groupId>org.jenkins-ci.plugins.workflow</groupId>
192192
<artifactId>workflow-step-api</artifactId>
193-
<version>2.20</version>
193+
<version>2.22</version>
194194
</dependency>
195195
<dependency>
196196
<groupId>org.jenkins-ci.plugins.workflow</groupId>

src/main/java/com/dabsquared/gitlabjenkins/workflow/GitLabCommitStatusStep.java

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -106,7 +106,14 @@ public void onSuccess(StepContext context, Object result) {
106106

107107
@Override
108108
public void onFailure(StepContext context, Throwable t) {
109-
BuildState state = t instanceof FlowInterruptedException ? BuildState.canceled : BuildState.failed;
109+
BuildState state = BuildState.failed;
110+
if (t instanceof FlowInterruptedException) {
111+
FlowInterruptedException ex = (FlowInterruptedException) t;
112+
if (ex.isActualInterruption()) {
113+
state = BuildState.canceled;
114+
}
115+
}
116+
110117
CommitStatusUpdater.updateCommitStatus(run, getTaskListener(context), state, name, step.builds, step.connection);
111118
context.onFailure(t);
112119
}

0 commit comments

Comments
 (0)