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

Git plugin sets wrong branch name GIT_BRANCH (more than 2 branches with same SHA1)

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

      Git plugin ver: 2.4.4

      In jenkins job we configure Git plugin ->
      Branches to build/Branch specifier: origin/ready/**

      Developer pushes code to central git repository, which Jenkins check into 2 branches:
      git push origin bugfix:sergey/bugfix
      git push origin bugfix:ready/bugfix

      When Jenkins job kicks in, it provides this output:

      14:01:36 > git branch -a -v --no-abbrev --contains 24ef859065480d5ac965652cfce8a0dd959fd082 # timeout=10
      14:01:36 Checking out Revision 24ef859065480d5ac965652cfce8a0dd959fd082 (origin/sergey/bugfix, origin/ready/bugfix)
      ..
      ..

      14:01:36 HOME=/var/lib/jenkins
      14:01:36 GIT_BRANCH=origin/sergey/bugfix
      14:01:36 EXECUTOR_NUMBER=1

      As you can see GIT_BRANCH got set to "origin/sergey/bugfix"
      and this is wrong because we asked for branch to match origin/ready/**

      This causes problems in our build process

          [JENKINS-33984] Git plugin sets wrong branch name GIT_BRANCH (more than 2 branches with same SHA1)

          Sergey Leonovich created issue -
          Mark Waite made changes -
          Assignee Original: Mark Waite [ markewaite ]
          Sergey Leonovich made changes -
          Attachment New: screenshot-1.png [ 32376 ]
          Sergey Leonovich made changes -
          Attachment New: screenshot-2.png [ 32377 ]
          Sergey Leonovich made changes -
          Attachment Original: screenshot-2.png [ 32377 ]
          Sergey Leonovich made changes -
          Attachment Original: screenshot-1.png [ 32376 ]
          Sergey Leonovich made changes -
          Attachment New: screenshot-1.png [ 32378 ]
          Michael Fowler made changes -
          Assignee New: Nicolas De Loof [ ndeloof ]
          Michael Fowler made changes -
          Link New: This issue is related to JENKINS-35162 [ JENKINS-35162 ]
          Mark Waite made changes -
          Assignee Original: Nicolas De Loof [ ndeloof ]
          R. Tyler Croy made changes -
          Workflow Original: JNJira [ 169997 ] New: JNJira + In-Review [ 183720 ]

            Unassigned Unassigned
            sleonovich Sergey Leonovich
            Votes:
            14 Vote for this issue
            Watchers:
            21 Start watching this issue

              Created:
              Updated: