From 9a4900f7ebb8b01c33d845f0d53d7943f7d64684 Mon Sep 17 00:00:00 2001 From: Stefan Reimer Date: Thu, 24 Oct 2024 14:36:00 +0000 Subject: [PATCH] Squashed '.ci/' changes from 8e202d4..d67a80e d67a80e feat: make push and rm-image more resilient, prevent exit codes git-subtree-dir: .ci git-subtree-split: d67a80e919d73b49eaa9af3b301024337a36130d --- podman.mk | 25 +++++++++++++------------ 1 file changed, 13 insertions(+), 12 deletions(-) diff --git a/podman.mk b/podman.mk index 4949362..5420260 100644 --- a/podman.mk +++ b/podman.mk @@ -54,17 +54,17 @@ scan: ## Scan image using trivy # first tag and push all actual images # create new manifest for each tag and add all available TAG-ARCH before pushing push: ecr-login ## push images to registry - for t in $(TAG) latest $(EXTRA_TAGS); do \ + for t in $(TAG) latest $(EXTRA_TAGS); do echo "Tagging image with $(REGISTRY)/$(IMAGE):$${t}-$(ARCH)" - buildah tag $(IMAGE):$(TAG)-$(_ARCH) $(REGISTRY)/$(IMAGE):$${t}-$(_ARCH); \ - buildah manifest rm $(IMAGE):$$t || true; \ - buildah manifest create $(IMAGE):$$t; \ - for a in $(ALL_ARCHS); do \ - podman image exists $(REGISTRY)/$(IMAGE):$(TAG)-$$a && \ - buildah manifest add $(IMAGE):$$t $(REGISTRY)/$(IMAGE):$(TAG)-$$a; \ - done; \ + buildah tag $(IMAGE):$(TAG)-$(_ARCH) $(REGISTRY)/$(IMAGE):$${t}-$(_ARCH) + buildah manifest rm $(IMAGE):$$t || true + buildah manifest create $(IMAGE):$$t + for a in $(ALL_ARCHS); do + podman image exists $(REGISTRY)/$(IMAGE):$$t-$$a && \ + buildah manifest add $(IMAGE):$$t $(REGISTRY)/$(IMAGE):$$t-$$a + done echo "Pushing manifest $(IMAGE):$$t" - buildah manifest push --all $(IMAGE):$$t docker://$(REGISTRY)/$(IMAGE):$$t; \ + buildah manifest push --all $(IMAGE):$$t docker://$(REGISTRY)/$(IMAGE):$$t done ecr-login: ## log into AWS ECR public @@ -77,9 +77,10 @@ rm-remote-untagged: ## delete all remote untagged and in-dev images, keep 10 tag clean:: ## clean up source folder rm-image: - for t in $(TAG) latest $(EXTRA_TAGS); do \ - test -z "$$(podman image ls -q $(IMAGE):$${t}-$(_ARCH))" || podman image rm -f $(IMAGE):$${t}-$(_ARCH); \ - test -z "$$(podman image ls -q $(IMAGE):$${t})" || podman image rm -f $(IMAGE):$${t}; \ + for t in $(TAG) latest $(EXTRA_TAGS); do + for a in $(ALL_ARCHS); do + podman image exists $(IMAGE):$$t-$$a && podman image rm -f $(IMAGE):$$t-$$a || true + done done ## some useful tasks during development