Skip to content

Commit 8dbe976

Browse files
committed
fix(helm): fail the appVersion check only when it lags, not on any mismatch
The check compared appVersion to /releases/latest for equality, which races the release it is meant to protect. Version tags are cut by the main-branch merge commit that releases them, so on that commit appVersion legitimately names a release that does not exist yet while ci.yml is still building it. Equality would have rejected the bump and blocked the very publish it was for. helm/sim/ci/kind-values.yaml already documents this circularity, and records it as the reason appVersion went unbumped from chart 1.2.0 to 1.6.3. Lagging is the failure; being ahead is a normal transient. The comparison is `sort -V`, so it orders versions rather than strings -- v0.9.9 against v0.10.0 is exactly where a string compare silently inverts. Verified all five cases: behind fails, equal passes, ahead passes with a notice, and both multi-digit orderings resolve correctly.
1 parent a04715a commit 8dbe976

1 file changed

Lines changed: 18 additions & 5 deletions

File tree

.github/workflows/helm.yml

Lines changed: 18 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -254,10 +254,18 @@ jobs:
254254
# versions are immutable, every stale value is frozen forever. It sat six
255255
# releases behind before this check existed, bumped only by hand.
256256
#
257+
# BEHIND is the failure. AHEAD is normal and must not be blocked: a
258+
# version tag is cut by the main-branch merge commit that releases it
259+
# (detect-version in ci.yml), so appVersion legitimately names a release
260+
# that does not exist yet while that release is still being built. Failing
261+
# on any mismatch would race that workflow and block the very publish the
262+
# bump was for. `helm/sim/ci/kind-values.yaml` documents the same
263+
# circularity, and it is why appVersion went unbumped for so long.
264+
#
257265
# Compares against the latest GitHub release rather than a hardcoded value
258-
# so it cannot go stale itself. Prereleases and drafts are excluded: the
259-
# `/releases/latest` endpoint already returns neither.
260-
- name: appVersion tracks the latest app release
266+
# so the check cannot go stale itself. Prereleases and drafts are excluded:
267+
# the `/releases/latest` endpoint already returns neither.
268+
- name: appVersion does not lag the app release
261269
env:
262270
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
263271
run: |
@@ -268,11 +276,16 @@ jobs:
268276
echo "::error::Could not resolve the latest release; refusing to publish unverified."
269277
exit 1
270278
fi
271-
if [ "$app_version" != "$latest" ]; then
279+
if [ "$app_version" = "$latest" ]; then
280+
echo "appVersion ${app_version} matches the latest release."
281+
exit 0
282+
fi
283+
oldest=$(printf '%s\n%s\n' "$app_version" "$latest" | sort -V | head -1)
284+
if [ "$oldest" = "$app_version" ]; then
272285
echo "::error::Chart.yaml appVersion is ${app_version} but the latest release is ${latest}. Bump appVersion (and the chart version) so the chart does not publish an install pinned to an older Sim."
273286
exit 1
274287
fi
275-
echo "appVersion ${app_version} matches the latest release."
288+
echo "::notice::appVersion ${app_version} is ahead of the latest release ${latest}, which is expected while that release is still being cut."
276289
277290
# Chart versions are immutable once published: whoever pinned a version
278291
# must keep resolving the same bytes forever. The PR gate above already

0 commit comments

Comments
 (0)