chore(make): split version.mk into vendorable core#5656
Merged
norman-abramovitz merged 1 commit intoJul 19, 2026
Merged
Conversation
version.mk is now a generic, repo-agnostic library that other repos can vendor unchanged: semver parse/reassembly from overridable parts, a VERSION_CMD source hook defaulting to nearest-tag-plus-one (next release), soft 0.0.0-unknown fallback with a testable SEMVER_VALID flag, zulu BUILD_DATE plus a semver-buildmeta-safe compact form and a BUILD_TZ-controlled local/forced-zone variant, and a dump recipe with a dump.version.extra extension hook. Stratos specifics move to a version block in the Makefile: the package.json VERSION_CMD, node/tsc/bun tool stamps, jetstream GO_LDFLAGS symbol map, build-info.ts path and stamp.frontend recipe, and the GO_LDFLAGS dump line. Validated against the intended consumers: byte-identical semver output for Stratos (dump/stamp/build differ only by timestamp and the zulu BUILD_VCS_ID_DATE), and the core resolves next-patch versions from tags in cfc-toolbelt-boshrelease (4.0.1->4.0.2) and cfc-cf-targets-plugin (2.2.0->2.2.1) with plain names via _HIDE=, part overrides, meta-only versions, and no-git soft fallback. Closes cloudfoundry#5652
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
version.mk previously mixed reusable semver/build-metadata logic with
Stratos-specific configuration, which blocked dropping the file into
other repos (one already carries an unused verbatim copy for exactly
this reason).
The file is now a generic, vendorable core:
VERSION_CMDhook. The default resolves thenearest git tag, strips a leading
v, and increments the patchnumber ("the next release") — the behavior several candidate consumer
repos already implement inline. Stratos overrides it with its
package.json read.
SEMVER_MAJOR/MINOR/PATCH/PRERELEASE/BUILDMETA) areindividually overridable (
?=), andSEMVER_VERSIONis reassembledfrom them, preserving any leading
vbyte-for-byte. This also fixesa latent parse bug:
1.2.3+meta(build metadata without prerelease)previously corrupted the patch field.
0.0.0-unknownandleave a
SEMVER_VALIDflag empty, so a repo that wants a hard errorcan test the flag with one line.
BUILD_DATEis canonical zulu; newBUILD_DATE_SEMVERis the sameinstant in a colon-free form legal inside semver build-metadata
identifiers; new
BUILD_DATE_TZcarries builder-local time, or aforced zone via
BUILD_TZ.dump.versiongains adump.version.extrahook so the includingMakefile can append its own lines.
_HIDEprefix convention and the lazy-vs-immediate evaluationnotes (bump/build chaining) survive. A repo preferring plain variable
names sets
_HIDE :=(empty) before the include.Stratos-specific pieces move to a version block in the Makefile:
the package.json
VERSION_CMD, node/tsc/bun tool-version stamps, thejetstream
GO_LDFLAGSsymbol map, the build-info.ts path with thestamp.frontendrecipe, and theGO_LDFLAGSdump line.Verification:
make dump version,make -n stamp frontend, andmake -n build backendoutputs differ from the pre-change baselineonly by timestamps, the new fields, and
BUILD_VCS_ID_DATEnow beingzulu. The core was exercised as-is from two external repos (a BOSH
release repo and a cf CLI plugin repo): next-patch tag resolution
(4.0.1→4.0.2, 2.2.0→2.2.1), plain-name mode, per-part overrides,
meta-only versions, and the no-git soft fallback all behave. Full
check gate passes (frontend 3135 tests, backend suites green).
Closes #5652