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

incremental build error when use gerrit-trigger choosing strategy

    XMLWordPrintable

Details

    Description

      We have problem by incremental build jenkins 1.506 and gerrit-trigger 2.8.0. if we push for example 3 commit at once, only the last commit will be built.

      The problem ist in com.sonyericsson.hudson.plugins.gerrit.trigger.hudsontrigger.GerritTriggerBuildChooser.prevBuildForChangelog(). This methods return parent commit as last commit, which let git-plugin build a wrong changelog.xml. and jenkins use this changelog.xml for incremental build.

      Patch for this problem:

      GerritTriggerBuildChooser.java
      --- a/gerrithudsontrigger/src/main/java/com/sonyericsson/hudson/plugins/gerrit/trigger/hudsontrigger/GerritTriggerBuildChooser.java
      +++ b/gerrithudsontrigger/src/main/java/com/sonyericsson/hudson/plugins/gerrit/trigger/hudsontrigger/GerritTriggerBuildChooser.java
      @@ -112,6 +112,14 @@
               // Now we cheat and add the parent as the last build on the branch, so we can
               // get the changelog working properly-ish.
               ObjectId parentSha1 = getFirstParent(sha1, git);
      +        
      +        if(data != null) {
      +          Build b = data.getLastBuildOfBranch(singleBranch);
      +          if(b != null) {
      +            parentSha1 = b.getSHA1();
      +          }
      +        }
      +        
               Revision parentRev = new Revision(parentSha1);
               parentRev.getBranches().add(new Branch(singleBranch, parentSha1));
        
      

      Attachments

        Issue Links

          Activity

            There are no comments yet on this issue.

            People

              rsandell rsandell
              hw Haijing Wei
              Votes:
              1 Vote for this issue
              Watchers:
              2 Start watching this issue

              Dates

                Created:
                Updated: