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

Git plugin ignores the branch we tell it to build and builds a random branch instead

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Not A Defect
    • Icon: Minor Minor
    • git-client-plugin
    • Git client plugin: 1.16.1
      Git plugin: 2.3.4

      I have the "refspec" empty so git plugin fetches all remote branches as documented. We are only interested in building origin/master (but we need the other branches around for the build).

      I am trying to put in the branch settings things like "refs/remotes/origin/master" or just "origin/master" but whatever I type in is ignored and some other remote branch gets built. It seems like whatever gets typed in in that input box has no effect whatsoever. Even if I type a reference that does not exists like "ref/foo/bar", it will (a) not give an error, and (b) check the same random branch. Here is a console output that demonstrates:

      Started by user User (user)
      Building in workspace /var/lib/jenkins/jobs/continuous_test/workspace
       > git rev-parse --is-inside-work-tree # timeout=10
      Fetching changes from the remote Git repository
       > git config remote.origin.url ssh://jenkins2@gerrit.domain.com:29418/Collectr.git # timeout=10
      Fetching upstream changes from ssh://jenkins2@gerrit.domain.com:29418/Collectr.git
       > git --version # timeout=10
       > git -c core.askpass=true fetch --tags --progress ssh://jenkins2@gerrit.domain.com:29418/Collectr.git +refs/heads/*:refs/remotes/origin/*
       > git rev-parse FETCH_HEAD^{commit} # timeout=10
      Checking out Revision 02a1ad8196306911dd4ee6749326c69d549c4cba (refs/foo/bar)
      

      Notice the "refs/foo/bar" at the end? It always checkouts the same commit, no matter what branch I give it.

            ndeloof Nicolas De Loof
            nadavsr Nadav Samet
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

              Created:
              Updated:
              Resolved: