Skip to content

Commit 7cd2718

Browse files
authored
Merge pull request rsyslog#6652 from rgerhards/codex-container-version-contract
packaging/docker: define safer image version contract
2 parents 46c4914 + 33f2570 commit 7cd2718

File tree

4 files changed

+99
-13
lines changed

4 files changed

+99
-13
lines changed

.github/workflows/container_build.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,8 @@ jobs:
4343
- name: Build rsyslog container family
4444
# Keep the workflow green for unrelated PRs while still exercising the
4545
# full image family whenever container packaging inputs change.
46+
# CI intentionally uses a non-release `ci-<sha>` tag. Stable release
47+
# workflows must inject their own explicit release version instead.
4648
if: >-
4749
${{ github.event_name == 'workflow_dispatch' ||
4850
steps.container_changes.outputs.any_changed == 'true' }}

AGENTS.md

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,15 @@ Follow these three steps for a typical development task:
3131
- **Metadata**: Every module directory contains `MODULE_METADATA.yaml`.
3232
- **Knowledge Base**: `doc/ai/` contains canonical patterns for RAG ingestion.
3333

34+
## Container Images
35+
36+
- Runtime container definitions live in `packaging/docker/rsyslog`.
37+
- The container Makefile default version must stay clearly non-release.
38+
Use explicit `VERSION=...` values for release-like local rehearsals and for
39+
any publish automation.
40+
- AI agents must not introduce release-looking fallback tags such as
41+
`2026-03` as the default local container build version.
42+
3443
## Context Discovery (Subtree Guides)
3544

3645
Each major subtree contains a specialized `AGENTS.md` that points to area-specific context and requirements:

packaging/docker/rsyslog/Makefile

Lines changed: 31 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -13,8 +13,12 @@
1313
ORG_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.
2024
BUILD_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
153157
rebuild_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"

packaging/docker/rsyslog/README.md

Lines changed: 57 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,57 @@
1+
# rsyslog container image family
2+
3+
This directory contains the build and packaging logic for the rsyslog
4+
container image family:
5+
6+
- `rsyslog/rsyslog-minimal`
7+
- `rsyslog/rsyslog`
8+
- `rsyslog/rsyslog-collector`
9+
- `rsyslog/rsyslog-dockerlogs`
10+
- `rsyslog/rsyslog-etl`
11+
12+
## Version and tag contract
13+
14+
Local builds default to a non-release tag on purpose:
15+
16+
```bash
17+
make all
18+
```
19+
20+
This produces images tagged with `dev-local`. The goal is to keep normal
21+
local builds clearly separate from release artifacts.
22+
23+
Use an explicit version whenever you want to rehearse a release build
24+
locally:
25+
26+
```bash
27+
make all VERSION=2026-03
28+
```
29+
30+
The build system treats `VERSION` as the source of truth for image tags.
31+
Release automation must pass the intended stable version explicitly
32+
instead of relying on the Makefile default.
33+
34+
## Publishing rules
35+
36+
Publish and `latest` tagging targets reject development-style versions:
37+
38+
- empty versions
39+
- `dev-local`
40+
- versions starting with `dev-`
41+
- versions starting with `ci-`
42+
43+
This guard is intentional. It prevents accidental pushes of local or CI
44+
validation builds.
45+
46+
Valid publishing examples:
47+
48+
```bash
49+
make VERSION=2026-03 all_push
50+
make VERSION=2026-03 push_latest
51+
```
52+
53+
## CI guidance
54+
55+
CI validation jobs should use non-release tags such as `ci-<sha>`.
56+
Release publishing jobs should inject the stable release version
57+
explicitly, for example `VERSION=2026-03`.

0 commit comments

Comments
 (0)