JENKINS-42809# Fix for correctly showing commitId
@@ -3,11 +3,10 @@ package io.jenkins.blueocean.rest.impl.pipeline;
import hudson.Extension;
import hudson.model.Queue;
import hudson.model.Run;
-import hudson.plugins.git.Revision;
-import hudson.plugins.git.util.BuildData;
import hudson.scm.ChangeLogSet;
import hudson.scm.ChangeLogSet.Entry;
import io.jenkins.blueocean.commons.ServiceException;
+import io.jenkins.blueocean.rest.Navigable;
import io.jenkins.blueocean.rest.Reachable;
import io.jenkins.blueocean.rest.annotation.Capability;
import io.jenkins.blueocean.rest.factory.BlueRunFactory;
@@ -21,12 +20,12 @@ import io.jenkins.blueocean.rest.model.BlueQueueItem;
import io.jenkins.blueocean.rest.model.BlueRun;
import io.jenkins.blueocean.rest.model.Container;
import io.jenkins.blueocean.rest.model.Containers;
-import io.jenkins.blueocean.rest.Navigable;
import io.jenkins.blueocean.service.embedded.rest.AbstractRunImpl;
import io.jenkins.blueocean.service.embedded.rest.ChangeSetResource;
import io.jenkins.blueocean.service.embedded.rest.QueueUtil;
import io.jenkins.blueocean.service.embedded.rest.StoppableRun;
import jenkins.model.Jenkins;
+import jenkins.scm.api.SCMRevisionAction;
import org.jenkinsci.plugins.workflow.cps.replay.ReplayAction;
import org.jenkinsci.plugins.workflow.job.WorkflowRun;
import org.jenkinsci.plugins.workflow.support.steps.ExecutorStepExecution;
@@ -155,13 +154,9 @@ public class PipelineRunImpl extends AbstractRunImpl<WorkflowRun> {
@Exported(name = "commitId")
public String getCommitId() {
- BuildData data = run.getAction(BuildData.class);
-
+ SCMRevisionAction data = run.getAction(SCMRevisionAction.class);
if (data != null){
- Revision revision = data.getLastBuiltRevision();
- if(revision != null){
- return revision.getSha1String();
- }
+ return data.getRevision().toString();
}
return null;
}
