Skip to content

Commit

Permalink
clusterversion: rework final minted version check
Browse files Browse the repository at this point in the history
Previously this isReleaseBranch could be easily forgotten during the release process leaving
the check disabled.

Now it will fail loudly if the binary version looks like a minted final ensuring we remember to
set it.

Release note: none.

Release justification: low risk, high benefit change to make sure an existing safety check is used.
  • Loading branch information
dt committed Aug 18, 2022
1 parent 04c6a1a commit d1fcec9
Showing 1 changed file with 6 additions and 5 deletions.
11 changes: 6 additions & 5 deletions pkg/clusterversion/cockroach_versions.go
Original file line number Diff line number Diff line change
Expand Up @@ -154,7 +154,7 @@ type Key int
//
//go:generate stringer -type=Key
const (
_ Key = iota - 1 // want first named one to start at zero
invalidVersionKey Key = iota - 1 // want first named one to start at zero

// V21_2 is CockroachDB v21.2. It's used for all v21.2.x patch releases.
V21_2
Expand Down Expand Up @@ -554,11 +554,12 @@ var (
)

func init() {
const isReleaseBranch = false
if isReleaseBranch {
if binaryVersion != ByKey(V21_2) {
panic("unexpected cluster version greater than release's binary version")
if finalVersion > invalidVersionKey {
if binaryVersion != ByKey(finalVersion) {
panic("binary version does not match final version")
}
} else if binaryVersion.Internal == 0 {
panic("a non-upgrade cluster version must be the final version")
}
}

Expand Down

0 comments on commit d1fcec9

Please sign in to comment.