From 0400c203c1f00c9128a25e3f6299f351835f6d8c Mon Sep 17 00:00:00 2001 From: Artur Harasimiuk Date: Sat, 8 Sep 2018 00:01:58 +0200 Subject: [PATCH 1/3] [JENKINS-44193] wfapi/describe execNode empty Adding ExecutorAction to FlowNode Signed-off-by: Artur Harasimiuk --- .../plugins/workflow/support/steps/ExecutorStepExecution.java | 2 ++ 1 file changed, 2 insertions(+) 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() From 18eeaa7f061ee4e4f7314acb2eb1b9e18cd2d8b6 Mon Sep 17 00:00:00 2001 From: Artur Harasimiuk Date: Tue, 11 Sep 2018 20:24:37 +0200 Subject: [PATCH 2/3] update version of workflow-api and struts part of PR but versions should updated accordingly after workflow-api PR#77 is merged. Signed-off-by: Artur Harasimiuk --- pom.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) 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 From 538d2d6237df7c55e8c08307ef01fdce90435ea5 Mon Sep 17 00:00:00 2001 From: Artur Harasimiuk Date: Wed, 10 Oct 2018 11:47:07 +0200 Subject: [PATCH 3/3] add Unit test to ensure ExecutorAction is added to FlowNode Signed-off-by: Artur Harasimiuk --- .../support/steps/ExecutorStepTest.java | 29 +++++++++++++++++++ 1 file changed, 29 insertions(+) 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()); + } + }); + } + }