diff --git a/pom.xml b/pom.xml index bd064c57..318180ec 100644 --- a/pom.xml +++ b/pom.xml @@ -83,7 +83,7 @@ org.jenkins-ci.plugins.workflow workflow-api - 2.30-beta-1 + 2.30-rc836.77211e4670e0 org.jenkins-ci.plugins.workflow diff --git a/src/main/java/org/jenkinsci/plugins/workflow/support/steps/ExecutorStepExecution.java b/src/main/java/org/jenkinsci/plugins/workflow/support/steps/ExecutorStepExecution.java index d17e5052..ffd04eb1 100644 --- a/src/main/java/org/jenkinsci/plugins/workflow/support/steps/ExecutorStepExecution.java +++ b/src/main/java/org/jenkinsci/plugins/workflow/support/steps/ExecutorStepExecution.java @@ -70,6 +70,7 @@ import org.jenkinsci.plugins.workflow.steps.BodyExecutionCallback; import org.jenkinsci.plugins.workflow.steps.StepContext; import org.jenkinsci.plugins.workflow.steps.durable_task.Messages; +import org.jenkinsci.plugins.workflow.actions.ExecutorAction; import org.jenkinsci.plugins.workflow.support.actions.WorkspaceActionImpl; import org.jenkinsci.plugins.workflow.support.concurrent.Timeout; import org.kohsuke.accmod.Restricted; @@ -719,6 +720,7 @@ private final class PlaceholderExecutable implements ContinuableExecutable { FlowNode flowNode = context.get(FlowNode.class); if (flowNode != null) { flowNode.addAction(new WorkspaceActionImpl(workspace, flowNode)); + flowNode.addAction(new ExecutorAction(exec)); } listener.getLogger().println("Running on " + ModelHyperlinkNote.encodeTo(node) + " in " + workspace); context.newBodyInvoker() diff --git a/src/test/java/org/jenkinsci/plugins/workflow/support/steps/ExecutorStepTest.java b/src/test/java/org/jenkinsci/plugins/workflow/support/steps/ExecutorStepTest.java index 2a788213..18e780e5 100644 --- a/src/test/java/org/jenkinsci/plugins/workflow/support/steps/ExecutorStepTest.java +++ b/src/test/java/org/jenkinsci/plugins/workflow/support/steps/ExecutorStepTest.java @@ -82,6 +82,7 @@ import static org.hamcrest.Matchers.*; import org.jboss.marshalling.ObjectResolver; import org.jenkinsci.plugins.durabletask.FileMonitoringTask; +import org.jenkinsci.plugins.workflow.actions.ExecutorAction; import org.jenkinsci.plugins.workflow.actions.LogAction; import org.jenkinsci.plugins.workflow.actions.QueueItemAction; import org.jenkinsci.plugins.workflow.actions.WorkspaceAction; @@ -916,4 +917,32 @@ private static class FallbackAuthenticator extends QueueItemAuthenticator { } } + @Issue("JENKINS-44193") + @Test + public void executionActionIsPresent() throws Exception { + story.addStep(new Statement() { + @Override public void evaluate() throws Throwable { + WorkflowJob p = story.j.jenkins.createProject(WorkflowJob.class, "executionActionIsPresent"); + p.setDefinition(new CpsFlowDefinition( + "node() {\n" + + " echo \"123\"\n" + + "}", true)); + WorkflowRun b = story.j.assertBuildStatusSuccess(p.scheduleBuild2(0)); + + // Wait until the build completes. + story.j.waitForCompletion(b); + + FlowGraphWalker walker = new FlowGraphWalker(b.getExecution()); + List actions = new ArrayList(); + for (FlowNode n : walker) { + ExecutorAction a = n.getAction(ExecutorAction.class); + if (a != null) { + actions.add(a); + } + } + assertEquals(1, actions.size()); + } + }); + } + }