jenkinsci / jenkinsci/gerrit-trigger-plugin

[JENKINS-17361] incremental build error when use gerrit-trigger choosing strategy

Open
#623 1 comment 0 reactions 0 assignees View on GitHub
component:gerrit-trigger-plugin imported-jira-issue priority:major resolution:unresolved
Dominant language
Java
Stars
226
Forks
289
PR merge metrics
No merged PRs in 30d

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


---
Originally reported by hw, imported from: incremental build error when use gerrit-trigger choosing strategy


  • assignee: rsandell
  • status: Open
  • priority: Major
  • component(s): gerrit-trigger-plugin
  • resolution: Unresolved
  • votes: 1
  • watchers: 2
  • imported: 2025-12-06

Raw content of original issue

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


Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.