@@ -21,8 +21,7 @@ include $(CURDIR)/versions.mk
2121
2222# The Makefile describes the build process for a single CUDA sample: e.g. `vectorAdd`
2323ifeq ($(SAMPLE ) ,)
24- # Use vectorAdd as the default sample
25- SAMPLE := vectorAdd
24+ $(error "SAMPLE is unset")
2625endif
2726LOWER_CASE_SAMPLE := $(shell echo $(SAMPLE ) | tr '[:upper:]' '[:lower:]')
2827
@@ -76,24 +75,11 @@ include $(CURDIR)/deployments/container/multi-arch.mk
7675endif
7776
7877push-% : DIST = $(* )
79- push-short : DIST = $(DEFAULT_PUSH_TARGET )
80- push-sample : DIST = $(DEFAULT_PUSH_TARGET )
81-
82- # For the default push target we also push a short tag equal to the version.
83- # We skip this for the development release
84- DEVEL_RELEASE_IMAGE_VERSION ?= devel
85- PUSH_MULTIPLE_TAGS ?= true
86- PUSH_SAMPLE_ONLY_TAG ?= false
87- ifeq ($(strip $(OUT_IMAGE_VERSION ) ) ,$(DEVEL_RELEASE_IMAGE_VERSION ) )
88- PUSH_MULTIPLE_TAGS = false
89- endif
90- ifeq ($(PUSH_MULTIPLE_TAGS ) ,true)
91- push-$(DEFAULT_PUSH_TARGET ) : push-short
92- # If required we retag and push the image tagged only with the sample name
93- ifeq ($(PUSH_SAMPLE_ONLY_TAG ) ,true)
94- push-$(DEFAULT_PUSH_TARGET ) : push-sample
95- endif
96- endif
78+
79+ # For the default push target we also push a short tag equal to the sample and version.
80+ SHORT_IMAGE_TAG = $(LOWER_CASE_SAMPLE ) -$(OUT_IMAGE_VERSION )
81+ SAMPLE_ONLY_IMAGE_TAG = $(LOWER_CASE_SAMPLE )
82+ push-$(DEFAULT_PUSH_TARGET ) : OUT_IMAGE_ALIASES = $(patsubst % ,$(OUT_IMAGE_NAME ) :% ,$(SHORT_IMAGE_TAG ) $(SAMPLE_ONLY_IMAGE_TAG ) )
9783
9884build-% : DIST = $(* )
9985# For the following samples, we use specific Dockerfiles:
@@ -120,19 +106,11 @@ $(IMAGE_TARGETS): image-%:
120106 -f $(DOCKERFILE ) \
121107 $(CURDIR )
122108
123- # Handle the default build target.
124- .PHONY : build
125- build : $(DEFAULT_PUSH_TARGET )
126- $(DEFAULT_PUSH_TARGET ) : build-$(DEFAULT_PUSH_TARGET )
127- $(DEFAULT_PUSH_TARGET ) : DIST = $(DEFAULT_PUSH_TARGET )
128-
129- REGCTL ?= regctl
130- $(PUSH_TARGETS ) : push-% :
131- $(REGCTL ) \
132- image copy \
133- $(IMAGE ) $(OUT_IMAGE )
134-
135- push-short :
136- $(REGCTL ) \
137- image copy \
138- $(IMAGE ) $(OUT_IMAGE_NAME ) :$(OUT_IMAGE_VERSION )
109+
110+ # If PUSH_ON_BUILD is set
111+ ifeq ($(PUSH_ON_BUILD ) ,true)
112+ $(BUILD_TARGETS ) : build-% : image-%
113+ $(CURDIR ) /hack/publish-images.sh $(IMAGE ) $(OUT_IMAGE ) $(OUT_IMAGE_ALIASES )
114+ else
115+ $(BUILD_TARGETS ) : build-% : image-%
116+ endif
0 commit comments