aws / aws/containers-roadmap

[ECR] [request]: Apply lifecycle rules to tags (not images)

Open
#2,568 0 comments 21 reactions 0 assignees View on GitHub
ECR Proposed
Dominant language
Shell
Stars
5.4k
Forks
334
PR merge metrics
No merged PRs in 30d

Description

### Community Note

* Please vote on this issue by adding a 👍 [reaction](https://blog.github.com/2016-03-10-add-reactions-to-pull-requests-issues-and-comments/) to the original issue to help the community and maintainers prioritize this request
* Please do not leave "+1" or "me too" comments, they generate extra noise for issue followers and do not help prioritize the request
* If you are interested in working on this issue or have submitted a pull request, please leave a comment

**Tell us about your request**
I would like for ECR lifecycle policies to apply to image tags, instead of images.

**Which service(s) is this request for?**
ECR

**Tell us about the problem you're trying to solve. What are you trying to do, and why is it hard?**
Right now, when we push an image it includes multiple tags, like:

- `github-sha-` for every build
- `-latest` for every build from a PR
- `v1.2.3` if built from a tag/release

We want to expire `github-sha-*` tags frequently, but keep the other tags forever. Currently, we have to create a high priority rule for each tag pattern we want to keep, e.g. `v*` and `*-latest`.

However, this frequently results in images being accidentally expired. If someone manually adds a tag (like `dev-`) but the build also includes a `github-sha-` tag, then the image will be expired because the `github-sha-*` tag rule is matched, even though the image has additional tags that wouldn't be expired by any rule.

I would like to be able to create a lifecycle rule that only removes the _tag_ matching the rule, not the entire image. Then, an additional rule can delete untagged images to free up storage. This way, the behaviour is as expected - tags matching the rule pattern are deleted, and other tags are not affected if they are on the same image.

My proposal is to add a new `action` value to the rules: `expireTag` that has this effect, but I'm not set on this.

**Are you currently working around this issue?**

Currently, we insert a high priority rule for all of the tag patterns we want to keep. But as mentioned above, this frequently results in images being accidentally expired.

Contributor guide

Open the contributing guide

Research direction

Start by reviewing the ECR lifecycle policy behavior described in the issue, including image tags, tag patterns, and the proposed expireTag action. Confirm whether the requested tag-only expiration is supported by the relevant ECR API and documentation; done means matching tags can be removed without expiring an image that has other tags.

Written by the indexing model from the issue text.

Assessment

Tech stack
aws
Domain
cloud
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.