From 7d3b771310ac8ee57c29469939e84ebc7f306aa4 Mon Sep 17 00:00:00 2001 From: Aditya Sheth Date: Thu, 22 Oct 2026 15:08:08 +0530 Subject: [PATCH 1/2] Start/stop the CI k8s sandbox for regional sandbox labels too, per listed region (ENG-221179) needs_sandbox: and stop_sandbox now also dispatch sandbox.yml for the regional labels (sandbox :eu:, :maple_leaf:, :classical_building:, :united_arab_emirates:, :us:, :australia:), passing the region as the needs_sandbox suffix (eu, ca, gov, uae, wu, ap). A region is dispatched only when it is listed in SANDBOX_K8S_REGIONS, set by the calling workflow, so a region joins CI k8s by being listed there. The plain `sandbox` dispatch is unchanged. Co-Authored-By: Claude Opus 5.5 --- entrypoint.sh | 36 +++++++++++++++++++++++++++++------- 1 file changed, 29 insertions(+), 7 deletions(-) diff --git a/entrypoint.sh b/entrypoint.sh index cbefbcf..eb4bfab 100755 --- a/entrypoint.sh +++ b/entrypoint.sh @@ -60,16 +60,26 @@ ci_k8s_request() { # ci_k8s_request : start a CI k8s run of this "${URI}/repos/${GITHUB_REPOSITORY}/actions/workflows/${1}/dispatches" || true } -# Likewise for the plain `sandbox` label: when SANDBOX_K8S_TRIGGER is "true", adding or -# removing it here also starts or stops the CI k8s sandbox (sandbox.yml). Never fails the -# action. -sandbox_k8s_request() { # sandbox_k8s_request : start or stop this PR's CI k8s sandbox +# Likewise for the sandbox labels: when SANDBOX_K8S_TRIGGER is "true", adding or removing +# one here also starts or stops the CI k8s sandbox (sandbox.yml). Never fails the action. +# +# A regional label (`sandbox :australia:` from needs_sandbox:ap) passes its region, the +# needs_sandbox suffix (eu, ca, gov, uae, wu, ap), only when that region is listed in +# SANDBOX_K8S_REGIONS (the calling workflow's, space- or comma-separated): a region joins +# CI k8s by being listed there, with no change here. sandbox.yml rejects a region it does +# not know (HTTP 422), which leaves the fleet's sandbox alone. +sandbox_k8s_request() { # sandbox_k8s_request [region]: start or stop this PR's CI k8s sandbox [[ "${SANDBOX_K8S_TRIGGER:-false}" == "true" ]] || return 0 - local ref + local region="${2:-}" inputs ref + inputs="\"pr\":\"${number}\",\"action\":\"${1}\"" + if [[ -n "$region" ]]; then + [[ " ${SANDBOX_K8S_REGIONS//,/ } " == *" ${region} "* ]] || return 0 + inputs="${inputs},\"region\":\"${region}\"" + fi ref=$(jq -r '.repository.default_branch // "master"' "$GITHUB_EVENT_PATH") - curl -sSL -o /dev/null -w "dispatch sandbox.yml $1: HTTP %{http_code}\n" \ + curl -sSL -o /dev/null -w "dispatch sandbox.yml $1 ${region:-us}: HTTP %{http_code}\n" \ -H "${AUTH_HEADER}" -H "${API_HEADER}" -X POST -H "Content-Type: application/json" \ - -d "{\"ref\":\"${ref}\",\"inputs\":{\"pr\":\"${number}\",\"action\":\"${1}\"}}" \ + -d "{\"ref\":\"${ref}\",\"inputs\":{${inputs}}}" \ "${URI}/repos/${GITHUB_REPOSITORY}/actions/workflows/sandbox.yml/dispatches" || true } # -------------------------------------------------------------------------------------- @@ -316,16 +326,22 @@ elif [[ $comment_body =~ ^(e2e_)?needs_sandbox(:(eu|gov|ca|uae|wu|ap))?(:(dev|([ if [[ "$already_needs_sandbox" == false ]]; then if [[ $comment_body =~ (e2e_)?needs_sandbox:eu ]]; then add_label "sandbox :eu:" + sandbox_k8s_request start eu elif [[ $comment_body =~ (e2e_)?needs_sandbox:ca ]]; then add_label "sandbox :maple_leaf:" + sandbox_k8s_request start ca elif [[ $comment_body =~ (e2e_)?needs_sandbox:gov ]]; then add_label "sandbox :classical_building:" + sandbox_k8s_request start gov elif [[ $comment_body =~ (e2e_)?needs_sandbox:uae ]]; then add_label "sandbox :united_arab_emirates:" + sandbox_k8s_request start uae elif [[ $comment_body =~ (e2e_)?needs_sandbox:wu ]]; then add_label "sandbox :us:" + sandbox_k8s_request start wu elif [[ $comment_body =~ (e2e_)?needs_sandbox:ap ]]; then add_label "sandbox :australia:" + sandbox_k8s_request start ap else add_label "sandbox" sandbox_k8s_request start @@ -342,21 +358,27 @@ if [[ $comment_body == "stop_sandbox" ]]; then ;; "sandbox :eu:") remove_label "sandbox%20:eu:" + sandbox_k8s_request stop eu ;; "sandbox :maple_leaf:") remove_label "sandbox%20:maple_leaf:" + sandbox_k8s_request stop ca ;; "sandbox :classical_building:") remove_label "sandbox%20:classical_building:" + sandbox_k8s_request stop gov ;; "sandbox :united_arab_emirates:") remove_label "sandbox%20:united_arab_emirates:" + sandbox_k8s_request stop uae ;; "sandbox :us:") remove_label "sandbox%20:us:" + sandbox_k8s_request stop wu ;; "sandbox :australia:") remove_label "sandbox%20:australia:" + sandbox_k8s_request stop ap ;; sandbox:${alternate_python_version}) remove_label "sandbox:${alternate_python_version}" From 44689ac26e31887022c2ccf15a85070ef2d96949 Mon Sep 17 00:00:00 2001 From: Aditya Sheth Date: Mon, 16 Nov 2026 11:44:49 +0530 Subject: [PATCH 2/2] Dispatch every regional sandbox label; sandbox.yml's region list decides, no SANDBOX_K8S_REGIONS (ENG-221179) Co-Authored-By: Claude Opus 5.5 --- entrypoint.sh | 12 ++++-------- 1 file changed, 4 insertions(+), 8 deletions(-) diff --git a/entrypoint.sh b/entrypoint.sh index eb4bfab..30c2ef0 100755 --- a/entrypoint.sh +++ b/entrypoint.sh @@ -64,18 +64,14 @@ ci_k8s_request() { # ci_k8s_request : start a CI k8s run of this # one here also starts or stops the CI k8s sandbox (sandbox.yml). Never fails the action. # # A regional label (`sandbox :australia:` from needs_sandbox:ap) passes its region, the -# needs_sandbox suffix (eu, ca, gov, uae, wu, ap), only when that region is listed in -# SANDBOX_K8S_REGIONS (the calling workflow's, space- or comma-separated): a region joins -# CI k8s by being listed there, with no change here. sandbox.yml rejects a region it does -# not know (HTTP 422), which leaves the fleet's sandbox alone. +# needs_sandbox suffix (eu, ca, gov, uae, wu, ap). Which regions have a CI k8s sandbox is +# sandbox.yml's own list (its region input's options): it rejects any other (HTTP 422), +# which leaves the fleet's sandbox alone. sandbox_k8s_request() { # sandbox_k8s_request [region]: start or stop this PR's CI k8s sandbox [[ "${SANDBOX_K8S_TRIGGER:-false}" == "true" ]] || return 0 local region="${2:-}" inputs ref inputs="\"pr\":\"${number}\",\"action\":\"${1}\"" - if [[ -n "$region" ]]; then - [[ " ${SANDBOX_K8S_REGIONS//,/ } " == *" ${region} "* ]] || return 0 - inputs="${inputs},\"region\":\"${region}\"" - fi + [[ -z "$region" ]] || inputs="${inputs},\"region\":\"${region}\"" ref=$(jq -r '.repository.default_branch // "master"' "$GITHUB_EVENT_PATH") curl -sSL -o /dev/null -w "dispatch sandbox.yml $1 ${region:-us}: HTTP %{http_code}\n" \ -H "${AUTH_HEADER}" -H "${API_HEADER}" -X POST -H "Content-Type: application/json" \