Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore(docker-tag): do not fail if tag already exists to make action more idempotent #172

Merged
merged 2 commits into from
Oct 21, 2024
Merged
Changes from 1 commit
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
9 changes: 7 additions & 2 deletions .github/workflows/docker-tag-v1.yml
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,11 @@
exit 1

- name: Tag image
run: |

Check failure on line 72 in .github/workflows/docker-tag-v1.yml

View workflow job for this annotation

GitHub Actions / lint

shellcheck reported issue in this script: SC1009:info:6:3: The mentioned syntax error was in this simple command

Check failure on line 72 in .github/workflows/docker-tag-v1.yml

View workflow job for this annotation

GitHub Actions / lint

shellcheck reported issue in this script: SC1073:error:6:99: Couldn't parse this double quoted string. Fix to allow more checks

Check failure on line 72 in .github/workflows/docker-tag-v1.yml

View workflow job for this annotation

GitHub Actions / lint

shellcheck reported issue in this script: SC1072:error:9:1: Expected end of double quoted string. Fix any mentioned problems and try again
MANIFEST=$(aws ecr batch-get-image --repository-name ${{ inputs.image_name }} --image-ids imageTag=${{ inputs.image_tag_from }} --output text --query 'images[].imageManifest')
aws ecr put-image --repository-name ${{ inputs.image_name }} --image-tag ${{ inputs.image_tag_to}} --image-manifest "$MANIFEST"
IMAGE_EXISTS=$(aws ecr describe-images --repository-name ${{ inputs.image_name }} --image-ids imageTag=${{ inputs.image_tag_to}})
if [[ -z "$IMAGE_EXISTS" ]]; then
MANIFEST=$(aws ecr batch-get-image --repository-name ${{ inputs.image_name }} --image-ids imageTag=${{ inputs.image_tag_from }} --output text --query 'images[].imageManifest')
aws ecr put-image --repository-name ${{ inputs.image_name }} --image-tag ${{ inputs.image_tag_to }} --image-manifest "$MANIFEST"
else
echo "image ${{ inputs.image_name }}" tag ${{ inputs.image_tag_to }} already exists. Skipping..."
fi
Loading