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

Git plugin does not correctly record built revision on failed merge

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Closed (View Workflow)
    • Priority: Minor
    • Resolution: Fixed
    • Component/s: git-plugin
    • Labels:
      None
    • Environment:
      git plugin 2.2.6
    • Similar Issues:

      Description

      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.

        Attachments

          Issue Links

            Activity

            Hide
            markewaite 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
            Show
            markewaite 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
            Hide
            wannessels 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.

            Show
            wannessels 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.
            Hide
            scm_issue_link 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]

            Show
            scm_issue_link 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]
            Hide
            scm_issue_link 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

            Show
            scm_issue_link 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
            Hide
            markewaite Mark Waite added a comment -

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

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

            Fix released in git plugin 2.3 10 Nov 2014

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

            Fix also included in git plugin 2.2.8 released 12 Nov 2014

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

              People

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

                Dates

                • Created:
                  Updated:
                  Resolved: