jozu-ai / kitops

Securely share and store AI/ML projects as OCI artifacts in your container registry.
https://KitOps.ml
Apache License 2.0
493 stars 53 forks source link

Show update notifications when a new version of kit is available #418

Closed amisevsk closed 3 months ago

amisevsk commented 4 months ago

Description

Show an update notification in the CLI if a newer version is available on GitHub:

Note: A new version of Kit is available! You are using Kit v0.2.2. The latest version is v0.3.0.
      To see a list of changes, visit https://github.com/jozu-ai/kitops/releases/tag/v0.3.0
      To disable this notification, use 'kit version --show-update-notifications=false'

Notifications can be disabled by running kit version --show-update-notifications=false (use =true to re-enable).

Errors in checking for an update are delegated to debug-level logs and not shown to the user by default.

To test this PR, you will need to build kit with at least -ldflags="-s -w -X kitops/pkg/lib/constants.Version=${version}"

Note: I had to put the enable/disable flag under the version subcommand, as trying to include it in the root command would either not run it or would break the default help text.

Linked issues

Closes #365

amisevsk commented 4 months ago

Is it possible to print the new release note after the output of the command? Is that a better experience?

We could potentially put it in postRun, but in my experience most applications print update notifications at the top before showing you the output you want. We don't want to be intrusive.