given the following pipeline, I would expect the "with NO agent" stage to trigger without any agent being launched. This is not the case, all stages are launched with an agent. This is specially a problem when I have an "input" step waiting for a user interaction in one of the stages defined.
{noformat} pipeline { agent any tools { jdk "Oracle JDK 1.8 (latest)" } stages { stage ('with any agent 0') { steps sh "java -version" } } stage ('with NO agent') { agent none steps { sh "java -version" } } stage ('with any agent 1') { steps { sh "java -version" } } } } {noformat}
This is also the case where "with NO agent" is the first stage in the pipeline. btw. I was only able to discover this because of JENKINS-42338 - I think it would also be a good idea to have the "stage" step print some info on which agent it actually runs.
There is no way to "leave" the node block once we've entered it without releasing the executor slot and having to get it back later, at which point there's no guarantee of the same workspace, etc...not to mention that it's a pain to figure out how to scope the blocks in this kind of scenario. So yeah, agent none does nothing unless at the top level.
and how would you define an _input_ step which can wait for say 2 days?
also I think together with JENKINS-42338 this means I have to duplicate the same configuration over and over again. Because I have to define _agent none_ on top scope and redefeine every agent for each _stage_ again.
...yeah, so we don't have a good answer on the waiting-for-2-days input step for sure. I need to do more experiments to see if I can find a way to "escape" from the executor for some other stuff too, but haven't yet found a way. In re JENKINS-42338, that is a good point and is why I'm thinking about that ticket and whether it may make sense to have tools apply for all stages if defined at the top level.