Uploaded image for project: 'Jenkins'
  1. Jenkins
  2. JENKINS-54919

Newly defined parameters aren't available in Declarative agent configuration on first build

    Details

    • Sprint:
      Declarative backlog
    • Similar Issues:

      Description

      This is similar to both JENKINS-40574 and JENKINS-43911 (well, how JENKINS-43911 would behave from 1.2 onward - previously it was just that environment was evaluated after agent during execution) - parameters is evaluated at the beginning of the Declarative runtime, but agent is populated before that, at the very start of execution. So if params.FOO already exists when the build starts, then agent { label params.FOO }}} will work fine, but if it's a new parameter (like, say, on first build of a branch), {{params.FOO's value there will end up as null.

      A workaround for now is to do label "${params.FOO ?: 'whatever-the-default-value-should-be'}", but I'll work on a better solution.

        Attachments

          Issue Links

            Activity

            Hide
            abayer Andrew Bayer added a comment -

            PR up at https://github.com/jenkinsci/pipeline-model-definition-plugin/pull/301 - let's see if it doesn't regress anything else...

            Show
            abayer Andrew Bayer added a comment - PR up at https://github.com/jenkinsci/pipeline-model-definition-plugin/pull/301 - let's see if it doesn't regress anything else...

              People

              • Assignee:
                abayer Andrew Bayer
                Reporter:
                abayer Andrew Bayer
              • Votes:
                0 Vote for this issue
                Watchers:
                2 Start watching this issue

                Dates

                • Created:
                  Updated: