-
Notifications
You must be signed in to change notification settings - Fork 3.3k
/
Copy pathinfluxdb-ci.yaml
228 lines (218 loc) · 6.02 KB
/
influxdb-ci.yaml
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
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
apiVersion: argoproj.io/v1alpha1
kind: Workflow
metadata:
generateName: influxdb-ci-
spec:
entrypoint: influxdb-ci
arguments:
parameters:
- name: repo
value: https://github.com/influxdata/influxdb.git
- name: revision
value: '1.6'
templates:
- name: influxdb-ci
steps:
- - name: checkout
template: checkout
- - name: build
template: build
arguments:
artifacts:
- name: source
from: "{{steps.checkout.outputs.artifacts.source}}"
- name: test-unit
template: test-unit
arguments:
artifacts:
- name: source
from: "{{steps.checkout.outputs.artifacts.source}}"
- - name: test-cov
template: test-cov
arguments:
artifacts:
- name: source
from: "{{steps.checkout.outputs.artifacts.source}}"
- name: test-e2e
template: test-e2e
arguments:
artifacts:
- name: influxd
from: "{{steps.build.outputs.artifacts.influxd}}"
- name: checkout
inputs:
artifacts:
- name: source
path: /src
git:
repo: "{{workflow.parameters.repo}}"
revision: "{{workflow.parameters.revision}}"
outputs:
artifacts:
- name: source
path: /src
container:
image: golang:1.9.2
command: ["/bin/sh", "-c"]
args: ["cd /src && git status && ls -l"]
- name: build
inputs:
artifacts:
- name: source
path: /go/src/github.com/influxdata/influxdb
outputs:
artifacts:
- name: influxd
path: /go/bin
container:
image: golang:1.9.2
command: ["/bin/sh", "-c"]
args: ["
cd /go/src/github.com/influxdata/influxdb &&
go get github.com/golang/dep/cmd/dep &&
dep ensure -vendor-only &&
go install -v ./...
"]
resources:
requests:
memory: 1024Mi
cpu: 200m
- name: test-unit
inputs:
artifacts:
- name: source
path: /go/src/github.com/influxdata/influxdb
container:
image: golang:1.9.2
command: ["/bin/sh", "-c"]
args: ["
cd /go/src/github.com/influxdata/influxdb &&
go get github.com/golang/dep/cmd/dep &&
dep ensure -vendor-only &&
go test -parallel=1 ./...
"]
- name: test-cov
inputs:
artifacts:
- name: source
steps:
- - name: test-cov-query
template: test-cov-base
arguments:
parameters:
- name: package
value: "query"
artifacts:
- name: source
from: "{{inputs.artifacts.source}}"
- name: test-cov-tsm1
template: test-cov-base
arguments:
parameters:
- name: package
value: "tsdb/engine/tsm1"
artifacts:
- name: source
from: "{{inputs.artifacts.source}}"
- name: test-cov-base
inputs:
parameters:
- name: package
artifacts:
- name: source
path: /go/src/github.com/influxdata/influxdb
outputs:
artifacts:
- name: covreport
path: /tmp/index.html
container:
image: golang:1.9.2
command: ["/bin/sh", "-c"]
args: ["
cd /go/src/github.com/influxdata/influxdb &&
go get github.com/golang/dep/cmd/dep &&
dep ensure -vendor-only &&
go test -v -coverprofile /tmp/cov.out ./{{inputs.parameters.package}} &&
go tool cover -html=/tmp/cov.out -o /tmp/index.html
"]
resources:
requests:
memory: 4096Mi
cpu: 200m
- name: test-e2e
inputs:
artifacts:
- name: influxd
steps:
- - name: influxdb-server
template: influxdb-server
arguments:
artifacts:
- name: influxd
from: "{{inputs.artifacts.influxd}}"
- - name: initdb
template: influxdb-client
arguments:
parameters:
- name: cmd
value: curl -XPOST 'http://{{steps.influxdb-server.ip}}:8086/query' --data-urlencode "q=CREATE DATABASE mydb"
- - name: producer1
template: influxdb-client
arguments:
parameters:
- name: cmd
value: for i in $(seq 1 20); do curl -XPOST 'http://{{steps.influxdb-server.ip}}:8086/write?db=mydb' -d "cpu,host=server01,region=uswest load=$i" ; sleep .5 ; done
- name: producer2
template: influxdb-client
arguments:
parameters:
- name: cmd
value: for i in $(seq 1 20); do curl -XPOST 'http://{{steps.influxdb-server.ip}}:8086/write?db=mydb' -d "cpu,host=server02,region=uswest load=$((RANDOM % 100))" ; sleep .5 ; done
- name: producer3
template: influxdb-client
arguments:
parameters:
- name: cmd
value: curl -XPOST 'http://{{steps.influxdb-server.ip}}:8086/write?db=mydb' -d 'cpu,host=server03,region=useast load=15.4'
- name: consumer
template: influxdb-client
arguments:
parameters:
- name: cmd
value: curl --silent -G http://{{steps.influxdb-server.ip}}:8086/query?pretty=true --data-urlencode "db=mydb" --data-urlencode "q=SELECT * FROM cpu"
- name: influxdb-server
inputs:
artifacts:
- name: influxd
path: /app
daemon: true
outputs:
artifacts:
- name: data
path: /var/lib/influxdb/data
container:
image: debian:9.4
readinessProbe:
httpGet:
path: /ping
port: 8086
initialDelaySeconds: 5
timeoutSeconds: 1
command: ["/bin/sh", "-c"]
args: ["chmod +x /app/influxd && /app/influxd"]
resources:
requests:
memory: 512Mi
cpu: 250m
- name: influxdb-client
inputs:
parameters:
- name: cmd
container:
image: appropriate/curl:latest
command: ["/bin/sh", "-c"]
args: ["{{inputs.parameters.cmd}}"]
resources:
requests:
memory: 32Mi
cpu: 100m