Skip to content

feat(version-file): follow release branches - #328

Merged
Automaat merged 4 commits into
kumahq:mainfrom
Automaat:feat/version-file-follow-release-branches
Oct 7, 2026
Merged

Automaat merged 4 commits into
kumahq:mainfrom
Automaat:feat/version-file-follow-release-branches

Conversation

@Automaat

@Automaat Automaat commented Oct 6, 2026

Copy link
Copy Markdown
Contributor

Motivation

kumahq/kuma and Kong/kong-mesh are releasing 3.0 (release-3.0 cut from master), but every release automation still computes the next version as 2.15: version-file derives the dev/preview entry from latestReleased.IncMinor() (2.14.5 → 2.15.x) and --active-branches only lists branches that already have a published release line, so release-3.0 is invisible for the whole branch-cut→publish cycle. Consumers (release-issue automations, backport workflows, docs dev label) all read these generated files.

Implementation information

  • GQLClient.ReleaseBranches lists repo branches via the REST API (paginated).
  • assembleVersions (extracted, unit-tested) detects the newest release-X.Y branch ahead of every published release line. When one exists, the preview entry's Release comes from that branch (3.0.x) and --active-branches includes it before the default branch. Without one, output is unchanged (preview = latest+1).
  • The comparison base is built from published releases only, so a draft release being prepared no longer masks its own release branch.
  • Draft-only release lines are now skipped instead of emitted as date-less entries; without this the draft line collided with the branch-derived preview (release: 3.0.x twice, release-3.0 twice in active-branches).
  • The branch lookup is advisory: on API failure the regeneration falls back to the release-only output instead of failing the daily cron.
  • Repos with zero published releases now get a clean error instead of an index-out-of-range panic.
  • Verified live: kumahq/kuma and Kong/kong-mesh now emit release: 3.0.x and list release-3.0 in baseBranchPatterns; byte-identical output on a control repo without release branches; branch pagination exercised (>100 branches on both).

Unsettled question from review: only the single newest unreleased branch is included. If two release branches exist with no published release (e.g. release-3.1 cut before 3.0.0 ships), the older one stays invisible. Not observed in practice; happy to extend if wanted.

Changelog: feat(version-file): derive dev version and active branches from release branches

Supporting documentation

  • kumahq/kuma versions.yml daily regeneration: .github/workflows/release.yaml (release-tool version-file)
  • Consumer computing 2.15: Kong/team-mesh pkg/release/version.go MinorReleaseVersions

version-file derived the dev/preview entry and the active branch list
purely from published GitHub releases, so during a branch-cut-to-publish
cycle every consumer saw latest+1: kuma releasing 3.0 still reported the
next version as 2.15 and release-3.0 stayed invisible to backport and
release-issue automations for the whole cycle.

Discover the repo's release-X.Y branches and, when the newest one is
ahead of every published release line, derive the preview release label
and active branches from it. Without such a branch the output is
unchanged.

Signed-off-by: Marcin Skalski <skalskimarcin33@gmail.com>
A draft release for the version being prepared (kong-mesh has one right
now) produced a versions.yml entry that masked its own release branch:
latestReleased parsed the draft's version, the branch compared equal
and was skipped, so the preview fell back to latest+1 exactly in the
window the fix targets. Derive the comparison base from published
releases only, and degrade to the release-only output when the branch
lookup fails instead of failing the daily regeneration.

Signed-off-by: Marcin Skalski <skalskimarcin33@gmail.com>
With a draft for the version being prepared the draft-only line still
built a versions.yml entry whose branch then collided with the newly
detected release branch: active-branches listed release-3.0 twice and
yaml mode emitted two entries claiming release 3.0.x. Skip lines that
have no published release and guard the branch insertion against
duplicates. The core assembly is now a pure function with tests
covering the draft window.

Signed-off-by: Marcin Skalski <skalskimarcin33@gmail.com>
@Automaat
Automaat requested a review from a team as a code owner October 6, 2026 15:03
@Automaat
Automaat requested review from lobkovilya and lukidzi and a balanced review from Copilot and removed request for a team October 6, 2026 15:03

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot review overview

🟡 Changes recommended

Prerelease handling is inconsistent, and malformed release branch versions can panic regeneration.

Review effort: Balanced
Findings: 2 Medium severity

Open (2)
What changed in this PR

Updates version-file generation to follow unreleased release-X.Y branches.

Changes:

  • Derives preview versions and active branches from release branches.
  • Skips draft-only release lines and handles missing published releases.
  • Adds paginated branch discovery and unit tests.
File Description
cmd/​release-tool/​version_file.go Adds branch-aware version assembly.
cmd/​release-tool/​version_file_test.go Tests version and branch selection.
cmd/​internal/​github/​graphql.go Adds paginated branch retrieval.

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

Comment thread cmd/release-tool/version_file.go
Comment thread cmd/release-tool/version_file.go Outdated
A semver-prerelease tag published without GitHub's prerelease flag
slipped into the comparison base, and a branch name whose numeric parts
exceed semver's range panicked the regeneration. Apply the same
semantic-version prerelease check to the comparison base and parse
branch versions with an error return, skipping invalid ones.

Signed-off-by: Marcin Skalski <skalskimarcin33@gmail.com>
@Automaat
Automaat merged commit 06b488b into kumahq:main Oct 7, 2026
9 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants