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

Jenkins builds incorrect branch when regex branch specifier changes

    • Icon: Bug Bug
    • Resolution: Unresolved
    • Icon: Major Major
    • git-plugin
    • None
    • git-plugin 2.4.0
      Jenkins ver. 1.626

      Today I noticed what seems to be a bug in Jenkins/git-plugin due to some sort of caching(??)

      • create new freestyle project
      • use git scm
      • specify a regex branch specifier, eg. :origin/master
      • save and build
      • update project, changing the branch specifier, eg. :origin/yolo
      • save and build
      • update the project, changing the branch specifier back to the original, eg. :origin/master
      • save and build

      I'd expect the last build to be master, but it really just checks out the previous branch :origin/yolo.

      I came across this when I tried using a parameterized build setup to build multiple branches :origin/(master|v.*) on scm change, with the option to manually specify a branch to build via the parameter. However, after changing the branch specifier in this case, Jenkins/git-plugin seems to get stuck on one branch :o.

      Let me know if I can help with any other details.

          [JENKINS-31865] Jenkins builds incorrect branch when regex branch specifier changes

          Lorenz Mende added a comment - - edited

          I can confirm this bug with Jenkins 2.63, Git plugin 3.3.0 and Git client plugin 2.4.6.

          Primarily detected on our test job hanging in a specific branch and never returned to our main branch.

          The reason to use a regex as branch specified is the use of tag/branch or commit hash as of

          :(.*${BRANCH}$)

          BRANCH is a job parameter. The SCM is configured with "wipe out & force clone" to get a clean repo for the job.

          Further details may be provided if needed.

          Lorenz Mende added a comment - - edited I can confirm this bug with Jenkins 2.63, Git plugin 3.3.0 and Git client plugin 2.4.6. Primarily detected on our test job hanging in a specific branch and never returned to our main branch. The reason to use a regex as branch specified is the use of tag/branch or commit hash as of :(.*${BRANCH}$) BRANCH is a job parameter. The SCM is configured with "wipe out & force clone" to get a clean repo for the job. Further details may be provided if needed.

            Unassigned Unassigned
            wilrnh William Hutson
            Votes:
            5 Vote for this issue
            Watchers:
            6 Start watching this issue

              Created:
              Updated: