Skip to content

fix(scripts): exclude RC tags from dogfood version resolution#24175

Closed
f0ssel wants to merge 3 commits intomainfrom
fix/dogfood-skip-rc-branches
Closed

fix(scripts): exclude RC tags from dogfood version resolution#24175
f0ssel wants to merge 3 commits intomainfrom
fix/dogfood-skip-rc-branches

Conversation

@f0ssel
Copy link
Copy Markdown
Member

@f0ssel f0ssel commented Apr 8, 2026

Closing — the real fix is a process change: push an RC tag when cutting the release branch, then fix version.sh to use the nearest ancestor tag instead of the global latest. Will be addressed in a follow-up PR on top of #24167.

Generated by Coder Agents

The should_deploy.sh script picks the latest release/x.y branch and
deploys from it when no v<x.y>.0 tag exists (frozen release). However,
release branches created for RCs (e.g. release/2.33 with only
v2.33.0-rc.1 tags) were incorrectly selected as the deploy branch,
causing dogfood to run RC builds instead of the actual frozen release.

Fix: iterate release branches from latest to earliest, skipping any
branch whose only tags are RCs (v<x.y>.0-rc.*). The first branch with
no .0 tag and no RC tags is the frozen deploy target. If all unfinalised
branches are RC-only, fall through to main.
@f0ssel f0ssel changed the title fix(scripts): skip RC-only release branches in dogfood deploy logic fix(scripts): skip RC-only release branches in dogfood version name logic Apr 8, 2026
Copy link
Copy Markdown
Member Author

@f0ssel f0ssel left a comment

Choose a reason for hiding this comment

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

The iteration approach is well-structured and the per-branch logging makes CI traces easy to follow. A few things to consider: 1 P2, 1 P3, 2 nits.

Generated by Coder Agents

# branch. A release branch is the deploy target if its `.0` tag does not yet
# exist (i.e. the release is in progress / frozen). Release branches that only
# carry RC tags (v<x.y>.0-rc.*) are skipped — they are not considered frozen.
for branch in $(echo "$release_branches" | sort -Vr); do
Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

P2 The RC-tag check couples this deploy logic to a tagging convention that is being retired ("no RC branches moving forward"). Going forward, the git tag -l branch on line 62 is effectively dead code that never triggers — but a future reader has to understand a defunct workflow to reason about correctness.

Consider an approach that doesn't depend on RC tags at all: find the latest released branch (has .0 tag), then check whether the next branch in version order exists:

for branch in $(echo "$release_branches" | sort -Vr); do
	version=${branch#release/}
	if git rev-parse "refs/tags/v${version}.0" >/dev/null 2>&1; then
		latest_released=$branch
		break
	fi
done

if [[ -n "${latest_released:-}" ]]; then
	frozen=$(echo "$release_branches" | grep -A1 "^${latest_released}$" | tail -n1)
	if [[ "$frozen" != "$latest_released" ]]; then
		deploy_branch=$frozen
	fi
fi

This expresses the real invariant directly ("frozen = the branch after the latest released one") rather than inferring it by elimination. No coupling to RC conventions, fewer git calls in the loop, and the logic stays correct whether RC tags exist or not.

Also a nit on this line: $release_branches is already sort -V'd on line 38. tac would be clearer — "same list, reversed" rather than re-sorting.

# No .0 tag. Check if there are RC tags, which would indicate this is
# an RC-only branch that we should skip.
if git tag -l "v${version}.0-rc.*" | grep -q .; then
log "Branch '$branch' only has RC tags, skipping"
Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

Nit Log says "only has RC tags" but the check verifies RC tags exist, not that they're the only tags. Minor wording mismatch — maybe "has RC tags but no final release, skipping" to match the actual condition.

log "Branch '$branch' is the frozen release branch"
deploy_branch=$branch
break
done
Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

P3 When the loop exhausts without finding a frozen branch (every candidate was either released or RC-only), deploy_branch stays main silently. The log on the next line shows the result but not the reason. Adding a message here would help operators triage unexpected main deploys:

done
if [[ "$deploy_branch" == "main" ]]; then
	log "No frozen release branch found, falling back to main"
fi

Address review feedback: instead of checking for RC tags (a
convention being retired), find the latest released branch and
pick the next one in version order as the frozen deploy target.

This expresses the real invariant directly and doesn't couple
to any tagging workflow. Also adds explicit log messages when
no frozen branch is found.
@f0ssel f0ssel changed the title fix(scripts): skip RC-only release branches in dogfood version name logic fix(scripts): use positional logic for dogfood deploy branch selection Apr 9, 2026
The fallback in version.sh uses the globally latest tag by semver to
build the dev version string. When RC tags like v2.33.0-rc.1 exist,
they sort higher than stable tags, causing dev builds to show
v2.33.0-rc.1-devel+sha even on the correct frozen release branch.

Filter out RC tags (v*-rc.*) from the fallback so dev builds are
based on the latest stable version. Falls back to including RCs
if no stable tags exist.
@f0ssel f0ssel changed the title fix(scripts): use positional logic for dogfood deploy branch selection fix(scripts): exclude RC tags from dogfood version resolution Apr 9, 2026
@f0ssel f0ssel closed this Apr 9, 2026
@github-actions github-actions bot locked and limited conversation to collaborators Apr 9, 2026
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant