From 74f2ec8c8a8f80cb28197474c22e286eecd22e50 Mon Sep 17 00:00:00 2001 From: Amin Sammara Date: Mon, 26 Oct 2026 15:38:52 +0700 Subject: [PATCH] fix: push the single-instance indexer image to a repository that exists The single-instance deploy pushed to atp-indexer--atp-indexer, the ECS fleet's ECR repository. The fleet's terraform owns that repository with force_delete, so it only exists while the fleet does: prod still has it, but testnet's went with the retired testnet fleet. The first testnet single-instance deploy built the image and then failed at the push: name unknown: The repository with name 'atp-indexer-testnet-atp-indexer' does not exist Resolve the repository at deploy time instead: use atp-indexer--atp-indexer or staking-dashboard--atp-indexer (the name the single-instance README deploys from), whichever exists, and create the fleet name only if neither does. The box's IAM role can pull from any repository in the account, so the box needs no change. Prod resolves to the repository it uses today. --- .github/workflows/deploy-indexer.yaml | 21 ++++++++++++++++++++- 1 file changed, 20 insertions(+), 1 deletion(-) diff --git a/.github/workflows/deploy-indexer.yaml b/.github/workflows/deploy-indexer.yaml index ef5d7f5c8..f2543aa9e 100644 --- a/.github/workflows/deploy-indexer.yaml +++ b/.github/workflows/deploy-indexer.yaml @@ -81,8 +81,27 @@ jobs: else yarn bootstrap fi + # Resolve the ECR repository. atp-indexer--atp-indexer is the ECS fleet's repo, which the + # fleet's terraform owns (force_delete): prod still has it, but testnet's went with the retired + # testnet fleet, so the push failed with "repository does not exist". The single-instance + # README names staking-dashboard--atp-indexer instead. Use whichever exists; failing + # that, create the fleet name. The box's role can pull from any repository in the account. + REPO="" + for candidate in "atp-indexer-$ENV-atp-indexer" "staking-dashboard-$ENV-atp-indexer"; do + if aws ecr describe-repositories --region "$AWS_REGION" --repository-names "$candidate" >/dev/null 2>&1; then + REPO="$candidate" + break + fi + done + if [ -z "$REPO" ]; then + REPO="atp-indexer-$ENV-atp-indexer" + echo "No indexer ECR repository for $ENV; creating $REPO" + aws ecr create-repository --region "$AWS_REGION" --repository-name "$REPO" \ + --image-tag-mutability MUTABLE --image-scanning-configuration scanOnPush=true >/dev/null + fi + echo "Using ECR repository $REPO" aws ecr get-login-password --region "$AWS_REGION" | docker login --username AWS --password-stdin "$AWS_ACCOUNT.dkr.ecr.$AWS_REGION.amazonaws.com" - IMAGE="$AWS_ACCOUNT.dkr.ecr.$AWS_REGION.amazonaws.com/atp-indexer-$ENV-atp-indexer:si-${GITHUB_SHA::7}" + IMAGE="$AWS_ACCOUNT.dkr.ecr.$AWS_REGION.amazonaws.com/$REPO:si-${GITHUB_SHA::7}" docker build -t "$IMAGE" . docker push "$IMAGE" echo "IMAGE=$IMAGE" >> "$GITHUB_ENV"