forked from vmware/vic
-
Notifications
You must be signed in to change notification settings - Fork 0
/
.drone.yml
419 lines (393 loc) · 12.5 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
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
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
workspace:
base: /go
path: src/github.com/vmware/vic
clone:
git:
image: plugins/git
tags: true
recursive: false
pipeline:
display-status:
image: 'wdc-harbor-ci.eng.vmware.com/default-project/vic-integration-test:1.48'
pull: true
environment:
BIN: bin
SHELL: /bin/bash
commands:
- 'export COMMIT=${DRONE_COMMIT}'
- 'echo "Expecting ${DRONE_COMMIT}"'
- 'git log -5'
- 'git log -1 --pretty=oneline | grep "^${DRONE_COMMIT}" > /dev/null && echo ''Build matches'' || (git log -1 --pretty=oneline | grep "Merge ${DRONE_COMMIT}" > /dev/null && echo ''Build is of a merge commit'' || (echo ''Build does not match!'' && exit 1))'
wait-for-build:
image: 'wdc-harbor-ci.eng.vmware.com/default-project/vic-integration-test:1.48'
pull: true
environment:
BIN: bin
GOPATH: /go
SHELL: /bin/bash
secrets:
- drone_server
- drone_token
- haas_url_array
- overflow_url_array
commands:
- export TEST_URL_ARRAY="$HAAS_URL_ARRAY $OVERFLOW_URL_ARRAY"
- tests/wait_until_previous_builds_complete.sh
check-org-membership:
image: 'wdc-harbor-ci.eng.vmware.com/default-project/vic-integration-test:1.48'
pull: true
environment:
BIN: bin
GOPATH: /go
SHELL: /bin/bash
secrets:
- github_automation_api_key
- skip_check_membership
commands:
- echo ${DRONE_COMMIT_AUTHOR}
- echo $SKIP_CHECK_MEMBERSHIP
- if [ "$SKIP_CHECK_MEMBERSHIP" = "true" ]; then echo 'check-org-membership step skipped'; else /bin/bash -c '[[ ! $(curl --silent "https://api.github.com/orgs/vmware/members/${DRONE_COMMIT_AUTHOR}?access_token=$GITHUB_AUTOMATION_API_KEY") ]]'; fi
when:
status: success
vic-engine:
image: 'wdc-harbor-ci.eng.vmware.com/default-project/vic-integration-test:1.48'
pull: true
environment:
BIN: bin
GOPATH: /go
SHELL: /bin/bash
secrets:
- drone_server
- drone_token
- github_automation_api_key
- codecov_token
commands:
- export BUILD_NUMBER=${DRONE_BUILD_NUMBER}
- make all
- tests/unit-test-check.sh
when:
status: success
vic-integration-test-on-pr:
image: 'wdc-harbor-ci.eng.vmware.com/default-project/vic-integration-test:1.48'
pull: true
privileged: true
environment:
BIN: bin
GOPATH: /go
SHELL: /bin/bash
LOG_TEMP_DIR: install-logs
secrets:
- ci_domain
- debug_vch
- drone_server
- drone_token
- drone_machine
- github_automation_api_key
- gs_client_email
- gs_private_key
- gs_project_id
- public_network
- registry_password
- reporting_server_url
- syslog_passwd
- syslog_server
- syslog_user
- test_datastore
- test_resource
- test_timeout
- test_password
- test_username
- haas_url_array
- overflow_test_timeout
- overflow_url_array
- ssh_test_username
- ssh_test_password
- vch_ops_username
- vch_ops_password
commands:
- export GOVC_INSECURE=true
- export GOVC_USERNAME=$TEST_USERNAME
- export GOVC_PASSWORD=$TEST_PASSWORD
- export GOVC_DATASTORE=$TEST_DATASTORE
- export DOMAIN=$CI_DOMAIN
- export MULTI_VCH=1
- echo $DOMAIN
- export TEST_URL_ARRAY="$HAAS_URL_ARRAY $OVERFLOW_URL_ARRAY"
- tests/integration-test.sh
volumes:
- /tmp
when:
status: success
vic-ui:
image: 'wdc-harbor-ci.eng.vmware.com/default-project/vic-integration-test:1.48'
pull: true
environment:
BIN: bin
secrets:
- gs_client_email
- gs_private_key
- gs_project_id
commands:
- 'export BUILD_NUMBER=${DRONE_BUILD_NUMBER}'
- 'mkdir -p $BIN/ui'
- 'export LATEST_VIC_UI_BUILD="$(gsutil ls -l ''gs://vic-ui-builds'' | grep -v TOTAL | grep vic_ | sort -k2 -r | (trap '' '' PIPE; head -1))"'
- 'export VIC_UI_URL=$(echo $LATEST_VIC_UI_BUILD | xargs | cut -d " " -f 3 | sed "s|gs://|https://storage.googleapis.com/|")'
- 'wget -nv $VIC_UI_URL -P $BIN'
- 'tar -xvzf $BIN/vic_ui_*.tar.gz'
- 'ls -la ./$BIN && ./$BIN/ui/sync-vic-ui-version.sh -p bin/ 2>&1'
- 'rm $BIN/vic_ui_*.tar.gz'
when:
event: [push, pull_request]
status: [success, failure]
vic-ui-release:
image: 'wdc-harbor-ci.eng.vmware.com/default-project/vic-integration-test:1.48'
pull: true
environment:
BIN: bin
secrets:
- gs_client_email
- gs_private_key
- gs_project_id
commands:
- 'export BUILD_NUMBER=${DRONE_BUILD_NUMBER}'
- 'mkdir -p $BIN/ui'
- 'export LATEST_VIC_UI_RELEASE="$(gsutil ls -l ''gs://vic-ui-releases'' | grep -v TOTAL | grep vic_ | sort -k2 -r | (trap '' '' PIPE; head -1))"'
- 'export VIC_UI_URL=$(echo $LATEST_VIC_UI_RELEASE | xargs | cut -d " " -f 3 | sed "s|gs://|https://storage.googleapis.com/|")'
- 'wget -nv $VIC_UI_URL -P $BIN'
- 'tar -xvzf $BIN/vic_ui_*.tar.gz'
- 'ls -la ./$BIN && ./$BIN/ui/sync-vic-ui-version.sh -p bin/ 2>&1'
- 'rm $BIN/vic_ui_*.tar.gz'
when:
branch: ['releases/*']
event: tag
bundle:
image: 'wdc-harbor-ci.eng.vmware.com/default-project/golang:1.8'
pull: true
environment:
BIN: bin
BIN_TEMP_DIR: bin/vic
GOPATH: /go
SHELL: /bin/bash
commands:
- 'rm -rf $BIN_TEMP_DIR'
- 'mkdir -p $BIN_TEMP_DIR'
- 'mv $BIN/ui $BIN_TEMP_DIR'
- 'cp LICENSE $BIN_TEMP_DIR'
- 'cp doc/bundle/README $BIN_TEMP_DIR'
- 'cp $BIN/vic-machine* $BIN_TEMP_DIR'
- 'cp $BIN/vic-ui* $BIN_TEMP_DIR'
- 'cp $BIN/appliance.iso $BIN_TEMP_DIR'
- 'cp $BIN/bootstrap.iso $BIN_TEMP_DIR'
- 'mkdir -p $BIN_TEMP_DIR/autocomplete/bash'
- 'cp infra/scripts/bash_autocomplete $BIN_TEMP_DIR/autocomplete/bash/vic-machine-darwin'
- 'cp infra/scripts/bash_autocomplete $BIN_TEMP_DIR/autocomplete/bash/vic-machine-linux'
- 'cp infra/scripts/bash_autocomplete $BIN_TEMP_DIR/autocomplete/bash/vic-machine-windows.exe'
- 'mkdir -p $BIN_TEMP_DIR/autocomplete/zsh'
- 'cp infra/scripts/zsh_autocomplete $BIN_TEMP_DIR/autocomplete/zsh/vic-machine-darwin'
- 'cp infra/scripts/zsh_autocomplete $BIN_TEMP_DIR/autocomplete/zsh/vic-machine-linux'
- 'cp infra/scripts/zsh_autocomplete $BIN_TEMP_DIR/autocomplete/zsh/vic-machine-windows.exe'
- 'tar czvf $BIN/vic_${DRONE_BUILD_NUMBER}.tar.gz -C $BIN vic'
- 'shasum -a 256 $BIN/vic_${DRONE_BUILD_NUMBER}.tar.gz'
- 'shasum -a 1 $BIN/vic_${DRONE_BUILD_NUMBER}.tar.gz'
- 'md5sum $BIN/vic_${DRONE_BUILD_NUMBER}.tar.gz'
- 'du -ks $BIN/vic_${DRONE_BUILD_NUMBER}.tar.gz | awk ''{print $1 / 1024}'' | { read x; echo $x MB; }'
- 'mkdir bundle'
- 'mkdir bundle-release'
- 'cp $BIN/vic_${DRONE_BUILD_NUMBER}.tar.gz bundle'
- 'cp $BIN/vic_${DRONE_BUILD_NUMBER}.tar.gz bundle-release/vic_$(git describe --tags --abbrev=0).tar.gz'
when:
repo: vmware/vic
status: [success, failure]
publish-gcs-builds-for-pr:
image: 'victest/drone-gcs:1'
pull: true
secrets:
- google_key
source: bundle
target: vic-engine-pr-builds/pull/${DRONE_PULL_REQUEST}/
acl:
- 'allUsers:READER'
cache_control: 'public,max-age=3600'
when:
repo: vmware/vic
event: pull_request
status: success
publish-gcs-builds-on-master-push-pass:
image: 'victest/drone-gcs:1'
pull: true
secrets:
- google_key
source: bundle
target: vic-engine-builds/
acl:
- 'allUsers:READER'
cache_control: 'public,max-age=3600'
when:
repo: vmware/vic
event: push
branch: [master]
status: success
publish-gcs-builds-on-release-push-pass:
image: 'victest/drone-gcs:1'
pull: true
secrets:
- google_key
source: bundle
target: vic-engine-builds/${DRONE_BRANCH}/
acl:
- 'allUsers:READER'
cache_control: 'public,max-age=3600'
when:
repo: vmware/vic
event: push
branch: ['releases/*']
status: success
publish-gcs-builds-on-fail:
image: 'victest/drone-gcs:1'
pull: true
secrets:
- google_key
source: bundle
target: vic-engine-failed-builds/
acl:
- 'allUsers:READER'
cache_control: 'public,max-age=3600'
when:
repo: vmware/vic
event: [push, tag]
branch: [master, 'releases/*']
status: failure
publish-gcs-releases:
image: 'victest/drone-gcs:1'
pull: true
secrets:
- google_key
source: bundle-release
target: vic-engine-releases/
acl:
- 'allUsers:READER'
cache_control: 'public,max-age=3600'
when:
repo: vmware/vic
branch: ['releases/*']
event: tag
status: success
vic-machine-server-tags-dev:
image: 'wdc-harbor-ci.eng.vmware.com/default-project/vic-integration-test:1.48'
pull: true
environment:
BIN: bin
SHELL: /bin/bash
commands:
- 'echo -n "$(git describe --tags --abbrev=0)-${DRONE_BUILD_NUMBER}-$(git rev-parse --short=8 HEAD)" > .tags;'
- 'if [ -n "$(echo "${DRONE_BRANCH}" | grep "master")" ]; then echo ",dev" >> .tags; fi'
- 'cat .tags'
when:
repo: vmware/vic
event: push
branch: [master, 'releases/*']
status: success
vic-machine-server-tags-release:
image: 'wdc-harbor-ci.eng.vmware.com/default-project/vic-integration-test:1.48'
pull: true
environment:
BIN: bin
SHELL: /bin/bash
commands:
- 'echo -n "$(git describe --tags --abbrev=0)-${DRONE_BUILD_NUMBER}-$(git rev-parse --short=8 HEAD),$(git describe --tags --abbrev=0),latest" > .tags;'
- 'cat .tags'
when:
repo: vmware/vic
event: tag
branch: 'releases/*'
status: success
vic-machine-server-publish:
image: plugins/gcr
pull: true
repo: eminent-nation-87317/vic-machine-server
dockerfile: cmd/vic-machine-server/Dockerfile
custom_dns: 10.142.7.21, 10.142.7.22, 10.166.17.90
secrets: [ token ]
when:
repo: vmware/vic
event: [push, tag]
branch: [master, 'releases/*']
status: success
trigger-downstream:
image: 'gcr.io/eminent-nation-87317/vic-downstream-trigger:1.3'
environment:
SHELL: /bin/bash
DOWNSTREAM_REPO: vmware/vic-product
DOWNSTREAM_BRANCH: ${DRONE_BRANCH}
secrets:
- drone_server
- drone_token
when:
repo: vmware/vic
event: [push]
branch: [master]
status: success
trigger-downstream-tag:
image: 'gcr.io/eminent-nation-87317/vic-downstream-trigger:1.3'
environment:
SHELL: /bin/bash
DOWNSTREAM_REPO: vmware/vic-product
DOWNSTREAM_BRANCH: ${DRONE_BRANCH}
secrets:
- drone_server
- drone_token
when:
repo: vmware/vic
event: [tag]
branch: [master, 'releases/*']
status: success
notify-slack-on-fail:
image: plugins/slack
secrets:
- source: slack_url
target: slack_webhook
username: drone
template: "Build https://ci-vic.vmware.com/vmware/vic/{{ build.number }} by {{ build.author }} finished with a {{ build.status }} status. Logs: https://console.cloud.google.com/m/cloudstorage/b/vic-ci-logs/o/integration_logs_{{ build.number }}_{{ build.commit }}.zip?authuser=1\n"
when:
repo: vmware/vic
event: [push, tag]
branch: [master, 'releases/*']
status: failure
notify-slack-on-pass:
image: plugins/slack
secrets:
- source: slack_url
target: slack_webhook
username: drone
template: "Build https://ci-vic.vmware.com/vmware/vic/{{ build.number }} by {{ build.author }} finished with a {{ build.status }} status, find the build at: https://storage.googleapis.com/vic-engine-builds/vic_{{ build.number }}.tar.gz\n"
when:
repo: vmware/vic
event: push
branch: [master, 'releases/*']
status: success
notify-slack-on-successful-tag:
image: plugins/slack
secrets:
- source: slack_url
target: slack_webhook
username: drone
template: "The latest version of VIC engine has been released, find the build here: https://console.cloud.google.com/storage/browser/vic-engine-releases\n"
when:
repo: vmware/vic
branch: ['releases/*']
event: tag
status: success
pass-rate:
image: 'wdc-harbor-ci.eng.vmware.com/default-project/vic-pass-rate:1.0'
pull: true
environment:
BIN: bin
SHELL: /bin/bash
secrets:
- github_automation_api_key
- slack_url
when:
repo: vmware/vic
event: [push, tag]
branch: [master, 'releases/*']
status: [success, failure]