Add ways to let users verify if new CLI released #1416
Conversation
00e71bf
to
9596a7c
6cc3694
to
2af3de5
Co-authored-by: per1234 <[email protected]>
Co-authored-by: per1234 <[email protected]>
updaterMessageChan <- nil | ||
} | ||
// Starts checking for updates | ||
currentVersion, err := semver.Parse(globals.VersionInfo.VersionString) |
cmaglie
Aug 30, 2021
Member
Is VersionString supposed to be always semver compliant? if yes you can use semver.MustParse
to avoid checking the error
Is VersionString supposed to be always semver compliant? if yes you can use semver.MustParse
to avoid checking the error
silvanocerza
Aug 30, 2021
Author
Contributor
It's not always semver compliant, it can also be git-snapshot
or nightly-<timestamp>
so I can't use semver.MustParse
.
It's not always semver compliant, it can also be git-snapshot
or nightly-<timestamp>
so I can't use semver.MustParse
.
cmaglie
Aug 30, 2021
Member
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.
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.
silvanocerza
Aug 31, 2021
Author
Contributor
I get what you mean but probably would be better if done in a separate PR.
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 { |
cmaglie
Aug 30, 2021
Member
We can make this function return a *semver.Version
(or nil
if fails or not valid semver)
We can make this function return a *semver.Version
(or nil
if fails or not valid semver)
silvanocerza
Aug 30, 2021
Author
Contributor
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. 🤔
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")) |
cmaglie
Aug 30, 2021
Member
Is this URL going to stay? Will it move at some point from arduino.github.io
to arduino.cc/something
?
Is this URL going to stay? Will it move at some point from arduino.github.io
to arduino.cc/something
?
silvanocerza
Aug 30, 2021
Author
Contributor
Ideally we'll change it in the future when the Arduino CLI will be added to https://www.arduino.cc/en/software.
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 | ||
} |
cmaglie
Aug 30, 2021
Member
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)
Suggested change
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
}
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 | |
} |
silvanocerza
Aug 30, 2021
Author
Contributor
I can't, it would fail because globals.VersionInfo.VersionString
can't be parsed as semver.
I can't, it would fail because globals.VersionInfo.VersionString
can't be parsed as semver.
Co-authored-by: Cristian Maglie <[email protected]>
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