incremental build error when use gerrit-trigger choosing strategy

This issue is archived. You can view it, but you can't modify it. Learn more

XMLWordPrintable

      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));
        
      

            Assignee:
            rsandell
            Reporter:
            Haijing Wei
            Archiver:
            Jenkins Service Account

              Created:
              Updated:
              Archived: