semaphoreci / cli

Semaphore 2.0 Command Line Interface
Apache License 2.0
25 stars 13 forks source link

CLI should indicate that a newer version is available #141

Open bmarkons opened 5 years ago

bmarkons commented 5 years ago

This is based on one customer question how to verify if latest version is being used.

We could print some warning message if there is new version available.

markoa commented 5 years ago

Changed the title slightly.

Support team received a number of tickets about orphan SSH sessions and had to refund credits for these cause users are not aware of the latest CLI.

What's good enough IMO:

shiroyasha commented 5 years ago

We have to keep in mind that this has some negative implications as well, especially this part:

* If a newer version is available, add a colorful message at the end of every command's output advising to run `sem upgrade`.

This behavior is present in gcloud, and every time you want to automate something, you need to keep in mind that sometimes the output of the command has undesired side-effect output.


I'm not against the idea, but I would keep an open eye for these edge cases, and made sure that the semaphore CLI offers a pleasant experience for automation (scripting) as well.

shiroyasha commented 5 years ago

From the perspective of scriptability, I would maybe even prefer this flow:

If you have an old CLI:

$ sem get projects
[error] Unsupported client version.

Upgrade your client to the latest version with `sem upgrade`

(exit status 1)

The reason for this is when I am scripting it is easier to foresee that the command flat-out fails than for it to return something unexpected silently without breaking.

Consider the following example, where I want to extract only projects names with a simple awk

$ sem get projects | awk '{ print $1 }' 

It is easier to handle exit 1, then to handle a Notice: your CLI is outdated message at the end of the projects table.