Fix rtd merge job to handle new tag uploaded
[releng/global-jjb.git] / shell / rtd-trigger-build.sh
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)