Skip to content

Commit

Permalink
fix(bump): exclude only if the image tag ends with -latest
Browse files Browse the repository at this point in the history
  • Loading branch information
uptickmetachu committed Oct 24, 2024
1 parent 8873083 commit 742ccd3
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions gitops/utils/images.py
Original file line number Diff line number Diff line change
Expand Up @@ -46,13 +46,17 @@ def get_latest_image(repository_name: str, prefix: str, ecr_repository: str | No
image_tag = f"{prefix}-latest" if prefix else "latest"

def add_image_to_results(image: "ImageDetailTypeDef") -> None:
"""This function adds the image to the results list if it matches the prefix and is not the latest image.
We want to ignore the latest image tag otherwise we will never diff anything other than `develop-latest` etc.
"""
if prefix != "":
if prefix_tags := [
tag for tag in image["imageTags"] if tag.startswith(prefix + "-") and "latest" not in tag
tag for tag in image["imageTags"] if tag.startswith(prefix + "-") and not tag.endswith("latest")
]:
results.append((prefix_tags[0], image["imagePushedAt"]))
else:
if prefix_tags := [tag for tag in image["imageTags"] if "-" not in tag and "latest" not in tag]:
if prefix_tags := [tag for tag in image["imageTags"] if "-" not in tag and not tag.endswith("latest")]:
results.append((prefix_tags[0], image["imagePushedAt"]))

try:
Expand Down

0 comments on commit 742ccd3

Please sign in to comment.