Browse Source

Check for image existence using aws ecr list-images

prod-pipeline-testing
Sam Seed 2 years ago
parent
commit
538485da4d
  1. 8
      .github/workflows/aws_deploy.yml

8
.github/workflows/aws_deploy.yml

@ -49,16 +49,14 @@ jobs:
with:
mask-password: 'true'
- name: Check if image with tag already exists (hide errors?)
run: |
aws ecr describe-images --repository-name=$repository --image-ids=imageTag=${{ github.sha }} 2> /dev/null
- name: Check if image with tag already exists
id: check-image-exists
run: |
aws ecr describe-images --repository-name=$repository --image-ids=imageTag=${{ github.sha }}
echo "image-exists=$(if aws ecr list-images --no-paginate --repository-name=$repository --query "imageIds[*].imageTag" | grep -q ${{ github.sha }}; then echo true; else echo false; fi)" >> $GITHUB_ENV
- name: Build, tag, and push docker image to ECR
id: build-image
if: ${{ ! env.image-exists }}
env:
registry: ${{ steps.ecr-login.outputs.registry }}
commit_tag: ${{ github.sha }}

Loading…
Cancel
Save