forked from grafana/grafana
-
Notifications
You must be signed in to change notification settings - Fork 0
/
.drone.yml
542 lines (484 loc) · 14.1 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
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
---
kind: pipeline
type: docker
name: test-pr
platform:
os: linux
arch: amd64
steps:
- name: identify-runner
image: alpine:3.12
commands:
- echo $DRONE_RUNNER_NAME
- name: initialize
image: grafana/build-container:1.2.24
commands:
- curl -fLO https://grafana-downloads.storage.googleapis.com/grafana-build-pipeline/v$${GRABPL_VERSION}/grabpl
- chmod +x grabpl
- mkdir -p bin
- mv grabpl bin
- curl -fLO https://github.com/jwilder/dockerize/releases/download/v$${DOCKERIZE_VERSION}/dockerize-linux-amd64-v$${DOCKERIZE_VERSION}.tar.gz
- tar -C bin -xzvf dockerize-linux-amd64-v$${DOCKERIZE_VERSION}.tar.gz
- rm dockerize-linux-amd64-v$${DOCKERIZE_VERSION}.tar.gz
- yarn install --frozen-lockfile --no-progress
environment:
DOCKERIZE_VERSION: 0.6.1
GRABPL_VERSION: 0.5.5
- name: lint-backend
image: grafana/build-container:1.2.24
commands:
- golangci-lint run --config scripts/go/configs/.golangci.toml ./pkg/...
- revive -formatter stylish -config scripts/go/configs/revive.toml ./pkg/...
- ./scripts/revive-strict
environment:
CGO_ENABLED: 1
depends_on:
- initialize
- name: codespell
image: grafana/build-container:1.2.24
commands:
- "echo -e \"unknwon\nreferer\nerrorstring\neror\niam\" > words_to_ignore.txt"
- codespell -I words_to_ignore.txt docs/
depends_on:
- initialize
- name: shellcheck
image: grafana/build-container:1.2.24
commands:
- curl -fLO http://storage.googleapis.com/grafana-downloads/ci-dependencies/shellcheck-v$${VERSION}.linux.x86_64.tar.xz
- echo $$CHKSUM shellcheck-v$${VERSION}.linux.x86_64.tar.xz | sha512sum --check --strict --status
- tar xf shellcheck-v$${VERSION}.linux.x86_64.tar.xz
- mv shellcheck-v$${VERSION}/shellcheck /usr/local/bin/
- rm -rf shellcheck-v$${VERSION}*
- ./bin/grabpl shellcheck
environment:
CHKSUM: beca3d7819a6bdcfbd044576df4fc284053b48f468b2f03428fe66f4ceb2c05d9b5411357fa15003cb0311406c255084cf7283a3b8fce644c340c2f6aa910b9f
VERSION: 0.7.1
depends_on:
- initialize
- name: test-backend
image: grafana/build-container:1.2.24
commands:
- ./bin/grabpl test-backend
- ./bin/grabpl integration-tests
depends_on:
- initialize
- lint-backend
- name: test-frontend
image: grafana/build-container:1.2.24
commands:
- yarn run prettier:check
- yarn run packages:typecheck
- yarn run typecheck
- yarn run test
environment:
TEST_MAX_WORKERS: 50%
depends_on:
- initialize
- name: build-backend
image: grafana/build-container:1.2.24
commands:
- ./bin/grabpl build-backend --jobs 8 --edition oss --build-id $DRONE_BUILD_NUMBER --variants linux-x64,linux-x64-musl,osx64,win64 --no-pull-enterprise
depends_on:
- initialize
- lint-backend
- test-backend
- name: build-frontend
image: grafana/build-container:1.2.24
commands:
- ./bin/grabpl build-frontend --jobs 8 --no-install-deps --edition oss --build-id $DRONE_BUILD_NUMBER --no-pull-enterprise
depends_on:
- initialize
- test-frontend
- name: build-plugins
image: grafana/build-container:1.2.24
commands:
- ./bin/grabpl build-plugins --jobs 8 --edition oss --no-install-deps
depends_on:
- initialize
- lint-backend
- name: package
image: grafana/build-container:1.2.24
commands:
- . scripts/build/gpg-test-vars.sh && ./bin/grabpl package --jobs 8 --edition oss --build-id $DRONE_BUILD_NUMBER --no-pull-enterprise --variants linux-x64,linux-x64-musl,osx64,win64
depends_on:
- build-backend
- build-frontend
- build-plugins
- test-backend
- test-frontend
- codespell
- shellcheck
- name: end-to-end-tests-server
image: grafana/build-container:1.2.24
detach: true
commands:
- ./e2e/start-server
depends_on:
- package
- name: end-to-end-tests
image: grafana/ci-e2e:12.18-1
commands:
- ./node_modules/.bin/cypress install
- ./bin/grabpl e2e-tests
environment:
HOST: end-to-end-tests-server
depends_on:
- end-to-end-tests-server
- name: build-storybook
image: grafana/build-container:1.2.24
commands:
- yarn storybook:build
depends_on:
- package
- name: build-docs-website
image: grafana/docs-base:latest
commands:
- mkdir -p /hugo/content/docs/grafana
- cp -r docs/sources /hugo/content/docs/grafana/latest
- cd /hugo && make prod
depends_on:
- initialize
- name: copy-packages-for-docker
image: grafana/build-container:1.2.24
commands:
- cp dist/*.tar.gz packaging/docker/
depends_on:
- package
- name: build-docker-images
image: grafana/drone-grafana-docker:0.2.0
settings:
archs: amd64
dry_run: true
edition: oss
depends_on:
- copy-packages-for-docker
- name: postgres-integration-tests
image: grafana/build-container:1.2.24
commands:
- apt-get update
- apt-get install -yq postgresql-client
- ./bin/dockerize -wait tcp://postgres:5432 -timeout 120s
- psql -p 5432 -h postgres -U grafanatest -d grafanatest -f devenv/docker/blocks/postgres_tests/setup.sql
- go clean -testcache
- ./bin/grabpl integration-tests --database postgres
environment:
GRAFANA_TEST_DB: postgres
PGPASSWORD: grafanatest
POSTGRES_HOST: postgres
depends_on:
- test-backend
- test-frontend
- name: mysql-integration-tests
image: grafana/build-container:1.2.24
commands:
- apt-get update
- apt-get install -yq default-mysql-client
- ./bin/dockerize -wait tcp://mysql:3306 -timeout 120s
- cat devenv/docker/blocks/mysql_tests/setup.sql | mysql -h mysql -P 3306 -u root -prootpass
- go clean -testcache
- ./bin/grabpl integration-tests --database mysql
environment:
GRAFANA_TEST_DB: mysql
MYSQL_HOST: mysql
depends_on:
- test-backend
- test-frontend
services:
- name: postgres
image: postgres:12.3-alpine
environment:
POSTGRES_DB: grafanatest
POSTGRES_PASSWORD: grafanatest
POSTGRES_USER: grafanatest
- name: mysql
image: mysql:5.6.48
environment:
MYSQL_DATABASE: grafana_tests
MYSQL_PASSWORD: password
MYSQL_ROOT_PASSWORD: rootpass
MYSQL_USER: grafana
trigger:
event:
- pull_request
---
kind: pipeline
type: docker
name: test-master
platform:
os: linux
arch: amd64
steps:
- name: identify-runner
image: alpine:3.12
commands:
- echo $DRONE_RUNNER_NAME
- name: initialize
image: grafana/build-container:1.2.24
commands:
- curl -fLO https://grafana-downloads.storage.googleapis.com/grafana-build-pipeline/v$${GRABPL_VERSION}/grabpl
- chmod +x grabpl
- mkdir -p bin
- mv grabpl bin
- curl -fLO https://github.com/jwilder/dockerize/releases/download/v$${DOCKERIZE_VERSION}/dockerize-linux-amd64-v$${DOCKERIZE_VERSION}.tar.gz
- tar -C bin -xzvf dockerize-linux-amd64-v$${DOCKERIZE_VERSION}.tar.gz
- rm dockerize-linux-amd64-v$${DOCKERIZE_VERSION}.tar.gz
- yarn install --frozen-lockfile --no-progress
environment:
DOCKERIZE_VERSION: 0.6.1
GRABPL_VERSION: 0.5.5
- name: lint-backend
image: grafana/build-container:1.2.24
commands:
- golangci-lint run --config scripts/go/configs/.golangci.toml ./pkg/...
- revive -formatter stylish -config scripts/go/configs/revive.toml ./pkg/...
- ./scripts/revive-strict
environment:
CGO_ENABLED: 1
depends_on:
- initialize
- name: codespell
image: grafana/build-container:1.2.24
commands:
- "echo -e \"unknwon\nreferer\nerrorstring\neror\niam\" > words_to_ignore.txt"
- codespell -I words_to_ignore.txt docs/
depends_on:
- initialize
- name: shellcheck
image: grafana/build-container:1.2.24
commands:
- curl -fLO http://storage.googleapis.com/grafana-downloads/ci-dependencies/shellcheck-v$${VERSION}.linux.x86_64.tar.xz
- echo $$CHKSUM shellcheck-v$${VERSION}.linux.x86_64.tar.xz | sha512sum --check --strict --status
- tar xf shellcheck-v$${VERSION}.linux.x86_64.tar.xz
- mv shellcheck-v$${VERSION}/shellcheck /usr/local/bin/
- rm -rf shellcheck-v$${VERSION}*
- ./bin/grabpl shellcheck
environment:
CHKSUM: beca3d7819a6bdcfbd044576df4fc284053b48f468b2f03428fe66f4ceb2c05d9b5411357fa15003cb0311406c255084cf7283a3b8fce644c340c2f6aa910b9f
VERSION: 0.7.1
depends_on:
- initialize
- name: test-backend
image: grafana/build-container:1.2.24
commands:
- ./bin/grabpl test-backend
- ./bin/grabpl integration-tests
depends_on:
- initialize
- lint-backend
- name: test-frontend
image: grafana/build-container:1.2.24
commands:
- yarn run prettier:check
- yarn run packages:typecheck
- yarn run typecheck
- yarn run test
environment:
TEST_MAX_WORKERS: 50%
depends_on:
- initialize
- name: build-backend
image: grafana/build-container:1.2.24
commands:
- ./bin/grabpl build-backend --jobs 8 --edition oss --build-id $DRONE_BUILD_NUMBER --no-pull-enterprise
depends_on:
- initialize
- lint-backend
- test-backend
- name: build-frontend
image: grafana/build-container:1.2.24
commands:
- ./bin/grabpl build-frontend --jobs 8 --no-install-deps --edition oss --build-id $DRONE_BUILD_NUMBER --no-pull-enterprise
depends_on:
- initialize
- test-frontend
- name: build-plugins
image: grafana/build-container:1.2.24
commands:
- ./bin/grabpl build-plugins --jobs 8 --edition oss --no-install-deps
depends_on:
- initialize
- lint-backend
- name: package
image: grafana/build-container:1.2.24
commands:
- . scripts/build/gpg-test-vars.sh && ./bin/grabpl package --jobs 8 --edition oss --build-id $DRONE_BUILD_NUMBER --no-pull-enterprise
depends_on:
- build-backend
- build-frontend
- build-plugins
- test-backend
- test-frontend
- codespell
- shellcheck
- name: end-to-end-tests-server
image: grafana/build-container:1.2.24
detach: true
commands:
- ./e2e/start-server
depends_on:
- package
- name: end-to-end-tests
image: grafana/ci-e2e:12.18-1
commands:
- ./node_modules/.bin/cypress install
- ./bin/grabpl e2e-tests
environment:
HOST: end-to-end-tests-server
depends_on:
- end-to-end-tests-server
- name: build-storybook
image: grafana/build-container:1.2.24
commands:
- yarn storybook:build
depends_on:
- package
- name: publish-storybook
image: grafana/grafana-ci-deploy:1.2.5
commands:
- printenv GCP_KEY | base64 -d > /tmp/gcpkey.json
- gcloud auth activate-service-account --key-file=/tmp/gcpkey.json
- echo gsutil -m rsync -d -r ./packages/grafana-ui/dist/storybook gs://grafana-storybook/canary
environment:
GCP_KEY:
from_secret: gcp_key
depends_on:
- build-storybook
- name: build-docs-website
image: grafana/docs-base:latest
commands:
- mkdir -p /hugo/content/docs/grafana
- cp -r docs/sources /hugo/content/docs/grafana/latest
- cd /hugo && make prod
depends_on:
- initialize
- name: copy-packages-for-docker
image: grafana/build-container:1.2.24
commands:
- cp dist/*.tar.gz packaging/docker/
depends_on:
- package
- name: build-docker-images
image: grafana/drone-grafana-docker:0.2.0
settings:
dry_run: true
edition: oss
depends_on:
- copy-packages-for-docker
- name: build-docker-images-ubuntu
image: grafana/drone-grafana-docker:0.2.0
settings:
dry_run: true
edition: oss
ubuntu: true
depends_on:
- copy-packages-for-docker
- name: postgres-integration-tests
image: grafana/build-container:1.2.24
commands:
- apt-get update
- apt-get install -yq postgresql-client
- ./bin/dockerize -wait tcp://postgres:5432 -timeout 120s
- psql -p 5432 -h postgres -U grafanatest -d grafanatest -f devenv/docker/blocks/postgres_tests/setup.sql
- go clean -testcache
- ./bin/grabpl integration-tests --database postgres
environment:
GRAFANA_TEST_DB: postgres
PGPASSWORD: grafanatest
POSTGRES_HOST: postgres
depends_on:
- test-backend
- test-frontend
- name: mysql-integration-tests
image: grafana/build-container:1.2.24
commands:
- apt-get update
- apt-get install -yq default-mysql-client
- ./bin/dockerize -wait tcp://mysql:3306 -timeout 120s
- cat devenv/docker/blocks/mysql_tests/setup.sql | mysql -h mysql -P 3306 -u root -prootpass
- go clean -testcache
- ./bin/grabpl integration-tests --database mysql
environment:
GRAFANA_TEST_DB: mysql
MYSQL_HOST: mysql
depends_on:
- test-backend
- test-frontend
- name: release-next-npm-packages
image: grafana/build-container:1.2.24
commands:
- npx lerna bootstrap
- echo "//registry.npmjs.org/:_authToken=$${NPM_TOKEN}" >> ~/.npmrc
- echo ./scripts/circle-release-next-packages.sh
environment:
NPM_TOKEN:
from_secret: npm_token
depends_on:
- end-to-end-tests
- name: publish-packages
image: grafana/grafana-ci-deploy:1.2.5
commands:
- echo ./bin/grabpl publish-packages --edition oss
depends_on:
- package
- end-to-end-tests
- mysql-integration-tests
- postgres-integration-tests
services:
- name: postgres
image: postgres:12.3-alpine
environment:
POSTGRES_DB: grafanatest
POSTGRES_PASSWORD: grafanatest
POSTGRES_USER: grafanatest
- name: mysql
image: mysql:5.6.48
environment:
MYSQL_DATABASE: grafana_tests
MYSQL_PASSWORD: password
MYSQL_ROOT_PASSWORD: rootpass
MYSQL_USER: grafana
trigger:
branch:
- master
event:
- push
---
kind: pipeline
type: docker
name: windows-installer-master
platform:
os: windows
arch: amd64
version: 1809
steps:
- name: identify-runner
image: mcr.microsoft.com/windows:1809
commands:
- echo $Env:DRONE_RUNNER_NAME
- name: build-windows-installer
image: grafana/ci-wix:0.1.1
commands:
- $$gcpKey = $$env:GCP_KEY
- "[System.Text.Encoding]::UTF8.GetString([System.Convert]::FromBase64String($$gcpKey)) > gcpkey.json"
- dos2unix gcpkey.json
- gcloud auth activate-service-account --key-file=gcpkey.json
- rm gcpkey.json
- $$ProgressPreference = "SilentlyContinue"
- Invoke-WebRequest https://grafana-downloads.storage.googleapis.com/grafana-build-pipeline/v0.5.5/windows/grabpl.exe -OutFile grabpl.exe
- Invoke-WebRequest https://grafana-downloads.storage.googleapis.com/oss/master/grafana-7.2.0-9fffe273pre.windows-amd64.zip -OutFile grafana.zip
- cp C:\App\nssm-2.24.zip .
- ./grabpl.exe windows-installer --edition oss grafana.zip
- $$fname = ((Get-Childitem grafana*.msi -name) -split "`n")[0]
- echo "gsutil cp $$fname gs://grafana-downloads/oss/master/"
- echo "gsutil cp $$fname.sha256 gs://grafana-downloads/oss/master/"
environment:
GCP_KEY:
from_secret: gcp_key
trigger:
branch:
- master
event:
- push
depends_on:
- test-master
...