Skip to content
Draft
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
46 changes: 46 additions & 0 deletions .github/workflows/deploy_skip_product_id_check_edge.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Comment on lines +42 to +44
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
Expand All @@ -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
Expand Down
Loading