• Icon: Bug Bug
    • Resolution: Won't Fix
    • Icon: Major Major
    • git-plugin
    • None
    • Jenkins 1.460, git plugin 1.1.17

      In a repository with multiple branches, Jenkins frequently builds a commit other than the head of the selected branch. For example, it builds HEAD^ from the master branch.

      I am selecting the branch to build based on a parameter $BRANCH, which defaults to **, and the problem occurs with this value. If I set BRANCH to "origin/master" explicitly, then I get the latest commit as expected.

          [JENKINS-13510] selects old git commit for build

          Marcus Better created issue -
          R. Tyler Croy made changes -
          Workflow Original: JNJira [ 143976 ] New: JNJira + In-Review [ 176049 ]

          William Osler added a comment - - edited

          I'm having issues with this on Jenkins 2.7.1, git plugin 2.5.3. I have a plugin installed that builds pull requests from a Stash instances, very similar to the GitHub pull request builder (which is also having issues, see JENKINS-31686). Frequently, but not always, it will instead build an old commit instead of the newest one on the branch. Given that this has been seen across different Git PR plugins, I think the git plugin itself is the culprate.

          More info:
          Refspec:

          +refs/pull-requests/*:refs/remotes/origin/pr/*
          

          Branch Specifier: origin/pr/${pullRequestId}/from

          Where

          ${pullRequestId}

          is an environment variable that contains the Stash PR number.

          William Osler added a comment - - edited I'm having issues with this on Jenkins 2.7.1, git plugin 2.5.3. I have a plugin installed that builds pull requests from a Stash instances, very similar to the GitHub pull request builder (which is also having issues, see JENKINS-31686 ). Frequently, but not always, it will instead build an old commit instead of the newest one on the branch. Given that this has been seen across different Git PR plugins, I think the git plugin itself is the culprate. More info: Refspec: +refs/pull-requests/*:refs/remotes/origin/pr/* Branch Specifier: origin/pr/${pullRequestId}/from Where ${pullRequestId} is an environment variable that contains the Stash PR number.
          Nicolas De Loof made changes -
          Assignee Original: Nicolas De Loof [ ndeloof ]

          Mark Waite added a comment -

          Building with multiple branches on a single job creates an unusable change history. Better to use a multibranch Jenkins pipeline and allow Jenkins to create and destroy jobs automatically as branches are created and destroyed. Won't fix this.

          Mark Waite added a comment - Building with multiple branches on a single job creates an unusable change history. Better to use a multibranch Jenkins pipeline and allow Jenkins to create and destroy jobs automatically as branches are created and destroyed. Won't fix this.
          Mark Waite made changes -
          Resolution New: Won't Fix [ 2 ]
          Status Original: Open [ 1 ] New: Closed [ 6 ]

            Unassigned Unassigned
            mbetter Marcus Better
            Votes:
            3 Vote for this issue
            Watchers:
            5 Start watching this issue

              Created:
              Updated:
              Resolved: