From 32fc471adb587ff7ee252ebd1b1e6664119185ea Mon Sep 17 00:00:00 2001 From: Anil Belur Date: Wed, 16 Oct 2019 22:30:53 +0530 Subject: [PATCH] Fix rtd merge job to handle new tag uploaded Issue: RELENG-2445 Change-Id: I83bbb8b5b44ae6aee8e9cafd1711e8ac19b48811 Signed-off-by: Anil Belur --- .../notes/fix-rtd-trigger-handle-ref-updated-c78eadbe4e72d38c.yaml | 7 +++++++ shell/rtd-trigger-build.sh | 3 +++ 2 files changed, 10 insertions(+) create mode 100644 releasenotes/notes/fix-rtd-trigger-handle-ref-updated-c78eadbe4e72d38c.yaml 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 index 00000000..f666ded7 --- /dev/null +++ b/releasenotes/notes/fix-rtd-trigger-handle-ref-updated-c78eadbe4e72d38c.yaml @@ -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. diff --git a/shell/rtd-trigger-build.sh b/shell/rtd-trigger-build.sh index 6af08d7d..30a04ca6 100644 --- a/shell/rtd-trigger-build.sh +++ b/shell/rtd-trigger-build.sh @@ -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) -- 2.16.6