From d560888f1f79930995676e8e7dcf7a642fe87402 Mon Sep 17 00:00:00 2001 From: Evan Lezar Date: Tue, 17 Jun 2025 15:32:35 +0200 Subject: [PATCH] Use single version tag for image Signed-off-by: Evan Lezar --- .github/workflows/e2e.yaml | 2 +- deployments/container/Makefile | 39 ++++++++-------------------- deployments/container/native-only.mk | 8 ------ 3 files changed, 12 insertions(+), 37 deletions(-) diff --git a/.github/workflows/e2e.yaml b/.github/workflows/e2e.yaml index acfb4e48..e8401871 100644 --- a/.github/workflows/e2e.yaml +++ b/.github/workflows/e2e.yaml @@ -72,7 +72,7 @@ jobs: env: E2E_INSTALL_CTK: "true" E2E_IMAGE_NAME: ghcr.io/nvidia/container-toolkit - E2E_IMAGE_TAG: ${{ inputs.version }}-ubi8 + E2E_IMAGE_TAG: ${{ inputs.version }} E2E_SSH_USER: ${{ secrets.E2E_SSH_USER }} E2E_SSH_HOST: ${{ steps.holodeck_public_dns_name.outputs.result }} run: | diff --git a/deployments/container/Makefile b/deployments/container/Makefile index caf57ad1..5c90f9c2 100644 --- a/deployments/container/Makefile +++ b/deployments/container/Makefile @@ -29,12 +29,12 @@ include $(CURDIR)/versions.mk IMAGE_VERSION := $(VERSION) -IMAGE_TAG ?= $(VERSION)-$(DIST) +IMAGE_TAG ?= $(VERSION) IMAGE = $(IMAGE_NAME):$(IMAGE_TAG) OUT_IMAGE_NAME ?= $(IMAGE_NAME) OUT_IMAGE_VERSION ?= $(IMAGE_VERSION) -OUT_IMAGE_TAG = $(OUT_IMAGE_VERSION)-$(DIST) +OUT_IMAGE_TAG = $(OUT_IMAGE_VERSION) OUT_IMAGE = $(OUT_IMAGE_NAME):$(OUT_IMAGE_TAG) ##### Public rules ##### @@ -56,30 +56,16 @@ else include $(CURDIR)/deployments/container/multi-arch.mk endif -# For the default push target we also push a short tag equal to the version. -# We skip this for the development release -DEVEL_RELEASE_IMAGE_VERSION ?= devel -PUSH_MULTIPLE_TAGS ?= true -ifeq ($(strip $(OUT_IMAGE_VERSION)),$(DEVEL_RELEASE_IMAGE_VERSION)) -PUSH_MULTIPLE_TAGS = false -endif -ifeq ($(PUSH_MULTIPLE_TAGS),true) -push-$(DEFAULT_PUSH_TARGET): push-short -endif - -push-%: DIST = $(*) -push-short: DIST = $(DEFAULT_PUSH_TARGET) - # Define the push targets $(PUSH_TARGETS): push-%: $(CURDIR)/scripts/publish-image.sh $(IMAGE) $(OUT_IMAGE) -push-short: - $(CURDIR)/scripts/publish-image.sh $(IMAGE) $(OUT_IMAGE) +DOCKERFILE = $(CURDIR)/deployments/container/Dockerfile - -build-%: DIST = $(*) -build-%: DOCKERFILE = $(CURDIR)/deployments/container/Dockerfile +# For packaging targets we set the output image tag to include the -packaging suffix. +%-packaging: INTERMEDIATE_TARGET := --target=packaging +%-packaging: IMAGE_TAG = $(IMAGE_VERSION)-packaging +%-packaging: OUT_IMAGE_TAG = $(IMAGE_VERSION)-packaging ARTIFACTS_ROOT ?= $(shell realpath --relative-to=$(CURDIR) $(DIST_DIR)) @@ -110,17 +96,14 @@ PACKAGE_DIST_DEB = ubuntu18.04 # TODO: This needs to be set to centos8 for ppc64le builds PACKAGE_DIST_RPM = centos7 -build-packaging: INTERMEDIATE_TARGET := --target=packaging +# Handle the default build target. +.PHONY: build push +build: build-$(DEFAULT_PUSH_TARGET) +push: push-$(DEFAULT_PUSH_TARGET) # Test targets test-%: DIST = $(*) -# Handle the default build target. -.PHONY: build -build: $(DEFAULT_PUSH_TARGET) -$(DEFAULT_PUSH_TARGET): build-$(DEFAULT_PUSH_TARGET) -$(DEFAULT_PUSH_TARGET): DIST = $(DEFAULT_PUSH_TARGET) - TEST_CASES ?= docker crio containerd $(TEST_TARGETS): test-%: TEST_CASES="$(TEST_CASES)" bash -x $(CURDIR)/test/container/main.sh run \ diff --git a/deployments/container/native-only.mk b/deployments/container/native-only.mk index 79d7fa99..38ef9009 100644 --- a/deployments/container/native-only.mk +++ b/deployments/container/native-only.mk @@ -23,11 +23,3 @@ $(BUILD_TARGETS): build-%: image-% else $(BUILD_TARGETS): build-%: image-% endif - -# For the default distribution we also retag the image. -# Note: This needs to be updated for multi-arch images. -ifeq ($(IMAGE_TAG),$(VERSION)-$(DIST)) -$(DEFAULT_PUSH_TARGET): - $(DOCKER) image inspect $(IMAGE) > /dev/null || $(DOCKER) pull $(IMAGE) - $(DOCKER) tag $(IMAGE) $(subst :$(IMAGE_TAG),:$(VERSION),$(IMAGE)) -endif