2017-05-15 06:31:10 +00:00
|
|
|
#!/bin/bash
|
|
|
|
|
|
|
|
set -e
|
|
|
|
set -o pipefail
|
|
|
|
|
|
|
|
HOST_OS=$(uname -s)
|
|
|
|
|
|
|
|
### ---- ###
|
|
|
|
|
|
|
|
echo "Switch back to master"
|
|
|
|
git checkout master
|
|
|
|
git reset --hard origin/master
|
|
|
|
|
|
|
|
### ---- ###
|
|
|
|
|
|
|
|
echo "Fetching latest version..."
|
2017-08-29 15:04:15 +00:00
|
|
|
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}
|
2017-05-15 06:31:10 +00:00
|
|
|
|
|
|
|
echo "Found version ${LATEST}, patching..."
|
2017-08-29 15:04:15 +00:00
|
|
|
sed -i "s/^FROM.*$/FROM jenkins\/jenkins:${LATEST}/" Dockerfile
|
2017-05-15 06:31:10 +00:00
|
|
|
|
|
|
|
echo "Checking for changes..."
|
|
|
|
git diff --exit-code && exit 0
|
|
|
|
|
|
|
|
echo "Testing build..."
|
|
|
|
docker build .
|
|
|
|
|
|
|
|
echo "Updating repository..."
|
|
|
|
git add Dockerfile
|
2017-05-15 06:46:00 +00:00
|
|
|
git -c user.name='Travis Automated Update' -c user.email='travis@luzifer.io' \
|
2017-05-15 06:31:10 +00:00
|
|
|
commit -m "Jenkins ${LATEST}"
|
|
|
|
git tag ${LATEST}
|
|
|
|
|
|
|
|
git push -q https://${GH_USER}:${GH_TOKEN}@github.com/Luzifer/docker-jenkins.git master --tags
|