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
This commit is contained in:
Stefan Reimer 2024-10-24 14:36:00 +00:00
parent 3f3de42ddc
commit 9a4900f7eb

View File

@ -54,17 +54,17 @@ scan: ## Scan image using trivy
# first tag and push all actual images # first tag and push all actual images
# create new manifest for each tag and add all available TAG-ARCH before pushing # create new manifest for each tag and add all available TAG-ARCH before pushing
push: ecr-login ## push images to registry 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)" echo "Tagging image with $(REGISTRY)/$(IMAGE):$${t}-$(ARCH)"
buildah tag $(IMAGE):$(TAG)-$(_ARCH) $(REGISTRY)/$(IMAGE):$${t}-$(_ARCH); \ buildah tag $(IMAGE):$(TAG)-$(_ARCH) $(REGISTRY)/$(IMAGE):$${t}-$(_ARCH)
buildah manifest rm $(IMAGE):$$t || true; \ buildah manifest rm $(IMAGE):$$t || true
buildah manifest create $(IMAGE):$$t; \ buildah manifest create $(IMAGE):$$t
for a in $(ALL_ARCHS); do \ for a in $(ALL_ARCHS); do
podman image exists $(REGISTRY)/$(IMAGE):$(TAG)-$$a && \ podman image exists $(REGISTRY)/$(IMAGE):$$t-$$a && \
buildah manifest add $(IMAGE):$$t $(REGISTRY)/$(IMAGE):$(TAG)-$$a; \ buildah manifest add $(IMAGE):$$t $(REGISTRY)/$(IMAGE):$$t-$$a
done; \ done
echo "Pushing manifest $(IMAGE):$$t" 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 done
ecr-login: ## log into AWS ECR public 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 clean:: ## clean up source folder
rm-image: rm-image:
for t in $(TAG) latest $(EXTRA_TAGS); do \ for t in $(TAG) latest $(EXTRA_TAGS); do
test -z "$$(podman image ls -q $(IMAGE):$${t}-$(_ARCH))" || podman image rm -f $(IMAGE):$${t}-$(_ARCH); \ for a in $(ALL_ARCHS); do
test -z "$$(podman image ls -q $(IMAGE):$${t})" || podman image rm -f $(IMAGE):$${t}; \ podman image exists $(IMAGE):$$t-$$a && podman image rm -f $(IMAGE):$$t-$$a || true
done
done done
## some useful tasks during development ## some useful tasks during development