From: Aric Gardner Date: Thu, 18 Jun 2020 19:17:03 +0000 (-0400) Subject: Fix logic for discovering new branches X-Git-Tag: v0.55.1~2 X-Git-Url: https://gerrit.linuxfoundation.org/infra/gitweb?a=commitdiff_plain;h=dcf5761d0c38f01d4397784870c9031d4d499441;p=releng%2Fglobal-jjb.git Fix logic for discovering new branches When a new branch exists on gerrit, but has never been seen by RTD we need to trigger a job so that the branch is discovered we can then mark it active in the following step. API changed under out feet, where a 404 was returned before we now get a 200 with the string null. Change code to explicitly match the returned string of "null" Issue-Id: RELENG-3027 Signed-off-by: Aric Gardner Change-Id: I769b66384f5b53d87527faeb0f467350a847b65c --- diff --git a/releasenotes/notes/rtd-activate-version-652c0d9730b936b1.yaml b/releasenotes/notes/rtd-activate-version-652c0d9730b936b1.yaml new file mode 100644 index 00000000..5db62251 --- /dev/null +++ b/releasenotes/notes/rtd-activate-version-652c0d9730b936b1.yaml @@ -0,0 +1,11 @@ +--- +fixes: + - | + Fixed logic for discovering new branches + When a new branch exists on gerrit, but has never been seen by RTD + we need to trigger a job so that the branch is discovered + we can then mark it active in the following step. + API changed under out feet, where a 404 was returned before + we now get a 200 with the string null. + Change code to explicitly match the returned string of + "null" diff --git a/shell/rtdv3.sh b/shell/rtdv3.sh index 7b4fef8b..f5be6e6b 100644 --- a/shell/rtdv3.sh +++ b/shell/rtdv3.sh @@ -130,8 +130,8 @@ echo "INFO: Performing merge action" branch=$(echo "$GERRIT_BRANCH" | tr '[:upper:]' '[:lower:]') echo "INFO: Checking if read the docs has seen branch $branch" - #if this is 404. then run discover branch - if ! lftools rtd project-version-details "$rtdproject" "$branch" | jq '.active'; then + #if this is 200 "null" Then run discover branch + if [[ $(lftools rtd project-version-details "$rtdproject" "$branch" | jq '.active') == "null" ]]; then echo "INFO: read the docs has not seen branch $branch for project $rtdproject" echo "INFO: triggering $rtdproject latest to instantiate new branch discovery" watchbuild latest