Use deployment primitives from travis
This commit is contained in:
parent
68bd24d065
commit
8e4c4f8407
7 changed files with 84 additions and 95 deletions
84
.travis.yml
84
.travis.yml
|
@ -1,32 +1,70 @@
|
||||||
branches:
|
sudo: required
|
||||||
|
dist: trusty
|
||||||
|
|
||||||
|
services:
|
||||||
|
- docker
|
||||||
|
|
||||||
env:
|
env:
|
||||||
global:
|
global:
|
||||||
- secure: btt4r13t09gQlHb6gYrvGC2yGCMMHfnp1Mz1RQedc4Mpf/FfT8aE6xmK2a2i9CCvskjrP0t/BFaS4yxIURjnFRn+ugQIEa0pLspB9UJArW/vgOSpIWM9/OQ/fg8z5XuMxN6Md4DL1/iLypMNSageA1x0TRdt89+D1N1dALpg5XRCXLFbC84TLi0gjlFuib9ibPKzEhLT+anCRJ6iZMzeupDSoaCVbAtJMoDvXw4+4AcRZ1+k4MybBLyCib5boaEOt4pTT88mz4Kk0YaMwPVJyg9Qv36VqyUcPS09Yd95LuyVQ4+tZt8Y1ccbIzULsK+sLM3hLCzxlmlpN3dQBlZJiiRtQde0mgGAKyC0P0A1XjuDTywcsa5edB+fTk1Dsewz9xZ9V0NmMz8t+UNZnaSsAPga9i86jULbXUUwMVSzVRc+Xgx02liB/8qI1xYC9FM6ilStt7rn7mF0k3KbiWhcptgeXjO6Lah9FjEKd5w4MXsdUSTi/86rQaLo+kj+XdaTrXCTulKHyRyQEUj+8V1w0oVz7pcGjePHd7y5oU9ByifVQy6sytuFBfRZvugM5bKHo+i0pcWvixrZS42DrzwxZJsspANOvqSe5ifVbvOkfUppQdCBIwptxV5N1b49XPKU3W/w34QJ8xGmKp3TFA7WwVCztriFHjPgiRpB3EG99Bg=
|
- secure: btt4r13t09gQlHb6gYrvGC2yGCMMHfnp1Mz1RQedc4Mpf/FfT8aE6xmK2a2i9CCvskjrP0t/BFaS4yxIURjnFRn+ugQIEa0pLspB9UJArW/vgOSpIWM9/OQ/fg8z5XuMxN6Md4DL1/iLypMNSageA1x0TRdt89+D1N1dALpg5XRCXLFbC84TLi0gjlFuib9ibPKzEhLT+anCRJ6iZMzeupDSoaCVbAtJMoDvXw4+4AcRZ1+k4MybBLyCib5boaEOt4pTT88mz4Kk0YaMwPVJyg9Qv36VqyUcPS09Yd95LuyVQ4+tZt8Y1ccbIzULsK+sLM3hLCzxlmlpN3dQBlZJiiRtQde0mgGAKyC0P0A1XjuDTywcsa5edB+fTk1Dsewz9xZ9V0NmMz8t+UNZnaSsAPga9i86jULbXUUwMVSzVRc+Xgx02liB/8qI1xYC9FM6ilStt7rn7mF0k3KbiWhcptgeXjO6Lah9FjEKd5w4MXsdUSTi/86rQaLo+kj+XdaTrXCTulKHyRyQEUj+8V1w0oVz7pcGjePHd7y5oU9ByifVQy6sytuFBfRZvugM5bKHo+i0pcWvixrZS42DrzwxZJsspANOvqSe5ifVbvOkfUppQdCBIwptxV5N1b49XPKU3W/w34QJ8xGmKp3TFA7WwVCztriFHjPgiRpB3EG99Bg=
|
||||||
- REPO: $TRAVIS_REPO_SLUG
|
- REPO: $TRAVIS_REPO_SLUG
|
||||||
- VERSION: $TRAVIS_TAG
|
- VERSION: $TRAVIS_TAG
|
||||||
- CODENAME: camembert
|
- CODENAME: camembert
|
||||||
matrix:
|
|
||||||
- DOCKER_VERSION=1.9.1
|
#addons:
|
||||||
- DOCKER_VERSION=1.10.1
|
# apt:
|
||||||
sudo: required
|
# packages:
|
||||||
services:
|
# - docker-engine=$DOCKER_VERSION.*
|
||||||
- docker
|
|
||||||
|
before_install:
|
||||||
|
- sudo -E apt-get -yq update
|
||||||
|
- sudo -E apt-get -yq --no-install-suggests --no-install-recommends --force-yes install docker-engine=${DOCKER_VERSION}*
|
||||||
|
|
||||||
install:
|
install:
|
||||||
- sudo service docker stop
|
- docker version
|
||||||
- sudo curl https://get.docker.com/builds/Linux/x86_64/docker-${DOCKER_VERSION} -o /usr/bin/docker
|
- pip install --user -r requirements.txt
|
||||||
- sudo chmod +x /usr/bin/docker
|
|
||||||
- sudo service docker start
|
|
||||||
- sleep 5
|
|
||||||
- docker version
|
|
||||||
- pip install --user -r requirements.txt
|
|
||||||
before_script:
|
before_script:
|
||||||
- make validate
|
- make validate
|
||||||
- make binary
|
- make binary
|
||||||
script:
|
script:
|
||||||
- make test-unit
|
- make test-unit
|
||||||
- make test-integration
|
- make test-integration
|
||||||
- make crossbinary
|
after_failure:
|
||||||
- make image
|
- docker ps
|
||||||
after_success:
|
|
||||||
- make deploy
|
matrix:
|
||||||
- make deploy-pr
|
fast_finish: true
|
||||||
|
include:
|
||||||
|
- env: DOCKER_VERSION=1.10.3
|
||||||
|
- env: DOCKER_VERSION=1.13.0
|
||||||
|
- env: DOCKER_VERSION=1.12.6
|
||||||
|
after_success:
|
||||||
|
- make crossbinary
|
||||||
|
- make image
|
||||||
|
before_deploy:
|
||||||
|
- mkdocs build --clean
|
||||||
|
- tar cfz dist/traefik-${VERSION}.src.tar.gz --exclude-vcs --exclude dist .
|
||||||
|
deploy:
|
||||||
|
- provider: pages
|
||||||
|
edge: true
|
||||||
|
github_token: ${GITHUB_TOKEN}
|
||||||
|
local_dir: site
|
||||||
|
on:
|
||||||
|
repo: containous/traefik
|
||||||
|
tags: true
|
||||||
|
- provider: releases
|
||||||
|
api_key: ${GITHUB_TOKEN}
|
||||||
|
file: dist/traefik_*
|
||||||
|
file_glob: true
|
||||||
|
on:
|
||||||
|
repo: containous/traefik
|
||||||
|
tags: true
|
||||||
|
- provider: scripts
|
||||||
|
script: script/deploy.sh
|
||||||
|
on:
|
||||||
|
repo: containous/traefik
|
||||||
|
tags: true
|
||||||
|
- provider: scripts
|
||||||
|
script: script/deploy-docker.sh
|
||||||
|
on:
|
||||||
|
repo: containous/traefik
|
||||||
|
|
7
Makefile
7
Makefile
|
@ -82,12 +82,5 @@ lint:
|
||||||
|
|
||||||
fmt:
|
fmt:
|
||||||
gofmt -s -l -w $(SRCS)
|
gofmt -s -l -w $(SRCS)
|
||||||
|
|
||||||
deploy:
|
|
||||||
./script/deploy.sh
|
|
||||||
|
|
||||||
deploy-pr:
|
|
||||||
./script/deploy-pr.sh
|
|
||||||
|
|
||||||
help: ## this help
|
help: ## this help
|
||||||
@awk 'BEGIN {FS = ":.*?## "} /^[a-zA-Z_-]+:.*?## / {sub("\\\\n",sprintf("\n%22c"," "), $$2);printf "\033[36m%-20s\033[0m %s\n", $$1, $$2}' $(MAKEFILE_LIST)
|
@awk 'BEGIN {FS = ":.*?## "} /^[a-zA-Z_-]+:.*?## / {sub("\\\\n",sprintf("\n%22c"," "), $$2);printf "\033[36m%-20s\033[0m %s\n", $$1, $$2}' $(MAKEFILE_LIST)
|
||||||
|
|
|
@ -10,12 +10,9 @@ RUN go get github.com/Masterminds/glide \
|
||||||
ARG DOCKER_VERSION=1.10.1
|
ARG DOCKER_VERSION=1.10.1
|
||||||
|
|
||||||
# Download docker
|
# Download docker
|
||||||
RUN set -ex; \
|
RUN mkdir -p /usr/local/bin \
|
||||||
curl https://get.docker.com/builds/Linux/x86_64/docker-${DOCKER_VERSION} -o /usr/local/bin/docker-${DOCKER_VERSION}; \
|
&& curl -SL https://get.docker.com/builds/Linux/x86_64/docker-${DOCKER_VERSION}.tgz \
|
||||||
chmod +x /usr/local/bin/docker-${DOCKER_VERSION}
|
| tar -xzC /usr/local/bin --transform 's#^.+/##x'
|
||||||
|
|
||||||
# Set the default Docker to be run
|
|
||||||
RUN ln -s /usr/local/bin/docker-${DOCKER_VERSION} /usr/local/bin/docker
|
|
||||||
|
|
||||||
WORKDIR /go/src/github.com/containous/traefik
|
WORKDIR /go/src/github.com/containous/traefik
|
||||||
|
|
||||||
|
|
19
script/deploy-docker.sh
Normal file
19
script/deploy-docker.sh
Normal 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"
|
|
@ -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"
|
|
|
@ -18,37 +18,6 @@ eval "$(ssh-agent -s)"
|
||||||
chmod 600 ~/.ssh/traefik.id_rsa
|
chmod 600 ~/.ssh/traefik.id_rsa
|
||||||
ssh-add ~/.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)
|
# update traefik-library-image repo (official Docker image)
|
||||||
echo "Updating traefik-library-imag repo..."
|
echo "Updating traefik-library-imag repo..."
|
||||||
git clone git@github.com:containous/traefik-library-image.git
|
git clone git@github.com:containous/traefik-library-image.git
|
||||||
|
|
|
@ -4,7 +4,7 @@ set -e
|
||||||
export SCRIPTDIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
|
export SCRIPTDIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
|
||||||
export DEST=.
|
export DEST=.
|
||||||
|
|
||||||
TESTFLAGS="${TESTFLAGS} -test.timeout=30m -check.v"
|
TESTFLAGS="${TESTFLAGS} -test.timeout=9m -check.v"
|
||||||
|
|
||||||
if [ -n "$VERBOSE" ]; then
|
if [ -n "$VERBOSE" ]; then
|
||||||
TESTFLAGS="${TESTFLAGS} -v"
|
TESTFLAGS="${TESTFLAGS} -v"
|
||||||
|
|
Loading…
Reference in a new issue