| My use case is that I have a pipeline, and part of the way through it I check out a git repo, and set the latest git commit hash to a variable which is used to tag and push a docker image. Later on I have a stage that uses that image, and thus I need the hash to run the stage using an agent based on that image. The only workaround to do this is to take the stage that checks out the code out of the declarative pipeline and do it before. If there were other steps that had to happen before that, I'd have to take them out of the pipeline too, so at that point I'd be basically just not using declarative pipeline because of this issue. I think being able to dynamically assign agents based on the pipeline is an important and powerful ability, and is something that exists in both scripted pipeline and freestyle jobs (you can assign node/label as a parameter for a freestyle job, and a pipeline of freestyle jobs effectively makes each job the equivalent of a "stage" in pipeline terminology). |