fix: clean up RC tags for custom tag prefixes on publish#190
Merged
Conversation
Signed-off-by: Joshua Temple <joshua.temple@stablekernel.com>
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.
Problem
When an rc is promoted to a full release,
publish()callscleanupRCTags()to delete the superseded RC git tags.parseRCTaghardcoded thevprefix (^(v\d+\.\d+\.\d+)-rc\.(\d+)$), so a repo using a customtag_prefix(e.g.rel-) produced RC tags likerel-0.1.0-rc.0that failed the regex. Cleanup skipped them, leaving stale RC tags after publish.Fix
parseRCTag/isRCTagare now prefix-aware. The base-version capture includes the prefix (^(.*\d+\.\d+\.\d+)-rc\.(\d+)$), so the value compares directly against the published release tag without reconstructing the prefix. The defaultv, custom prefixes (rel-,release/), and the empty prefix all parse. The$anchor keeps hotfix-shaped tags (...-rc.N.hotfix.M) inert, and cleanup still only deletes RC tags whose prefixed base matches the published version.Verification
TestParseRCTagextended with custom-prefix, empty-prefix, hotfix, and non-numeric cases.TestManager_Publish_CustomTagPrefix: publishingrel-0.1.0deletesrel-0.1.0-rc.0/1, whilerel-0.2.0-rc.0(different base) andv0.1.0-rc.0(different prefix) survive.go build ./... && go test ./... && golangci-lint run ./...green.The RC git-tag cleanup path is GitHub-only (gated by
isGitHubHost); the Gitea e2e backend lacks the git-data refs API, so a Gitea e2e scenario would not exercise it. Coverage is the targeted unit test plus the real-GitHub validation fleet.