forked from oliver006/redis_exporter
-
Notifications
You must be signed in to change notification settings - Fork 0
/
.drone.yml
622 lines (563 loc) · 13.6 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
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
kind: pipeline
name: default
type: kubernetes
services:
- name: redis5
image: redis:5
pull: if-not-exists
commands:
- "redis-server --port 6383 --dbfilename dump5.rdb"
ports:
- 6383
- name: redis6
image: redis:6.2
pull: if-not-exists
commands:
- "redis-server --protected-mode no --dbfilename dump6.rdb"
ports:
- 6379
- name: redis7
image: redis:7.0
pull: if-not-exists
commands:
- "redis-server --port 6384 --protected-mode no --dbfilename dump7.rdb"
ports:
- 6384
- name: pwd-redis5
image: redis:5
pull: if-not-exists
commands:
- "redis-server --port 6380 --requirepass redis-password --dbfilename dump5-pwd.rdb"
ports:
- 6380
- name: pwd-redis6
image: redis:6
pull: if-not-exists
commands:
- "redis-server --port 6390 --requirepass dummy --user exporter on +INFO +CLIENT +SELECT +SLOWLOG +LATENCY '>exporter-password' --dbfilename dump6-pwd.rdb"
ports:
- 6390
- name: redis-2-8
image: redis:2.8.22
pull: if-not-exists
commands:
- "redis-server --port 6381 --dbfilename dump2-8.rdb"
ports:
- 6381
- name: keydb-01
image: "eqalpha/keydb:x86_64_v6.3.1"
pull: if-not-exists
commands:
- "keydb-server --protected-mode no --port 6401 --dbfilename dump-keydb-01.rdb"
ports:
- 6401
- name: keydb-02
image: "eqalpha/keydb:x86_64_v6.3.1"
pull: if-not-exists
commands:
- "keydb-server --protected-mode no --port 6402 --active-replica yes --replicaof keydb-01 6401 --dbfilename dump-keydb-02.rdb"
ports:
- 6402
- name: redis-cluster
image: grokzen/redis-cluster:6.2.10
pull: if-not-exists
ports: [ 7000, 7001, 7002, 7003, 7004, 7005 ]
- name: redis-cluster-password
image: bitnami/redis-cluster
environment:
REDIS_PORT_NUMBER: 7006
REDIS_PASSWORD: redis-password
REDIS_CLUSTER_CREATOR: yes
REDIS_NODES: redis-cluster-password:7006
ports:
- 7006
- name: tile38
image: tile38/tile38:latest
pull: if-not-exists
ports:
- 9851
steps:
- name: start
image: "golang:1.20"
pull: if-not-exists
commands:
- sleep 20
- 'echo "start"'
when:
event:
- pull_request
- push
- tag
#
# starting this service down here using "detached: true" because it depends on
# the "redis6" service and it intermittently fails if that service is not available yet
# making it start after the "start" step which waits 10 seconds hopefully fixes that issue
#
- name: redis-sentinel
image: "docker.io/bitnami/redis-sentinel:6.2-debian-10"
pull: if-not-exists
environment:
REDIS_MASTER_HOST: redis6
ports:
- 26379
detach: true
when:
event:
- pull_request
- push
- tag
depends_on:
- start
- name: test-docker-build
image: plugins/docker
pull: if-not-exists
settings:
mtu: 1200
tags: "test"
dockerfile: ./docker/Dockerfile
repo: oliver006/redis_exporter
target: scratch
dry_run: true
build_args:
- 'TAG=test'
- 'SHA1=${DRONE_COMMIT_SHA}'
- 'GOARCH=amd64'
username:
from_secret: docker_test_user
password:
from_secret: docker_test_pass
when:
event:
- pull_request
- push
- tag
depends_on:
- start
- name: lint
image: golangci/golangci-lint:v1.42.1-alpine
pull: if-not-exists
commands:
- golangci-lint run --tests=false --exclude-use-default
- golangci-lint run -D=errcheck --exclude-use-default
when:
event:
- pull_request
- push
- tag
depends_on:
- start
- name: tests
image: "golang:1.20"
pull: if-not-exists
environment:
GO111MODULE: on
LOG_LEVEL: "info"
commands:
- sleep 15
- make checks
- make test
when:
event:
- pull_request
- push
- tag
depends_on:
- test-docker-build
- name: mixins
image: golang:1.20
pull: if-not-exists
commands:
- make mixin
when:
event:
- pull_request
- push
depends_on:
- start
- name: coverage-codecov
image: golang:1.20
pull: if-not-exists
environment:
CODECOV_TOKEN:
from_secret: codecov-token
commands:
- curl -Os https://uploader.codecov.io/latest/linux/codecov
- chmod +x codecov
- ./codecov -t ${CODECOV_TOKEN} -f coverage.txt
when:
event:
- pull_request
- push
depends_on:
- tests
- name: coverage-coveralls
image: "golang:1.20"
pull: if-not-exists
environment:
GO111MODULE: on
LOG_LEVEL: "info"
COVERALLS_TOKEN:
from_secret: coveralls-token
commands:
- make upload-coverage
when:
event:
- pull_request
- push
- tag
depends_on:
- tests
- name: build-some-amd64-binaries
image: "golang:1.20"
pull: if-not-exists
environment:
GO111MODULE: on
LOG_LEVEL: "info"
commands:
- make build-some-amd64-binaries
when:
event:
- pull_request
- push
- tag
depends_on:
- tests
- name: build-all-binaries
image: "golang:1.20"
pull: if-not-exists
environment:
GO111MODULE: on
LOG_LEVEL: "info"
commands:
- make build-all-binaries
when:
event:
- tag
depends_on:
- build-some-amd64-binaries
- name: release-docker-image-scratch
image: plugins/docker
pull: if-not-exists
settings:
mtu: 1200
tags: "latest,latest-amd64,${DRONE_TAG},${DRONE_TAG}-amd64"
dockerfile: ./docker/Dockerfile
repo: oliver006/redis_exporter
target: scratch
no_cache: true
build_args:
- 'TAG=${DRONE_TAG}'
- 'SHA1=${DRONE_COMMIT_SHA}'
- 'GOARCH=amd64'
username:
from_secret: docker_user
password:
from_secret: docker_pass
when:
event:
- tag
depends_on:
- build-all-binaries
- name: release-docker-image-alpine-arm64
image: plugins/docker
pull: if-not-exists
settings:
mtu: 1200
tags: "latest-arm64,${DRONE_TAG}-arm64,alpine-arm64"
dockerfile: ./docker/Dockerfile
repo: oliver006/redis_exporter
target: alpine
no_cache: true
build_args:
- 'TAG=${DRONE_TAG}'
- 'SHA1=${DRONE_COMMIT_SHA}'
- 'GOARCH=arm64'
username:
from_secret: docker_user
password:
from_secret: docker_pass
when:
event:
- tag
depends_on:
- release-docker-image-scratch
- name: release-docker-image-alpine-arm
image: plugins/docker
pull: if-not-exists
settings:
mtu: 1200
tags: "latest-arm,${DRONE_TAG}-arm,alpine-arm"
dockerfile: ./docker/Dockerfile
repo: oliver006/redis_exporter
target: alpine
no_cache: true
build_args:
- 'TAG=${DRONE_TAG}'
- 'SHA1=${DRONE_COMMIT_SHA}'
- 'GOARCH=arm'
username:
from_secret: docker_user
password:
from_secret: docker_pass
when:
event:
- tag
depends_on:
- release-docker-image-alpine-arm64
- name: release-docker-image-alpine-amd64
image: plugins/docker
pull: if-not-exists
settings:
mtu: 1200
tags: "${DRONE_TAG}-alpine,alpine-amd64"
dockerfile: ./docker/Dockerfile
repo: oliver006/redis_exporter
target: alpine
no_cache: true
build_args:
- 'TAG=${DRONE_TAG}'
- 'SHA1=${DRONE_COMMIT_SHA}'
- 'GOARCH=amd64'
username:
from_secret: docker_user
password:
from_secret: docker_pass
when:
event:
- tag
depends_on:
- release-docker-image-alpine-arm
- name: manifest-docker-latest
image: plugins/manifest
pull: if-not-exists
settings:
username:
from_secret: docker_user
password:
from_secret: docker_pass
target: oliver006/redis_exporter:latest
template: "oliver006/redis_exporter:${DRONE_TAG}-ARCH"
platforms:
- linux/amd64
- linux/arm
- linux/arm64
when:
event:
- tag
depends_on:
- release-docker-image-scratch
- release-docker-image-alpine-arm64
- release-docker-image-alpine-arm
- release-docker-image-alpine-amd64
- name: manifest-docker-tag
image: plugins/manifest
pull: if-not-exists
settings:
username:
from_secret: docker_user
password:
from_secret: docker_pass
target: "oliver006/redis_exporter:${DRONE_TAG}"
template: "oliver006/redis_exporter:${DRONE_TAG}-ARCH"
platforms:
- linux/amd64
- linux/arm
- linux/arm64
when:
event:
- tag
depends_on:
- manifest-docker-latest
- name: manifest-docker-alpine
image: plugins/manifest
pull: if-not-exists
settings:
username:
from_secret: docker_user
password:
from_secret: docker_pass
target: oliver006/redis_exporter:alpine
template: oliver006/redis_exporter:alpine-ARCH
platforms:
- linux/amd64
- linux/arm
- linux/arm64
when:
event:
- tag
depends_on:
- manifest-docker-tag
###########
#
# Mirroring the docker images to quay.io
#
- name: release-quay-scratch
image: plugins/docker
pull: if-not-exists
settings:
mtu: 1200
registry: "quay.io"
repo: "quay.io/oliver006/redis_exporter"
tags: "latest,latest-amd64,${DRONE_TAG},${DRONE_TAG}-amd64"
dockerfile: ./docker/Dockerfile
target: scratch
no_cache: true
build_args:
- 'TAG=${DRONE_TAG}'
- 'SHA1=${DRONE_COMMIT_SHA}'
- 'GOARCH=amd64'
username:
from_secret: quay_user
password:
from_secret: quay_pass
when:
event:
- tag
depends_on:
- manifest-docker-tag
- name: release-quay-alpine-arm64
image: plugins/docker
pull: if-not-exists
settings:
mtu: 1200
registry: "quay.io"
repo: "quay.io/oliver006/redis_exporter"
tags: "latest-arm64,${DRONE_TAG}-arm64,alpine-arm64"
dockerfile: ./docker/Dockerfile
target: alpine
no_cache: true
build_args:
- 'TAG=${DRONE_TAG}'
- 'SHA1=${DRONE_COMMIT_SHA}'
- 'GOARCH=arm64'
username:
from_secret: quay_user
password:
from_secret: quay_pass
when:
event:
- tag
depends_on:
- release-quay-scratch
- name: release-quay-alpine-arm
image: plugins/docker
pull: if-not-exists
settings:
mtu: 1200
registry: "quay.io"
repo: "quay.io/oliver006/redis_exporter"
tags: "latest-arm,${DRONE_TAG}-arm,alpine-arm"
dockerfile: ./docker/Dockerfile
target: alpine
no_cache: true
build_args:
- 'TAG=${DRONE_TAG}'
- 'SHA1=${DRONE_COMMIT_SHA}'
- 'GOARCH=arm'
username:
from_secret: quay_user
password:
from_secret: quay_pass
when:
event:
- tag
depends_on:
- release-quay-alpine-arm64
- name: release-quay-alpine-amd64
image: plugins/docker
pull: if-not-exists
settings:
mtu: 1200
registry: "quay.io"
repo: "quay.io/oliver006/redis_exporter"
tags: "${DRONE_TAG}-alpine,alpine-amd64"
dockerfile: ./docker/Dockerfile
target: alpine
no_cache: true
build_args:
- 'TAG=${DRONE_TAG}'
- 'SHA1=${DRONE_COMMIT_SHA}'
- 'GOARCH=amd64'
username:
from_secret: quay_user
password:
from_secret: quay_pass
when:
event:
- tag
depends_on:
- release-quay-alpine-arm
- name: manifest-quay-latest
image: plugins/manifest
pull: if-not-exists
settings:
username:
from_secret: quay_user
password:
from_secret: quay_pass
target: quay.io/oliver006/redis_exporter:latest
template: "quay.io/oliver006/redis_exporter:${DRONE_TAG}-ARCH"
platforms:
- linux/amd64
- linux/arm
- linux/arm64
when:
event:
- tag
depends_on:
- release-quay-alpine-arm64
- release-quay-alpine-arm
- release-quay-alpine-amd64
- name: manifest-quay-tag
image: plugins/manifest
pull: if-not-exists
settings:
username:
from_secret: quay_user
password:
from_secret: quay_pass
target: "quay.io/oliver006/redis_exporter:${DRONE_TAG}"
template: "quay.io/oliver006/redis_exporter:${DRONE_TAG}-ARCH"
platforms:
- linux/amd64
- linux/arm
- linux/arm64
when:
event:
- tag
depends_on:
- manifest-quay-latest
- name: manifest-quay-alpine
image: plugins/manifest
pull: if-not-exists
settings:
username:
from_secret: quay_user
password:
from_secret: quay_pass
target: quay.io/oliver006/redis_exporter:alpine
template: quay.io/oliver006/redis_exporter:alpine-ARCH
platforms:
- linux/amd64
- linux/arm
- linux/arm64
when:
event:
- tag
depends_on:
- manifest-quay-tag
- name: release-github-binaries
image: "golang:1.20"
pull: if-not-exists
environment:
GITHUB_TOKEN:
from_secret: github_token
GO111MODULE: on
commands:
- "apt-get update && apt-get install -y zip"
- "./release-github-binaries.sh"
when:
event:
- tag
depends_on:
- manifest-quay-tag