-
Notifications
You must be signed in to change notification settings - Fork 33
/
.travis.yml
102 lines (100 loc) · 3.78 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
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
sudo: required
language: python
cache: pip
python:
- '3.6'
services:
- docker
stages:
- name: test
- name: build
if: fork = false
- name: publish
if: tag =~ ^v.*
- name: verify
if: branch = master AND type IN (push, api)
jobs:
include:
- stage: test
install:
- pip install -e ".[test]"
- pip check
script:
- python3 -m flake8
- stage: test
before_install:
- docker-compose -f docker-compose.yml -f docker-compose.kubernetes.yml -f docker-compose.auth.yml up -d
install:
- pip install -e ".[dev]"
script:
- export prometheus_multiproc_dir=$(mktemp -d)
- sudo mkdir /var/log/kqueen-api
- sudo chmod -R 777 /var/log/kqueen-api
- python3 -m pytest --cov=. --cov-report=term-missing:skip-covered
- coverage xml
- coveralls
- |
[ ! -z "${CODACY_PROJECT_TOKEN}" ] && python-codacy-coverage -r coverage.xml || echo "Codacy coverage NOT exported"
- pip3 install --editable .
- python3 -m kqueen &
- sleep 2
- wget -O - http://localhost:5000/api/v1/health
- stage: build
install:
- "/bin/true"
script:
- export IMAGE="kqueen/api:${TRAVIS_BRANCH/\//-}"
- echo "Building image $IMAGE"
- docker build -t $IMAGE .
- docker login -u "$DOCKER_USERNAME" -p "$DOCKER_PASSWORD"
- docker push $IMAGE
- docker logout
- stage: test
install:
- "/bin/true"
script:
# https://github.com/coreos/etcd/blob/master/Documentation/v2/admin_guide.md#disaster-recovery
- docker-compose -f docker-compose.etcd-volume.yml up -d
- docker-compose -f docker-compose.etcd-volume.yml exec etcd etcdctl mkdir /travis/
- docker-compose -f docker-compose.etcd-volume.yml exec etcd etcdctl set /travis/commit $TRAVIS_COMMIT
- docker-compose -f docker-compose.etcd-volume.yml exec etcd etcdctl backup --data-dir /0.etcd/ --backup-dir /root/etcd-backup/
- docker-compose -f docker-compose.etcd-volume.yml stop
- docker-compose -f docker-compose.etcd-volume.yml rm -fv
# restore and verify
- export ETCD_FORCE_NEW_CLUSTER=1 ETCD_DATA_DIR=/root/etcd-backup/
- docker-compose -f docker-compose.etcd-volume.yml up -d
- docker-compose -f docker-compose.etcd-volume.yml exec etcd etcdctl ls --recursive /travis/
- |
export VALUE="$(docker-compose -f docker-compose.etcd-volume.yml exec -T etcd etcdctl get /travis/commit)";
echo "$VALUE == $TRAVIS_COMMIT";
[ "$VALUE" == "$TRAVIS_COMMIT" ] && exit 0 || exit 1
- stage: publish
install:
- "/bin/true"
script:
- "/bin/true"
deploy:
provider: pypi
user: tomkukral
password:
secure: Xfov5rO0PH40sBITF8TxfbnMJcRD9DZ5Bl1JNBwsk+dd56dpZUR5ZMAmjjGgMQTMk6JPfU1EDx/c4r8SS5gU3LErPI9cuHzggp59hhAMIjKdI7a42t6vLPc/fmymWBejhhcA2NAgDzc7p6B50ZiFJGchWADrvuVpDhzQIrokayv83FnKcB4cY31LKLJwu85o5CehUMQCRlvzCv/NuEstfJEdIhqzx2xnQI8qlLPNtMHtCJy5r/kauURFpx2IqgQ2WjMVWsfAtSlT+b5n7rZrhPCrCWD4C1VGWK5+LpxcuEhVb33oeaT1y2wpSo5+rg4c12/HP/HQXYPe0HoHJxKshT3Xw5YjcwQtoYpvkrmssHbEzY0l1QBkRqFVnuybXMcqLW2YSoUJ2M62U1ll0TyvFl/R9j1Jf+tXFxwANr+buaWSPW/FBsfMw//+EBXmNGAmwT+VfPdEysGP95bM1Ewl4w2OHLj1IDvA/V1d/Uf1NXOr0A8Q4MeiDT+PFngwoK+QKdVPO0hoErKJZ1QXXEALdBEbnuDM60a8gvJCD7D5sfygfUCVRxSvcQfFRULam5JvHcyH7JeWJzlBabKl9YNJbQgji1vkbLk1gEyyKl7SayLGngqVzdrCCLlfRbH8UsPR8pgIWW4LU5DS3AsWz3ln6mfyHV333DDj4r9ImZDMvhI=
on:
tags: true
repo: Mirantis/kqueen
- stage: verify
before_install:
- docker-compose -f docker-compose.yml -f docker-compose.kubernetes.yml up -d
install:
- pip3 install --upgrade kqueen
script:
- "./entrypoint.sh &"
- sleep 2
- wget -O - http://localhost:5000/api/v1/health
notifications:
webhooks:
on_success: change # options: [always|never|change] default: always
on_failure: never
on_start: never
on_cancel: never
on_error: never
email: true