osmith has uploaded this change for review.
jenkins-gerrit: send comment to full identifier
Fix an error when the same Change-Id is used on multiple branches. This
is actually allowed by gerrit, and we use this e.g. when backporting
patches from master. Instead of referring to the patch by the Change-Id,
use the full "<project>~<branch>~<Change-Id>" identifier.
Fix for:
+ ssh -p 29418 -l jenkins gerrit.osmocom.org gerrit review 4835a62cd88f0d69db76fb3bfd2df02176a91a6d --json
fatal: "4835a62cd88f0d69db76fb3bfd2df02176a91a6d" matches multiple patch sets
Related: https://gerrit-review.googlesource.com/Documentation/rest-api-changes.html#change-id
Change-Id: I2d627f8f3b400fa57a50a228d47df2194f60fd08
---
M jobs/gerrit-lint.yml
M jobs/gerrit-pipeline-result.yml
M jobs/gerrit-verifications.yml
M lint/lint_diff.sh
M scripts/jenkins-gerrit/pipeline_summary_send.sh
5 files changed, 10 insertions(+), 2 deletions(-)
git pull ssh://gerrit.osmocom.org:29418/osmo-ci refs/changes/47/30147/1
diff --git a/jobs/gerrit-lint.yml b/jobs/gerrit-lint.yml
index 847096b..4abdc71 100644
--- a/jobs/gerrit-lint.yml
+++ b/jobs/gerrit-lint.yml
@@ -31,6 +31,9 @@
osmo-ci.git branch
default: 'master'
- string:
+ name: GERRIT_PROJECT
+ description: set by gerrit verification pipeline job
+ - string:
name: GERRIT_BRANCH
description: set by gerrit verification pipeline job
- string:
diff --git a/jobs/gerrit-pipeline-result.yml b/jobs/gerrit-pipeline-result.yml
index c3c03b6..31b77ae 100644
--- a/jobs/gerrit-pipeline-result.yml
+++ b/jobs/gerrit-pipeline-result.yml
@@ -29,6 +29,9 @@
osmo-ci.git branch
default: 'master'
- string:
+ name: GERRIT_PROJECT
+ description: set by gerrit verification pipeline job
+ - string:
name: GERRIT_BRANCH
description: set by gerrit verification pipeline job
- string:
diff --git a/jobs/gerrit-verifications.yml b/jobs/gerrit-verifications.yml
index 8649635..a94fa65 100644
--- a/jobs/gerrit-verifications.yml
+++ b/jobs/gerrit-verifications.yml
@@ -445,6 +445,7 @@
catchError(buildResult: 'SUCCESS', stageResult: 'FAILURE') {{
env.PIPELINE_LINT_PASSED = "0"
build job: 'gerrit-lint', parameters: [
+ string(name: "GERRIT_PROJECT", value: "${{env.GERRIT_PROJECT}}"),
string(name: "GERRIT_BRANCH", value: "${{env.GERRIT_BRANCH}}"),
string(name: "GERRIT_HOST", value: "${{env.GERRIT_HOST}}"),
string(name: "GERRIT_PATCHSET_REVISION", value: "${{env.GERRIT_PATCHSET_REVISION}}"),
@@ -510,6 +511,7 @@
// comment + vote to gerrit
script {{
build job: 'gerrit-pipeline-result', parameters: [
+ string(name: "GERRIT_PROJECT", value: "${{env.GERRIT_PROJECT}}"),
string(name: "GERRIT_BRANCH", value: "${{env.GERRIT_BRANCH}}"),
string(name: "GERRIT_HOST", value: "${{env.GERRIT_HOST}}"),
string(name: "GERRIT_PATCHSET_REVISION", value: "${{env.GERRIT_PATCHSET_REVISION}}"),
diff --git a/lint/lint_diff.sh b/lint/lint_diff.sh
index 7ae186f..ca3c03d 100755
--- a/lint/lint_diff.sh
+++ b/lint/lint_diff.sh
@@ -68,7 +68,7 @@
"$GERRIT_HOST" \
gerrit \
review \
- "$GERRIT_PATCHSET_REVISION" \
+ "$GERRIT_PROJECT~$GERRIT_BRANCH~$GERRIT_PATCHSET_REVISION" \
--json \
< gerrit_report.json
fi
diff --git a/scripts/jenkins-gerrit/pipeline_summary_send.sh b/scripts/jenkins-gerrit/pipeline_summary_send.sh
index c49f428..ea3176a 100755
--- a/scripts/jenkins-gerrit/pipeline_summary_send.sh
+++ b/scripts/jenkins-gerrit/pipeline_summary_send.sh
@@ -26,6 +26,6 @@
"$GERRIT_HOST" \
gerrit \
review \
- "$GERRIT_PATCHSET_REVISION" \
+ "$GERRIT_PROJECT~$GERRIT_BRANCH~$GERRIT_PATCHSET_REVISION" \
--json \
< gerrit_report.json
To view, visit change 30147. To unsubscribe, or for help writing mail filters, visit settings.