Skip to content

Instantly share code, notes, and snippets.

@jglick
Last active January 27, 2023 07:06
Show Gist options
  • Save jglick/0a85759ea65f60e107ac5a85a5032cae to your computer and use it in GitHub Desktop.
Save jglick/0a85759ea65f60e107ac5a85a5032cae to your computer and use it in GitHub Desktop.
#!/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'
@dwnusbaum
Copy link

dwnusbaum commented Feb 1, 2019

Negative indices to head aren't supported on macOS (BSD head), so I used update-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.

@jglick
Copy link
Author

jglick commented Sep 1, 2021

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