From: Anil Belur Date: Wed, 16 Oct 2019 17:00:53 +0000 (+0530) Subject: Fix rtd merge job to handle new tag uploaded X-Git-Url: https://gerrit.linuxfoundation.org/infra/gitweb?a=commitdiff_plain;h=refs%2Fchanges%2F09%2F62009%2F1;p=releng%2Fglobal-jjb.git Fix rtd merge job to handle new tag uploaded Issue: RELENG-2445 Change-Id: I83bbb8b5b44ae6aee8e9cafd1711e8ac19b48811 Signed-off-by: Anil Belur --- 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)