From b56291f40de36dac75abb80d72c6a9ee60499efc Mon Sep 17 00:00:00 2001 From: Rail Aliiev Date: Fri, 9 May 2025 13:54:11 -0400 Subject: [PATCH] Do not try to bump versions with suffixes This commit adds a check to reject version bumps for modified CRDB versions, e.g. that have "-cloudonly" or other suffixes. --- version.go | 3 +++ version_test.go | 2 ++ 2 files changed, 5 insertions(+) diff --git a/version.go b/version.go index 50d56b6..ea1aa1e 100644 --- a/version.go +++ b/version.go @@ -387,6 +387,9 @@ func (v Version) IncPreRelease() (Version, error) { if !(v.IsPrerelease()) { return Version{}, errors.New("version is not a prerelease") } + if v.phaseSubOrdinal > 0 || v.customOrdinal > 0 { + return Version{}, errors.New("only unmodified CRDB versions are supported") + } nextVersion := Version{ raw: v.raw, phase: v.phase, diff --git a/version_test.go b/version_test.go index 7baa926..fb1dcba 100644 --- a/version_test.go +++ b/version_test.go @@ -704,10 +704,12 @@ func TestIncPreRelease(t *testing.T) { {"v21.2.0-alpha.1", "v21.2.0-alpha.2", false}, {"v21.1.0-beta.3", "v21.1.0-beta.4", false}, {"v21.1.0-rc.3", "v21.1.0-rc.4", false}, + {"v21.1.0-rc.3-cloudonly.1", "", true}, {"v21.1.0-cloudonly.1", "", true}, {"v21.1.0", "", true}, {"v21.1.8", "", true}, {"v26.4.8", "", true}, + {"v26.4.8-cloudonly.1", "", true}, {"v21.1.0-customLabel", "", true}, {"v21.1.0-1-g9cbe7c5281", "", true}, {"v21.1.0-1-g9cbe7c5281-customLabel", "", true},