mirror of https://gerrit.osmocom.org/osmo-ci
jenkins-gerrit: fix ambiguous use of review api
Fix an error when the same Change-Id is used on multiple branches or in theory projects. This is actually allowed by gerrit, and we use this e.g. when backporting patches from master. Use the project, change number (e.g. 30147) and patchset number (e.g. 2) instead of the Change-Id. 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/cmd-review.html Change-Id: I2d627f8f3b400fa57a50a228d47df2194f60fd08changes/47/30147/3
parent
6b7741400d
commit
f560ce08ab
|
@ -30,6 +30,15 @@
|
|||
description: |
|
||||
osmo-ci.git branch
|
||||
default: 'master'
|
||||
- string:
|
||||
name: GERRIT_PROJECT
|
||||
description: set by gerrit verification pipeline job
|
||||
- string:
|
||||
name: GERRIT_CHANGE_NUMBER
|
||||
description: set by gerrit verification pipeline job
|
||||
- string:
|
||||
name: GERRIT_PATCHSET_NUMBER
|
||||
description: set by gerrit verification pipeline job
|
||||
- string:
|
||||
name: GERRIT_BRANCH
|
||||
description: set by gerrit verification pipeline job
|
||||
|
|
|
@ -28,6 +28,15 @@
|
|||
description: |
|
||||
osmo-ci.git branch
|
||||
default: 'master'
|
||||
- string:
|
||||
name: GERRIT_PROJECT
|
||||
description: set by gerrit verification pipeline job
|
||||
- string:
|
||||
name: GERRIT_CHANGE_NUMBER
|
||||
description: set by gerrit verification pipeline job
|
||||
- string:
|
||||
name: GERRIT_PATCHSET_NUMBER
|
||||
description: set by gerrit verification pipeline job
|
||||
- string:
|
||||
name: GERRIT_BRANCH
|
||||
description: set by gerrit verification pipeline job
|
||||
|
|
|
@ -445,6 +445,9 @@
|
|||
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_CHANGE_NUMBER", value: "${{env.GERRIT_CHANGE_NUMBER}}"),
|
||||
string(name: "GERRIT_PATCHSET_NUMBER", value: "${{env.GERRIT_PATCHSET_NUMBER}}"),
|
||||
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 +513,9 @@
|
|||
// comment + vote to gerrit
|
||||
script {{
|
||||
build job: 'gerrit-pipeline-result', parameters: [
|
||||
string(name: "GERRIT_PROJECT", value: "${{env.GERRIT_PROJECT}}"),
|
||||
string(name: "GERRIT_CHANGE_NUMBER", value: "${{env.GERRIT_CHANGE_NUMBER}}"),
|
||||
string(name: "GERRIT_PATCHSET_NUMBER", value: "${{env.GERRIT_PATCHSET_NUMBER}}"),
|
||||
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}}"),
|
||||
|
|
|
@ -68,7 +68,8 @@ if [ "$ERROR" = 1 ]; then
|
|||
"$GERRIT_HOST" \
|
||||
gerrit \
|
||||
review \
|
||||
"$GERRIT_PATCHSET_REVISION" \
|
||||
--project "$GERRIT_PROJECT" \
|
||||
"$GERRIT_CHANGE_NUMBER,$GERRIT_PATCHSET_NUMBER" \
|
||||
--json \
|
||||
< gerrit_report.json
|
||||
fi
|
||||
|
|
|
@ -26,6 +26,7 @@ ssh \
|
|||
"$GERRIT_HOST" \
|
||||
gerrit \
|
||||
review \
|
||||
"$GERRIT_PATCHSET_REVISION" \
|
||||
--project "$GERRIT_PROJECT" \
|
||||
"$GERRIT_CHANGE_NUMBER,$GERRIT_PATCHSET_NUMBER" \
|
||||
--json \
|
||||
< gerrit_report.json
|
||||
|
|
Loading…
Reference in New Issue