Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 5 additions & 1 deletion ci.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down
13 changes: 10 additions & 3 deletions ci3/bootstrap_ec2
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
Loading