fix(upgrade.sh): main.yaml sed regex handles semver pre-release tags#128
Merged
Conversation
The prior `[0-9.]*` character class stopped at the first `-`, so upgrading from an existing RC tag left the old suffix in place and produced nonsense like `@v0.10.0-rc2-rc1`. ros1_bridge surfaced this when running `./template/upgrade.sh v0.10.0-rc2` from a v0.9.13 pin and manually un-gluing the double suffix before the PR could go green. Fix: anchor the regex on full semver shape per §9: @v\d+\.\d+\.\d+(-[0-9A-Za-z.-]+)? Two regression tests added: - RC → RC (e.g. v0.10.0-rc1 → v0.10.0-rc2; must not produce -rc2-rc1 or -rc2-rc) - RC → stable (e.g. v0.10.0-rc2 → v0.10.0; plus a mixed starting state with v0.9.9 on release-worker; must strip `rc2` from the file entirely) 675 → 677 tests.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Closes #61.
upgrade.shline 191-192 used[0-9.]*character class to match the existing@vX.Y.Zreference, which stops at the first non-[0-9.]character. Upgrading from an existing RC tag therefore left the old-rcNsuffix in place and appended the new version after it:ros1_bridge surfaced this when running
./template/upgrade.sh v0.10.0-rc2from@v0.9.13— the RC bump produced@v0.10.0-rc2-rc2and the PR had to manually unglue it before CI could go green.Fix
Regex anchored on full semver shape per §9:
Same change for release-worker.
Tests
Two regression tests in
template_spec.bats:upgrade.sh main.yaml sed handles semver pre-release tags (RC → RC)—@v0.10.0-rc1→@v0.10.0-rc2, asserts no-rc2-rcdouble suffix remains.upgrade.sh main.yaml sed handles stable → stable + RC → stable transitions— mixed@v0.10.0-rc2+@v0.9.9→@v0.10.0, assertsrc2is gone everywhere.675 → 677 total.
Test plan
make -f Makefile.ci testlocal — 677/677 pass