From 433ed7f919bda559a367a828df0fcfb1656d265e Mon Sep 17 00:00:00 2001 From: Anil Belur Date: Mon, 20 Apr 2020 13:46:06 +1000 Subject: [PATCH] Fix update cloud image list job to handle newlines Fix update cloud image list job to handle newlines correctly and update an existing gerrit change request. A gerrit change submitted through git-review checks for an existing change-id on Gerrit and either updates the patchset or creates a new one. For this to work correctly the change-id should go into the commit footer and not in the GERRIT_COMMIT_MESSAGE. The embedded newlines are not processed correctly in the script and fails to separate the footer and the GERRIT_COMMIT_MESSAGE, instead it creates a new patches everytime rather than updating an existing one. The change is tested and now existing CR's are updated rather than pushing a new CR everytime. https://git.opendaylight.org/gerrit/c/releng/builder/+/89136 Issue: RELENG-2687 Change-Id: I8397d2d8a9402db07c99173c9f999152bc3c61ee Signed-off-by: Anil Belur --- .../notes/fix-update-cloud-image-34c35922e841dae6.yaml | 18 ++++++++++++++++++ shell/gerrit-push-patch.sh | 2 +- 2 files changed, 19 insertions(+), 1 deletion(-) create mode 100644 releasenotes/notes/fix-update-cloud-image-34c35922e841dae6.yaml diff --git a/releasenotes/notes/fix-update-cloud-image-34c35922e841dae6.yaml b/releasenotes/notes/fix-update-cloud-image-34c35922e841dae6.yaml new file mode 100644 index 00000000..6257ff90 --- /dev/null +++ b/releasenotes/notes/fix-update-cloud-image-34c35922e841dae6.yaml @@ -0,0 +1,18 @@ +--- +fixes: + - | + Fix update cloud image list job to handle newlines correctly and update + an existing gerrit change request. + + A gerrit change submitted through git-review checks for an existing + change-id on Gerrit and either updates the patchset or creates a new one. + For this to work correctly the change-id should go into the commit footer + and not in the GERRIT_COMMIT_MESSAGE. The embedded newlines are not + processed correctly in the script and fails to separate the footer and the + GERRIT_COMMIT_MESSAGE, instead it creates a new patches everytime rather + than updating an existing one. + + The change is tested now existing CR's are updated rather than pushing a + new CR everytime. + + https://git.opendaylight.org/gerrit/c/releng/builder/+/89136 diff --git a/shell/gerrit-push-patch.sh b/shell/gerrit-push-patch.sh index b33f0f52..d075cdda 100644 --- a/shell/gerrit-push-patch.sh +++ b/shell/gerrit-push-patch.sh @@ -60,7 +60,7 @@ job=$JOB_NAME/$BUILD_NUMBER # If available, add change_id to commit message if change_id=$(echo "$query_result" | grep 'Change-Id:' | awk '{print $2}'); then echo "NOTE: Found gerrit review: $change_id" - message="Job: $job\nChange-Id: $change_id" + message="Job: $job"$'\n\n'"Change-Id: $change_id" else echo "NOTE: No gerrit review found" message="Job: $job" -- 2.16.6