Relates to JENKINS-41758 - to determine whether we should do a SCM checkout, we need to check Root and SkipDefaultCheckout, both of which are in pipeline-model-definition, so it's hard to make an extension of DeclarativeAgent that just depends on pipeline-model-declarative-agent. That should be fixed.
Code changed in jenkins User: Andrew Bayer Path: pipeline-model-declarative-agent/src/main/java/org/jenkinsci/plugins/pipeline/modeldefinition/agent/DeclarativeAgent.java pipeline-model-definition/src/main/groovy/org/jenkinsci/plugins/pipeline/modeldefinition/model/Agent.groovy
Code changed in jenkins User: Andrew Bayer Path: pipeline-model-declarative-agent/src/main/java/org/jenkinsci/plugins/pipeline/modeldefinition/agent/DeclarativeAgent.java pipeline-model-definition/src/main/groovy/org/jenkinsci/plugins/pipeline/modeldefinition/model/Agent.groovy
There's no actual good reason for carrying the whole context (i.e., Root or Stage object) around in the DeclarativeAgent when all we need to know is whether we're already in a stage. So...switch that to a boolean and have Agent.groovy check whether the context it's handed is a Root instance. If it is a Root instance, we're not in a stage. If it isn't a Root instance, we are in a stage. Tada.