Environment section should be evaluated before other sections

XMLWordPrintable

    • Type: Improvement
    • Resolution: Unresolved
    • Priority: Minor
    • None
    • Environment:
      Jenkins LTS 2.249.3
      pipeline-model-definition-plugin 1.7.2

      For a multibranch pipeline we have a pipeline like this:

      pipeline {
          agent none
          environment {
              RELEASE_BRANCH = 'master'
              // ...
          }
          triggers {
              cron(env.BRANCH_NAME == env.RELEASE_BRANCH ? '0 18 * * 7' : '')
          }
          // ...
      }
      

      The use case is to have the release branch rebuilt on a scheduled interval.
      However, this doesn't work as env.RELEASE_BRANCH is not set when the trigger is evaluated. I suggest that the environment section is evaluated first of all sections or at least as one of the first, so that env variables can be used in other sections.

            Assignee:
            Unassigned
            Reporter:
            Anders Hammar
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated: