diff --git a/Makefile b/Makefile index d0fb60a4..fe21ecee 100644 --- a/Makefile +++ b/Makefile @@ -12,7 +12,13 @@ # See the License for the specific language governing permissions and # limitations under the License. +STABLE_DOCKER_REGISTRY := $(shell tools/get_workspace_status.sh | grep STABLE_DOCKER_REGISTRY | cut -d ' ' -f 2) +STABLE_DOCKER_IMAGE_PREFIX := $(shell tools/get_workspace_status.sh | grep STABLE_DOCKER_IMAGE_PREFIX | cut -d ' ' -f 2) +STABLE_DOCKER_TAG := $(shell tools/get_workspace_status.sh | grep STABLE_DOCKER_TAG | cut -d ' ' -f 2) +IMAGE_BASE := $(STABLE_DOCKER_REGISTRY)/$(STABLE_DOCKER_IMAGE_PREFIX) + BAZEL_FLAGS=--features=pure --platforms=@io_bazel_rules_go//go/toolchain:linux_amd64 + .PHONY: all all: test @@ -37,20 +43,54 @@ push-etcd-manager: bazel run ${BAZEL_FLAGS} --platforms=@io_bazel_rules_go//go/toolchain:linux_amd64 //images:push-etcd-manager bazel run ${BAZEL_FLAGS} --platforms=@io_bazel_rules_go//go/toolchain:linux_arm64 //images:push-etcd-manager +.PHONY: push-etcd-manager-manifest +push-etcd-manager-manifest: + DOCKER_CLI_EXPERIMENTAL=enabled docker manifest create \ + $(IMAGE_BASE)etcd-manager:$(STABLE_DOCKER_TAG) \ + $(IMAGE_BASE)etcd-manager:$(STABLE_DOCKER_TAG)-amd64 \ + $(IMAGE_BASE)etcd-manager:$(STABLE_DOCKER_TAG)-arm64 + DOCKER_CLI_EXPERIMENTAL=enabled docker manifest push --purge \ + $(IMAGE_BASE)etcd-manager:$(STABLE_DOCKER_TAG) + .PHONY: push-etcd-dump push-etcd-dump: bazel run ${BAZEL_FLAGS} --platforms=@io_bazel_rules_go//go/toolchain:linux_amd64 //images:push-etcd-dump bazel run ${BAZEL_FLAGS} --platforms=@io_bazel_rules_go//go/toolchain:linux_arm64 //images:push-etcd-dump +.PHONY: push-etcd-dump-manifest +push-etcd-dump-manifest: + DOCKER_CLI_EXPERIMENTAL=enabled docker manifest create \ + $(IMAGE_BASE)etcd-dump:$(STABLE_DOCKER_TAG) \ + $(IMAGE_BASE)etcd-dump:$(STABLE_DOCKER_TAG)-amd64 \ + $(IMAGE_BASE)etcd-dump:$(STABLE_DOCKER_TAG)-arm64 + DOCKER_CLI_EXPERIMENTAL=enabled docker manifest push --purge \ + $(IMAGE_BASE)etcd-dump:$(STABLE_DOCKER_TAG) + .PHONY: push-etcd-backup push-etcd-backup: bazel run ${BAZEL_FLAGS} --platforms=@io_bazel_rules_go//go/toolchain:linux_amd64 //images:push-etcd-backup bazel run ${BAZEL_FLAGS} --platforms=@io_bazel_rules_go//go/toolchain:linux_arm64 //images:push-etcd-backup -.PHONY: push -push: push-etcd-manager push-etcd-dump push-etcd-backup +.PHONY: push-etcd-backup-manifest +push-etcd-backup-manifest: + DOCKER_CLI_EXPERIMENTAL=enabled docker manifest create \ + $(IMAGE_BASE)etcd-backup:$(STABLE_DOCKER_TAG) \ + $(IMAGE_BASE)etcd-backup:$(STABLE_DOCKER_TAG)-amd64 \ + $(IMAGE_BASE)etcd-backup:$(STABLE_DOCKER_TAG)-arm64 + DOCKER_CLI_EXPERIMENTAL=enabled docker manifest push --purge \ + $(IMAGE_BASE)etcd-backup:$(STABLE_DOCKER_TAG) + +.PHONY: push-images +push-images: push-etcd-manager push-etcd-dump push-etcd-backup echo "pushed images" +.PHONY: push-manifests +push-manifests: push-etcd-manager-manifest push-etcd-dump-manifest push-etcd-backup-manifest + echo "pushed manifests" + +.PHONY: push +push: push-images push-manifests + .PHONY: gazelle gazelle: bazel run //:gazelle -- fix diff --git a/images/BUILD b/images/BUILD index 6358248f..7ee75e17 100644 --- a/images/BUILD +++ b/images/BUILD @@ -107,11 +107,11 @@ container_push( format = "Docker", image = ":etcd-manager", registry = "{STABLE_DOCKER_REGISTRY}", - repository = select({ - "@io_bazel_rules_go//go/platform:amd64": "{STABLE_DOCKER_IMAGE_PREFIX}etcd-manager-amd64", - "@io_bazel_rules_go//go/platform:arm64": "{STABLE_DOCKER_IMAGE_PREFIX}etcd-manager-arm64", + repository = "{STABLE_DOCKER_IMAGE_PREFIX}etcd-manager", + tag = select({ + "@io_bazel_rules_go//go/platform:amd64": "{STABLE_DOCKER_TAG}-amd64", + "@io_bazel_rules_go//go/platform:arm64": "{STABLE_DOCKER_TAG}-arm64", }), - tag = "{STABLE_DOCKER_TAG}", ) container_image( @@ -132,11 +132,11 @@ container_push( format = "Docker", image = ":etcd-dump", registry = "{STABLE_DOCKER_REGISTRY}", - repository = select({ - "@io_bazel_rules_go//go/platform:amd64": "{STABLE_DOCKER_IMAGE_PREFIX}etcd-dump-amd64", - "@io_bazel_rules_go//go/platform:arm64": "{STABLE_DOCKER_IMAGE_PREFIX}etcd-dump-arm64", + repository = "{STABLE_DOCKER_IMAGE_PREFIX}etcd-dump", + tag = select({ + "@io_bazel_rules_go//go/platform:amd64": "{STABLE_DOCKER_TAG}-amd64", + "@io_bazel_rules_go//go/platform:arm64": "{STABLE_DOCKER_TAG}-arm64", }), - tag = "{STABLE_DOCKER_TAG}", ) container_image( @@ -158,9 +158,9 @@ container_push( format = "Docker", image = ":etcd-backup", registry = "{STABLE_DOCKER_REGISTRY}", - repository = select({ - "@io_bazel_rules_go//go/platform:amd64": "{STABLE_DOCKER_IMAGE_PREFIX}etcd-backup-amd64", - "@io_bazel_rules_go//go/platform:arm64": "{STABLE_DOCKER_IMAGE_PREFIX}etcd-backup-arm64", + repository = "{STABLE_DOCKER_IMAGE_PREFIX}etcd-backup", + tag = select({ + "@io_bazel_rules_go//go/platform:amd64": "{STABLE_DOCKER_TAG}-amd64", + "@io_bazel_rules_go//go/platform:arm64": "{STABLE_DOCKER_TAG}-arm64", }), - tag = "{STABLE_DOCKER_TAG}", )