From 4e2f9417a13d3b8c637be646847be0431225530f Mon Sep 17 00:00:00 2001 From: David Cheung Date: Thu, 14 Oct 2021 11:37:14 -0400 Subject: [PATCH 1/2] Mitigate ECR update tag errors out when no change in dev-env we use last-deployed tag to spin up the deployment, so when we deploy we tag the deployed image, but if we tag it twice it errors out. --- templates/.github/actions/deploy/action.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/templates/.github/actions/deploy/action.yml b/templates/.github/actions/deploy/action.yml index 67b9f86..84538e5 100644 --- a/templates/.github/actions/deploy/action.yml +++ b/templates/.github/actions/deploy/action.yml @@ -46,4 +46,4 @@ runs: fi # Update the last-deployed tag to be used in dev environments MANIFEST=$(aws ecr batch-get-image --region ${{ inputs.region }} --repository-name ${{ inputs.repository-name }} --image-ids imageTag=${{ inputs.image-tag }} --query 'images[].imageManifest' --output text) - aws ecr put-image --region ${{ inputs.region }} --repository-name ${{ inputs.repository-name }} --image-tag last-deployed --image-manifest "$MANIFEST" + aws ecr put-image --region ${{ inputs.region }} --repository-name ${{ inputs.repository-name }} --image-tag last-deployed --image-manifest "$MANIFEST" || echo "Image Tag already updated" From f0885057e965c93c33c3dcb9f4516b4264a81d7c Mon Sep 17 00:00:00 2001 From: David Cheung Date: Thu, 14 Oct 2021 11:48:09 -0400 Subject: [PATCH 2/2] fixup! Mitigate ECR update tag errors out when no change --- templates/.circleci/config.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/templates/.circleci/config.yml b/templates/.circleci/config.yml index 8f2fe50..e66c17b 100644 --- a/templates/.circleci/config.yml +++ b/templates/.circleci/config.yml @@ -285,7 +285,7 @@ jobs: fi MANIFEST=$(aws ecr batch-get-image --region << parameters.region >> --repository-name << parameters.repo >> --image-ids imageTag=${VERSION_TAG} --query 'images[].imageManifest' --output text) - aws ecr put-image --region << parameters.region >> --repository-name << parameters.repo >> --image-tag last-deployed --image-manifest "$MANIFEST" + aws ecr put-image --region << parameters.region >> --repository-name << parameters.repo >> --image-tag last-deployed --image-manifest "$MANIFEST" || echo "Image Tag already updated" workflows: version: 2 # The main workflow. Check out the code, build it, push it, deploy to staging, test, deploy to production