Hub: Notify for new version

Created on 24 Apr 2019  ·  18Comments  ·  Source: github/hub

I would like hub to notify me for newer versions of itself.

feature

Most helpful comment

Please note that as a Linux distribution packager I very much expect that the warning can be disabled. Many users are downloading hub from the distribution package manager and thus do not want to be notified about upstream releases -- they only wish to be notified, by their package manager, of new distro releases. (I try to update hub roughly as soon as it comes out, anyway.)

Some distributions like Debian may have inviolable rules against software unexpectedly connecting to the internet just to provide messages about version updates they don't expect users to get from elsewhere, and will either not package the software at all, or provide downstream patches that disable it before allowing a package.

All 18 comments

That's not a bad idea. We used to have hub automatically checking for newer versions and even updating itself in-place, but this code was removed since it proved to be difficult to maintain d400838ecf7653923713b4c3a84dd625c5b5ce7a

I guess it would be way easier to implement just checking and have the user handle the upgrade once they know there is a newer version available.

@mightyiam @mislav

Is this what you have in mind?

```$terraform version
Terraform v0.11.7

Your version of Terraform is out of date! The latest version
is 0.11.10. You can update by downloading from www.terraform.io/downloads.html
```

@RajatVaryani that looks good to me, except that I would include the protocol in the URL. To use the same example, https://www.terraform.io/downloads.html.

@mislav I would like to raise a PR if you agree.

@mightyiam Noted.

@RajatVaryani I would be interested in seeing a PR for this feature, thank you!

Some notes:

  • People will need a way to opt out of automatic update prompts. Some people will not want to update right now or they installed hub via their package manager and they want to upgrade only when an update is available through their package manager.
  • Automatic update checks should not ever execute in CI environments. Those can be detected by looking at environment flags, e.g. if CI or TRAVIS is set. Example: https://github.com/watson/ci-info/blob/3141158a4f82772732bc5626d79621413cac6d41/index.js#L52-L56
  • How often should checks for a newer version be performed? Perhaps once a day/once a week?

@mislav I had other thing in mind. Whenever hub version is run then only message will be prompted to upgrade if a newer version is available.

@RajatVaryani I'd like it to check and tell me, no matter what command I happen to run. Similar to how this behaves: https://www.npmjs.com/package/update-notifier.

@mightyiam I agree with you.

The answer how often should we check depends on the release frequency. After checking I see that we usually release after a week. So let's keep the check once in a week. The only way I can think of communicating the user how to turn off auto update is in the update message itself. And how to turn off auto update is another question?(Maybe another command) Wdyt? @mightyiam @mislav

How about not allowing to turn it off? Except for CI environments, where it would be off. How many would actually turn it off?

@mightyiam Few people might find it annoying to see the message in every command and not able to do anything except updating.

@RajatVaryani yes, I agree. I wouldn't put in the extra code for that case. My attitude would be "they should update". And that connects to the question of how easy it is to update. Which is the matter of distribution. For Linux, I feel it should be addressed with #1754. If you feel like putting in the extra code to allow people to use the latest version without messages in their terminal... Go ahead. I could argue, though, that having these notifications might decrease the number of new issues opened in the bug tracker for things that have been resolved in the latest version, already.

@mightyiam Point taken. I am slightly inclined towards what you are saying. Just want to understand @mislav thought's on this.

I agree that any hub command could check for updates (not just hub version) and notify you of a newer version available. The user should not see this notice more than once a week, though. Plus, the notice should always come with instructions like: “If you want to turn off automatic check for updates, set HUB_VERSION_CHECK=off in your environment”. Additionally, hub's build system should support setting a flag that disables automatic checks completely in the built binary in case someone wishes to compile hub in a way that this is turned off by default. Something like:

go build -ldflags "-X github.com/github/hub/version.Check=false"

Do all of these things sound like a good idea?

I want to be extremely careful with making this feature because it has the potential to annoy users if done badly, and I want us to provide them only with helpful information and then get out of their way while they're doing daily work with hub.

@mislav It does. I will start implementing.

Please note that as a Linux distribution packager I very much expect that the warning can be disabled. Many users are downloading hub from the distribution package manager and thus do not want to be notified about upstream releases -- they only wish to be notified, by their package manager, of new distro releases. (I try to update hub roughly as soon as it comes out, anyway.)

Some distributions like Debian may have inviolable rules against software unexpectedly connecting to the internet just to provide messages about version updates they don't expect users to get from elsewhere, and will either not package the software at all, or provide downstream patches that disable it before allowing a package.

@eli-schwartz Fully agreed. Automatic version checks should be enabled/disabled via a build flag, so that people who are packaging hub can disable it completely. I'm just pondering now whether it should be enabled or disabled by default when someone runs make and doesn't specify any extra build flags/environment variables. Thoughts?

The question is do you want people who build it themselves, by checking out the hub repository and running make, to receive notifications which would tell them that they should get the latest version and rebuild. Distro packagers can certainly set the flag to disable it, and official releases can certainly set the flag to enable it, but which category would you assign for the remaining people?

Was this page helpful?
0 / 5 - 0 ratings

Related issues

segevfiner picture segevfiner  ·  4Comments

kentcdodds picture kentcdodds  ·  4Comments

cbeams picture cbeams  ·  4Comments

xxmyjk picture xxmyjk  ·  4Comments

kurko picture kurko  ·  4Comments