Repository navigation
Version validation from gh - #642
Merged
Merged
Conversation
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
The main release workflow (
.github/workflows/release.yml) now fails fast if the release tag does not match the software version baked into the code. Previously nothing stopped a release from being tagged with a version that didn't matchSoftwareVersion, so a release could ship with a mismatched version number.As part of this, the
SoftwareVersionconstant and the version-validation helpers were consolidated into a dedicatedlib/version.gofile.Changes
Release validation
cmd/scripts/semverwith an opt-in--check-server-versionflag. When set, in addition to validating that the argument is valid semver, it asserts the version matcheslib.SoftwareVersion.vis optional; build metadata (e.g.+beta) is significant and must match.version mismatch: remember to update the version number in lib/version.go..github/workflows/release.ymlonly. The fiverelease-plugin-*.ymlworkflows are unchanged — they still run plain semver validation, since plugins are versioned independently of the node software.Version constant relocation
SoftwareVersionand the version helpers (IsValidVersion,MatchesSoftwareVersion,normalizeVersion) into a newlib/version.go.lib.MatchesSoftwareVersion(version), which compares against the constant internally so callers don't pass the expected version around.cmd/rpc/server.goand updated all usages tolib.SoftwareVersion:cmd/rpc/query.go,cmd/cli/cli.go,cmd/auto-update/main.go(and dropped its now-unusedcmd/rpcimport).CHANGELOG_development.mdreference to point at the newlib/version.golocation.Tests
TestIsValidVersion/TestNormalizeVersiontolib/version_test.goand addedTestMatchesSoftwareVersion(covers bare/v-prefixed matches, plain mismatch, and build-metadata mismatch).TestRunCheckServerVersionin the semver script tests.Why read the version from
libinstead ofcmd/rpcThe script originally referenced
rpc.SoftwareVersion, but importingcmd/rpcforces the compiler to resolve its//go:embed all:web/explorer/distdirective, which requires the built frontend. That broke the validate step (pattern all:web/explorer/dist: no matching files found). Keeping the version inliblets the script validate it without building the frontend — confirmed viago list -deps, which shows no dependency oncmd/rpcor the web embed.