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

Git Plugin only scans refs/heads on multibranch scan

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Unresolved
    • Icon: Major Major
    • git-plugin
    • None
    • Jenkins 2.75
      git-plugin 3.5.1

      Because this was completely breaking my build environment, I was able to track down the issue to the following file: https://github.com/jenkinsci/git-plugin/blob/git-3.5.1/src/main/java/jenkins/plugins/git/AbstractGitSCMSource.java

      Broken on sha a4febc060a23740816d660915b9fe0a7a6ffdcf6

      Working on sha d7c3ece2553cf0494a56c766f62a6c9f340bbe4c

      To get it to work in my environment, I reverted this one file to the previous sha and built the plugin locally. Installed on my Jenkins instance and the issue was fixed.

       

      Issue:

      For multibranch projects- not tested on single branch projects

      Basically, when listing remotes during branch discovery, it forces the '-h' option for git ls-remotes and ignores any refspec given.

      For example, I give the refspec '+refs/collab/:refs/remotes/origin/collab/' but it only lists (and therefore filters) remotes for '+refs/heads/:refs/remotes/origin/heads/'

      Our org needs the custom refs location because that is how we automate code reviews.  On version 3.4.1 of the plugin, this refspec worked just fine.  On version 3.5.0, it broke and deleted all the collab branches.

      Please let me know if you need any additional details.  I would submit a PR but, my Java is weak.  Thank you, kindly!

       

       

       

            Unassigned Unassigned
            scatt Stephen Catt
            Votes:
            6 Vote for this issue
            Watchers:
            12 Start watching this issue

              Created:
              Updated: