|
36 | 36 | import org.jenkinsci.plugins.workflow.flow.FlowExecution; |
37 | 37 | import org.jenkinsci.plugins.workflow.graph.BlockEndNode; |
38 | 38 | import org.jenkinsci.plugins.workflow.graph.FlowNode; |
| 39 | +import org.jenkinsci.plugins.workflow.graph.StepNode; |
39 | 40 | import org.jenkinsci.plugins.workflow.graphanalysis.LinearBlockHoppingScanner; |
40 | 41 | import org.jenkinsci.plugins.workflow.steps.StepContext; |
41 | 42 | import org.jenkinsci.plugins.workflow.support.steps.AgentErrorCondition; |
@@ -91,6 +92,7 @@ public boolean test(Throwable t, StepContext context) throws IOException, Interr |
91 | 92 | LOGGER.fine(() -> "Found origin " + origin + " " + origin.getDisplayFunctionName()); |
92 | 93 | LinearBlockHoppingScanner scanner = new LinearBlockHoppingScanner(); |
93 | 94 | scanner.setup(origin); |
| 95 | + boolean foundPodTemplate = false; |
94 | 96 | for (FlowNode callStack : scanner) { |
95 | 97 | WorkspaceAction ws = callStack.getPersistentAction(WorkspaceAction.class); |
96 | 98 | if (ws != null) { |
@@ -121,9 +123,15 @@ public boolean test(Throwable t, StepContext context) throws IOException, Interr |
121 | 123 | LOGGER.fine(() -> "active on " + node + " (termination reasons: " + terminationReasons + ")"); |
122 | 124 | return true; |
123 | 125 | } |
| 126 | + foundPodTemplate |= callStack instanceof StepNode && ((StepNode) callStack).getDescriptor() instanceof PodTemplateStep.DescriptorImpl; |
124 | 127 | } |
125 | 128 | if (!handleNonKubernetes) { |
126 | | - listener.getLogger().println("Could not find a node block associated with " + origin.getDisplayFunctionName() + " (source of error)"); |
| 129 | + if (foundPodTemplate) { |
| 130 | + listener.getLogger().println("Could not find a node block associated with " + origin.getDisplayFunctionName() + " (source of error) but inside podTemplate"); |
| 131 | + return true; |
| 132 | + } else { |
| 133 | + listener.getLogger().println("Could not find a node block associated with " + origin.getDisplayFunctionName() + " (source of error)"); |
| 134 | + } |
127 | 135 | } |
128 | 136 | return handleNonKubernetes; |
129 | 137 | } |
|
0 commit comments