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

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

XMLWordPrintable

    • Declarative backlog

      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.

            Unassigned Unassigned
            abayer Andrew Bayer
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated: