Adjust version check to use latestver

Signed-off-by: Knut Ahlers <knut@ahlers.me>
This commit is contained in:
Knut Ahlers 2017-08-29 17:04:15 +02:00
parent e28c6d6951
commit 2d606b320a
Signed by: luzifer
GPG key ID: DC2729FDD34BE99E

View file

@ -13,32 +13,14 @@ git reset --hard origin/master
### ---- ###
if ! [ -e jq ]; then
echo "Loading local copy of jq-1.5"
case ${HOST_OS} in
Linux)
curl -sSLfo ./jq https://github.com/stedolan/jq/releases/download/jq-1.5/jq-linux64
;;
Darwin)
curl -sSLfo ./jq https://github.com/stedolan/jq/releases/download/jq-1.5/jq-osx-amd64
;;
*)
echo "/!\\ Unable to download jq for ${HOST_OS}"
exit 1
;;
esac
chmod +x jq
fi
### ---- ###
echo "Fetching latest version..."
LATEST=$(curl -sSLf https://index.docker.io/v1/repositories/jenkins/tags | ./jq -r '.[].name' | grep "^[0-9]\+\.[0-9]\+\(\.[0-9]\+\)\?$" | sort -Vr | head -n1)
LATEST=$(curl -sSLf 'https://latest.luzifer.io/catalog-api/jenkins/lts.txt?p=version')
echo "Testing pull for jenkins/jenkins:${LATEST}..."
docker pull jenkins/jenkins:${LATEST}
echo "Found version ${LATEST}, patching..."
sed -i "s/^FROM.*$/FROM jenkins:${LATEST}/" Dockerfile
sed -i "s/^FROM.*$/FROM jenkins\/jenkins:${LATEST}/" Dockerfile
echo "Checking for changes..."
git diff --exit-code && exit 0