CI: Fix possible unbound variable access
Oopsie, this is what I got when not using Depends-on:
+ echo 'BR2_PRIMARY_SITE="https://object-store.cloud.muni.cz/swift/v1/ci-artifacts-public/mirror/buildroot"'
+ [[ 1 == 1 ]]
++ jq -r '[.artifacts[]? | select(.name == "br2-work-dir") | select(.project == "CzechLight/br2-external")][-1]?.url + ""'
+ ARTIFACT_URL=
+ [[ -z '' ]]
ci/build.sh: line 57: ZUUL_TENANT: unbound variable
And while I'm editing this, also don't hardcode the Gerrit server name.
Change-Id: I8ec8701b0881bb88db7e98bd60b9bba918d26a08
diff --git a/ci/build.sh b/ci/build.sh
index f51d271..624877f 100755
--- a/ci/build.sh
+++ b/ci/build.sh
@@ -4,8 +4,10 @@
shopt -s failglob
ZUUL_JOB_NAME=$(jq < ~/zuul-env.json -r '.job')
-ZUUL_PROJECT_SRC_DIR=$HOME/$(jq < ~/zuul-env.json -r '.projects["cesnet-gerrit-czechlight/CzechLight/br2-external"].src_dir')
-ZUUL_PROJECT_SHORT_NAME=$(jq < ~/zuul-env.json -r '.projects["cesnet-gerrit-czechlight/CzechLight/br2-external"].short_name')
+ZUUL_TENANT=$(jq < ~/zuul-env.json -r '.tenant')
+ZUUL_GERRIT_HOSTNAME=$(jq < ~/zuul-env.json -r '.project.canonical_hostname')
+ZUUL_PROJECT_SRC_DIR=$HOME/$(jq < ~/zuul-env.json -r ".projects[\"${ZUUL_GERRIT_HOSTNAME}/CzechLight/br2-external\"].src_dir")
+ZUUL_PROJECT_SHORT_NAME=$(jq < ~/zuul-env.json -r ".projects[\"${ZUUL_GERRIT_HOSTNAME}/CzechLight/br2-external\"].short_name")
CI_PARALLEL_JOBS=$(awk -vcpu=$(getconf _NPROCESSORS_ONLN) 'BEGIN{printf "%.0f", cpu*1.3+1}')
BUILD_DIR=~/build