Repository navigation
[ci] Harden update_tag_in_docs_and_files.sh against silent staleness - #3276
Conversation
#3274 happened because this script's whole-tree sed only matches when LATEST_TAG is the exact string still embedded in the files; once a wrong LATEST_TAG - or anything else - makes it miss, every later release looks for a tag that's never actually there and the chart's default image tags drift forever with no signal anything is wrong. Two changes: - After the rewrite, assert charts/selenium-grid/values.yaml's imageTag and nodesImageTag actually equal NEXT_TAG, and exit 1 with a clear message if not. Verified this both fixes the real catch-up (exit 0, matching #3275) and catches the exact wrong-LATEST_TAG scenario that caused #3274 (exit 1, correct error) when run against a container with real GNU find/sed, matching what CI runs. - Exclude three files from the tag/date sed passes that a real end-to-end run showed getting corrupted instead of fixed: multiple-nodes-platform-version.yaml and its test copy pin per-Chrome-version tags dated independently of the Grid release, and their date collides with the Grid release's date often enough that the bare-date pass was rewriting dates that were never actually built for those browser versions. deploy.yml's only tag-shaped strings are inside one comment narrating this exact past incident by its specific values - every later release's LATEST_TAG eventually matches one of those literals, silently turning the incident report into a false account of itself. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
|
ⓘ Qodo reviews are paused because the subscription is no longer active. Ask your workspace admin to reactivate the subscription to resume reviews. Manage billing |
helm-chart-release.yml only triggers on changes to charts/selenium-grid/Chart.yaml, so the values.yaml fix in this PR would never actually get published as a chart release on its own. Patch bump: existing defaults corrected, no new features, no appVersion change (Grid version is unaffected). Also fix .github/ISSUE_TEMPLATE/bug_report.yml's version placeholder, corrupted by a different sed bug: update_tag_in_docs_and_files.sh's chart-version-bump step uses the chart version as an unescaped sed pattern, so "0.60.0" (dots as regex wildcards) matched a 6-digit substring inside "20260905" and replaced it with "0.61.0", producing "20.61.05". Root-caused; the regex-escaping fix for the script itself is in #3276. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
|
Added one more fix while bumping the chart for #3275 (PR #3275 bumps While checking what a chart-coupled release actually does, found that this script's "bump chart version" step has its own version of the same class of bug:
Fixed by escaping the version string before using it as the sed pattern. Verified by replaying the exact historical scenario that caused the corruption ( |
* [ci] Catch up stale default image tags to 4.51.0-20261010 Fixes #3274. Since the 4.49.0 release, update_tag_in_docs_and_files.sh's whole-tree sed has matched nothing in these 51 files: the old sort-based LATEST_TAG resolution picked 4.48.0-20261010 (lexically highest) instead of the real previous tag 4.48.0-20260905, so the sed found no match and these files were never rewritten. #3254 fixed the resolution (switched to ancestry-based `git describe`), but every release since then searches for the immediately-preceding tag, which is never what's actually still embedded several releases back - so it can't self-heal without a one-time manual catch-up. Ran update_tag_in_docs_and_files.sh 4.48.0-20260905 4.51.0-20261010 locally and reviewed the diff by hand. Reverted four files it touched that shouldn't be in scope: - .github/workflows/deploy.yml: the stale tag appears only inside a comment narrating this exact past incident by its specific values; rewriting it would corrupt the history it's documenting. - charts/selenium-grid/multiple-nodes-platform-version.yaml and tests/charts/ci/multiple-nodes-platform-version-values.yaml: these pin per-Chrome-version image tags (146.0, 145.0, ...), each dated independently of the Grid release cadence. The date-only sed pass matched their "20260905" by coincidence, not because they're stale in the same way - a real fix for these needs its own pass. - tests/ci/test_cleanup_pr_images.py: synthetic example tags in a regex-matching unit test, unrelated to live defaults. Verified the restored tags are real published images (Docker Hub and the GitHub release) before committing. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com> * [ci] Bump chart to 0.62.1 to publish the stale-tag fix helm-chart-release.yml only triggers on changes to charts/selenium-grid/Chart.yaml, so the values.yaml fix in this PR would never actually get published as a chart release on its own. Patch bump: existing defaults corrected, no new features, no appVersion change (Grid version is unaffected). Also fix .github/ISSUE_TEMPLATE/bug_report.yml's version placeholder, corrupted by a different sed bug: update_tag_in_docs_and_files.sh's chart-version-bump step uses the chart version as an unescaped sed pattern, so "0.60.0" (dots as regex wildcards) matched a 6-digit substring inside "20260905" and replaced it with "0.61.0", producing "20.61.05". Root-caused; the regex-escaping fix for the script itself is in #3276. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com> --------- Co-authored-by: Claude Sonnet 5 <noreply@anthropic.com>
Summary
Follow-up to #3274 / #3275. That issue happened because
update_tag_in_docs_and_files.sh's whole-treesed "s/${LATEST_TAG}/${NEXT_TAG}/g"only matches whenLATEST_TAGis the exact string still embedded in the files. Once a wrongLATEST_TAG(or anything else) makes it miss once, every later release searches for a tag that's never actually there, and the chart's default image tags drift silently - for three releases, in this repo's actual history - with nothing in CI to signal it.This hardens the script itself so the same class of bug can't recur unnoticed:
Fail loudly instead of drifting silently. After the rewrite, assert that
charts/selenium-grid/values.yaml'simageTagandnodesImageTagactually equalNEXT_TAG, andexit 1with a clear message if not. I verified this two ways against a real Linux container (GNU find/sed, matching what the GitHub Actions runners use):4.48.0-20260905→4.51.0-20261010, the [ci] Catch up stale default image tags to 4.51.0-20261010 #3275 catch-up) exits0and produces the correct rewrite.LATEST_TAGthat actually caused [🐛 Bug]: Chart values.yaml image tags stuck at 4.48.0-20260905 since 0.60.0 - chart upgrades no longer bring new images #3274 (4.48.0-20261010, the lexically-highest-but-never-shipped tag the old sort-based resolution picked) now exits1with:./charts/selenium-grid/values.yaml's imageTag was not updated to 4.51.0-20261010. LATEST_TAG (4.48.0-20261010) probably doesn't match what's actually in the file - fix it manually before releasing.Previously this scenario exited0and shipped stale defaults silently - that's exactly what happened in production.Stop the sed from corrupting files it shouldn't touch. A full end-to-end run (not just the hand-reviewed [ci] Catch up stale default image tags to 4.51.0-20261010 #3275 catch-up) surfaced two real false-positive targets:
charts/selenium-grid/multiple-nodes-platform-version.yamland its test copytests/charts/ci/multiple-nodes-platform-version-values.yamlpin per-Chrome-version image tags (146.0-<date>,145.0-<date>, ...), dated independently of the Grid release by their own browser-version release process. Their date collides with the Grid release's date often enough that the bare-date pass was rewriting dates that were never actually built for those specific browser versions..github/workflows/deploy.yml's only tag-shaped strings are inside one comment narrating this exact past incident, by its specific tag values (explaining whyLATEST_TAGresolution moved fromgit tag --sorttogit describe). Every later release'sLATEST_TAGeventually matches one of those literals, silently turning the incident report into a false account of its own history - I caught this happening again during testing for [ci] Catch up stale default image tags to 4.51.0-20261010 #3275's catch-up and reverted it there by hand, but the script would keep doing it forever without this exclusion.Test plan
bash -nsyntax check.make lint_format_scripts(shfmt) makes no further changes.ubuntu:24.04container against a throwaway copy of the repo at its pre-[ci] Catch up stale default image tags to 4.51.0-20261010 #3275 (stale) state, with the real previous tag: exits0, matches [ci] Catch up stale default image tags to 4.51.0-20261010 #3275's hand-reviewed result exactly (values.yamlfixed, the three newly-excluded files untouched).1with the new, actionable error.🤖 Generated with Claude Code