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

GIT_BRANCH is incorrect in build steps when branch choosing strategy is set to inverse (but it is correct in build name macro)

    • Icon: Bug Bug
    • Resolution: Unresolved
    • Icon: Major Major
    • git-plugin
    • None

      Context: I'm trying to create a parameterized job chain for our branches.
      Version info:
      Jenkins 1.450
      Git 1.1.15
      build-name-setter 1.3
      parametrized trigger 2.12

      1) Set the git branch to */master and in advanced, select branching strategy = inverse
      2) Set the build name (using plugin) to #${BUILD_NUMBER}.${GIT_BRANCH}
      3) In the build, use shell to execute: echo ${BUILD_BRANCH}
      4) Push a change into a branch in git then manually start the build in Jenkins

      Result:
      The build string is set correctly to the branch used in step#4, but the echo in step #3 incorrectly says origin/master. Note, that the wrong GIT_BRANCH is also sent in my parameterized trigger.

      The setting for GIT_BRANCH is correct at all times when Default choosing strategy is selected.

          [JENKINS-12655] GIT_BRANCH is incorrect in build steps when branch choosing strategy is set to inverse (but it is correct in build name macro)

          Ruth Morgenstein created issue -
          Ruth Morgenstein made changes -
          Description Original: Context: I'm trying to create a parameterized job chain for our branches.

          1) Set the git branch to */master and in advanced, select branching strategy = inverse
          2) Set the build name (using plugin) to #${BUILD_NUMBER}.${GIT_BRANCH}
          3) In the build, use shell to execute: echo ${BUILD_BRANCH}
          4) Push a change into a branch in git then manually start the build in Jenkins

          Result:
          The build string is set correctly to the branch used in step#4, but the echo in step #3 incorrectly says origin/master. Note, that the wrong GIT_BRANCH is also sent in my parameterized trigger.

          The setting for GIT_BRANCH is correct at all times when Default choosing strategy is selected.

          New: Context: I'm trying to create a parameterized job chain for our branches.
          Version info:
          Jenkins 1.450
          Git 1.1.15
          build-name-setter 1.3
          parametrized trigger 2.12


          1) Set the git branch to */master and in advanced, select branching strategy = inverse
          2) Set the build name (using plugin) to #${BUILD_NUMBER}.${GIT_BRANCH}
          3) In the build, use shell to execute: echo ${BUILD_BRANCH}
          4) Push a change into a branch in git then manually start the build in Jenkins

          Result:
          The build string is set correctly to the branch used in step#4, but the echo in step #3 incorrectly says origin/master. Note, that the wrong GIT_BRANCH is also sent in my parameterized trigger.

          The setting for GIT_BRANCH is correct at all times when Default choosing strategy is selected.

          R. Tyler Croy made changes -
          Workflow Original: JNJira [ 143110 ] New: JNJira + In-Review [ 175814 ]
          Mark Waite made changes -
          Assignee Original: Andrew Bayer [ abayer ]

            Unassigned Unassigned
            rmorgenstein Ruth Morgenstein
            Votes:
            5 Vote for this issue
            Watchers:
            9 Start watching this issue

              Created:
              Updated: