Skip to content
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

Merged
merged 1 commit into from
Apr 27, 2022

Conversation

josephschorr
Copy link
Member

Can be disabled with the skip-release-check flag/env var

@josephschorr josephschorr requested a review from a team as a code owner April 26, 2022 23:00
@github-actions github-actions bot added area/CLI Affects the command line area/dependencies Affects dependencies area/tooling Affects the dev or user toolchain (e.g. tests, ci, build tools) labels Apr 26, 2022
client := github.NewClient(nil)
var current *Release

// Load the releases from GitHub in a paginated fashion (to not overwhelm the API).
Copy link
Contributor

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

Copy link
Member Author

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?

Copy link
Member Author

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

@josephschorr josephschorr force-pushed the release-check branch 2 times, most recently from ceae81c to 6d79eac Compare April 27, 2022 15:40
)

func TestReleases(t *testing.T) {
release, err := GetLatestRelease(context.Background())
Copy link
Contributor

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.

Copy link
Member Author

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

Copy link
Contributor

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!

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Updated

Can be disabled with the `skip-release-check` flag/env var
Copy link
Contributor

@vroldanbet vroldanbet left a 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! 🙇🏻

@josephschorr josephschorr merged commit 57a215c into authzed:main Apr 27, 2022
@github-actions github-actions bot locked and limited conversation to collaborators Apr 27, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
area/CLI Affects the command line area/dependencies Affects dependencies area/tooling Affects the dev or user toolchain (e.g. tests, ci, build tools)
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants