collaborationFactory/cplace-asc

Easy detection of version updates for jenkins

Closed this issue · 2 comments

Motivation: a cplace-asc installation on a build server needs of course to check for updates. This is now done with the help of grep, but would fail as soon the message changes.

Suggestion: implement a new command that allows a quiet version check that exits with

  1. 0 if no newer version is found
  2. maybe 2 if a newer version is found (1 is used as default error code if the build fails).

There are some NPM default tools for that. It's not exactly the same, but may cover the same use-cases:

npm outdated -g @cplace/asc will check if a new version is available and if there is it will print out the new version. If no new version is available, it will print nothing.
Could be used as:

if [[ $(npm outdated -g @cplace/asc) ]]; then
    npm install -g @cplace/asc
fi

Alternatively, to get the latest version, you can do npm show @cplace/asc version and compare that with the current installed version cplace-cli --version

Or you could just run npm update -g @cplace/asc which will update to the latest version if a new version is available. (NPM version 2.6.1+ is required, but I'm assuming there is already a way newer version @ jenkins)

Ah, very cool. IMHO this resolves this issue. Thank a lot.