Skip to content

Commit 8b22037

Browse files
committed
Full refactor
* find running digests also in k8s (also: `check_eks`, `check_ecs` flags) * add loads of logging (instead of print) * rename `ignore_tags_regex` to `protect_tags_regex` and address awslabs#34 * set ecs_client Config params (connect_timeout, read_timeout, max_attempts) * add `repo_name_regex` * add `protect_latest` flag * add `older_than` filter inspired by awslabs#18
1 parent a92e4e1 commit 8b22037

File tree

4 files changed

+697
-216
lines changed

4 files changed

+697
-216
lines changed

README.md

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ The Python script and Lambda function described here help clean up images in [Am
77
## Use virtualenv for Python execution
88

99
To prevent any problems with your system Python version conflicting with the application, we recommend using virtualenv.
10+
This code was tested with Python 3.13, but would probably work with any Python >= 3.6.
1011

1112
Install Python:
1213
`pip install python 3`
@@ -28,7 +29,7 @@ Install virtualenv:
2829
## Upload the package to Lambda
2930

3031
1. Run the following command:
31-
`aws lambda create-function --function-name {NAME_OF_FUNCTION} --runtime python2.7
32+
`aws lambda create-function --function-name {NAME_OF_FUNCTION} --runtime python3.13
3233
--role {ARN_NUMBER} --handler main.handler --timeout 15
3334
--zip-file fileb://{ZIP_FILE_PATH}`
3435

@@ -59,7 +60,12 @@ Deletes the images that are not used by running tasks and which are older than t
5960

6061
`python main.py –dryrun False –imagestokeep 20 –region us-west-2`
6162

63+
6264
Deletes the images that are not used by running tasks and which are older than the last 20 versions (in each repository), in Oregon only, and ignore image tags that contains `release` or `archive`:
6365

6466
`python main.py –dryrun False –imagestokeep 20 –region us-west-2 -ignoretagsregex release|archive`
6567

68+
69+
For full option list, please refer to the help, by running:
70+
71+
`python main.py -h`

lambda-cloudformation.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ Resources:
1414
Type: AWS::Serverless::Function
1515
Properties:
1616
Handler: main.handler
17-
Runtime: python2.7
17+
Runtime: python3.13
1818
Description: ECR Cleanup Lambda
1919
CodeUri: ./
2020
MemorySize: 128

0 commit comments

Comments
 (0)