-
Notifications
You must be signed in to change notification settings - Fork 246
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add a check on startup for the last released version of SpiceDB #564
Conversation
pkg/releases/releases.go
Outdated
client := github.NewClient(nil) | ||
var current *Release | ||
|
||
// Load the releases from GitHub in a paginated fashion (to not overwhelm the API). |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Did you consider using the API specific to get the latest release instead of iterating over all releases?
https://docs.github.com/en/rest/releases/releases#get-the-latest-release
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
My concern there was if we published a "fix" release; say we're at 1.6.0 and we publish 1.5.7 as a fix afterwards (for 1.5.6). Will GitHub now report 1.5.7 as the "latest" release?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
As discussed, we'll set a policy to ensure if we release a 1.5.7, we also release a 1.6.1, to ensure it is always the latest
ceae81c
to
6d79eac
Compare
) | ||
|
||
func TestReleases(t *testing.T) { | ||
release, err := GetLatestRelease(context.Background()) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think this test is the least interesting bit to test but also puts it at the mercy of GitHub's availability and thus flakes. Plus is not being a great citizen by having all those CI builds hit GitHub. (I get it, GH is already in the critical path for everything, but still...)
I think it would the interesting bits to test IMHO are in CheckAndLogRunE
, since it's the core logic of this functionality. You could mock GetLatestRelease
and test the various scenarios on how the spicedb warns the operator about updates.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That's why its behind a build tag that isn't used in CI; its only there so we can manually run the tests if necessary
I'll add a test with a mocked version for CheckAndLogRunE
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
overlooked that bit! thank you!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Updated
6d79eac
to
752bc7e
Compare
Can be disabled with the `skip-release-check` flag/env var
752bc7e
to
fe9041e
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This looks great, thanks for addressing my comments! 🙇🏻
Can be disabled with the
skip-release-check
flag/env var