Skip to content

Commit 0193510

Browse files
authored
fix(ci3): GITHUB_REPOSITORY unbound when running ci.sh locally (#24059)
## Regression The cross-repo instance-name fix (#23987) added to `ci.sh` and `ci3/bootstrap_ec2`: ```sh repo=${GITHUB_REPOSITORY##*/} repo=${repo:-aztec-packages} ``` Under `set -u` (set by `ci3/source`), the `##*/` expansion on an **unset** `GITHUB_REPOSITORY` aborts *before* the `:-aztec-packages` default on the next line can apply. So any local invocation fails immediately: ``` $ ./ci.sh bench ./ci.sh: line 58: GITHUB_REPOSITORY: unbound variable ``` It only bit locally — CI always has `GITHUB_REPOSITORY` set, so it passed there. ## Fix Default first, then strip: ```sh repo=${GITHUB_REPOSITORY:-aztec-packages} repo=${repo##*/} ``` Applied in both `ci.sh` and `ci3/bootstrap_ec2`. Verified under `set -u` with the var unset: resolves to `aztec-packages` (and `AztecProtocol/aztec-packages` → `aztec-packages` when set), so the instance-name scheme is unchanged.
2 parents fa06339 + 2693cfa commit 0193510

2 files changed

Lines changed: 4 additions & 4 deletions

File tree

ci.sh

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -55,8 +55,8 @@ function print_usage {
5555

5656
# Keep this in sync with bootstrap_ec2's instance_name scheme (repo-scoped) so the
5757
# shell/kill/get-ip helpers find instances launched by a CI run for this repo.
58-
repo=${GITHUB_REPOSITORY##*/}
59-
repo=${repo:-aztec-packages}
58+
repo=${GITHUB_REPOSITORY:-aztec-packages}
59+
repo=${repo##*/}
6060
instance_name=${INSTANCE_NAME:-${repo}_$(echo -n "$BRANCH" | tr -c 'a-zA-Z0-9-' '_')_${arch}}
6161
[ -n "${INSTANCE_POSTFIX:-}" ] && instance_name+="_$INSTANCE_POSTFIX"
6262

ci3/bootstrap_ec2

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -71,8 +71,8 @@ fi
7171
# the same tag/ref concurrently under the same role, and must not reap each
7272
# other's instances. The key stays stable across re-runs within a repo, so the
7373
# orphan cleanup still works.
74-
repo=${GITHUB_REPOSITORY##*/}
75-
repo=${repo:-aztec-packages}
74+
repo=${GITHUB_REPOSITORY:-aztec-packages}
75+
repo=${repo##*/}
7676
if [[ "$REF_NAME" =~ ^gh-readonly-queue/.*(pr-[0-9]+) ]]; then
7777
instance_name="${repo}_${BASH_REMATCH[1]}_$arch"
7878
else

0 commit comments

Comments
 (0)