From 24e5ad4bdd0465531b25ceda06d01207edcb30b5 Mon Sep 17 00:00:00 2001 From: Jiawei Huang Date: Thu, 23 Nov 2023 10:41:16 -0800 Subject: [PATCH] Fix push-manifests Makefile target Third party `manifest-tool` is removed from calico/go-build:v0.90 in favor of the official `docker manifest` command. This change re-implements the push-manifests target. --- Makefile | 12 ++---------- 1 file changed, 2 insertions(+), 10 deletions(-) diff --git a/Makefile b/Makefile index d31f895f73..4ab2134379 100644 --- a/Makefile +++ b/Makefile @@ -89,13 +89,6 @@ DOCKER_CONFIG ?= $(HOME)/.docker/config.json escapefs = $(subst :,---,$(subst /,___,$(1))) unescapefs = $(subst ---,:,$(subst ___,/,$(1))) -# these macros create a list of valid architectures for pushing manifests -space := -space += -comma := , -prefix_linux = $(addprefix linux/,$(strip $1)) -join_platforms = $(subst $(space),$(comma),$(call prefix_linux,$(strip $1))) - # Targets used when cross building. .PHONY: register # Enable binfmt adding support for miscellaneous binary formats. @@ -203,9 +196,8 @@ sub-push-%: push-manifests: imagetag $(addprefix sub-manifest-,$(call escapefs,$(PUSH_MANIFEST_IMAGE_PREFIXES))) sub-manifest-%: - # Docker login to hub.docker.com required before running this target as we are using $(DOCKER_CONFIG) holds the docker login credentials - # path to credentials based on manifest-tool's requirements here https://github.com/estesp/manifest-tool#sample-usage - docker run -t --entrypoint /bin/sh -v $(DOCKER_CONFIG):/root/.docker/config.json $(CALICO_BUILD) -c "/usr/bin/manifest-tool push from-args --platforms $(call join_platforms,$(VALIDARCHES)) --template $(call unescapefs,$*$(BUILD_IMAGE):$(IMAGETAG))-ARCH --target $(call unescapefs,$*$(BUILD_IMAGE):$(IMAGETAG))" + docker manifest create $(call unescapefs,$*$(BUILD_IMAGE):$(IMAGETAG)) $(addprefix --amend ,$(addprefix $(call unescapefs,$*$(BUILD_IMAGE):$(IMAGETAG))-,$(VALIDARCHES))) + docker manifest push --purge $(call unescapefs,$*$(BUILD_IMAGE):$(IMAGETAG)) ## push default amd64 arch where multi-arch manifest is not supported push-non-manifests: imagetag $(addprefix sub-non-manifest-,$(call escapefs,$(PUSH_NONMANIFEST_IMAGE_PREFIXES)))