-
-
Notifications
You must be signed in to change notification settings - Fork 3
/
.travis.yml
33 lines (31 loc) · 1.16 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
sudo: required
language: go
services:
- docker
go:
- 1.8
env:
global:
- CGO_ENABLED=0
- DOCKER_USER=<your-dockerhub-user>
matrix:
- SERVICE=eventservice
- SERVICE=bookingservice
install:
- curl -LO https://storage.googleapis.com/kubernetes-release/release/v1.6.1/bin/linux/amd64/kubectl
- chmod +x kubectl
- echo "${KUBE_CA_CERT}" > ca.crt
- ./kubectl config set-credentials travis-ci --token="${KUBE_TOKEN}"
- ./kubectl config set-cluster your-cluster --server=https://your-cluster.example --certificate-authority=ca.crt
- ./kubectl config set-context your-cluster --cluster=your-cluster --user=travis-ci --namespace=default
- ./kubectl config use-context your-cluster
script:
- go vet $(go list ./... | grep -v vendor)
- cd src/${SERVICE} && go build
- docker image build -t ${DOCKER_USER}/myevents_${SERVICE}:${TRAVIS_BRANCH} src/${SERVICE}
after_success:
- if [ -n "${TRAVIS_TAG}" ] ; then
docker login -u="${DOCKER_USERNAME}" -p="${DOCKER_PASSWORD}";
docker push ${DOCKER_USER}/myevents_${SERVICE}:${TRAVIS_BRANCH};
./kubectl set image deployment/${SERVICE} api=${DOCKER_USER}/myevents_${SERVICE}:${TRAVIS_BRANCH}
fi