feat: Pin records which Upstream Version the Rebuild counts against #17

Merged
piscis merged 4 commits from piscis/forgejo-16-implement into main 2026-09-30 14:21:35 +00:00
Owner

Summary

The Pin now records which Upstream Version its Rebuild counts against (ADR 0003). Bumping UPSTREAM_VERSION alone resets the Rebuild to 1, so Renovate never has to touch REBUILD.

 # pin.env
 UPSTREAM_VERSION=v3.2.0
 UPSTREAM_COMMIT=e30bb7e…
 REBUILD=1
+REBUILD_OF=v3.2.0
effective Rebuild = REBUILD  if REBUILD_OF == UPSTREAM_VERSION
                    1        otherwise
TAG = <UPSTREAM_VERSION without "v">-r<effective Rebuild>

make print-tag prints only TAG, so CI (#6, #7) reads the tag from the Makefile instead of repeating the rule. MAKEFLAGS += --no-print-directory keeps make -C <dir> print-tag clean on GNU Make 4.x (explicit -w still prints the directory lines, by request).

Evidence

  • Before: bumping the Upstream Version kept the old Rebuild: v3.3.0 with REBUILD=2 → 3.3.0-r2. There was no target that printed the tag.
    After (local GNU Make 3.81, command-line overrides):
$ make print-tag UPSTREAM_VERSION=v3.2.0 REBUILD=2 REBUILD_OF=v3.2.0
3.2.0-r2
$ make print-tag UPSTREAM_VERSION=v3.3.0 REBUILD=2 REBUILD_OF=v3.2.0
3.3.0-r1
$ make print-tag
3.2.0-r1
$ make -s print-tag
3.2.0-r1
$ [ "$(make print-tag)" = "3.2.0-r1" ] && echo match
match
$ [ "$(make -s print-tag)" = "3.2.0-r1" ] && echo match
match
$ [ "$(make -C . print-tag)" = "3.2.0-r1" ] && echo match
match
$ make help
  help         show available targets
  print-tag    print the Image tag from the Pin, and nothing else (read by CI)
  build        build the Image for every platform in PLATFORMS with buildx
  smoke-test   run scripts/smoke-test.sh against every platform built by `make build`

GNU Make 4.4.1 (alpine container), make -C <dir> print-tag:

without --no-print-directory:      with it:
make: Entering directory '/w'      3.2.0-r1
3.2.0-r1
make: Leaving directory '/w'

make build and make smoke-test (Docker 29.4.0, buildx v0.33.0; build layers came from the local cache):

>> building forgejo-mcp:3.2.0-r1-amd64 (linux/amd64)
#16 naming to docker.io/library/forgejo-mcp:3.2.0-r1-amd64 done
>> building forgejo-mcp:3.2.0-r1-arm64 (linux/arm64)
#16 naming to docker.io/library/forgejo-mcp:3.2.0-r1-arm64 done
smoke-test [linux/amd64]: PASS: 156 tools listed
smoke-test [linux/arm64]: PASS: 156 tools listed

Review follow-up: the match is now an exact ifeq on the stripped values, not $(filter), so malformed values fall back to r1. Before this change the same commands gave 3.2.0-r2 and 3.%-r2:

$ make print-tag 'REBUILD_OF=v3.2.0 v3.3.0' REBUILD=2
3.2.0-r1
$ make print-tag 'UPSTREAM_VERSION=v3.%' REBUILD=2
3.%-r1

I re-ran all the checks above after this change. Same output, and the build and smoke test still pass on both architectures.

Merge Danger

Door: two-way

Only pin.env and the Makefile change. Revert restores the old TAG.

Blast Radius: local-build

Nothing publishes yet. The tag for the current Pin is still 3.2.0-r1. Watch out: a Rebuild that raises REBUILD but forgets REBUILD_OF silently stays at r1. The pin.env comment now spells out both cases: raise REBUILD if REBUILD_OF already matches, otherwise set REBUILD_OF and REBUILD=2. CI's "tag already exists" refusal (ADR 0003) will catch this.

Closes #16

## Summary The Pin now records which Upstream Version its Rebuild counts against (ADR 0003). Bumping `UPSTREAM_VERSION` alone resets the Rebuild to 1, so Renovate never has to touch `REBUILD`. ```diff # pin.env UPSTREAM_VERSION=v3.2.0 UPSTREAM_COMMIT=e30bb7e… REBUILD=1 +REBUILD_OF=v3.2.0 ``` ```text effective Rebuild = REBUILD if REBUILD_OF == UPSTREAM_VERSION 1 otherwise TAG = <UPSTREAM_VERSION without "v">-r<effective Rebuild> ``` `make print-tag` prints only `TAG`, so CI (#6, #7) reads the tag from the Makefile instead of repeating the rule. `MAKEFLAGS += --no-print-directory` keeps `make -C <dir> print-tag` clean on GNU Make 4.x (explicit `-w` still prints the directory lines, by request). ## Evidence - **Before:** bumping the Upstream Version kept the old Rebuild: `v3.3.0` with `REBUILD=2` → `3.3.0-r2`. There was no target that printed the tag. **After** (local GNU Make 3.81, command-line overrides): ```console $ make print-tag UPSTREAM_VERSION=v3.2.0 REBUILD=2 REBUILD_OF=v3.2.0 3.2.0-r2 $ make print-tag UPSTREAM_VERSION=v3.3.0 REBUILD=2 REBUILD_OF=v3.2.0 3.3.0-r1 $ make print-tag 3.2.0-r1 $ make -s print-tag 3.2.0-r1 $ [ "$(make print-tag)" = "3.2.0-r1" ] && echo match match $ [ "$(make -s print-tag)" = "3.2.0-r1" ] && echo match match $ [ "$(make -C . print-tag)" = "3.2.0-r1" ] && echo match match $ make help help show available targets print-tag print the Image tag from the Pin, and nothing else (read by CI) build build the Image for every platform in PLATFORMS with buildx smoke-test run scripts/smoke-test.sh against every platform built by `make build` ``` GNU Make 4.4.1 (alpine container), `make -C <dir> print-tag`: ```console without --no-print-directory: with it: make: Entering directory '/w' 3.2.0-r1 3.2.0-r1 make: Leaving directory '/w' ``` `make build` and `make smoke-test` (Docker 29.4.0, buildx v0.33.0; build layers came from the local cache): ```console >> building forgejo-mcp:3.2.0-r1-amd64 (linux/amd64) #16 naming to docker.io/library/forgejo-mcp:3.2.0-r1-amd64 done >> building forgejo-mcp:3.2.0-r1-arm64 (linux/arm64) #16 naming to docker.io/library/forgejo-mcp:3.2.0-r1-arm64 done smoke-test [linux/amd64]: PASS: 156 tools listed smoke-test [linux/arm64]: PASS: 156 tools listed ``` Review follow-up: the match is now an exact `ifeq` on the stripped values, not `$(filter)`, so malformed values fall back to `r1`. Before this change the same commands gave `3.2.0-r2` and `3.%-r2`: ```console $ make print-tag 'REBUILD_OF=v3.2.0 v3.3.0' REBUILD=2 3.2.0-r1 $ make print-tag 'UPSTREAM_VERSION=v3.%' REBUILD=2 3.%-r1 ``` I re-ran all the checks above after this change. Same output, and the build and smoke test still pass on both architectures. ## Merge Danger **Door:** two-way Only `pin.env` and the Makefile change. Revert restores the old `TAG`. **Blast Radius:** local-build Nothing publishes yet. The tag for the current Pin is still `3.2.0-r1`. Watch out: a Rebuild that raises `REBUILD` but forgets `REBUILD_OF` silently stays at `r1`. The `pin.env` comment now spells out both cases: raise `REBUILD` if `REBUILD_OF` already matches, otherwise set `REBUILD_OF` and `REBUILD=2`. CI's "tag already exists" refusal (ADR 0003) will catch this. Closes #16
piscis merged commit 7c693e88dd into main 2026-09-30 14:21:35 +00:00
Sign in to join this conversation.
No description provided.