2018-01-08 22:38:54 +00:00
|
|
|
#!/bin/bash
|
|
|
|
set -euo pipefail
|
|
|
|
|
|
|
|
HOST_OS=$(uname -s)
|
|
|
|
|
|
|
|
### ---- ###
|
|
|
|
|
|
|
|
echo "Switch back to master"
|
|
|
|
git checkout master
|
|
|
|
git reset --hard origin/master
|
|
|
|
|
|
|
|
### ---- ###
|
|
|
|
|
|
|
|
if ! [ -e jq ]; then
|
2019-03-18 19:33:58 +00:00
|
|
|
echo "Loading local copy of jq-1.5"
|
|
|
|
|
|
|
|
case ${HOST_OS} in
|
|
|
|
Linux)
|
|
|
|
curl -sSLo ./jq https://github.com/stedolan/jq/releases/download/jq-1.5/jq-linux64
|
|
|
|
;;
|
|
|
|
Darwin)
|
|
|
|
curl -sSLo ./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
|
2018-01-08 22:38:54 +00:00
|
|
|
fi
|
|
|
|
|
|
|
|
### ---- ###
|
|
|
|
|
|
|
|
echo "Fetching latest version number of awscli"
|
|
|
|
|
|
|
|
CURATOR_VERSION=$(curl -sSL https://pypi.python.org/pypi/elasticsearch-curator/json | ./jq -r .info.version)
|
|
|
|
|
2019-03-18 19:33:58 +00:00
|
|
|
if (git tag -l ${CURATOR_VERSION} | grep -q ${CURATOR_VERSION}); then
|
|
|
|
echo "/!\\ Already got a tag for version ${CURATOR_VERSION}, stopping now"
|
|
|
|
exit 0
|
2018-01-08 22:38:54 +00:00
|
|
|
fi
|
|
|
|
|
|
|
|
echo "Writing requirements.txt"
|
2019-03-18 19:33:58 +00:00
|
|
|
echo "elasticsearch-curator==${CURATOR_VERSION}" >requirements.txt
|
2019-03-18 19:33:30 +00:00
|
|
|
echo "PyYAML==3.13" >>requirements.txt # Temp. fix for https://github.com/elastic/curator/issues/1368
|
2018-01-08 22:38:54 +00:00
|
|
|
|
|
|
|
### ---- ###
|
|
|
|
|
|
|
|
echo "Testing build..."
|
|
|
|
docker build .
|
|
|
|
|
|
|
|
### ---- ###
|
|
|
|
|
|
|
|
echo "Updating repository..."
|
|
|
|
git add requirements.txt
|
|
|
|
git -c user.name='Travis Automated Update' -c user.email='travis@luzifer.io' \
|
2019-03-18 19:33:58 +00:00
|
|
|
commit -m "elasticsearch-curator ${CURATOR_VERSION}"
|
2018-01-08 22:38:54 +00:00
|
|
|
git tag ${CURATOR_VERSION}
|
|
|
|
|
|
|
|
git push -q https://auth:${GH_TOKEN}@github.com/luzifer-docker/curator master --tags
|