diff --git a/pom.xml b/pom.xml index 896143bd..ae2cbddc 100644 --- a/pom.xml +++ b/pom.xml @@ -63,12 +63,18 @@ org.jenkins-ci.plugins.workflow - workflow-job + workflow-step-api org.jenkins-ci.plugins.workflow - workflow-step-api + workflow-support + + + + org.jenkins-ci.plugins.workflow + workflow-job + test diff --git a/src/main/java/io/jenkins/plugins/checks/status/BuildStatusChecksPublisher.java b/src/main/java/io/jenkins/plugins/checks/status/BuildStatusChecksPublisher.java index 0eb36b86..64b43ea6 100644 --- a/src/main/java/io/jenkins/plugins/checks/status/BuildStatusChecksPublisher.java +++ b/src/main/java/io/jenkins/plugins/checks/status/BuildStatusChecksPublisher.java @@ -3,20 +3,28 @@ import edu.umd.cs.findbugs.annotations.CheckForNull; import hudson.Extension; import hudson.FilePath; -import hudson.model.*; +import hudson.model.Job; +import hudson.model.Queue; +import hudson.model.Result; +import hudson.model.Run; +import hudson.model.TaskListener; import hudson.model.listeners.RunListener; import hudson.model.listeners.SCMListener; import hudson.model.queue.QueueListener; import hudson.scm.SCM; import hudson.scm.SCMRevisionState; -import io.jenkins.plugins.checks.api.*; +import io.jenkins.plugins.checks.api.ChecksConclusion; import io.jenkins.plugins.checks.api.ChecksDetails.ChecksDetailsBuilder; +import io.jenkins.plugins.checks.api.ChecksOutput; +import io.jenkins.plugins.checks.api.ChecksPublisher; +import io.jenkins.plugins.checks.api.ChecksPublisherFactory; +import io.jenkins.plugins.checks.api.ChecksStatus; import io.jenkins.plugins.util.JenkinsFacade; import org.jenkinsci.plugins.workflow.actions.LabelAction; import org.jenkinsci.plugins.workflow.flow.FlowExecution; +import org.jenkinsci.plugins.workflow.flow.FlowExecutionOwner; import org.jenkinsci.plugins.workflow.flow.GraphListener; import org.jenkinsci.plugins.workflow.graph.FlowNode; -import org.jenkinsci.plugins.workflow.job.WorkflowRun; import java.io.File; import java.io.IOException; @@ -89,13 +97,18 @@ static Optional getChecksName(final Job job) { @CheckForNull static ChecksOutput getOutput(final Run run) { - if (run instanceof WorkflowRun) { - FlowExecution execution = ((WorkflowRun) run).getExecution(); - if (execution != null) { - return getOutput(run, execution); - } + if (!(run instanceof FlowExecutionOwner.Executable)) { + return null; + } + FlowExecutionOwner owner = ((FlowExecutionOwner.Executable) run).asFlowExecutionOwner(); + if (owner == null) { + return null; + } + FlowExecution execution = owner.getOrNull(); + if (execution == null) { + return null; } - return null; + return getOutput(run, execution); } static ChecksOutput getOutput(final Run run, final FlowExecution execution) {