From d093f9a74eb74634bc2c56aaa67be3f8641c905c Mon Sep 17 00:00:00 2001 From: Weite Dai Date: Tue, 27 Oct 2026 15:25:28 +1100 Subject: [PATCH] fix(ci): force edge redeploy when toggling skip_product_id_check --- .../deploy_skip_product_id_check_edge.yaml | 46 +++++++++++++++++++ 1 file changed, 46 insertions(+) diff --git a/.github/workflows/deploy_skip_product_id_check_edge.yaml b/.github/workflows/deploy_skip_product_id_check_edge.yaml index 04a8f13..ced0f09 100644 --- a/.github/workflows/deploy_skip_product_id_check_edge.yaml +++ b/.github/workflows/deploy_skip_product_id_check_edge.yaml @@ -15,9 +15,44 @@ permissions: actions: read jobs: + # The SSM flag is read only at task start, so changing it gives appdeploy no diff and nothing redeploys. + # Re-push :latest with a new digest to force new tasks. + # Long-term fix: add a force_new_deployment input to aodn/appdeploy deploy.yml and drop this job. + repush_image: + name: Re-push Latest Image + runs-on: ubuntu-latest + environment: central + outputs: + digest: ${{ steps.push.outputs.digest }} + steps: + - name: Configure AWS Credentials for image push + uses: aws-actions/configure-aws-credentials@v6 + with: + audience: sts.amazonaws.com + aws-region: ${{ vars.AWS_REGION }} + role-to-assume: ${{ vars.AWS_ROLE_ARN }} + + - name: Login to ECR Central + uses: aws-actions/amazon-ecr-login@v2 + + - name: Re-push latest image with a new digest + id: push + run: | + image="$ECR_REGISTRY/$ECR_REPOSITORY" + printf 'FROM %s:latest\nLABEL au.org.aodn.redeploy-run-id="%s"\n' "$image" "$RUN_ID" \ + | docker build --pull -t "$image:latest" - + docker push "$image:latest" + digest=$(docker inspect --format '{{index .RepoDigests 0}}' "$image:latest" | cut -d@ -f2) + echo "digest=$digest" >> "$GITHUB_OUTPUT" + env: + ECR_REGISTRY: ${{ vars.ECR_REGISTRY }} + ECR_REPOSITORY: ${{ vars.ECR_REPOSITORY }} + RUN_ID: ${{ github.run_id }} + update_ssm_and_deploy: name: Update SSM and Deploy to Edge runs-on: ubuntu-latest + needs: repush_image environment: edge steps: - name: Configure AWS Credentials @@ -37,6 +72,17 @@ jobs: env: skip_product_id_check: ${{ inputs.skip_product_id_check }} + - name: Update Image Digest to SSM Parameter + if: ${{ needs.repush_image.outputs.digest != '' }} + run: | + aws ssm put-parameter \ + --name "/apps/oceancurrent/edge/image_digest" \ + --type "String" \ + --value "$digest" \ + --overwrite + env: + digest: ${{ needs.repush_image.outputs.digest }} + - name: Generate App Token uses: actions/create-github-app-token@v3 id: app-token