From da7d877b40839419ce6d6e39b65964073529457b Mon Sep 17 00:00:00 2001 From: Stefan Reimer Date: Mon, 21 Apr 2025 11:47:18 +0000 Subject: [PATCH] Squashed '.ci/' changes from 3feaf6f..9725c2e 9725c2e fix: ensure we dont remove rc builds a5cd89d feat: improve tag parsing, ensure dirty is added if needed 15e4d1f ci: make work with main branch git-subtree-dir: .ci git-subtree-split: 9725c2ef8842467951ec60adb1b45dfeca7618f5 --- README.md | 2 +- ecr_public_lifecycle.py | 3 ++- podman.mk | 4 ++-- 3 files changed, 5 insertions(+), 4 deletions(-) diff --git a/README.md b/README.md index 689e535..699dbe6 100644 --- a/README.md +++ b/README.md @@ -14,7 +14,7 @@ include .ci/podman.mk Add subtree to your project: ``` -git subtree add --prefix .ci https://git.zero-downtime.net/ZeroDownTime/ci-tools-lib.git master --squash +git subtree add --prefix .ci https://git.zero-downtime.net/ZeroDownTime/ci-tools-lib.git main --squash ``` diff --git a/ecr_public_lifecycle.py b/ecr_public_lifecycle.py index 7397dc4..40bfc59 100755 --- a/ecr_public_lifecycle.py +++ b/ecr_public_lifecycle.py @@ -41,7 +41,8 @@ for image in sorted(images, key=lambda d: d['imagePushedAt'], reverse=True): _delete = True for tag in image["imageTags"]: # Look for at least one tag NOT beign a SemVer dev tag - if "-" not in tag: + # untagged dev builds get tagged as -g + if "-g" not in tag and "dirty" not in tag: _delete = False if _delete: print("Deleting development image {}".format(image["imageTags"])) diff --git a/podman.mk b/podman.mk index ed5aa26..59286e2 100644 --- a/podman.mk +++ b/podman.mk @@ -8,8 +8,8 @@ SHELL := bash .PHONY: all # All targets are accessible for user .DEFAULT: help # Running Make will run the help target -# Parse version from latest git semver tag -GIT_TAG ?= $(shell git describe --tags --match v*.*.* 2>/dev/null || git rev-parse --short HEAD 2>/dev/null) +# Parse version from latest git semver tag, use short commit otherwise +GIT_TAG ?= $(shell git describe --tags --match v*.*.* --dirty 2>/dev/null || git describe --match="" --always --dirty 2>/dev/null) GIT_BRANCH ?= $(shell git rev-parse --abbrev-ref HEAD 2>/dev/null) TAG ::= $(GIT_TAG)