fix(scripts): exclude RC tags from dogfood version resolution#24175
fix(scripts): exclude RC tags from dogfood version resolution#24175
Conversation
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
left a comment
There was a problem hiding this comment.
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
scripts/should_deploy.sh
Outdated
| # 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 |
There was a problem hiding this comment.
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
fiThis 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.
scripts/should_deploy.sh
Outdated
| # 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" |
There was a problem hiding this comment.
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.
scripts/should_deploy.sh
Outdated
| log "Branch '$branch' is the frozen release branch" | ||
| deploy_branch=$branch | ||
| break | ||
| done |
There was a problem hiding this comment.
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"
fiAddress 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.
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.
Closing — the real fix is a process change: push an RC tag when cutting the release branch, then fix
version.shto use the nearest ancestor tag instead of the global latest. Will be addressed in a follow-up PR on top of #24167.