1313ORG_NAME = rsyslog
1414
1515# Default version for all images.
16- # This can be overridden via command line: 'make VERSION=my-custom-tag <target>'
17- VERSION ?= 2025-10
16+ # Keep the default obviously non-release so local `make all` does not produce
17+ # release-like tags by accident.
18+ DEFAULT_VERSION = dev-local
19+ # Override on the command line for release rehearsals, for example:
20+ # make all VERSION=2026-03
21+ VERSION ?= $(DEFAULT_VERSION )
1822
1923# Default OCI metadata values for local builds.
2024BUILD_DATE ?= $(shell date -u +% Y-% m-% dT% H:% M:% SZ)
@@ -59,7 +63,7 @@ ETL_IMAGE_TAG = $(strip $(ETL_IMAGE_NAME):$(VERSION))
5963 minimal standard collector dockerlogs etl \
6064 build_minimal_image build_standard_image build_collector_image build_dockerlogs_image build_etl_image \
6165 push_minimal push_standard push_collector push_dockerlogs push_etl \
62- rebuild_all
66+ rebuild_all check_publish_version
6367
6468# Default target: Builds all functional images.
6569# Assumed layering: minimal -> standard -> (collector, dockerlogs, etl)
@@ -153,24 +157,36 @@ build: all
153157rebuild_all :
154158 $(MAKE ) all REBUILD=yes
155159
160+ # Publishing must always use an explicit non-development version. This keeps
161+ # local smoke builds and CI validation tags from being pushed by mistake.
162+ check_publish_version :
163+ @case " $( VERSION) " in \
164+ " " | $(DEFAULT_VERSION ) | dev-* | ci-* ) \
165+ echo " ERROR: publish/tag targets require an explicit stable VERSION." ; \
166+ echo " Set VERSION to a release tag, for example: make VERSION=2026-03 all_push" ; \
167+ exit 1 ;; \
168+ * ) \
169+ echo " Using publishable VERSION=$( VERSION) " ;; \
170+ esac
171+
156172# --- Push Targets ---
157- push_minimal : build_minimal_image
173+ push_minimal : check_publish_version build_minimal_image
158174 @echo " --- Pushing minimal image: $( MINIMAL_IMAGE_TAG) ---"
159175 docker push $(MINIMAL_IMAGE_TAG )
160176
161- push_standard : build_standard_image
177+ push_standard : check_publish_version build_standard_image
162178 @echo " --- Pushing standard image: $( STANDARD_IMAGE_TAG) ---"
163179 docker push $(STANDARD_IMAGE_TAG )
164180
165- push_collector : build_collector_image
181+ push_collector : check_publish_version build_collector_image
166182 @echo " --- Pushing collector image: $( COLLECTOR_IMAGE_TAG) ---"
167183 docker push $(COLLECTOR_IMAGE_TAG )
168184
169- push_dockerlogs : build_dockerlogs_image
185+ push_dockerlogs : check_publish_version build_dockerlogs_image
170186 @echo " --- Pushing dockerlogs image: $( DOCKERLOGS_IMAGE_TAG) ---"
171187 docker push $(DOCKERLOGS_IMAGE_TAG )
172188
173- push_etl : build_etl_image
189+ push_etl : check_publish_version build_etl_image
174190 @echo " --- Pushing ETL image: $( ETL_IMAGE_TAG) ---"
175191 docker push $(ETL_IMAGE_TAG )
176192
@@ -179,7 +195,7 @@ all_push: push_minimal push_standard push_collector push_dockerlogs push_etl
179195
180196# --- Tagging Targets ---
181197# Ensures all images are built before attempting to tag them.
182- tag_latest : build_minimal_image build_standard_image build_collector_image build_dockerlogs_image build_etl_image
198+ tag_latest : check_publish_version build_minimal_image build_standard_image build_collector_image build_dockerlogs_image build_etl_image
183199 @echo " --- Tagging images with 'latest' ---"
184200 docker tag $(STANDARD_IMAGE_TAG ) $(STANDARD_IMAGE_NAME ) :latest
185201 docker tag $(MINIMAL_IMAGE_TAG ) $(MINIMAL_IMAGE_NAME ) :latest
@@ -234,12 +250,14 @@ help:
234250 @echo " Variables:"
235251 @echo " VERSION - Override the default version (e.g., make VERSION=custom all)."
236252 @echo " Current default: $( VERSION) "
253+ @echo " The default is intentionally non-release for local builds."
254+ @echo " Publish/tag targets reject development-like values."
237255 @echo " REBUILD - Set to 'yes' to force a full rebuild, bypassing Docker build cache."
238256 @echo " Example: make all REBUILD=yes"
239257 @echo " "
240258 @echo " Example Workflow:"
241- @echo " 1. Build a specific image : make standard "
242- @echo " 2. Build all images : make all"
259+ @echo " 1. Local smoke build : make all "
260+ @echo " 2. Local release rehearsal : make VERSION=2026-03 all"
243261 @echo " 3. Force a full rebuild of all images: make rebuild_all"
244- @echo " 4. Push all versioned images: make all_push"
245- @echo " 5. Tag and push latest for all : make push_latest"
262+ @echo " 4. Push all release-tagged images: make VERSION=2026-03 all_push"
263+ @echo " 5. Tag and push latest for a release build : make VERSION=2026-03 push_latest"
0 commit comments