Skip to content

Commit

Permalink
Merge pull request #200 from uktrade/fix/visualisation-lifecycle-rule
Browse files Browse the repository at this point in the history
fix: visualisation-base lifecycle rule
  • Loading branch information
michalc authored Jan 3, 2025
2 parents bcff7d0 + 69b08a1 commit 02af66e
Showing 1 changed file with 15 additions and 4 deletions.
19 changes: 15 additions & 4 deletions infra/ecr.tf
Original file line number Diff line number Diff line change
Expand Up @@ -281,20 +281,31 @@ data "aws_ecr_lifecycle_policy_document" "expire_preview_and_untagged_after_one_
}

data "aws_ecr_lifecycle_policy_document" "visualisation_base_expire_old_after_one_day" {
# Match tagged python and rv4 images, but expire them in 1000 years...
# Match tagged python, but expire them in 1000 years...
rule {
priority = 1
selection {
tag_status = "tagged"
tag_pattern_list = ["python", "rv4"]
tag_pattern_list = ["python"]
count_type = "sinceImagePushed"
count_unit = "days"
count_number = 365000
}
}
# ... and images that don't match python and rv4, but have a tag, are cached layers
# otherwise match tagged rv4, but expire them in 1000 years...
rule {
priority = 2
selection {
tag_status = "tagged"
tag_pattern_list = ["rv4"]
count_type = "sinceImagePushed"
count_unit = "days"
count_number = 365000
}
}
# ... and images that don't match python or rv4, but have a tag, are cached layers
rule {
priority = 3
selection {
tag_status = "tagged"
tag_pattern_list = ["*"]
Expand All @@ -305,7 +316,7 @@ data "aws_ecr_lifecycle_policy_document" "visualisation_base_expire_old_after_on
}
# ... and for when we end up with untagged images, expire them after 1 day as well
rule {
priority = 3
priority = 4
selection {
tag_status = "untagged"
count_type = "sinceImagePushed"
Expand Down

0 comments on commit 02af66e

Please sign in to comment.