Original reporter misery

      I need to know the current branch in generated job (see conditional step) but there is no $BRANCH variable or something like this I can use. $JOB_NAME does not contain only "branch name".

      Please add a $CURRENT_BRANCH or something like this.
      As a work-around I used Envinject plugin with the following groovy script.

      def jobName = currentJob.getName()
      return [BRANCH: "${jobName}"]
      

      It's weird that currentJob.getName() works instead of $JOB_NAME.

          [JENKINS-32244] Environment variable for current branch

            mjdetullio Matthew DeTullio
            mjdetullio Matthew DeTullio
            Votes:
            2 Vote for this issue
            Watchers:
            4 Start watching this issue

              Created:
              Updated:
              Resolved: