Use deployment primitives from travis

This commit is contained in:
Guilhem Lettron 2016-11-14 17:41:12 +01:00
parent 68bd24d065
commit 8e4c4f8407
7 changed files with 84 additions and 95 deletions

19
script/deploy-docker.sh Normal file
View file

@ -0,0 +1,19 @@
#!/bin/bash
set -e
if [ -n "$TRAVIS_COMMIT" ]; then
echo "Deploying PR..."
else
echo "Skipping deploy PR"
exit 0
fi
# create docker image containous/traefik
echo "Updating docker containous/traefik image..."
docker login -e $DOCKER_EMAIL -u $DOCKER_USER -p $DOCKER_PASS
docker tag containous/traefik containous/traefik:${TRAVIS_COMMIT}
docker push containous/traefik:${TRAVIS_COMMIT}
docker tag containous/traefik containous/traefik:experimental
docker push containous/traefik:experimental
echo "Deployed"

View file

@ -1,27 +0,0 @@
#!/bin/bash
set -e
if ([ -z "$TRAVIS_TAG" ]) && [ "$TRAVIS_PULL_REQUEST" = "false" ] && [ "$DOCKER_VERSION" = "1.10.1" ]; then
echo "Deploying PR..."
else
echo "Skipping deploy PR"
exit 0
fi
COMMENT=$(git log -1 --pretty=%B)
PR=$(echo $COMMENT | grep -oP "Merge pull request #\K(([0-9]*))(?=.*)")
if [ -z "$PR" ]; then
echo "Unable to get PR number: $PR from: $COMMENT"
exit 0
fi
# create docker image containous/traefik
echo "Updating docker containous/traefik image..."
docker login -e $DOCKER_EMAIL -u $DOCKER_USER -p $DOCKER_PASS
docker tag containous/traefik containous/traefik:pr-${PR}
docker push containous/traefik:pr-${PR}
docker tag containous/traefik containous/traefik:experimental
docker push containous/traefik:experimental
echo "Deployed"

View file

@ -18,37 +18,6 @@ eval "$(ssh-agent -s)"
chmod 600 ~/.ssh/traefik.id_rsa
ssh-add ~/.ssh/traefik.id_rsa
# download github release
echo "Downloading ghr..."
curl -LOs https://github.com/tcnksm/ghr/releases/download/v0.5.0/ghr_v0.5.0_linux_amd64.zip
unzip -q ghr_v0.5.0_linux_amd64.zip
sudo mv ghr /usr/bin/ghr
sudo chmod +x /usr/bin/ghr
# github release and tag
echo "Github release..."
tar cfz dist/traefik-${VERSION}.src.tar.gz --exclude-vcs --exclude dist .
ghr -t $GITHUB_TOKEN -u containous -r traefik ${VERSION} dist/
# update docs.traefik.io
echo "Generating and updating documentation..."
# DOESN'T WORK :'(
# git remote add ssh git@github.com:containous/traefik.git
# mkdocs gh-deploy -m $VERSION -c -r ssh
mkdir site
cd site
git init
git remote add origin git@github.com:containous/traefik.git
git fetch origin
git checkout gh-pages
cd ..
mkdocs build --clean
cd site
git add .
echo $VERSION | git commit --file -
git push -q -f origin gh-pages > /dev/null 2>&1
# update traefik-library-image repo (official Docker image)
echo "Updating traefik-library-imag repo..."
git clone git@github.com:containous/traefik-library-image.git

View file

@ -4,7 +4,7 @@ set -e
export SCRIPTDIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
export DEST=.
TESTFLAGS="${TESTFLAGS} -test.timeout=30m -check.v"
TESTFLAGS="${TESTFLAGS} -test.timeout=9m -check.v"
if [ -n "$VERBOSE" ]; then
TESTFLAGS="${TESTFLAGS} -v"