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

Environment section should be evaluated before other sections

    XMLWordPrintable

    Details

    • Similar Issues:

      Description

      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.

        Attachments

          Activity

          Hide
          ahammar Anders Hammar added a comment -

          Or possibly a better option is that the sections are evaluated in the order they are defined?

          Show
          ahammar Anders Hammar added a comment - Or possibly a better option is that the sections are evaluated in the order they are defined?

            People

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

              Dates

              Created:
              Updated: