From 94b4dd04f7aa7c0593c5f7d0641043fc5d97ee7f Mon Sep 17 00:00:00 2001 From: Balaji Ganesan Date: Fri, 18 Sep 2026 14:07:31 -0700 Subject: [PATCH] fix(ci): push each image of a multi-image subtree to its own dev repository image-push mapped every target named `image` to the service repository. NVCA has four such targets, cmd/nvca, cmd/nvca-operator, cmd/cluster-validator and cmd/tools, so a deploy-to-stg build pushed all four to /nvca: and the last one won. When a subtree has more than one plain `image` target, the package leaf now names the repository, with the leaf equal to the service keeping the service name. Subtrees with a single `image` target keep mapping to the service wherever that target lives. Co-Authored-By: Balaji Ganesan --- .github/workflows/image-push-manual.yml | 20 +++++++++++++++++++- 1 file changed, 19 insertions(+), 1 deletion(-) diff --git a/.github/workflows/image-push-manual.yml b/.github/workflows/image-push-manual.yml index dda5a035ae..2fd8351498 100644 --- a/.github/workflows/image-push-manual.yml +++ b/.github/workflows/image-push-manual.yml @@ -328,6 +328,18 @@ jobs: exit 1 fi echo "discovered: ${indexes[*]}" + # A subtree with several targets all named `image` (nvca: cmd/nvca, + # cmd/nvca-operator, cmd/cluster-validator, cmd/tools) would map every + # one of them to the service repo and the last push would win. When + # that is the case, the package leaf names the repo instead, with the + # leaf that equals the service keeping the plain service name. A + # subtree with a single `image` target keeps mapping to the service + # wherever that target lives (cmd/, crates/server/, ...). + plain_image_count=0 + for tgt in "${indexes[@]}"; do + n="${tgt##*:}"; n="${n%_index}" + [ "$n" = "image" ] && plain_image_count=$((plain_image_count + 1)) + done for tgt in "${indexes[@]}"; do name="${tgt##*:}"; name="${name%_index}" # Two naming conventions exist in the tree and they mean different @@ -342,7 +354,13 @@ jobs: # Previously the hyphenated form fell through to the default and # produced names like byoo-otel-collector-byoo-otel-collector-image. case "$name" in - image) repo="${svc}" ;; + image) + if [ "$plain_image_count" -gt 1 ]; then + pkg="${tgt%%:*}"; leaf="${pkg##*/}" + if [ "$leaf" = "$svc" ]; then repo="${svc}"; else repo="${leaf}"; fi + else + repo="${svc}" + fi ;; *_image) sub="$(printf '%s' "${name%_image}" | tr '_' '-')"; repo="${svc}-${sub}" ;; *-image) repo="${name%-image}" ;; *) sub="$(printf '%s' "$name" | tr '_' '-')"; repo="${svc}-${sub}" ;;