-
Notifications
You must be signed in to change notification settings - Fork 17
/
.travis.yml
70 lines (70 loc) · 2.81 KB
/
.travis.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
sudo: required
services:
- docker
env:
global:
# Ensure the install happens without prompts
- CLOUDSDK_CORE_DISABLE_PROMPTS=1
language: node_js
node_js:
- '6'
before_install:
- echo "Cloudboost Tutorial"
- curl -LO https://storage.googleapis.com/kubernetes-release/release/$(curl -s https://storage.googleapis.com/kubernetes-release/release/stable.txt)/bin/linux/amd64/kubectl
- chmod +x ./kubectl
- sudo mv ./kubectl /usr/local/bin/kubectl
install:
- npm install
after_success:
# Build Docker Images
- docker build -t cloudboost/tutorial:2.0.$TRAVIS_BUILD_NUMBER .
- if [ "$TRAVIS_BRANCH" == "master" ]; then
docker build -t cloudboost/tutorial:latest .;
fi
# Docker Deploy for staging builds
- if [ "$TRAVIS_BRANCH" == "staging" ]; then
docker build -t cloudboost/tutorial:staging .;
docker login --username $DOCKERUSERNAME --password $DOCKERPASSWORD --email $DOCKEREMAIL;
docker push cloudboost/tutorial:staging;
git clone https://github.com/CloudBoost/kube-cred.git;
cd kube-cred;
openssl enc -in config_staging.enc -out config -d -aes256 -k $KUBE_ENC;
mkdir ~/.kube;
mv config ~/.kube/;
kubectl rolling-update cloudboost-tutorial-staging --image=cloudboost/tutorial:staging --image-pull-policy=Always;
curl -X DELETE "https://api.cloudflare.com/client/v4/zones/""$cloudflare_zone""/purge_cache" -H "X-Auth-Email:hello@cloudboost.io" -H "X-Auth-Key:""$cloud_flare_key" -H "Content-Type:application/json" --data "{'purge_everything':true}";
fi
before_deploy:
- git config --global user.email "builds@travis-ci.com"
- git config --global user.name "Travis CI"
- export GIT_TAG=2.0.$TRAVIS_BUILD_NUMBER
- git tag $GIT_TAG -a -m "Generated tag from TravisCI for build $TRAVIS_BUILD_NUMBER"
- git push -q https://$GITLOGIN@github.com/CloudBoost/tutorial --tags
deploy:
provider: releases
api_key: $GH_TOKEN
file: "README.md"
skip_cleanup: true
on:
tags: false
branch: master
after_deploy:
# Docker Deploy.
- if [ "$TRAVIS_BRANCH" == "master" ]; then
docker login --username $DOCKERUSERNAME --password $DOCKERPASSWORD --email $DOCKEREMAIL;
docker push cloudboost/tutorial:2.0.$TRAVIS_BUILD_NUMBER;
docker push cloudboost/tutorial:latest;
git clone https://github.com/CloudBoost/kube-cred.git;
cd kube-cred;
openssl enc -in config.enc -out config -d -aes256 -k $KUBE_ENC;
mkdir ~/.kube;
mv config ~/.kube/;
kubectl rolling-update cloudboost-tutorial --image=cloudboost/tutorial:latest --image-pull-policy=Always;
curl -X DELETE "https://api.cloudflare.com/client/v4/zones/""$cloudflare_zone""/purge_cache" -H "X-Auth-Email:hello@cloudboost.io" -H "X-Auth-Key:""$cloud_flare_key" -H "Content-Type:application/json" --data "{'purge_everything':true}";
fi
branches:
except:
- /^*-v[0-9]/
#Notify Team on Slack
notifications:
slack: cloudboost:gm7nWJDLDtBRyF75VKLKOoMW