Last active
January 27, 2023 07:06
-
-
Save jglick/0a85759ea65f60e107ac5a85a5032cae to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
PLUGIN=$1 | |
VERSION=$2 | |
UC=$3 | |
if [ -z "$PLUGIN" ] | |
then | |
echo 'Usage: uc-grep short-name [core-version [https://jenkins-updates.cloudbees.com/update-center/envelope-core-mm/]]' | |
exit 1 | |
fi | |
if [ -z "$VERSION" ] | |
then | |
VERSION=2.375.2 | |
fi | |
if [ -z "$UC" ] | |
then | |
UC=https://updates.jenkins-ci.org/ | |
fi | |
curl -sL "${UC}update-center.json?version=$VERSION" | head -n-1 | tail -n+2 | jq -r '.plugins | .["'$PLUGIN'"] | .version' |
update-center.actual.json
is indeed preferable. I have kept the JSONP variant since the CloudBees CI update center does not yet support the JSON URL pattern.
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Negative indices to
head
aren't supported on macOS (BSDhead
), so I usedupdate-center.actual.json
instead which is JSON instead of JSONP and then just deleted| head -n-1 | tail -n+2
, although I'm not sure if there are differences between the files that make that a bad idea.