feat: make push and rm-image more resilient, prevent exit codes
This commit is contained in:
parent
8e202d4fba
commit
d67a80e919
25
podman.mk
25
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
|
||||
|
Loading…
Reference in New Issue
Block a user