Skip to content
Permalink
Browse files

Merge pull request #5 from jglick/JENKINS-26132-FlowNodeSerialWalker

Load step flow graph fix
  • Loading branch information...
jglick committed Apr 12, 2016
2 parents 5e8cbc2 + 934d37b commit 32c5626173ff03becc9e563d4aad1058899ba783
@@ -35,6 +35,7 @@
import org.jenkinsci.plugins.workflow.cps.nodes.StepEndNode;
import org.jenkinsci.plugins.workflow.cps.nodes.StepStartNode;
import org.jenkinsci.plugins.workflow.cps.persistence.PersistIn;
import org.jenkinsci.plugins.workflow.cps.steps.LoadStep;
import org.jenkinsci.plugins.workflow.cps.steps.ParallelStep;
import org.jenkinsci.plugins.workflow.flow.FlowExecutionOwner;
import org.jenkinsci.plugins.workflow.graph.FlowNode;
@@ -114,7 +115,7 @@ public Object invokeMethod(String name, Object args) {
FlowNode an;

// TODO: generalize the notion of Step taking over the FlowNode creation.
boolean hack = d instanceof ParallelStep.DescriptorImpl;
boolean hack = d instanceof ParallelStep.DescriptorImpl || d instanceof LoadStep.DescriptorImpl;

if (ps.body == null && !hack) {
an = new StepAtomNode(exec, d, thread.head.get());
@@ -1,18 +1,15 @@
package org.jenkinsci.plugins.workflow.cps.steps;

import com.google.inject.Inject;
import groovy.lang.GroovyShell;
import groovy.lang.Script;
import hudson.ExtensionList;
import hudson.ExtensionPoint;
import hudson.FilePath;
import hudson.model.TaskListener;
import javax.annotation.Nonnull;
import org.jenkinsci.plugins.workflow.actions.LabelAction;
import org.jenkinsci.plugins.workflow.cps.CpsFlowExecution;
import org.jenkinsci.plugins.workflow.cps.CpsStepContext;
import org.jenkinsci.plugins.workflow.cps.CpsThread;
import org.jenkinsci.plugins.workflow.graph.FlowNode;
import org.jenkinsci.plugins.workflow.steps.AbstractStepExecutionImpl;
import org.jenkinsci.plugins.workflow.steps.BodyExecutionCallback;
import org.jenkinsci.plugins.workflow.steps.StepContextParameter;
@@ -31,9 +28,6 @@
@Inject(optional=true)
private transient LoadStep step;

@StepContextParameter
private transient FlowNode node;

@StepContextParameter
private transient TaskListener listener;

@@ -51,11 +45,10 @@ public boolean start() throws Exception {

Script script = execution.getShell().parse(text);

node.addAction(new LabelAction(step.getPath()));

// execute body as another thread that shares the same head as this thread
// as the body can pause.
cps.newBodyInvoker(t.getGroup().export(script))
.withDisplayName(step.getPath())
.withCallback(BodyExecutionCallback.wrap(cps))
.start(); // when the body is done, the load step is done

0 comments on commit 32c5626

Please sign in to comment.
You can’t perform that action at this time.