Fix rtd merge job to handle new tag uploaded 09/62009/1 v0.45.x
authorAnil Belur <abelur@linuxfoundation.org>
Wed, 16 Oct 2019 17:00:53 +0000 (22:30 +0530)
committerAnil Belur <abelur@linuxfoundation.org>
Wed, 16 Oct 2019 17:00:53 +0000 (22:30 +0530)
Issue: RELENG-2445
Change-Id: I83bbb8b5b44ae6aee8e9cafd1711e8ac19b48811
Signed-off-by: Anil Belur <abelur@linuxfoundation.org>
releasenotes/notes/fix-rtd-trigger-handle-ref-updated-c78eadbe4e72d38c.yaml [new file with mode: 0644]
shell/rtd-trigger-build.sh

diff --git a/releasenotes/notes/fix-rtd-trigger-handle-ref-updated-c78eadbe4e72d38c.yaml b/releasenotes/notes/fix-rtd-trigger-handle-ref-updated-c78eadbe4e72d38c.yaml
new file mode 100644 (file)
index 0000000..f666ded
--- /dev/null
@@ -0,0 +1,7 @@
+---
+fixes:
+  - |
+    Fix rtd merge job to handle case of a new tag upload. When a new tag is
+    pushed this sets the gerrit event type to "ref-updated", and sets the
+    `branch=*` which is invalid. The change handles the case of tag update
+    and builds against the appropriate branch for that tag.
index 6af08d7..30a04ca 100644 (file)
@@ -27,6 +27,9 @@ set -e -o pipefail
 last_char=${RTD_BUILD_URL:length-1:1}
 [[ $last_char != "/" ]] && RTD_BUILD_URL="$RTD_BUILD_URL/"; :
 
+# Handle case for gerrit event type is ref-updated when new tag are pushed
+[[ $GERRIT_EVENT_TYPE =~ "ref-updated" ]] && GERRIT_BRANCH=${GERRIT_REFNAME##*/}
+
 json=$(curl -X POST -d "branches=${GERRIT_BRANCH}" -d "token=$RTD_TOKEN" "$RTD_BUILD_URL")
 build_triggered=$(echo "$json" | jq -r .build_triggered)