-
Notifications
You must be signed in to change notification settings - Fork 40
New issue
Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? # to your account
Check Regal version at start-up #824
Conversation
cmd/lint.go
Outdated
dir = regalDir.Name() | ||
} | ||
|
||
if userConfig.Features.RemoteFeatures.CheckVersion && |
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.
Config loading is handled in a few places, lint, fix and the lsp, in each place, there are minor differences in when and how the config is loaded. Depending on config for this version check functionality makes it more tightly coupled, and harder to just run anywhere. So not sure, about the config stuff in this PR, but we can remove if we don't like it and just offer the env var.
This adds functionality to the regal LS and lint commands what will check the current version against the latest release in GH. In order to keep the number of requests down, the version is cached to disk in the .regal dir. The task runs in another goroutine to keep things fast too. Config has been updated with a features key, and REGAL_FEATURES_REMOTE_CHECK_VERSION can also be set to disable to functionality. Sharing for review, if we think it looks good, I'll add some docs and we can get this in. Signed-off-by: Charlie Egan <charlie@styra.com>
7a8d7c9
to
0b7db0a
Compare
internal/update/update.rego
Outdated
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.
👏
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.
Change looks good to me! With a few things to consider / discuss.
Also, we'd need some docs on this, right?
Signed-off-by: Charlie Egan <charlie@styra.com>
Signed-off-by: Charlie Egan <charlie@styra.com>
Signed-off-by: Charlie Egan <charlie@styra.com>
Signed-off-by: Charlie Egan <charlie@styra.com>
This is all updated again, I just need to do some docs for it. |
dedd3bb adds the docs. |
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.
Looks great, and the refactoring was very welcome!
There's some build failures. I just realized it might be good to mention this briefly in the README too, and provide a link to the docs page on that! |
Signed-off-by: Charlie Egan <charlie@styra.com>
Have fixed the md lint error and updated readme too. |
* Check Regal version at start-up This adds functionality to the regal LS and lint commands what will check the current version against the latest release in GH. In order to keep the number of requests down, the version is cached to disk in the .regal dir. The task runs in another goroutine to keep things fast too. Config has been updated with a features key, and REGAL_FEATURES_REMOTE_CHECK_VERSION can also be set to disable to functionality. Sharing for review, if we think it looks good, I'll add some docs and we can get this in. Signed-off-by: Charlie Egan <charlie@styra.com> * Share logic for sharing of defaulting config Signed-off-by: Charlie Egan <charlie@styra.com> * Rename var to disable the check version feature Signed-off-by: Charlie Egan <charlie@styra.com> * Use global config dir for version state Signed-off-by: Charlie Egan <charlie@styra.com> * Use shorter var name Signed-off-by: Charlie Egan <charlie@styra.com> * Extract check to func * Add docs Signed-off-by: Charlie Egan <charlie@styra.com> * Set lang in docs Signed-off-by: Charlie Egan <charlie@styra.com> --------- Signed-off-by: Charlie Egan <charlie@styra.com>
This adds functionality to the regal LS and lint commands what will check the current version against the latest release in GH.
In order to keep the number of requests down, the version is cached to disk in the .regal dir. The task runs in another goroutine to keep things fast too.
Config has been updated with a features key, and
REGAL_FEATURES_REMOTE_CHECK_VERSION can also be set to disable to functionality.
Sharing for review, if we think it looks good, I'll add some docs and we can get this in.
Fixes #802