Skip to content
Permalink
Branch: master
Find file Copy path
Fetching contributors…
Cannot retrieve contributors at this time
54 lines (43 sloc) 1.92 KB
language: python
python:
- "3.5"
services:
- docker
cache:
directories:
- $HOME/.cache/pip
env:
global:
- SSL_KEY=nginx.key
- SSL_CERT=nginx.crt
- LETSENCRYPT=false
- DOCKER_REGISTRY_HOST=docker.io
- BOTS_WAIT_TIMEOUT=30
- DEPLOY_TRIGGER_URL=https://bot.radio-t.com:1443/deploy
before_install:
- DOCKER_REGISTRY_LOGIN= DOCKER_REGISTRY_PASSWORD= DEPLOY_USER= DEPLOY_PASSWD= pip install docker-compose==1.9.0
- openssl req -x509 -nodes -days 365 -newkey rsa:2048 -subj "/C=US/ST=Test/L=Test/O=Dis/CN=localhost" -keyout "etc/ssl/${SSL_KEY}" -out "etc/ssl/${SSL_CERT}"
install:
- DOCKER_REGISTRY_LOGIN= DOCKER_REGISTRY_PASSWORD= DEPLOY_USER= DEPLOY_PASSWD= pip install -r ci/requirements.txt
- DOCKER_REGISTRY_LOGIN= DOCKER_REGISTRY_PASSWORD= DEPLOY_USER= DEPLOY_PASSWD= docker-compose build
before_script:
- DOCKER_REGISTRY_LOGIN= DOCKER_REGISTRY_PASSWORD= DEPLOY_USER= DEPLOY_PASSWD= docker-compose up -d
script:
- set -e
- echo "Waiting nginx-bot to launch on nginx-bot:443..."
- while ! wget --no-check-certificate https://localhost/ping &> /dev/null; do sleep 1; done
- echo "Waiting $BOTS_WAIT_TIMEOUT seconds to ensure if all bots are ready..."; sleep "$BOTS_WAIT_TIMEOUT"
- DOCKER_REGISTRY_LOGIN= DOCKER_REGISTRY_PASSWORD= DEPLOY_USER= DEPLOY_PASSWD= BOT_BASE_URL="https://localhost" python ci/run_bot_tests.py . || (docker-compose logs -t && exit 1)
- |
if [ "$TRAVIS_BRANCH" = "master" ] && [ "$TRAVIS_PULL_REQUEST" == "false" ]; then
docker login --username "$DOCKER_REGISTRY_LOGIN" --password "$DOCKER_REGISTRY_PASSWORD" "$DOCKER_REGISTRY_HOST"
docker-compose push
echo "Deploying containers..."
deploy_result=$(curl -X POST \
-u "${DEPLOY_USER}:${DEPLOY_PASSWD}" \
"$DEPLOY_TRIGGER_URL")
echo "$deploy_result"
echo "$deploy_result" | grep -q '"status": "ok"'
fi
after_script:
- docker-compose down
You can’t perform that action at this time.