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

Git plugin 1.1.21 cannot build branches with repository specified but no wildcards

    XMLWordPrintable

Details

    • Bug
    • Status: Closed (View Workflow)
    • Major
    • Resolution: Fixed
    • git-plugin
    • None
    • Debian Squeeze on x86_64

    Description

      If a branch to build is specified like REPONAME/BRANCHNAME then the git plugin will look for branches named REPONAME/REPONAME/BRANCHNAME.
      Worse still, if the git repository has multiple repositories configured, it will then search for OTHERREPO/REPONAME/REPONAME/BRANCHNAME.

      I believe this is the same cause as https://issues.jenkins-ci.org/browse/JENKINS-14394

      I believe the problem code to be https://github.com/jenkinsci/git-plugin/blob/master/src/main/java/hudson/plugins/git/util/DefaultBuildChooser.java#L73, the block after 'if (!singleBranch.contains("/"))' should be inside it, since that is for unqialified branches.

      I worked around this issue by changing the refspecs to include an extra component in the branch, so origin/master becomes origin/UGLYHACK/master with '+refs/heads/*:refs/remotes/origin/UGLYHACK/*', so the branch specification becomes origin/*/master.

      Attachments

        Issue Links

          Activity

            sti Sami Tikka added a comment -

            This happened to me also. I was just investigating why a job that usually runs fine has started failing after the git plugin upgrade to 1.1.21. The job was configured to build "origin/master". Jenkins system log shows it running git command like this:

            19.7.2012 1:46:53 hudson.Proc
            FINE: Running: git rev-parse origin/origin/master^{commit}
            

            Reconfiguring the job to build branch "master" fixed it. However, it would be nice if the existing behavior could be kept. At work I have hundreds of jobs configured with "origin/master" and it wouldn't be nice to have to change them all.

            sti Sami Tikka added a comment - This happened to me also. I was just investigating why a job that usually runs fine has started failing after the git plugin upgrade to 1.1.21. The job was configured to build "origin/master". Jenkins system log shows it running git command like this: 19.7.2012 1:46:53 hudson.Proc FINE: Running: git rev-parse origin/origin/master^{commit} Reconfiguring the job to build branch "master" fixed it. However, it would be nice if the existing behavior could be kept. At work I have hundreds of jobs configured with "origin/master" and it wouldn't be nice to have to change them all.

            Code changed in jenkins
            User: Nicolas De Loof
            Path:
            src/main/java/hudson/plugins/git/util/DefaultBuildChooser.java
            http://jenkins-ci.org/commit/git-plugin/2ee61e6c01ac47099dd0ade635e0ea78d558f362
            Log:
            [FIXED JENKINS-14480] handle fully qualified branch names
            backward compatible way

            scm_issue_link SCM/JIRA link daemon added a comment - Code changed in jenkins User: Nicolas De Loof Path: src/main/java/hudson/plugins/git/util/DefaultBuildChooser.java http://jenkins-ci.org/commit/git-plugin/2ee61e6c01ac47099dd0ade635e0ea78d558f362 Log: [FIXED JENKINS-14480] handle fully qualified branch names backward compatible way
            jhansche Joe Hansche added a comment -

            Any news on when 1.1.22 will be released? I see it's already in the changelog on the wiki, but hasn't been released yet.

            Are you just looking for testers to make sure the update fixes the bug?

            jhansche Joe Hansche added a comment - Any news on when 1.1.22 will be released? I see it's already in the changelog on the wiki, but hasn't been released yet. Are you just looking for testers to make sure the update fixes the bug?

            People

              ndeloof Nicolas De Loof
              richard_maw Richard Maw
              Votes:
              2 Vote for this issue
              Watchers:
              7 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: