-
Notifications
You must be signed in to change notification settings - Fork 0
/
.drone.yml
executable file
·115 lines (105 loc) · 3.16 KB
/
.drone.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
103
104
105
106
107
108
109
110
111
112
113
114
115
---
kind: pipeline
type: docker
name: ni-mon-tests__nightly__python-3.5__prod
steps:
- name: config target
image: python:3.5
environment:
MONITORING_HOST_PROD:
from_secret: monitoring_host_prod
commands:
- cd tests/config
- cp config.yaml.example config.yaml
- sed -i "s/<ni_mon_server_addr>/$MONITORING_HOST_PROD/g" config.yaml
- sed -i "s/<ni_ni_nfvo_addr>/$MONITORING_HOST_PROD/g" config.yaml
- name: run test
image: python:3.5
commands:
- cd tests && pip install -r requirements.txt && cd ..
- pytest tests/test_ni_mon.py
- name: notify slack nightly check status
image: python:3.5
environment:
SLACK_HOOK_URL:
from_secret: slack_hook_url
commands:
- curl -X POST -H 'Content-type:application/json' --data '{"channel":"#ci_status", "username":"ci_report",
"text":"${DRONE_REPO_NAME} - Testbed nightly check status is ${DRONE_BUILD_STATUS}"}'
$SLACK_HOOK_URL
when:
status:
- success
- failure
trigger:
branch:
- master
event:
- cron
---
kind: pipeline
type: docker
name: ni-tests__dev
steps:
- name: config target
image: python:3.5
environment:
COMPUTE_HOSTNAME_DEV:
from_secret: compute_hostname_dev
CONTROLLER_HOST_DEV:
from_secret: controller_host_dev
MONITORING_HOST_DEV:
from_secret: monitoring_host_dev
OPENSTACK_PASSWORD:
from_secret: openstack_password
MONITORING_HOST_PROD:
from_secret: monitoring_host_prod
commands:
# config ni_mon
- cd ni_mon/config
- cp config.yaml.example config.yaml
- sed -i "s/<controller_ip>/$CONTROLLER_HOST_DEV/g" config.yaml
- sed -i "s/<influxdb_server_address>/$MONITORING_HOST_DEV/g" config.yaml
- sed -i "s/<password>/$OPENSTACK_PASSWORD/g" config.yaml
# does not need to subtitute the sw-id
- sed -i "s/<node1_id>/$COMPUTE_HOSTNAME_DEV/g" config.yaml
- cat config.yaml
# config ni_nfvo
- cd ../../ni_nfvo/config
- cp config.yaml.example config.yaml
- sed -i "s/<controller_server_address>/$CONTROLLER_HOST_DEV/g" config.yaml
- sed -i "s/<password>/$OPENSTACK_PASSWORD/g" config.yaml
- cat config.yaml
# config tests
- cd ../../tests/config
- cp config.yaml.example config.yaml
- sed -i "s/<ni_mon_server_addr>/localhost/g" config.yaml
- sed -i "s/<ni_ni_nfvo_addr>/localhost/g" config.yaml
- cat config.yaml
- name: run modules and tests
image: python:3.5
commands:
- cd ni_mon && pip install -r requirements.txt && cd ..
- cd ni_nfvo && pip install -r requirements.txt && cd ..
- cd tests && pip install -r requirements.txt && cd ..
# need sleep so that services has time to init
- bash -c 'python -m ni_mon > ni_mon.log 2>&1' & sleep 5
- bash -c 'python -m ni_nfvo > ni_nfvo.log 2>&1' & sleep 5
- python -m pytest tests || (cat *.log & exit 1)
- name: notify slack test result
image: python:3.5
environment:
SLACK_HOOK_URL:
from_secret: slack_hook_url
commands:
- curl -X POST -H 'Content-type:application/json' --data '{"channel":"#ci_status", "username":"ci_report",
"text":"${DRONE_REPO_NAME} - Dev build status is ${DRONE_BUILD_STATUS}"}'
$SLACK_HOOK_URL
when:
status:
- success
- failure
trigger:
event:
exclude:
- cron