Search in sources :

Example 1 with BodyInvocationAction

use of org.jenkinsci.plugins.workflow.actions.BodyInvocationAction in project workflow-cps-plugin by jenkinsci.

the class CpsBodyExecution method addBodyEndFlowNode.

/**
 * Inserts the flow node that indicates the beginning of the body invocation.
 *
 * @see #addBodyStartFlowNode(FlowHead)
 */
@Nonnull
private StepEndNode addBodyEndFlowNode() {
    try {
        FlowHead head = CpsThread.current().head;
        StepEndNode end = new StepEndNode(head.getExecution(), getBodyStartNode(), head.get());
        head.getExecution().cacheNode(end);
        end.addAction(new BodyInvocationAction());
        head.setNewHead(end);
        return end;
    } catch (IOException e) {
        LOGGER.log(WARNING, "Failed to grow the flow graph", e);
        throw new Error(e);
    }
}
Also used : BodyInvocationAction(org.jenkinsci.plugins.workflow.actions.BodyInvocationAction) StepEndNode(org.jenkinsci.plugins.workflow.cps.nodes.StepEndNode) IOException(java.io.IOException) Nonnull(javax.annotation.Nonnull)

Example 2 with BodyInvocationAction

use of org.jenkinsci.plugins.workflow.actions.BodyInvocationAction in project workflow-cps-plugin by jenkinsci.

the class CpsBodyExecution method addBodyStartFlowNode.

/**
 * Inserts the flow node that indicates the beginning of the body invocation.
 *
 * @see #addBodyEndFlowNode()
 */
@Nonnull
private StepStartNode addBodyStartFlowNode(FlowHead head) {
    CpsFlowExecution.maybeAutoPersistNode(head.get());
    StepStartNode start = new StepStartNode(head.getExecution(), context.getStepDescriptor(), head.get());
    head.getExecution().cacheNode(start);
    this.startNodeId = start.getId();
    start.addAction(new BodyInvocationAction());
    return start;
}
Also used : StepStartNode(org.jenkinsci.plugins.workflow.cps.nodes.StepStartNode) BodyInvocationAction(org.jenkinsci.plugins.workflow.actions.BodyInvocationAction) Nonnull(javax.annotation.Nonnull)

Aggregations

Nonnull (javax.annotation.Nonnull)2 BodyInvocationAction (org.jenkinsci.plugins.workflow.actions.BodyInvocationAction)2 IOException (java.io.IOException)1 StepEndNode (org.jenkinsci.plugins.workflow.cps.nodes.StepEndNode)1 StepStartNode (org.jenkinsci.plugins.workflow.cps.nodes.StepStartNode)1