CI: allow triggering these jobs from other projects

The end goal is running jobs in the "leaf" repositories (like this one)
automatically when a change to CzechLight/dependencies is enquequed.

Change-Id: Id389a3975e9d818939477adf15a6677c299dcdc4
diff --git a/.zuul.yaml b/.zuul.yaml
index bed644a..23c7ebb 100644
--- a/.zuul.yaml
+++ b/.zuul.yaml
@@ -4,6 +4,14 @@
       Build a minimal version without sysrepo or the test suite
     parent: f34-gcc
 
+- job:
+    name: netconf-cli-f34-clang-asan-ubsan
+    parent: f34-clang-asan-ubsan
+    pre-run: ci/pre.yaml
+    requires: CzechLight-deps-f34-clang-asan-ubsan
+    vars:
+      zuul_work_dir: "{{ zuul.projects[zuul.project.canonical_hostname + '/CzechLight/netconf-cli'].src_dir }}"
+
 - project:
     check:
       jobs:
@@ -12,9 +20,7 @@
             requires: CzechLight-deps-f34-gcc
             required-projects: &projects
               - CzechLight/dependencies
-        - f34-clang-asan-ubsan:
-            pre-run: ci/pre.yaml
-            requires: CzechLight-deps-f34-clang-asan-ubsan
+        - netconf-cli-f34-clang-asan-ubsan:
             required-projects: *projects
         - f34-clang-tsan:
             pre-run: ci/pre.yaml
diff --git a/ci/build.sh b/ci/build.sh
index 8fc78ea..c42dbc9 100755
--- a/ci/build.sh
+++ b/ci/build.sh
@@ -5,9 +5,11 @@
 
 ZUUL_JOB_NAME=$(jq < ~/zuul-env.json -r '.job')
 ZUUL_TENANT=$(jq < ~/zuul-env.json -r '.tenant')
-ZUUL_PROJECT_SRC_DIR=$HOME/$(jq < ~/zuul-env.json -r '.project.src_dir')
-ZUUL_PROJECT_SHORT_NAME=$(jq < ~/zuul-env.json -r '.project.short_name')
+LEAF_PROJECT_NAME=CzechLight/netconf-cli
+ZUUL_PROJECT_SRC_DIR=$HOME/$(jq < ~/zuul-env.json -r ".projects[] | select(.name == \"${LEAF_PROJECT_NAME}\").src_dir")
+ZUUL_PROJECT_SHORT_NAME=$(jq < ~/zuul-env.json -r ".projects[] | select(.name == \"${LEAF_PROJECT_NAME}\").short_name")
 ZUUL_GERRIT_HOSTNAME=$(jq < ~/zuul-env.json -r '.project.canonical_hostname')
+ZUUL_JOB_NAME_NO_PROJECT=${ZUUL_JOB_NAME##${ZUUL_PROJECT_SHORT_NAME}-}
 
 CI_PARALLEL_JOBS=$(awk -vcpu=$(getconf _NPROCESSORS_ONLN) 'BEGIN{printf "%.0f", cpu*1.3+1}')
 CMAKE_OPTIONS=""
@@ -71,7 +73,7 @@
     # nothing ahead in the pipeline -> fallback to the latest promoted artifact
     DEPSRCDIR=$(jq < ~/zuul-env.json -e -r ".projects[] | select(.name == \"CzechLight/dependencies\").src_dir")
     DEP_SUBMODULE_COMMIT=$(git --git-dir ${HOME}/${DEPSRCDIR}/.git rev-parse HEAD)
-    ARTIFACT_URL="https://object-store.cloud.muni.cz/swift/v1/ci-artifacts-${ZUUL_TENANT}/${ZUUL_GERRIT_HOSTNAME}/CzechLight/dependencies/${ZUUL_JOB_NAME%%+(-cover?(-previous)|-netconf-cli-no-sysrepo)}/${DEP_SUBMODULE_COMMIT}.tar.zst"
+    ARTIFACT_URL="https://object-store.cloud.muni.cz/swift/v1/ci-artifacts-${ZUUL_TENANT}/${ZUUL_GERRIT_HOSTNAME}/CzechLight/dependencies/${ZUUL_JOB_NAME_NO_PROJECT%%+(-cover?(-previous)|-netconf-cli-no-sysrepo)}/${DEP_SUBMODULE_COMMIT}.tar.zst"
 fi
 
 curl ${ARTIFACT_URL} | unzstd --stdout | tar -C ${PREFIX} -xf -