Skip to content

Instantly share code, notes, and snippets.

@stefansedich
Created June 7, 2016 21:39
Show Gist options
  • Save stefansedich/3158fc37a2c82d30a22374e2cf4bdcfc to your computer and use it in GitHub Desktop.
Save stefansedich/3158fc37a2c82d30a22374e2cf4bdcfc to your computer and use it in GitHub Desktop.
Cleaning up the untagged codeship cache images
#!/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
aws_deploy:
image: codeship/aws-deployment
...(volumes for deploy scripts and my encrypted env)
- 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