Retrieving latest release metadata from osctrl.net in osctrl-admin#785
Retrieving latest release metadata from osctrl.net in osctrl-admin#785
osctrl-admin#785Conversation
There was a problem hiding this comment.
Pull request overview
This PR adds a mechanism in osctrl-admin to fetch release metadata from a remote JSON endpoint and compare it against the running version to notify operators about newer releases.
Changes:
- Introduces
pkg/version.VersionData,RetrieveVersionData(), andCheckSuggestedRelease()for remote version metadata + comparison. - Updates
osctrl-adminstartup to call the version check and log release/update information. - Adds/updates unit tests around version constants/URL/JSON tags and adds
golang.org/x/moddependency.
Reviewed changes
Copilot reviewed 4 out of 6 changed files in this pull request and generated 7 comments.
Show a summary per file
| File | Description |
|---|---|
| pkg/version/version.go | Adds remote version metadata retrieval and a semver-based comparison helper. |
| pkg/version/version_test.go | Replaces fixed version assertions with validation tests for constants/URL and JSON tags. |
| cmd/admin/main.go | Calls the new version-check logic at service startup and logs results. |
| go.mod | Adds golang.org/x/mod dependency for semver comparison. |
| go.sum | Records checksums for the new module dependency. |
| .gitignore | Ignores a local version_data.json file. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| if version.CheckSuggestedRelease(latest.SuggestedRelease) { | ||
| log.Info().Msgf("A newer version of %s is available: %s (current: %s)", serviceName, latest.SuggestedRelease, buildVersion) | ||
| log.Info().Msgf("Release notes: %s", latest.MoreInformation) | ||
| } else { | ||
| log.Info().Msgf("%s is up to date with the latest release (%s)", serviceName, buildVersion) | ||
| } |
There was a problem hiding this comment.
The condition is inverted relative to the message: CheckSuggestedRelease returns true when the current version is equal/newer than the suggested release, but the log says “A newer version ... is available”. Either invert the if condition or change CheckSuggestedRelease semantics/name so that true means an update is available.
Metadata for latest release retrieved from osctrl.net to make sure stable version is used.