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

Environment section should be evaluated before other sections

XMLWordPrintable

    • Icon: Improvement Improvement
    • Resolution: Unresolved
    • Icon: Minor Minor
    • None
    • 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.

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

              Created:
              Updated: