-
Notifications
You must be signed in to change notification settings - Fork 98
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
Repositories filter and env variables fix #28
Open
talset
wants to merge
11
commits into
awslabs:master
Choose a base branch
from
cycloidio:master
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Conversation
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
In order to "limitate" the clean, adding a filter on repositories name to keep.
When using the -ignoretagsregex, if we had an image with multiple tags the image is deleted if all tags not match the ignoretagsregex For example image tag: dev foo bar -ignoretagsregex dev the image will be added to the deletesha list. The fix ensure that if one of the images's tags match the ignoretagsregex, the image is skiped
Previously environnement variable was defined but always overrided by args: os.environ["DRYRUN"] = args.dryrun.lower() and then affectied to the global var: DRYRUN = os.environ.get('DRYRUN', "false").lower() In this case the real env variables wasn't use. This fix allow parser to get by default the env var and them a default value. Global var are now using directly args. from parser.
Previously the could keep was done on all tagged image but when using IGNORE_TAGS_REGEX, the image ignored was taken in the keep count. That means if we have 3 images * image1 tagfoo * image2 tagbar * image3 tag bla and set keep 1 with ignoretags tagfoo it would have deleted image2 and 3. Now keep is done on other image that are ignored. I the previous example it will delete image3 only, ignore image1 (tagfoo) and keep image2
Inspired by https://github.com/awslabs/ecr-cleanup-lambda/pull/17/files Add parameter to allow only deleting images where the tag contains a specific string Specify a regex to match tags. If no tags on the image match, the image will be skipped/ignored. Allow us to only clean a specifig type/tag of images
Fix the # #17 |
Fixes environment variables when run as a Lambda
Add initialize() function
+1 for this PR (filter by repository name) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
main.py: filter on repositories
It use a list to match repositories name. If the repository is in the list, the repository is used for the clean else it is skipped.
main.py: fix multiple tags deleting issue
main.py: add python shebang
In order to be able to chmod +x main.py and use it directly with ./main.py
main.py: arg to use os.environ
main.py take care of ignored tag in the keep count
main.py: Add filter to clean image with tag match