-
Notifications
You must be signed in to change notification settings - Fork 250
/
.drone.yml
584 lines (510 loc) · 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
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
# kind: pipeline
# type: docker
# name: block_duplicated_pr_merged
# steps:
# - name: current_hollaex_kit_version
# image: alpine
# commands:
# - export PACKAGE_VERSION="$(cat version)" && echo "$PACKAGE_VERSION" > .tags_current
# - echo "Current Release tag is :" && cat .tags_current
# - name: previous_hollaex_kit_version
# image: byrnedo/alpine-curl
# commands:
# - curl https://raw.githubusercontent.com/hollaex/hollaex-kit/master/version > .tags_previous
# - echo "The previous master release tag is :" && cat .tags_previous
# - name: version_comparison
# image: frolvlad/alpine-bash
# commands:
# - export TAGS_CURRENT=$(cat .tags_current) && export TAGS_PREVIOUS=$(cat .tags_previous) && if [ "$TAGS_PREVIOUS" == "$TAGS_CURRENT" ]; then echo "Blocking the merge since the versions are same..." && exit 1; else echo "hi"; fi
# - name: slack_noti_job_end
# image: plugins/slack
# settings:
# channel: deployment
# webhook:
# from_secret: slack_webhook
# when:
# status: [failure]
# trigger:
# branch:
# - master
# event:
# - pull_request
# ---
# kind: pipeline
# type: docker
# name: hollaex_kit_amd64_build_deployment
# platform:
# os: linux
# arch: amd64
# steps:
# - name: docker_tagging_amd64_testnet
# image: alpine
# commands:
# - export TZ=UTC-9 && export GIT_COMMIT_SHORT="$(echo $DRONE_COMMIT | cut -c 1-7)" && export PACKAGE_VERSION="$(cat version)" && echo " $PACKAGE_VERSION-${DRONE_BRANCH}-$GIT_COMMIT_SHORT-amd64" > .tags
# - echo "Current Docker tag is :" && cat .tags
# - echo "dockerTag:$(cat .tags)" > .dockerTag.yml
# - name: docker_build_amd64
# image: plugins/docker
# settings:
# repo: hollaex/hollaex-kit
# dockerfile: Dockerfile
# environment:
# DOCKER_USERNAME:
# from_secret: docker_username
# DOCKER_PASSWORD:
# from_secret: docker_password
# - name: dct_signing
# image: docker:20.10-dind
# privileged: true
# environment:
# DOCKER_USERNAME:
# from_secret: docker_username
# DOCKER_PASSWORD:
# from_secret: docker_password
# DOCKER_CONTENT_TRUST_REPOSITORY_PASSPHRASE:
# from_secret: DOCKER_CONTENT_TRUST_REPOSITORY_PASSPHRASE
# DOCKER_CONTENT_TRUST_PRIVATE_KEY:
# from_secret: DOCKER_CONTENT_TRUST_PRIVATE_KEY
# volumes:
# - name: docker
# path: /var/run/docker.sock
# commands:
# - docker login -u $${DOCKER_USERNAME} -p $${DOCKER_PASSWORD}
# - export DOCKER_CLI_EXPERIMENTAL=enabled
# - docker pull hollaex/hollaex-kit:$(cat .tags)
# - export DOCKER_CONTENT_TRUST=1
# - mkdir $${HOME}/.docker/trust && mkdir $${HOME}/.docker/trust/private
# - echo -n $${DOCKER_CONTENT_TRUST_PRIVATE_KEY} | base64 -d > $${HOME}/.docker/trust/private/2aa7f2853b764c97de67db773c493d379ee655d7d78ff909d68c04a442fe3b69.key
# - chmod 600 $${HOME}/.docker/trust/private/2aa7f2853b764c97de67db773c493d379ee655d7d78ff909d68c04a442fe3b69.key
# - docker trust key load $${HOME}/.docker/trust/private/2aa7f2853b764c97de67db773c493d379ee655d7d78ff909d68c04a442fe3b69.key --name bitholla-cicd
# - docker trust sign hollaex/hollaex-kit:$(cat .tags)
# - name: docker_tagging_arm64v8_testnet
# image: alpine
# commands:
# - export TZ=UTC-9 && export GIT_COMMIT_SHORT="$(echo $DRONE_COMMIT | cut -c 1-7)" && export PACKAGE_VERSION="$(cat version)" && echo " $PACKAGE_VERSION-${DRONE_BRANCH}-$GIT_COMMIT_SHORT-arm64v8" > .tags
# - echo "Current Docker tag is :" && cat .tags
# - echo "dockerTag:$(cat .tags)" > .dockerTag.yml
# - name: docker_build_arm64v8
# image: plugins/docker
# settings:
# repo: hollaex/hollaex-kit
# dockerfile: Dockerfile.arm64v8
# environment:
# DOCKER_USERNAME:
# from_secret: docker_username
# DOCKER_PASSWORD:
# from_secret: docker_password
# - name: manifest_creation
# image: docker:18.06.3-dind
# privileged: true
# environment:
# DOCKER_USERNAME:
# from_secret: docker_username
# DOCKER_PASSWORD:
# from_secret: docker_password
# volumes:
# - name: docker
# path: /var/run/docker.sock
# commands:
# - docker login -u $${DOCKER_USERNAME} -p $${DOCKER_PASSWORD}
# - export DOCKER_CLI_EXPERIMENTAL=enabled
# - export TZ=UTC-9 && export GIT_COMMIT_SHORT="$(echo $DRONE_COMMIT | cut -c 1-7)" && export PACKAGE_VERSION="$(grep version package.json | cut -c 15- | rev | cut -c 3- | rev)" && echo "$PACKAGE_VERSION" > .tags
# - cat .tags
# - docker manifest create hollaex/hollaex-kit:$(cat .tags) hollaex/hollaex-kit:$(cat .tags)-amd64 hollaex/hollaex-kit:$(cat .tags)-arm64v8 --amend
# - docker manifest annotate hollaex/hollaex-kit:$(cat .tags) hollaex/hollaex-kit:$(cat .tags)-amd64 --arch amd64
# - docker manifest annotate hollaex/hollaex-kit:$(cat .tags) hollaex/hollaex-kit:$(cat .tags)-arm64v8 --arch amd64
# - docker manifest push hollaex/hollaex-kit:$(cat .tags)
# volumes:
# - name: docker
# host:
# path: /var/run/docker.sock
# trigger:
# branch:
# - deployment
# event:
# - push
kind: pipeline
type: docker
name: hollaex_kit_amd64_build
platform:
os: linux
arch: amd64
steps:
- name: slack_noti_job_start_testnet
image: plugins/slack
settings:
channel: deployment
webhook:
from_secret: slack_webhook
template: "<{{build.link}}|HollaEx Kit Testnet AMD64 Build> - #{{build.number}} started on <https://github.com/{{repo.owner}}/{{repo.name}}/tree/{{build.branch}}|{{repo.name}} / {{build.branch}}> by {{build.author}}"
when:
branch: testnet
- name: slack_noti_job_start_master
image: plugins/slack
settings:
channel: deployment
webhook:
from_secret: slack_webhook
template: "<{{build.link}}|HollaEx Kit Master AMD64 Build> - #{{build.number}} started on <https://github.com/{{repo.owner}}/{{repo.name}}/tree/{{build.branch}}|{{repo.name}} / {{build.branch}}> by {{build.author}}"
when:
branch: master
- name: docker_tagging_amd64_testnet
image: alpine
commands:
- export TZ=UTC-9 && export GIT_COMMIT_SHORT="$(echo $DRONE_COMMIT | cut -c 1-7)" && export PACKAGE_VERSION="$(cat version)" && echo " $PACKAGE_VERSION-${DRONE_BRANCH}-$GIT_COMMIT_SHORT" > .tags
- echo "Current Docker tag is :" && cat .tags
- echo "dockerTag:$(cat .tags)" > .dockerTag.yml
when:
branch: testnet
- name: docker_tagging_amd64_master
image: alpine
commands:
- export TZ=UTC-9 && export GIT_COMMIT_SHORT="$(echo $DRONE_COMMIT | cut -c 1-7)" && export PACKAGE_VERSION="$(cat version)" && echo " $PACKAGE_VERSION,$PACKAGE_VERSION-amd64" > .tags
- echo "Current Docker tag is :" && cat .tags
- echo "dockerTag:$(cat .tags)" > .dockerTag.yml
when:
branch: master
# - name: docker_tagging_amd64_deployment
# image: alpine
# commands:
# - export TZ=UTC-9 && export GIT_COMMIT_SHORT="$(echo $DRONE_COMMIT | cut -c 1-7)" && export PACKAGE_VERSION="$(cat version)" && echo "2.7.0-testnet-86884d5" > .tags
# - echo "Current Docker tag is :" && cat .tags
# - echo "dockerTag:$(cat .tags)" > .dockerTag.yml
# when:
# branch: deployment
- name: docker_build_amd64
image: plugins/docker
settings:
repo: hollaex/hollaex-kit
dockerfile: Dockerfile
environment:
DOCKER_USERNAME:
from_secret: docker_username
DOCKER_PASSWORD:
from_secret: docker_password
- name: dct_signing
image: docker:20.10-dind
privileged: true
environment:
DOCKER_USERNAME:
from_secret: docker_username
DOCKER_PASSWORD:
from_secret: docker_password
DOCKER_CONTENT_TRUST_REPOSITORY_PASSPHRASE:
from_secret: DOCKER_CONTENT_TRUST_REPOSITORY_PASSPHRASE
DOCKER_CONTENT_TRUST_PRIVATE_KEY:
from_secret: DOCKER_CONTENT_TRUST_PRIVATE_KEY
volumes:
- name: docker
path: /var/run/docker.sock
commands:
- docker login -u $${DOCKER_USERNAME} -p $${DOCKER_PASSWORD}
- export DOCKER_CLI_EXPERIMENTAL=enabled
- TAG=$(cat .tags | tr -d ' ' | cut -f1 -d ',') && echo $TAG > .tags
- docker pull hollaex/hollaex-kit:$(cat .tags)
- export DOCKER_CONTENT_TRUST=1
- mkdir $${HOME}/.docker/trust && mkdir $${HOME}/.docker/trust/private
- echo -n $${DOCKER_CONTENT_TRUST_PRIVATE_KEY} | base64 -d > $${HOME}/.docker/trust/private/2aa7f2853b764c97de67db773c493d379ee655d7d78ff909d68c04a442fe3b69.key
- chmod 600 $${HOME}/.docker/trust/private/2aa7f2853b764c97de67db773c493d379ee655d7d78ff909d68c04a442fe3b69.key
- docker trust key load $${HOME}/.docker/trust/private/2aa7f2853b764c97de67db773c493d379ee655d7d78ff909d68c04a442fe3b69.key --name bitholla-cicd
- docker trust sign hollaex/hollaex-kit:$(cat .tags)
- name: docker_tagging_arm64v8_master
image: alpine
commands:
- export TZ=UTC-9 && export GIT_COMMIT_SHORT="$(echo $DRONE_COMMIT | cut -c 1-7)" && export PACKAGE_VERSION="$(cat version)" && echo " $PACKAGE_VERSION-arm64v8" > .tags
- echo "Current Docker tag is :" && cat .tags
- echo "dockerTag:$(cat .tags)" > .dockerTag.yml
when:
branch: master
- name: docker_build_arm64v8
image: plugins/docker
settings:
repo: hollaex/hollaex-kit
dockerfile: Dockerfile.arm64v8
environment:
DOCKER_USERNAME:
from_secret: docker_username
DOCKER_PASSWORD:
from_secret: docker_password
when:
branch: master
- name: manifest_creation
image: docker:18.06.3-dind
privileged: true
environment:
DOCKER_USERNAME:
from_secret: docker_username
DOCKER_PASSWORD:
from_secret: docker_password
volumes:
- name: docker
path: /var/run/docker.sock
commands:
- docker login -u $${DOCKER_USERNAME} -p $${DOCKER_PASSWORD}
- export DOCKER_CLI_EXPERIMENTAL=enabled
- export PACKAGE_VERSION="$(cat version)" && echo "$PACKAGE_VERSION" > .tags
- cat .tags
- docker manifest create hollaex/hollaex-kit:$(cat .tags) hollaex/hollaex-kit:$(cat .tags)-amd64 hollaex/hollaex-kit:$(cat .tags)-arm64v8 --amend
- docker manifest annotate hollaex/hollaex-kit:$(cat .tags) hollaex/hollaex-kit:$(cat .tags)-amd64 --arch amd64
- docker manifest annotate hollaex/hollaex-kit:$(cat .tags) hollaex/hollaex-kit:$(cat .tags)-arm64v8 --arch arm64
- docker manifest push hollaex/hollaex-kit:$(cat .tags)
when:
branch: master
- name: slack_noti_job_end
image: plugins/slack
settings:
channel: deployment
webhook:
from_secret: slack_webhook
template: >
{{#success build.status}}
Successfully <{{build.link}}|built> the AMD64 Docker Image.
{{else}}
<{{build.link}}|Failed to build the AMD64 Docker Image.>
{{/success}}
when:
status: [success, failure]
volumes:
- name: docker
host:
path: /var/run/docker.sock
trigger:
branch:
- testnet
- master
event:
- push
---
kind: pipeline
type: docker
name: slack_notify
steps:
- name: partymaker_version_tag
image: alpine
commands:
- cat version > .tags
- echo "Current version tag is :" && cat .tags
when:
branch: master
- name: partymaker_version_tag_testnet
image: alpine
commands:
- echo "$(cat version)-testnet" > .tags
- echo "Current version tag is :" && cat .tags
when:
branch: testnet
- name: create_github_release
image: bitholla/devops-tools:drone_github_hub-2004241546
environment:
GITHUB_TOKEN:
from_secret: github_oauth2_token_for_releases
commands:
- apt-get update && apt-get install -y hub git
- hub release create -m "HollaEx Kit v$(cat .tags) Release" -t ${DRONE_BRANCH} $(cat .tags)
when:
branch: master
- name: slack_noti_to_tech
image: bitholla/devops-tools:drone_partymaker-220208
environment:
WEBHOOK_URL:
from_secret: webhook_url_tech
when:
status: [success, failure]
branch: testnet
- name: slack_noti_to_releases
image: bitholla/devops-tools:drone_partymaker-220208
environment:
WEBHOOK_URL:
from_secret: webhook_url
when:
status: [success, failure]
branch: master
- name: notify_to_discord_releases
image: bitholla/devops-tools:drone_partymaker-220208
channel: deployment
settings:
target: discord
release_name: hollaex-kit
environment:
WEBHOOK_URL:
from_secret: discord_webhook_url
when:
status: [ success, failure ]
branch: master
trigger:
branch:
- master
- testnet
event:
- push
---
kind: pipeline
type: docker
name: kit_v2_sandbox_deployment
depends_on:
- hollaex_kit_amd64_build
steps:
- name: slack_noti_job_start
image: plugins/slack
settings:
channel: deployment
webhook:
from_secret: slack_webhook
template: "<{{build.link}}|HollaEx v2 Sandbox Deployment> - #{{build.number}} started on <https://github.com/{{repo.owner}}/{{repo.name}}/tree/{{build.branch}}|{{repo.name}} / {{build.branch}}> by {{build.author}}"
- name: partymaker_version_tag
image: alpine
commands:
- echo "$(cat version)-sandbox" > .tags
- echo "Current version tag is :" && cat .tags
- name: request_hollacloud_to_run_upgrade
image: bitholla/devops-tools:drone_hollacloud-220216
environment:
HOLLAEX_EMAIL:
from_secret: hollaex_email
HOLLAEX_PASSWORD:
from_secret: hollaex_password
HOLLAEX_LOGIN_KEY:
from_secret: hollaex_network_testnet_login_key
settings:
exchange_id: 176
exchange_name: "Sandbox HollaEx"
- name: slack_noti_job_end
image: plugins/slack
settings:
channel: deployment
webhook:
from_secret: slack_webhook
when:
status: [success, failure]
trigger:
branch:
- testnet
event:
- push
---
kind: pipeline
type: docker
name: kit_v2_next_deployment
steps:
- name: slack_noti_job_start
image: plugins/slack
settings:
channel: deployment
webhook:
from_secret: slack_webhook
template: "<{{build.link}}|HollaEx v2 Next Test Exchange Deployment> - #{{build.number}} started on <https://github.com/{{repo.owner}}/{{repo.name}}/tree/{{build.branch}}|{{repo.name}} / {{build.branch}}> by {{build.author}}"
- name: partymaker_version_tag
image: alpine
commands:
- echo "$(cat version)-next" > .tags
- echo "Current version tag is :" && cat .tags
- name: request_hollacloud_to_run_upgrade
image: bitholla/devops-tools:drone_hollacloud-220216
environment:
HOLLAEX_EMAIL:
from_secret: next_email
HOLLAEX_PASSWORD:
from_secret: next_password
HOLLAEX_LOGIN_KEY:
from_secret: hollaex_network_testnet_login_key
settings:
exchange_id: 539
exchange_name: "Next"
kit_branch: "next"
- name: slack_noti_job_end
image: plugins/slack
settings:
channel: deployment
webhook:
from_secret: slack_webhook
when:
status: [success, failure]
trigger:
branch:
- next
event:
- push
---
kind: secret
name: slack_webhook
get:
path: devops/data/drone-ci/secret
name: slack_webhook
---
kind: secret
name: webhook_url
get:
path: devops/data/drone-ci/secret
name: webhook_url
---
kind: secret
name: webhook_url_tech
get:
path: devops/data/drone-ci/secret
name: webhook_url_tech
---
kind: secret
name: discord_webhook_url
get:
path: devops/data/drone-ci/secret
name: discord_webhook_url
---
kind: secret
name: github_oauth2_token_for_releases
get:
path: devops/data/drone-ci/secret
name: github_oauth2_token_for_releases
---
kind: secret
name: docker_username
get:
path: devops/data/drone-ci/secret
name: docker_username
---
kind: secret
name: docker_password
get:
path: devops/data/drone-ci/secret
name: docker_password
---
kind: secret
name: hollaex_email
get:
path: devops/data/drone-ci/secret
name: hollaex_email
---
kind: secret
name: hollaex_password
get:
path: devops/data/drone-ci/secret
name: hollaex_password
---
kind: secret
name: hollaex_network_testnet_login_key
get:
path: devops/data/drone-ci/secret
name: hollaex_network_testnet_login_key
---
kind: secret
name: next_email
get:
path: devops/data/drone-ci/secret
name: next_email
---
kind: secret
name: next_password
get:
path: devops/data/drone-ci/secret
name: next_password
---
kind: secret
name: DOCKER_CONTENT_TRUST_REPOSITORY_PASSPHRASE
get:
path: devops/data/drone-ci/secret
name: DOCKER_CONTENT_TRUST_REPOSITORY_PASSPHRASE
---
kind: secret
name: DOCKER_CONTENT_TRUST_PRIVATE_KEY
get:
path: devops/data/drone-ci/secret
name: DOCKER_CONTENT_TRUST_PRIVATE_KEY