Created
June 7, 2016 21:39
-
-
Save stefansedich/3158fc37a2c82d30a22374e2cf4bdcfc to your computer and use it in GitHub Desktop.
Cleaning up the untagged codeship cache images
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
set -e | |
# Environment | |
REPOSITORY=$1 | |
# Remove untagged images from the specified repository. | |
aws ecr list-images --repository-name $REPOSITORY --query 'imageIds[?type(imageTag)!=`string`].[imageDigest]' --output text \ | |
| while read line; do aws ecr batch-delete-image --repository-name $REPOSITORY --image-ids imageDigest=$line; done |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
aws_deploy: | |
image: codeship/aws-deployment | |
...(volumes for deploy scripts and my encrypted env) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
- name: deploy | |
...(deploys the app to ECS) | |
- name: cleanup | |
service: aws_deploy | |
command: bash -c "./cleanup.sh my-repo-name" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment