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

Git plugin does not correctly record built revision on failed merge

    • Icon: Bug Bug
    • Resolution: Fixed
    • Icon: Minor Minor
    • git-plugin
    • None
    • git plugin 2.2.6

      If the plugin has to merge with multiple branches, and at least 1 merge succeeds and 1 fails, then the revision of the last successful merge is recorded as lastBuiltRevision, but not the original (marked) revision. Because the original revision is not recognized as already built, polling will trigger another build, resulting in an infinite loop.

          [JENKINS-25191] Git plugin does not correctly record built revision on failed merge

          Mark Waite added a comment -

          I tried to duplicate this bug and was unable to do so. Can you clarify the steps you took to show the problem?

          The steps I took (on my Ubuntu workstation):

          1. Create a bare git repository
            1. $ mkdir /var/lib/git/mwaite/bugs/JENKINS-25191.git
            2. $ cd /var/lib/git/mwaite/bugs/JENKINS-25191.git
            3. $ git init --bare
          2. Clone the bare repository
            1. $ cd
            2. $ git clone /var/lib/git/mwaite/bugs/JENKINS-25191.git
            3. $ cd JENKINS-25191
          3. Commit README on master, push that commit
            1. $ echo "Checking JENKINS-225191" > README
            2. $ git add README
            3. $ git commit -m "Add README"
            4. $ git push -set-upstream origin master
          4. Checkout branch integration1 from master
            1. $ git checkout -b integration1 master
          5. Commit a new file on integration1
            1. $ date >> conflicting-commit
            2. $ git add conflicting-commit
            3. $ git commit -m "Add a conflicting file on integration1"
          6. Checkout branch integration2 from master
            1. $ git checkout -b integration2 master
          7. Commit a new file on integration2
            1. $ date >> conflicting-commit
            2. $ git add conflicting-commit
            3. $ git commit -m "Add a conflicting file on integration2"
          8. Confirm branch layout visually
            1. $ git log --all --graph --pretty=oneline --abbrev-commit --decorate
          9. Create a Jenkins job using that git repo, configured to build any branch, and merge to the master branch, polling for changes, and publish changes back to the git repository
          10. Run the Jenkins job once (will build the master branch once)
          11. Push branches integration1 and integration2 to the bare repository
            1. $ git checkout integration1
            2. $ git push --set-upstream origin integration1
            3. $ git checkout integration2
            4. $ git push --set-upstream origin integration2
          12. Wait for polling interval and confirm that two jobs are run, one for integration1 and 1 for integration2

          Mark Waite added a comment - I tried to duplicate this bug and was unable to do so. Can you clarify the steps you took to show the problem? The steps I took (on my Ubuntu workstation): Create a bare git repository $ mkdir /var/lib/git/mwaite/bugs/ JENKINS-25191 .git $ cd /var/lib/git/mwaite/bugs/ JENKINS-25191 .git $ git init --bare Clone the bare repository $ cd $ git clone /var/lib/git/mwaite/bugs/ JENKINS-25191 .git $ cd JENKINS-25191 Commit README on master, push that commit $ echo "Checking JENKINS-225191" > README $ git add README $ git commit -m "Add README" $ git push -set-upstream origin master Checkout branch integration1 from master $ git checkout -b integration1 master Commit a new file on integration1 $ date >> conflicting-commit $ git add conflicting-commit $ git commit -m "Add a conflicting file on integration1" Checkout branch integration2 from master $ git checkout -b integration2 master Commit a new file on integration2 $ date >> conflicting-commit $ git add conflicting-commit $ git commit -m "Add a conflicting file on integration2" Confirm branch layout visually $ git log --all --graph --pretty=oneline --abbrev-commit --decorate Create a Jenkins job using that git repo, configured to build any branch, and merge to the master branch, polling for changes, and publish changes back to the git repository Run the Jenkins job once (will build the master branch once) Push branches integration1 and integration2 to the bare repository $ git checkout integration1 $ git push --set-upstream origin integration1 $ git checkout integration2 $ git push --set-upstream origin integration2 Wait for polling interval and confirm that two jobs are run, one for integration1 and 1 for integration2

          Wannes Sels added a comment -

          Can you share your job config.xml from step 9 and build log from step 10 with GitSCM.VERBOSE=true?
          I can't access my work pc & jenkins server over the weekend, but I'll see what I can do at home.

          Wannes Sels added a comment - Can you share your job config.xml from step 9 and build log from step 10 with GitSCM.VERBOSE=true? I can't access my work pc & jenkins server over the weekend, but I'll see what I can do at home.

          Code changed in jenkins
          User: Wannes Sels
          Path:
          src/main/java/hudson/plugins/git/GitSCM.java
          src/main/java/hudson/plugins/git/extensions/GitSCMExtension.java
          src/main/java/hudson/plugins/git/extensions/impl/PreBuildMerge.java
          src/test/java/hudson/plugins/git/GitSCMTest.java
          http://jenkins-ci.org/commit/git-plugin/80a396f1f9110e3129e6411fc812dfb421d8c4b5
          Log:
          Pass marked revision to decorateRevisionToBuild()
          [FIXED JENKINS-25191]

          SCM/JIRA link daemon added a comment - Code changed in jenkins User: Wannes Sels Path: src/main/java/hudson/plugins/git/GitSCM.java src/main/java/hudson/plugins/git/extensions/GitSCMExtension.java src/main/java/hudson/plugins/git/extensions/impl/PreBuildMerge.java src/test/java/hudson/plugins/git/GitSCMTest.java http://jenkins-ci.org/commit/git-plugin/80a396f1f9110e3129e6411fc812dfb421d8c4b5 Log: Pass marked revision to decorateRevisionToBuild() [FIXED JENKINS-25191]

          Code changed in jenkins
          User: Wannes Sels
          Path:
          src/main/java/hudson/plugins/git/GitSCM.java
          src/main/java/hudson/plugins/git/extensions/GitSCMExtension.java
          src/main/java/hudson/plugins/git/extensions/impl/PreBuildMerge.java
          src/test/java/hudson/plugins/git/GitSCMTest.java
          http://jenkins-ci.org/commit/git-plugin/a9f9d9b9ea0addf917b61bde829bf123a9633f0c
          Log:
          Pass marked revision to decorateRevisionToBuild()
          [FIXED JENKINS-25191]

          cherry-picked 80a396f

          SCM/JIRA link daemon added a comment - Code changed in jenkins User: Wannes Sels Path: src/main/java/hudson/plugins/git/GitSCM.java src/main/java/hudson/plugins/git/extensions/GitSCMExtension.java src/main/java/hudson/plugins/git/extensions/impl/PreBuildMerge.java src/test/java/hudson/plugins/git/GitSCMTest.java http://jenkins-ci.org/commit/git-plugin/a9f9d9b9ea0addf917b61bde829bf123a9633f0c Log: Pass marked revision to decorateRevisionToBuild() [FIXED JENKINS-25191] cherry-picked 80a396f

          Mark Waite added a comment -

          Change planned to be available in git-plugin 2.2.8 and in git-plugin 2.3-beta-4

          Mark Waite added a comment - Change planned to be available in git-plugin 2.2.8 and in git-plugin 2.3-beta-4

          Mark Waite added a comment -

          Fix released in git plugin 2.3 10 Nov 2014

          Mark Waite added a comment - Fix released in git plugin 2.3 10 Nov 2014

          Mark Waite added a comment -

          Fix also included in git plugin 2.2.8 released 12 Nov 2014

          Mark Waite added a comment - Fix also included in git plugin 2.2.8 released 12 Nov 2014

            wannessels Wannes Sels
            wannessels Wannes Sels
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

              Created:
              Updated:
              Resolved: