-
-
Notifications
You must be signed in to change notification settings - Fork 398
Add ways to let users verify if new CLI released #1416
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
Conversation
00e71bf
to
9596a7c
Compare
6cc3694
to
2af3de5
Compare
52f32bf
to
f0cab1b
Compare
Co-authored-by: per1234 <[email protected]>
Co-authored-by: per1234 <[email protected]>
f0cab1b
to
78a8ba4
Compare
updaterMessageChan <- nil | ||
} | ||
// Starts checking for updates | ||
currentVersion, err := semver.Parse(globals.VersionInfo.VersionString) |
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.
Is VersionString supposed to be always semver compliant? if yes you can use semver.MustParse
to avoid checking the error
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.
It's not always semver compliant, it can also be git-snapshot
or nightly-<timestamp>
so I can't use semver.MustParse
.
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.
Shouldn't those versions be changed to 0.0.0-git
or 0.0.0-nightly-<timestamp>
?
These non-semver versions plugged in feels "wrong" to me...
Also we already had:
var (
defaultVersionString = "0.0.0-git"
versionString = ""
commit = ""
status = "alpha"
date = ""
tr = i18n.Tr
)
in version.go
IMHO we should follow the same pattern and force semver compliance.
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 get what you mean but probably would be better if done in a separate PR.
|
||
// getLatestRelease queries the official Arduino download server for the latest release, | ||
// if there are no errors or issues a version string is returned, in all other case an empty string. | ||
func getLatestRelease() string { |
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.
We can make this function return a *semver.Version
(or nil
if fails or not valid semver)
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 don't think that would help that much, this getLatestRelease
is only used in checkForUpdate
and there we handle eventual errors in parsing the version string, if I change getLatestRelease
to return a *semver.Version
I'd have to check for the parsing error inside it and handle the nil
version in checkForUpdate
too.
Don't seem much of an improvement to me really. 🤔
color.YellowString(tr("A new release of Arduino CLI is available:")), | ||
color.CyanString(globals.VersionInfo.VersionString), | ||
color.CyanString(latestVersion), | ||
color.YellowString("https://arduino.github.io/arduino-cli/latest/installation/#latest-packages")) |
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.
Is this URL going to stay? Will it move at some point from arduino.github.io
to arduino.cc/something
?
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.
Ideally we'll change it in the future when the Arduino CLI will be added to https://www.arduino.cc/en/software.
if strings.Contains(globals.VersionInfo.VersionString, "git-snapshot") || strings.Contains(globals.VersionInfo.VersionString, "nightly") { | ||
// We're using a development version, no need to check if there's a | ||
// new release available | ||
feedback.Print(globals.VersionInfo) | ||
return | ||
} |
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 don't know if this is sensible here... I'd leave the version
command to always check for the latest version (even in dev builds)
if strings.Contains(globals.VersionInfo.VersionString, "git-snapshot") || strings.Contains(globals.VersionInfo.VersionString, "nightly") { | |
// We're using a development version, no need to check if there's a | |
// new release available | |
feedback.Print(globals.VersionInfo) | |
return | |
} |
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 can't, it would fail because globals.VersionInfo.VersionString
can't be parsed as semver.
Co-authored-by: Cristian Maglie <[email protected]>
5fe844c
to
cf4d75a
Compare
Please check if the PR fulfills these requirements
before creating one)
our contributing guidelines
UPGRADING.md
has been updated with a migration guide (for breaking changes)Adds a new feature and change behaviour of an existing command.
Users are never notified of new releases of the Arduino CLI.
If more than 24 hours have passed since the last check the Arduino CLI verifies if the currently executed version is the latest available, if not it notifies the user that a new release is available. e.g.
The message is printed on the
stderr
output so it won't disrupt existing parsers and the JSON output.This behaviour you can disable it by setting the
updater.disable_notification
config or the env varARDUINO_UPDATER_DISABLE_NOTIFICATION
totrue
.arduino-cli version
command will always force a check for new versions even if the above config or env var are set.titled accordingly?
Nope.
Heavily inspired by https://github.com/cli/cli.
See how to contribute