From 664db0fde7091c53f90c145357773041bb2ae719 Mon Sep 17 00:00:00 2001 From: Charlie <5764343+charlielye@users.noreply.github.com> Date: Wed, 10 Jun 2026 12:41:33 +0000 Subject: [PATCH] fix(ci3): scope build-instance name by repo to stop cross-repo reaping MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit bootstrap_ec2 terminates any existing instance sharing the target Name tag, to reap orphans left by a cancelled GA run on the same ref. But the name was just _[_postfix], with no repo component — so aztec-packages and aztec-packages-private, which build the same tags/refs concurrently under the same OIDC role, computed identical names and reaped each other's live instances. Observed: nightly tag v5.0.0-nightly.20260610 built in both repos; the public run's pre-launch reap terminated the private run's in-progress arm64 release instance ~7 min in, failing that build. Prefix the instance name with the repo basename (GITHUB_REPOSITORY##*/, default aztec-packages). The key stays stable across re-runs within a repo, so the intended orphan cleanup still works; it only stops the two repos from colliding. ci.sh's helper instance_name (shell/kill/get-ip) is kept in sync. --- ci.sh | 6 +++++- ci3/bootstrap_ec2 | 13 ++++++++++--- 2 files changed, 15 insertions(+), 4 deletions(-) diff --git a/ci.sh b/ci.sh index 26b0dfecb105..101409c887ce 100755 --- a/ci.sh +++ b/ci.sh @@ -53,7 +53,11 @@ function print_usage { [ -n "$cmd" ] && shift -instance_name=${INSTANCE_NAME:-$(echo -n "$BRANCH" | tr -c 'a-zA-Z0-9-' '_')_${arch}} +# Keep this in sync with bootstrap_ec2's instance_name scheme (repo-scoped) so the +# shell/kill/get-ip helpers find instances launched by a CI run for this repo. +repo=${GITHUB_REPOSITORY##*/} +repo=${repo:-aztec-packages} +instance_name=${INSTANCE_NAME:-${repo}_$(echo -n "$BRANCH" | tr -c 'a-zA-Z0-9-' '_')_${arch}} [ -n "${INSTANCE_POSTFIX:-}" ] && instance_name+="_$INSTANCE_POSTFIX" function get_ip_for_instance { diff --git a/ci3/bootstrap_ec2 b/ci3/bootstrap_ec2 index a15113a4c126..f5ce6c62868b 100755 --- a/ci3/bootstrap_ec2 +++ b/ci3/bootstrap_ec2 @@ -65,11 +65,18 @@ if [[ "$(git fetch origin --negotiate-only --negotiation-tip="$current_commit")" fi # Our instance_name acts as a uniqueness key for the instance. -# Instances are terminated if they exist with the same name. +# Instances are terminated if they exist with the same name; this reaps orphans +# left when a GA run is cancelled (e.g. by a new push) on the same ref. +# Scope the key to the repo: aztec-packages and aztec-packages-private can build +# the same tag/ref concurrently under the same role, and must not reap each +# other's instances. The key stays stable across re-runs within a repo, so the +# orphan cleanup still works. +repo=${GITHUB_REPOSITORY##*/} +repo=${repo:-aztec-packages} if [[ "$REF_NAME" =~ ^gh-readonly-queue/.*(pr-[0-9]+) ]]; then - instance_name="${BASH_REMATCH[1]}_$arch" + instance_name="${repo}_${BASH_REMATCH[1]}_$arch" else - instance_name=$(echo -n "$REF_NAME" | head -c 50 | tr -c 'a-zA-Z0-9-' '_')_$arch + instance_name="${repo}_$(echo -n "$REF_NAME" | head -c 50 | tr -c 'a-zA-Z0-9-' '_')_$arch" fi state_dir=$(mktemp -d /tmp/aws_request_instance.XXXXXX)