Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/sstarcher/ecr-cleaner
Opinionated tool to clean out ECR images
https://github.com/sstarcher/ecr-cleaner
Last synced: 19 days ago
JSON representation
Opinionated tool to clean out ECR images
- Host: GitHub
- URL: https://github.com/sstarcher/ecr-cleaner
- Owner: sstarcher
- License: apache-2.0
- Created: 2020-03-01T00:31:26.000Z (over 4 years ago)
- Default Branch: master
- Last Pushed: 2022-03-23T14:21:30.000Z (over 2 years ago)
- Last Synced: 2024-06-21T17:52:16.138Z (5 months ago)
- Language: Go
- Size: 37.1 KB
- Stars: 5
- Watchers: 3
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# ECR Cleaner
This tool helps you clean up your ECR repository. ECR is limited in how you can remove images by either a amount of elapsed time or via an expression matching the name. Due to the limitations in this combination this tool exists.### Purging
* The image must be over 90 days old unless `--days` is set.
* Image tags that are [SemVer](https://semver.org/) compatible are kept by default set `--no-semver` to remove SemVer tags. If the tag starts with a r or v those characters will be stripped and the remainder of the name will be tested for SemVer compatiability.
* `--dry-run` allows you to run the command to see what the results would be.
* By default it will skip any repo that would have all images removed set `--force` to remove them anyways## Helm Install
Using helm 3
```
$ helm repo add sstarcher https://shanestarcher.com/helm-charts/
$ helm install ecr-cleaner sstarcher/ecr-cleaner
```If using kube2iam you will want to specify podAnnotations
```yaml
podAnnotations:
iam.amazonaws.com/role: IAM_ROLE
```By default dry-run is turned on and nothing will be deleted. Set the following to disable dry-run.
```yaml
config:
dryRun: false
```### AWS IAM Policy
The following permissions will be needed by ecr-cleaner to function.
```
{
"Version": "2012-10-17",
"Statement": [
{
"Sid": "ecr-cleaner",
"Effect": "Allow",
"Action": [
"ecr:BatchDeleteImage",
"ecr:BatchGetImage",
"ecr:DescribeImages",
"ecr:ListImages",
"ecr:DescribeRepositories"
]
}
]
}
```## Automated Docker Builds
This is handled by docker hub's automated [build process](https://hub.docker.com/repository/docker/sstarcher/ecr-cleaner/).