-
Improvement
-
Resolution: Not A Defect
-
Minor
-
None
Hi, so using the declarative pipeline it appears if you have agent none set at the top of the pipeline and agents defined per stage, you are unable to have a post section that executes certain steps (that require a node context). The following will result in an error::
pipeline { agent none stages { stage('Example') { steps { echo 'Hello World' } } } post { always { deleteDir() } } }
Required context class hudson.FilePath is missing Perhaps you forgot to surround the code with a step that provides this, such as: node ERROR: Attempted to execute a step that requires a node context while agent none was specified. Be sure to specify your own node { ... } blocks when using agent none.
I'm guessing its expected behavior but would it be possible to associate an agent with the post section as we do with stages?
Thanks, David
- relates to
-
JENKINS-64874 declarative pipeline post do not execute in agent
-
- Open
-
[JENKINS-43578] Declarative pipeline: post section doesn't play nice with agent none
Description |
Original:
Hi, so using the declarative pipeline it appears if you have *agent none* set at the top of the pipeline and agents defined per stage, you are unable to have a *post* section that executes certain steps (that require a node context). For example: {code:java} pipeline { agent none stages { stage('Example') { steps { echo 'Hello World' } } } post { always { deleteDir() } } } {code} I'm guessing its expected behavior but would it be possible to associate an agent with the *post* section as we do with stages? Thanks, David |
New:
Hi, so using the declarative pipeline it appears if you have *agent none* set at the top of the pipeline and agents defined per stage, you are unable to have a *post* section that executes certain steps (that require a node context). The following will result in an error:: {code:java} pipeline { agent none stages { stage('Example') { steps { echo 'Hello World' } } } post { always { deleteDir() } } } {code} {code:java} Required context class hudson.FilePath is missing Perhaps you forgot to surround the code with a step that provides this, such as: node ERROR: Attempted to execute a step that requires a node context while agent none was specified. Be sure to specify your own node { ... } blocks when using agent none.{code} I'm guessing its expected behavior but would it be possible to associate an agent with the *post* section as we do with stages? Thanks, David |
Rank | New: Ranked higher |
Component/s | Original: pipeline [ 21692 ] |
Resolution | New: Not A Defect [ 7 ] | |
Status | Original: Open [ 1 ] | New: Resolved [ 5 ] |
Status | Original: Resolved [ 5 ] | New: Closed [ 6 ] |
Link | New: This issue relates to JENKINS-64874 [ JENKINS-64874 ] |