From bbeb9c8f3cf6f4554291517a02fe46e2dac95763 Mon Sep 17 00:00:00 2001 From: Jesse Glick Date: Thu, 28 Mar 2019 14:06:35 -0400 Subject: [PATCH] Just as DefaultStepContext makes FlowExecution available automatically, it should offer FlowNode. --- .../plugins/workflow/support/DefaultStepContext.java | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/main/java/org/jenkinsci/plugins/workflow/support/DefaultStepContext.java b/src/main/java/org/jenkinsci/plugins/workflow/support/DefaultStepContext.java index 7ca30432..4ccdbcc4 100644 --- a/src/main/java/org/jenkinsci/plugins/workflow/support/DefaultStepContext.java +++ b/src/main/java/org/jenkinsci/plugins/workflow/support/DefaultStepContext.java @@ -95,6 +95,8 @@ public abstract class DefaultStepContext extends StepContext { return castOrNull(key, get(Run.class).getParent()); } else if (FlowExecution.class.isAssignableFrom(key)) { return castOrNull(key,getExecution()); + } else if (FlowNode.class.isAssignableFrom(key)) { + return castOrNull(key, getNode()); } else { // unrecognized key return null; @@ -160,11 +162,13 @@ private T castOrNull(Class key, Object o) { /** * Finds the associated execution. + * Automatically available from {@link #get}. */ protected abstract @Nonnull FlowExecution getExecution() throws IOException; /** * Finds the associated node. + * Automatically available from {@link #get}. */ protected abstract @Nonnull FlowNode getNode() throws IOException;