Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
<repository>
<id>jenkins-releases</id>
<name>Jenkins Releases</name>
<url>http://repo.jenkins-ci.org/releases</url>
<url>https://repo.jenkins-ci.org/releases</url>
</repository>
</repositories>

Expand Down Expand Up @@ -82,7 +82,7 @@
<groupId>org.jenkins-ci.main</groupId>
<artifactId>jenkins-core</artifactId>
<version>${jenkins.version}</version>
<scope>test</scope>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>org.jenkins-ci.plugins.workflow</groupId>
Expand Down Expand Up @@ -121,7 +121,7 @@
<groupId>javax.servlet</groupId>
<artifactId>javax.servlet-api</artifactId>
<version>${jenkins.servlet.version}</version>
<scope>test</scope>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>org.jenkins-ci.plugins</groupId>
Expand Down
10 changes: 8 additions & 2 deletions src/io/stenic/jpipe/plugin/SkipCommitPlugin.groovy
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ package io.stenic.jpipe.plugin
import io.stenic.jpipe.event.Event
import org.jenkinsci.plugins.scriptsecurity.sandbox.RejectedAccessException
import org.jenkinsci.plugins.workflow.steps.FlowInterruptedException
import jenkins.model.CauseOfInterruption.UserInterruption
import hudson.model.Result

class SkipCommitPlugin extends Plugin {
Expand Down Expand Up @@ -43,7 +42,14 @@ class SkipCommitPlugin extends Plugin {
// event.script.currentBuild.getRawBuild().setResult(Result.fromString(event.script.currentBuild.getPreviousBuild().result))
// } catch (RejectedAccessException e) {}

throw new FlowInterruptedException(Result.fromString(event.script.currentBuild.getPreviousBuild().result), true, new UserInterruption(event.script.env.BUILD_USER_ID))
// Do not attach a UserInterruption cause: [skip ci] builds are SCM-triggered,
// so BUILD_USER_ID is null. UserInterruption stores the null user id and its
// hashCode() NPEs inside FlowInterruptedException.handle() during
// WorkflowRun.finish(), which aborts completion before
// RunListener.fireCompleted() runs. That skips the GitHub Branch Source
// final commit status, leaving the commit stuck on "pending".
// actualInterruption is false because nobody actually interrupted the build.
throw new FlowInterruptedException(Result.fromString(event.script.currentBuild.getPreviousBuild()?.result ?: 'SUCCESS'), false)
}

return true
Expand Down
Loading