-
Notifications
You must be signed in to change notification settings - Fork 8
/
.drone.yml
1480 lines (1355 loc) · 40.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
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
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
kind: pipeline
type: docker
name: root checks
trigger:
event:
- pull_request
steps:
- name: cat-drone-consider
image: node:18.19
commands:
- cat .drone-consider
- name: check-sdk-abi
image: node:18.19
commands:
- cd packages/sdk
- npm run refresh-abis
- |
if [ -n "$(git diff --name-only)" ]; then
echo "ABIs not up-to-date in packages/sdk, need to run 'npm run refresh-abis'"
exit 1
fi
- name: check-subgraph-abi
image: node:18.19
commands:
- cd packages/subgraph
- npm run refresh-abis
- |
if [ -n "$(git diff --name-only)" ]; then
echo "ABIs not up-to-date in packages/subgraph, need to run 'npm run refresh-abis'"
exit 1
fi
- name: check-dapp-abi
image: node:18.19
commands:
- cd packages/protected-data-delivery-dapp/deployment
- npm run refresh-abis
- |
if [ -n "$(git diff --name-only)" ]; then
echo "ABIs not up-to-date in protected-data-delivery-dapp/abis, need to run 'npm run refresh-abis'"
exit 1
fi
---
# deploy DataProtector smart contract to prod, dev or staging
kind: pipeline
type: docker
name: smart-contract deploy
trigger:
event:
- promote
target:
# deploy and verify the DataProtector contract with the dev deployer
- smart-contract-deploy-dev
# deploy and verify the DataProtector contract with the dev deployer and commit the staging environment update
- smart-contract-deploy-staging
# deploy and verify the DataProtector contract with the prod deployer and commit the prod environment update
- smart-contract-deploy-prod
branch:
- develop
- main
steps:
- name: install deps
image: node:18.19
pull: always
commands:
- cd packages/smart-contract
- node -v
- npm -v
- npm ci
- name: check format
image: node:18.19
commands:
- cd packages/smart-contract
- npm run check-format
- name: check lint
image: node:18.19
commands:
- cd packages/smart-contract
- npm run lint
- name: compile smart contracts
image: node:18.19
commands:
- cd packages/smart-contract
- npm run compile
- name: test smart contracts
image: node:18.19
commands:
- cd packages/smart-contract
- npm run test
- name: smart-contract dev/staging deployment
image: node:18.19
environment:
WALLET_PRIVATE_KEY:
from_secret: deployer-dev-privatekey
commands:
- cd packages/smart-contract
- npm run deploy -- --network bellecour
when:
target:
- smart-contract-deploy-staging
- smart-contract-deploy-dev
branch:
- develop
- name: smart-contract prod deployment
image: node:18.19
environment:
WALLET_PRIVATE_KEY:
from_secret: deployer-prod-privatekey
commands:
- cd packages/smart-contract
- npm run deploy -- --network bellecour
when:
target:
- smart-contract-deploy-prod
branch:
- main
- name: update prod env
image: node:18.19
environment:
ENV: prod
commands:
- cd environments
- KEY=dataprotectorContractAddress VALUE=$(cat ../packages/smart-contract/deployments/DataProtector/address) npm run update-env
- KEY=dataprotectorStartBlock VALUE=$(cat ../packages/smart-contract/deployments/DataProtector/block) npm run update-env
- git add environments.json
- git commit -m "$DRONE_DEPLOY_TO deployment $DRONE_BUILD_NUMBER $DRONE_COMMIT" --author="drone-product <[email protected]>"
when:
target:
- smart-contract-deploy-prod
- name: update staging env
image: node:18.19
environment:
ENV: staging
commands:
- cd environments
- KEY=dataprotectorContractAddress VALUE=$(cat ../packages/smart-contract/deployments/DataProtector/address) npm run update-env
- KEY=dataprotectorStartBlock VALUE=$(cat ../packages/smart-contract/deployments/DataProtector/block) npm run update-env
- git add environments.json
- git commit -m "$DRONE_DEPLOY_TO deployment $DRONE_BUILD_NUMBER $DRONE_COMMIT" --author="drone-product <[email protected]>"
when:
target:
- smart-contract-deploy-staging
- name: git-push
image: appleboy/drone-git-push
settings:
remote: ssh://[email protected]/iExecBlockchainComputing/dataprotector-sdk.git
branch: update-env-${DRONE_BUILD_NUMBER}
ssh_key:
from_secret: ssh-key-team-product-github-push
when:
target:
- smart-contract-deploy-prod
- smart-contract-deploy-staging
- name: verify contract
image: node:18.19
commands:
- cd packages/smart-contract
- npm run verify -- --network bellecour $(cat deployments/DataProtector/address) $(cat deployments/DataProtector/args)
---
# deploy sharing smart contract to prod, staging or dev
kind: pipeline
type: docker
name: sharing-smart-contract deploy
trigger:
event:
- promote
target:
# deploy and verify the AddOnlyAppWhitelistRegistry and DataProtectorSharing contracts with the dev deployer
- sharing-smart-contract-deploy-dev
# deploy and verify the AddOnlyAppWhitelistRegistry and DataProtectorSharing contracts with the dev deployer, configure DataProtectorSharing for staging and commit the staging environment update
- sharing-smart-contract-deploy-staging
# deploy and verify the AddOnlyAppWhitelistRegistry and DataProtectorSharing contracts with the prod deployer and commit the prod environment update
- sharing-smart-contract-deploy-prod
branch:
- develop
- main
steps:
- name: install-deps
image: node:18.19
pull: always
commands:
- cd packages/sharing-smart-contract
- node -v
- npm -v
- npm ci
- name: install-forge
image: node:18.19
pull: always
commands:
- export XDG_CONFIG_HOME=/drone/src
- curl -L https://foundry.paradigm.xyz | bash
- export PATH="$PATH:/drone/src/.foundry/bin"
- foundryup
- cd packages/sharing-smart-contract
- forge install foundry-rs/forge-std --no-git
- name: bellecour-fork
detach: true
image: ghcr.io/foundry-rs/foundry:latest
pull: always
expose:
- 8545
commands:
- anvil --host 0.0.0.0 --port 8545 --hardfork berlin --fork-url https://bellecour.iex.ec --chain-id 134 --gas-limit 6700000 --gas-price 0
- name: bellecour-fork-healthy
image: bash
commands:
- while ! nc -z bellecour-fork 8545 ; do sleep 1 ; done && echo "bellecour-fork ready"
depends_on:
- bellecour-fork
- name: compile
image: node:18.19
commands:
- cd packages/sharing-smart-contract
- export PATH="$PATH:/drone/src/.foundry/bin"
- npm run compile
depends_on:
- install-forge
- install-deps
- name: check format
image: node:18.19
commands:
- cd packages/sharing-smart-contract
- npm run check-format
depends_on:
- install-deps
- name: lint
image: node:18.19
commands:
- cd packages/sharing-smart-contract
- npm run lint
depends_on:
- install-deps
- name: uml-diagrams
image: node:18.19
commands:
- cd packages/sharing-smart-contract
- npm run uml
depends_on:
- install-deps
- name: static-analyzer
image: node:18.19
commands:
- cd packages/sharing-smart-contract
- git clone https://github.com/Picodes/4naly3er.git
- cd 4naly3er
- git reset --hard HEAD~1 # FIX issue https://github.com/Picodes/4naly3er/issues/48
- yarn install
- yarn analyze ../contracts
depends_on:
- compile
- lint
- name: hardhat-tests
image: node:18.19
commands:
- cd packages/sharing-smart-contract
- export PATH="$PATH:/drone/src/.foundry/bin"
- npm run test -- --network ci-bellecour-fork
depends_on:
- install-deps
- install-forge
- compile
- bellecour-fork-healthy
- name: forge-tests
image: node:18.19
commands:
- cd packages/sharing-smart-contract
- export PATH="$PATH:/drone/src/.foundry/bin"
- forge test --no-match-test "invariant" -vvvvv
depends_on:
- install-deps
- install-forge
- compile
- bellecour-fork-healthy
- name: smart-contract-dev-deployment
image: node:18.19
environment:
WALLET_PRIVATE_KEY:
from_secret: deployer-dev-privatekey
commands:
- cd packages/sharing-smart-contract
- export PATH="$PATH:/drone/src/.foundry/bin"
- npm run deploy -- --network bellecour
depends_on:
- compile
- forge-tests
- hardhat-tests
when:
target:
- sharing-smart-contract-deploy-dev
branch:
- develop
- name: smart-contract-staging-deployment
image: node:18.19
environment:
WALLET_PRIVATE_KEY:
from_secret: deployer-dev-privatekey
ENV: staging
MANIFEST_DEFAULT_DIR: .openzeppelin/staging
commands:
- cd packages/sharing-smart-contract
- export PATH="$PATH:/drone/src/.foundry/bin"
- npm run deploy -- --network bellecour
- git add .openzeppelin
depends_on:
- compile
- forge-tests
- hardhat-tests
when:
target:
- sharing-smart-contract-deploy-staging
branch:
- develop
- name: smart-contract-prod-deployment
image: node:18.19
environment:
WALLET_PRIVATE_KEY:
from_secret: deployer-prod-privatekey
MANIFEST_DEFAULT_DIR: .openzeppelin/prod
commands:
- cd packages/sharing-smart-contract
- export PATH="$PATH:/drone/src/.foundry/bin"
- npm run deploy -- --network bellecour
- git add .openzeppelin
depends_on:
- compile
- forge-tests
- hardhat-tests
when:
target:
- sharing-smart-contract-deploy-prod
branch:
- main
- name: update-prod-env
image: node:18.19
environment:
ENV: prod
commands:
- cd environments
- KEY=dataprotectorSharingContractAddress VALUE=$(cat ../packages/sharing-smart-contract/deployments/DataProtectorSharing/address) npm run update-env
- KEY=dataprotectorSharingStartBlock VALUE=$(cat ../packages/sharing-smart-contract/deployments/DataProtectorSharing/block) npm run update-env
- KEY=addOnlyAppWhitelistRegistryContractAddress VALUE=$(cat ../packages/sharing-smart-contract/deployments/AddOnlyAppWhitelistRegistry/address) npm run update-env
- KEY=addOnlyAppWhitelistRegistryStartBlock VALUE=$(cat ../packages/sharing-smart-contract/deployments/AddOnlyAppWhitelistRegistry/block) npm run update-env
- git add environments.json
- git commit -m "$DRONE_DEPLOY_TO deployment $DRONE_BUILD_NUMBER $DRONE_COMMIT" --author="drone-product <[email protected]>"
when:
target:
- sharing-smart-contract-deploy-prod
depends_on:
- smart-contract-prod-deployment
- name: update-staging-env
image: node:18.19
environment:
ENV: staging
commands:
- cd environments
- KEY=dataprotectorSharingContractAddress VALUE=$(cat ../packages/sharing-smart-contract/deployments/DataProtectorSharing/address) npm run update-env
- KEY=dataprotectorSharingStartBlock VALUE=$(cat ../packages/sharing-smart-contract/deployments/DataProtectorSharing/block) npm run update-env
- KEY=addOnlyAppWhitelistRegistryContractAddress VALUE=$(cat ../packages/sharing-smart-contract/deployments/AddOnlyAppWhitelistRegistry/address) npm run update-env
- KEY=addOnlyAppWhitelistRegistryStartBlock VALUE=$(cat ../packages/sharing-smart-contract/deployments/AddOnlyAppWhitelistRegistry/block) npm run update-env
- git add environments.json
- git commit -m "$DRONE_DEPLOY_TO deployment $DRONE_BUILD_NUMBER $DRONE_COMMIT" --author="drone-product <[email protected]>"
when:
target:
- sharing-smart-contract-deploy-staging
depends_on:
- smart-contract-staging-deployment
- name: smart-contract-staging-update-env
image: node:18.19
environment:
WALLET_PRIVATE_KEY:
# TODO replace by dataprotector-admin-dev-privatekey
from_secret: deployer-dev-privatekey
ENV: staging
commands:
- cd packages/sharing-smart-contract
- export PATH="$PATH:/drone/src/.foundry/bin"
- npm run update-env -- --network bellecour
depends_on:
# relies on environments.json
- update-staging-env
when:
target:
- sharing-smart-contract-deploy-staging
branch:
- develop
- name: git-push
image: appleboy/drone-git-push
settings:
remote: ssh://[email protected]/iExecBlockchainComputing/dataprotector-sdk.git
branch: update-env-${DRONE_BUILD_NUMBER}
ssh_key:
from_secret: ssh-key-team-product-github-push
when:
target:
- sharing-smart-contract-deploy-prod
- sharing-smart-contract-deploy-staging
depends_on:
- update-prod-env
- update-staging-env
- smart-contract-staging-update-env
---
# pipeline to updateEnv in DataProtectorSharing SC
kind: pipeline
type: docker
name: sharing-smart-contract update-env
trigger:
event:
- promote
target:
# configure the staging DataProtectorSharing contract to use the staging environment
- sharing-smart-contract-update-env-staging
# configure the prod DataProtectorSharing contract to use the prod environment
- sharing-smart-contract-update-env-prod
branch:
- develop
- main
steps:
- name: install-deps
image: node:18.19
pull: always
commands:
- cd packages/sharing-smart-contract
- npm ci
- name: install-forge
image: node:18.19
pull: always
commands:
- export XDG_CONFIG_HOME=/drone/src
- curl -L https://foundry.paradigm.xyz | bash
- export PATH="$PATH:/drone/src/.foundry/bin"
- foundryup
- forge install foundry-rs/forge-std --no-git
- name: smart-contract-staging-update-env
image: node:18.19
environment:
WALLET_PRIVATE_KEY:
# TODO replace by dataprotector-admin-dev-privatekey
from_secret: deployer-dev-privatekey
ENV: staging
commands:
- cd packages/sharing-smart-contract
- export PATH="$PATH:/drone/src/.foundry/bin"
- npm run update-env -- --network bellecour
depends_on:
- install-forge
- install-deps
when:
target:
- sharing-smart-contract-update-env-staging
branch:
- develop
- name: smart-contract-prod-update-env
image: node:18.19
environment:
WALLET_PRIVATE_KEY:
# TODO replace by dataprotector-admin-prod-privatekey
from_secret: deployer-prod-privatekey
ENV: prod
commands:
- cd packages/sharing-smart-contract
- export PATH="$PATH:/drone/src/.foundry/bin"
- npm run update-env -- --network bellecour
depends_on:
- install-forge
- install-deps
when:
target:
- sharing-smart-contract-update-env-prod
branch:
- main
---
# pipeline to upgrade the DataProtectorSharing SC
kind: pipeline
type: docker
name: sharing-smart-contract upgrade
trigger:
event:
- promote
target:
# upgrade the staging DataProtectorSharing contract with the new implementation
- sharing-smart-contract-upgrade-staging
# # upgrade the prod DataProtectorSharing contract with the new implementation
# - sharing-smart-contract-upgrade-prod
branch:
- develop
- main
steps:
- name: install-deps
image: node:18.19
pull: always
commands:
- cd packages/sharing-smart-contract
- npm ci
- name: install-forge
image: node:18.19
pull: always
commands:
- export XDG_CONFIG_HOME=/drone/src
- curl -L https://foundry.paradigm.xyz | bash
- export PATH="$PATH:/drone/src/.foundry/bin"
- foundryup
- forge install foundry-rs/forge-std --no-git
- name: smart-contract-staging-upgrade
image: node:18.19
environment:
WALLET_PRIVATE_KEY:
# TODO replace by dataprotector-admin-dev-privatekey
from_secret: deployer-dev-privatekey
ENV: staging
MANIFEST_DEFAULT_DIR: .openzeppelin/staging
commands:
- cd packages/sharing-smart-contract
- export PATH="$PATH:/drone/src/.foundry/bin"
- npm run upgrade -- --network bellecour
- git add .openzeppelin
- git commit -m "$DRONE_DEPLOY_TO deployment $DRONE_BUILD_NUMBER $DRONE_COMMIT" --author="drone-product <[email protected]>"
depends_on:
- install-forge
- install-deps
when:
target:
- sharing-smart-contract-upgrade-staging
branch:
- develop
# - name: smart-contract-prod-upgrade
# image: node:18.19
# environment:
# WALLET_PRIVATE_KEY:
# # TODO replace by dataprotector-admin-prod-privatekey
# from_secret: deployer-prod-privatekey
# ENV: prod
# MANIFEST_DEFAULT_DIR: .openzeppelin/prod
# commands:
# - cd packages/sharing-smart-contract
# - export PATH="$PATH:/drone/src/.foundry/bin"
# - npm run upgrade -- --network bellecour
# - git add .openzeppelin
# - git commit -m "$DRONE_DEPLOY_TO deployment $DRONE_BUILD_NUMBER $DRONE_COMMIT" --author="drone-product <[email protected]>"
# depends_on:
# - install-forge
# - install-deps
# when:
# target:
# - sharing-smart-contract-upgrade-prod
# branch:
# - main
- name: git-push
image: appleboy/drone-git-push
settings:
remote: ssh://[email protected]/iExecBlockchainComputing/dataprotector-sdk.git
branch: update-env-${DRONE_BUILD_NUMBER}
ssh_key:
from_secret: ssh-key-team-product-github-push
depends_on:
- smart-contract-staging-upgrade
# - smart-contract-prod-upgrade
---
kind: pipeline
type: docker
name: publish dataprotector-subgraph-deployer docker image
trigger:
event:
- promote
target:
# publish a dataprotector-subgraph-deployer docker image dev
- subgraph-deployer-docker-dev
# publish a dataprotector-subgraph-deployer docker image prod
- subgraph-deployer-docker-prod
branch:
- develop
- main
steps:
- name: set-prod-tag-from-package
image: node:18.19
# generates the .tags file for the docker plugin
commands:
- cd packages/subgraph
- npm pkg get version | sed 's/"//g' > ../../.tags
when:
branch:
- main
target:
- subgraph-deployer-docker-prod
- name: set-dev-tag
image: node:18.19
# generates the .tags file for the docker plugin
commands:
- echo "dev-$DRONE_COMMIT" > .tags
when:
branch:
- develop
target:
- subgraph-deployer-docker-dev
- name: docker-dry-run
image: plugins/docker
pull: always
settings:
context: .
dockerfile: packages/subgraph/deployer.Dockerfile
registry: docker-regis.iex.ec
repo: docker-regis.iex.ec/product/dataprotector-subgraph-deployer
pull_image: true
username:
from_secret: nexus-user
password:
from_secret: nexus-password
---
kind: pipeline
type: docker
name: subgraph deploy
trigger:
event:
- promote
target:
# deploy the dataprotector subgraph
- subgraph-deploy-dev
# deploy the dataprotector subgraph for the staging environment
- subgraph-deploy-staging
# deploy the dataprotector subgraph for the prod environment
- subgraph-deploy-prod
branch:
- develop
- main
steps:
- name: deploy-v2-dev
image: node:18.19
params:
- START_BLOCK
environment:
GRAPHNODE_URL:
from_secret: graphnode-url
IPFS_URL:
from_secret: ipfs-url
ENV: prod
commands:
- cd packages/subgraph
- export SUBGRAPH_NAME=bellecour/dev-dataprotector-v2
- echo "deploying commit $DRONE_COMMIT on subgraph $SUBGRAPH_NAME"
- npm ci
- npm run codegen
- npm run build
- npx graph create --node $GRAPHNODE_URL $SUBGRAPH_NAME
- npx graph deploy --node $GRAPHNODE_URL $SUBGRAPH_NAME --ipfs $IPFS_URL --version-label $DRONE_COMMIT
when:
target:
- subgraph-deploy-dev
branch:
- develop
- name: deploy-v2-prod
image: node:18.19
params:
- START_BLOCK
environment:
GRAPHNODE_URL:
from_secret: graphnode-url
IPFS_URL:
from_secret: ipfs-url
ENV: prod
commands:
- cd packages/subgraph
- export SUBGRAPH_NAME=bellecour/dataprotector-v2
- echo "deploying commit $DRONE_COMMIT on subgraph $SUBGRAPH_NAME"
- npm ci
- npm run codegen
- npm run build
- npx graph create --node $GRAPHNODE_URL $SUBGRAPH_NAME
- npx graph deploy --node $GRAPHNODE_URL $SUBGRAPH_NAME --ipfs $IPFS_URL --version-label $(npm pkg get version)
when:
target:
- subgraph-deploy-prod
branch:
- main
- name: deploy-v2-staging
image: node:18.19
params:
- START_BLOCK
environment:
GRAPHNODE_URL:
from_secret: graphnode-url
IPFS_URL:
from_secret: ipfs-url
ENV: staging
commands:
- cd packages/subgraph
- export SUBGRAPH_NAME=bellecour/staging-dataprotector-v2
- echo "deploying commit $DRONE_COMMIT on subgraph $SUBGRAPH_NAME"
- npm ci
- npm run codegen
- npm run build
- npx graph create --node $GRAPHNODE_URL $SUBGRAPH_NAME
- npx graph deploy --node $GRAPHNODE_URL $SUBGRAPH_NAME --ipfs $IPFS_URL --version-label $(npm pkg get version)
when:
target:
- subgraph-deploy-staging
branch:
- develop
---
#pipeline to deploy app whitelist on iexec
kind: pipeline
type: docker
name: protected-data-delivery-dapp deploy whitelist
trigger:
event:
- promote
target:
# deploy a whitelist for the protected-data-delivery-dapp on the staging env
- protected-data-delivery-dapp-deploy-app-whitelist-staging
# deploy a whitelist for the protected-data-delivery-dapp on the prod env
- protected-data-delivery-dapp-deploy-app-whitelist-prod
branch:
- develop
- main
steps:
- name: install deps
image: node:18.19
pull: always
commands:
- cd packages/protected-data-delivery-dapp/deployment
- npm ci
- name: create app whitelist prod
image: node:18.19
pull: always
environment:
ENV: prod
WALLET_PRIVATE_KEY:
from_secret: protectedDataSharing-dapp-prod-privatekey
commands:
- cd packages/protected-data-delivery-dapp/deployment
- npm run create-app-whitelist
when:
target:
- protected-data-delivery-dapp-deploy-app-whitelist-prod
branch:
- main
- name: create app whitelist staging
image: node:18.19
pull: always
environment:
ENV: staging
WALLET_PRIVATE_KEY:
from_secret: protectedDataSharing-dapp-dev-privatekey
commands:
- cd packages/protected-data-delivery-dapp/deployment
- npm run create-app-whitelist
when:
target:
- protected-data-delivery-dapp-deploy-app-whitelist-staging
branch:
- develop
- name: update prod env
image: node:18.19
environment:
ENV: prod
commands:
- cd environments
- KEY=protectedDataDeliveryWhitelistAddress VALUE=$(cat ../packages/protected-data-delivery-dapp/deployment/.app-whitelist-address) npm run update-env
- git add environments.json
- git commit -m "$DRONE_DEPLOY_TO deployment $DRONE_BUILD_NUMBER $DRONE_COMMIT" --author="drone-product <[email protected]>"
when:
target:
- protected-data-delivery-dapp-deploy-app-whitelist-prod
branch:
- main
- name: update staging env
image: node:18.19
environment:
ENV: staging
commands:
- cd environments
- KEY=protectedDataDeliveryWhitelistAddress VALUE=$(cat ../packages/protected-data-delivery-dapp/deployment/.app-whitelist-address) npm run update-env
- git add environments.json
- git commit -m "$DRONE_DEPLOY_TO deployment $DRONE_BUILD_NUMBER $DRONE_COMMIT" --author="drone-product <[email protected]>"
when:
target:
- protected-data-delivery-dapp-deploy-app-whitelist-staging
branch:
- develop
- name: git-push
image: appleboy/drone-git-push
settings:
remote: ssh://[email protected]/iExecBlockchainComputing/dataprotector-sdk.git
branch: update-env-${DRONE_BUILD_NUMBER}
ssh_key:
from_secret: ssh-key-team-product-github-push
when:
target:
- protected-data-delivery-dapp-deploy-app-whitelist-staging
- protected-data-delivery-dapp-deploy-app-whitelist-prod
---
# dapp content-creator: build non-scone (non-tee) docker image & publish on docker-regis (dev)
kind: pipeline
type: docker
name: protected-data-delivery-dapp publish non-tee docker image
trigger:
event:
- promote
target:
# build the protected-data-delivery-dapp non-tee docker image for dev
- protected-data-delivery-dapp-docker-non-tee-dev
# build the protected-data-delivery-dapp non-tee docker image for staging
- protected-data-delivery-dapp-docker-non-tee-staging
# build the protected-data-delivery-dapp non-tee docker image for prod
- protected-data-delivery-dapp-docker-non-tee-prod
branch:
- develop
- main
steps:
- name: install-dependencies
image: node:14-alpine3.11
pull: always
commands:
- cd packages/protected-data-delivery-dapp
- node -v
- npm -v
- npm ci
- name: format
image: node:14-alpine3.11
commands:
- cd packages/protected-data-delivery-dapp
- npm run check-format
- name: lint
image: node:18.19
commands:
- cd packages/protected-data-delivery-dapp
- npm run lint
- name: set-prod-tag-from-package
image: node:18.19
# generates the .tags file for the docker plugin
commands:
- cd packages/protected-data-delivery-dapp
- npm pkg get version | sed 's/"//g' > ../../.tags
when:
branch:
- main
target:
- protected-data-delivery-dapp-docker-non-tee-prod
- name: set-staging-tag
image: node:18.19
# generates the .tags file for the docker plugin
commands:
- cd packages/protected-data-delivery-dapp
- echo "staging-$DRONE_COMMIT" > ../../.tags
when:
branch:
- develop
- main
target:
- protected-data-delivery-dapp-docker-non-tee-staging
- name: publish-dev-non-tee-docker-image
# plugin doc https://plugins.drone.io/plugins/docker and repo https://github.com/drone-plugins/drone-docker
image: plugins/docker
pull: always
settings:
context: packages/protected-data-delivery-dapp
dockerfile: packages/protected-data-delivery-dapp/Dockerfile
registry: docker-regis.iex.ec
repo: docker-regis.iex.ec/product/protected-data-delivery-dapp
pull_image: true
username:
from_secret: nexus-user
password:
from_secret: nexus-password
tags:
- dev
- 'dev-${DRONE_COMMIT}'
when:
branch:
- develop
target:
- protected-data-delivery-dapp-docker-non-tee-dev
- name: publish-prod/staging-non-tee-docker-image
# plugin doc https://plugins.drone.io/plugins/docker and repo https://github.com/drone-plugins/drone-docker
image: plugins/docker
pull: always
settings:
context: packages/protected-data-delivery-dapp
dockerfile: packages/protected-data-delivery-dapp/Dockerfile
# tag comes from .tags file
registry: docker-regis.iex.ec
repo: docker-regis.iex.ec/product/protected-data-delivery-dapp
pull_image: true
username:
from_secret: nexus-user
password:
from_secret: nexus-password
when:
branch:
- develop
- main
target:
- protected-data-delivery-dapp-docker-non-tee-staging
- protected-data-delivery-dapp-docker-non-tee-prod
---
#pipeline to deploy dapp on iexec
kind: pipeline
type: docker
name: protected-data-delivery-dapp deploy iexec dapp
trigger:
event:
- promote
target:
# deploy the tee protected-data-delivery-dapp add it to the staging app whitelist and register the ENS for staging environment
- protected-data-delivery-dapp-deploy-staging
# deploy the tee protected-data-delivery-dapp add it to the prod app whitelist and register the ENS for prod environment
- protected-data-delivery-dapp-deploy-prod
branch:
- develop
- main
steps:
- name: install deps
image: node:18.19
pull: always
commands:
- cd packages/protected-data-delivery-dapp/deployment
- npm ci
- name: format
image: node:18.19
commands:
- cd packages/protected-data-delivery-dapp/deployment