forked from tezedge/tezedge
-
Notifications
You must be signed in to change notification settings - Fork 7
/
.drone.longrunning.yml
478 lines (435 loc) · 18.6 KB
/
.drone.longrunning.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
kind: pipeline
name: build-tezedge-binaries
workspace:
path: /drone/src
steps:
- name: build-artifacts
image: tezedge/tezedge-ci-builder:rust-1.58.1-v13.0-octez
pull: if-not-exists
user: root
environment:
RUST_BACKTRACE: 1
SODIUM_USE_PKG_CONFIG: 1
OCAML_BUILD_CHAIN: remote
LOG_LEVEL: info
OCAML_LOG_ENABLED: false
commands:
# prepare rust toolchain dir
- echo "`rustup show home`/toolchains/`rustup show active-toolchain | tr " " "\n" | head -1`/lib"
# build and unit-test
- cargo clean
- cargo build --release --workspace
- cargo test --release --workspace --no-run
# collect binary artefacts
# directory in the workspace to cache all the binary artefacts
# TODO: use snake-case for directories
- mkdir -p drone-cache/build_files/ffi
- mkdir -p drone-cache/build_files/tezedge
- mkdir -p drone-cache/build_files/identities
- mkdir -p drone-cache/test_data/tests/resources
- mkdir -p drone-cache/tests
- mkdir -p drone-cache/sandbox_files
# copy binaries
- cp ./target/release/light-node drone-cache/build_files
- cp ./target/release/sandbox drone-cache/build_files
- cp ./target/release/protocol-runner drone-cache/build_files
- cp ./tezos/sys/lib_tezos/artifacts/libtezos.so drone-cache/build_files/ffi
- cp ./sandbox/artifacts/tezos-client drone-cache/build_files
# copy sapling init files
- cp ./tezos/sys/lib_tezos/artifacts/sapling-spend.params drone-cache/build_files/ffi
- cp ./tezos/sys/lib_tezos/artifacts/sapling-output.params drone-cache/build_files/ffi
# copy sandbox resources
- cp ./light_node/etc/tezedge_sandbox/sandbox-patch-context.json drone-cache/sandbox_files
- cp ./light_node/etc/tezedge_sandbox/006-carthage-protocol-parameters.json drone-cache/sandbox_files
- cp ./light_node/etc/tezedge_sandbox/008-edo-protocol-parameters.json drone-cache/sandbox_files
- cp ./light_node/etc/tezedge_sandbox/009-florence-protocol-parameters.json drone-cache/sandbox_files
- cp ./light_node/etc/tezedge_sandbox/010-granada-protocol-parameters.json drone-cache/sandbox_files
- cp ./light_node/etc/tezedge_sandbox/tezedge_drone_sandbox.config drone-cache/sandbox_files
- cp ./light_node/etc/tezedge_sandbox/sandbox_start_light_node_args.json drone-cache/sandbox_files
- cp ./light_node/etc/tezedge_sandbox/sandbox_init_client_request.json drone-cache/sandbox_files
- cp ./light_node/etc/tezedge_sandbox/sandbox_activate_protocol_request.json drone-cache/sandbox_files
- cp ./light_node/etc/tezedge_sandbox/sandbox_activate_protocol_009_request.json drone-cache/sandbox_files
- cp ./light_node/etc/tezedge_sandbox/sandbox_activate_protocol_010_request.json drone-cache/sandbox_files
- cp ./light_node/etc/tezedge_sandbox/sandbox_bake_empty_block.json drone-cache/sandbox_files
# copy other resources
- cp ./light_node/etc/drone/assert_equals.sh drone-cache/build_files/ && chmod 755 drone-cache/build_files/assert_equals.sh
- cp ./light_node/etc/drone/assert_contains.sh drone-cache/build_files/ && chmod 755 drone-cache/build_files/assert_contains.sh
- cp ./light_node/etc/drone/wait_file.sh drone-cache/build_files/ && chmod 755 drone-cache/build_files/wait_file.sh
- cp ./light_node/etc/drone/assert_cyclic_test_result.sh drone-cache/build_files/ && chmod 755 drone-cache/build_files/assert_cyclic_test_result.sh
- cp ./light_node/etc/drone/identities/* drone-cache/build_files/identities/
- cp ./light_node/etc/tezedge/tezedge_drone.config drone-cache/build_files/tezedge/
# copy test binaries
- cp `find ./target/release/deps/ | grep integration_test | grep -v "\.d" | head -1` drone-cache/tests/rpc_integration_test
- cp `find ./target/release/deps/ | grep reward_distribution_tests | grep -v "\.d" | head -1` drone-cache/tests/rpc_reward_distribution_tests
# collect modified python tests stuff
- mkdir -p drone-cache/python-tests/daemons
- mkdir -p drone-cache/python-tests/launchers
- mkdir -p drone-cache/python-tests/tools
- cp -r ./tezos/python-tests/daemons/node.py drone-cache/python-tests/daemons/node.py
- cp -r ./tezos/python-tests/launchers/sandbox.py drone-cache/python-tests/launchers/sandbox.py
- cp -r ./tezos/python-tests/tools/constants.py drone-cache/python-tests/tools/constants.py
- name: rebuild-artifacts-cache
image: meltwater/drone-cache
pull: true
environment:
SFTP_USERNAME:
from_secret: sftp_username
SFTP_PASSWORD:
from_secret: sftp_password
SFTP_AUTH_METHOD: PASSWORD
SFTP_HOST: 65.21.165.82
SFTP_PORT: 22
SFTP_CACHE_ROOT: "/upload"
settings:
rebuild: true
backend: "sftp"
cache_key: 'build-{{ .Build.Number }}'
mount:
- 'drone-cache' # <- builds a cache from this directory
trigger:
branch: develop
event: push
---
###################################################################################################################
# This pipeline runs a TezEdge node and compares the rewards distribution calculated by tezedge to the tzkt indexer
# to ensure the calculated values are correct
###################################################################################################################
kind: pipeline
name: corr/rewards-distribution-rpc-test
trigger:
branch: develop
event: push
depends_on:
- build-tezedge-binaries
image_pull_secrets:
- docker_pull_secret
volumes:
- name: cache
temp: {}
- name: tezedge-node-ithacanet-data
host:
path: /home/dev/tezedge-data/tezedge-ithacanet-data
environment:
FROM_CYCLE: 6
TO_CYCLE: 157
TEZEDGE_NODE_RPC_CONTEXT_ROOT: http://tezedge-node-ithacanet-run:18732
steps:
- name: prepare-cache-dir
image: alpine/git
user: root
commands:
- mkdir -p drone-cache
- name: restore-cache
image: meltwater/drone-cache
pull: true
environment:
SFTP_USERNAME:
from_secret: sftp_username
SFTP_PASSWORD:
from_secret: sftp_password
SFTP_AUTH_METHOD: PASSWORD
SFTP_HOST: 65.21.165.82
SFTP_PORT: 22
SFTP_CACHE_ROOT: "/upload"
settings:
restore: true
debug: true
backend: "sftp"
cache_key: 'build-{{ .Build.Number }}'
mount:
- 'drone-cache' # <- builds a cache from this directory
- name: tezedge-node-ithacanet-run
image: tezedge/tezedge-ci-builder:rust-1.58.1-v13.0-octez
pull: if-not-exists
user: root
detach: true
volumes:
- name: tezedge-node-ithacanet-data
path: /data/tezedge-data
environment:
SODIUM_USE_PKG_CONFIG: 1
commands:
- rust_libs=$(echo "`rustup show home`/toolchains/`rustup show active-toolchain | tr " " "\n" | head -1`/lib")
- export LD_LIBRARY_PATH="drone-cache/build_files/ffi:$rust_libs"
- echo "LD_LIBRARY_PATH - $LD_LIBRARY_PATH"
- drone-cache/build_files/light-node --config-file "drone-cache/build_files/tezedge/tezedge_drone.config" --disable-bootstrap-lookup --peer-thresh-low=0 --peer-thresh-high=0 --identity-file "drone-cache/build_files/identities/identity_4.json" --network "ithaca" --protocol-runner "drone-cache/build_files/protocol-runner" --p2p-port 19732 --init-sapling-spend-params-file drone-cache/build_files/ffi/sapling-spend.params --init-sapling-output-params-file drone-cache/build_files/ffi/sapling-output.params --tezos-data-dir /data/tezedge-data --bootstrap-db-path bootstrap_db --tezos-context-storage irmin
- name: wait-for-node
image: tezedge/tezos-node-bootstrap:latest
commands:
- tezos-node-bootstrap bootstrap --level=10 --nodes $${TEZEDGE_NODE_RPC_CONTEXT_ROOT}
- name: rewards-rpc-test
image: tezedge/tezedge-ci-builder:rust-1.58.1-v13.0-octez
pull: if-not-exists
user: root
environment:
RUST_BACKTRACE: 1
commands:
- export NODE_RPC_CONTEXT_ROOT_1=$${TEZEDGE_NODE_RPC_CONTEXT_ROOT}
- export FROM_CYCLE=$${FROM_CYCLE}
- export TO_CYCLE=$${TO_CYCLE}
- drone-cache/tests/rpc_reward_distribution_tests --ignored --nocapture test_rewards_distribution
---
##############################################################################################################
# This pipeline tests the import-snapshot subcommand with both types of context snapshots directly from the
# deployed snapshot server
##############################################################################################################
kind: pipeline
name: corr/import-latest-snapshot
trigger:
branch: develop
event: push
environment:
NETWORK: hangzhou
SNAPSHOT_SERVER: http://162.55.241.136/
SNAPSHOT_IRMIN_FULL_PATH: testnet/irmin/full/
SNAPSHOT_TEZEDGE_FULL_PATH: testnet/tezedge/full/
depends_on:
- build-tezedge-binaries
image_pull_secrets:
- docker_pull_secret
volumes:
- name: cache
temp: {}
steps:
- name: prepare-data
image: alpine/git
user: root
commands:
- mkdir -p drone-cache
- name: restore-cache
image: meltwater/drone-cache
pull: true
environment:
SFTP_USERNAME:
from_secret: sftp_username
SFTP_PASSWORD:
from_secret: sftp_password
SFTP_AUTH_METHOD: PASSWORD
SFTP_HOST: 65.21.165.82
SFTP_PORT: 22
SFTP_CACHE_ROOT: "/upload"
settings:
restore: true
debug: true
backend: "sftp"
cache_key: 'build-{{ .Build.Number }}'
mount:
- 'drone-cache' # <- builds a cache from this directory
- name: import-snapshot-with-irmin-context
image: tezedge/tezedge-ci-builder:rust-1.58.1-v13.0-octez
user: root
pull: if-not-exists
environment:
SODIUM_USE_PKG_CONFIG: 1
THROTTLING_QUOTA_DISABLE: true
volumes:
- name: cache
path: /cache
commands:
- LATEST_SNAPSHOT=$(curl -s "$${SNAPSHOT_SERVER}$${SNAPSHOT_IRMIN_FULL_PATH}" | jq .[-1].name | tr -d '"')
- ./drone-cache/build_files/light-node import-snapshot --from $${SNAPSHOT_SERVER}$${SNAPSHOT_IRMIN_FULL_PATH}$LATEST_SNAPSHOT --tezos-data-dir /cache
- echo $LATEST_SNAPSHOT | awk '{split($0,a,"_"); print a[4]}' > /cache/block_hash
- name: run-restored-with-irmin-context
image: tezedge/tezedge-ci-builder:rust-1.58.1-v13.0-octez
user: root
pull: if-not-exists
volumes:
- name: cache
path: /cache
commands:
- rust_libs=$(echo "`rustup show home`/toolchains/`rustup show active-toolchain | tr " " "\n" | head -1`/lib")
- export LD_LIBRARY_PATH="drone-cache/build_files/ffi:$rust_libs"
- BLOCK_HASH=$(cat /cache/block_hash)
- LEVEL_TO_CHECK=$(curl https://api.$${NETWORK}.tzstats.com/explorer/block/$BLOCK_HASH | jq .height | awk '{print $1+10}')
- >
./drone-cache/build_files/light-node
--config-file=./drone-cache/build_files/tezedge/tezedge_drone.config
--identity-file=./drone-cache/build_files/identities/identity_2.json
--protocol-runner=./drone-cache/build_files/protocol-runner
--init-sapling-spend-params-file=./drone-cache/build_files/ffi/sapling-spend.params
--init-sapling-output-params-file=./drone-cache/build_files/ffi/sapling-output.params
--peer-thresh-low=1 --peer-thresh-high=10 --network "$${NETWORK}"
--tezos-data-dir=/cache --bootstrap-db-path=bootstrap_db
--tezos-context-storage=irmin
--log-level debug --context-integrity-check true &
echo $! > /var/run/tezedge.pid
# this command waits the node to be on level LEVEL_TO_CHECK
- |
sh -c '
block=0
attempts=0
while [ $block -lt $LEVEL_TO_CHECK ]; do
sleep 5
b=$(curl -s localhost:18732/chains/main/blocks/head | jq .header.level)
block=$${b:-$block}
echo "===> Block level $block"
if [ $attempts -gt 12 ]; then
echo "Failed to bootstrap after a minute."
exit 1
fi
attempts=$(($attempts + 1))
done
'
- echo "Bootstrapped. Killing the node and waiting for 10 seconds."
# terminate the node gracefully and wait to allow `valgrind` dump data
- kill -INT $(cat /var/run/tezedge.pid) && sleep 10
- name: cleanup-cached-tezedge-data
image: tezedge/tezedge-ci-builder:rust-1.58.1-v13.0-octez
user: root
pull: if-not-exists
volumes:
- name: cache
path: /cache
commands:
- rm -rf /cache/*
- name: import-snapshot-with-tezedge-context
image: tezedge/tezedge-ci-builder:rust-1.58.1-v13.0-octez
user: root
pull: if-not-exists
environment:
SODIUM_USE_PKG_CONFIG: 1
THROTTLING_QUOTA_DISABLE: true
volumes:
- name: cache
path: /cache
commands:
- LATEST_SNAPSHOT=$(curl -s "$${SNAPSHOT_SERVER}$${SNAPSHOT_TEZEDGE_FULL_PATH}" | jq .[-1].name | tr -d '"')
- ./drone-cache/build_files/light-node import-snapshot --from $${SNAPSHOT_SERVER}$${SNAPSHOT_TEZEDGE_FULL_PATH}$LATEST_SNAPSHOT --tezos-data-dir /cache
- echo $LATEST_SNAPSHOT | awk '{split($0,a,"_"); print a[4]}' > /cache/block_hash
- name: run-restored-with-tezedge-context
image: tezedge/tezedge-ci-builder:rust-1.58.1-v13.0-octez
user: root
pull: if-not-exists
volumes:
- name: cache
path: /cache
commands:
- rust_libs=$(echo "`rustup show home`/toolchains/`rustup show active-toolchain | tr " " "\n" | head -1`/lib")
- export LD_LIBRARY_PATH="drone-cache/build_files/ffi:$rust_libs"
- BLOCK_HASH=$(cat /cache/block_hash)
- LEVEL_TO_CHECK=$(curl https://api.$${NETWORK}.tzstats.com/explorer/block/$BLOCK_HASH | jq .height | awk '{print $1+10}')
- >
./drone-cache/build_files/light-node
--config-file=./drone-cache/build_files/tezedge/tezedge_drone.config
--identity-file=./drone-cache/build_files/identities/identity_2.json
--protocol-runner=./drone-cache/build_files/protocol-runner
--init-sapling-spend-params-file=./drone-cache/build_files/ffi/sapling-spend.params
--init-sapling-output-params-file=./drone-cache/build_files/ffi/sapling-output.params
--peer-thresh-low=1 --peer-thresh-high=10 --network "$${NETWORK}"
--tezos-data-dir=/cache --bootstrap-db-path=bootstrap_db
--tezos-context-storage=tezedge
--log-level debug --context-integrity-check true &
echo $! > /var/run/tezedge.pid
# this command waits the node to be on level LEVEL_TO_CHECK
- |
sh -c '
block=0
attempts=0
while [ $block -lt $LEVEL_TO_CHECK ]; do
sleep 5
b=$(curl -s localhost:18732/chains/main/blocks/head | jq .header.level)
block=$${b:-$block}
echo "===> Block level $block"
if [ $attempts -gt 12 ]; then
echo "Failed to bootstrap after a minute."
exit 1
fi
attempts=$(($attempts + 1))
done
'
- echo "Bootstrapped. Killing the node and waiting for 10 seconds."
# terminate the node gracefully and wait to allow `valgrind` dump data
- kill -INT $(cat /var/run/tezedge.pid) && sleep 10
---
###################################################################################################################
# This pipeline runs a long running RPC call comparison test that compares tezedge results with octez, ensuring the
# data the RPC returns is correct
###################################################################################################################
kind: pipeline
name: corr/baking-endorsing-rights-rpc-test
environment:
TO_BLOCK_HEADER_FOR_RPC: 1672200
TEZEDGE_NODE_RPC_CONTEXT_ROOT: http://tezedge-updated-node-mainnet-run:18732
OCTEZ_NODE_RPC_CONTEXT_ROOT: http://octez-node-mainnet-run-1:8732
steps:
- name: prepare-cache-dir
image: alpine/git
user: root
commands:
- mkdir -p drone-cache
- name: restore-cache
image: meltwater/drone-cache
pull: true
environment:
SFTP_USERNAME:
from_secret: sftp_username
SFTP_PASSWORD:
from_secret: sftp_password
SFTP_AUTH_METHOD: PASSWORD
SFTP_HOST: 65.21.165.82
SFTP_PORT: 22
SFTP_CACHE_ROOT: "/upload"
settings:
restore: true
debug: true
backend: "sftp"
cache_key: 'build-{{ .Build.Number }}'
mount:
- 'drone-cache' # <- builds a cache from this directory
- name: octez-node-mainnet-run-1
user: root
image: tezos/tezos:v10.2
detach: true
volumes:
- name: octez-node-mainnet-snapshot-data
path: /home/tezos/data
- name: cache
path: /data/cache
commands:
- rm -f /home/tezos/data/lock
- cp drone-cache/build_files/identities/identity_1.json /home/tezos/data/identity.json
- tezos-node config reset --data-dir /home/tezos/data --network mainnet --no-bootstrap-peers --history-mode archive
- tezos-node run --history-mode archive --data-dir /home/tezos/data --rpc-addr 0.0.0.0:8732 --allow-all-rpc 0.0.0.0:8732 --net-addr 0.0.0.0:9734 --network mainnet --no-bootstrap-peers
- name: tezedge-updated-node-mainnet-run
image: tezedge/tezedge-ci-builder:rust-1.58.1-v13.0-octez
pull: if-not-exists
user: root
detach: true
volumes:
- name: tezedge-node-mainnet-snapshot-data
path: /data/tezedge-data
environment:
SODIUM_USE_PKG_CONFIG: 1
commands:
- rust_libs=$(echo "`rustup show home`/toolchains/`rustup show active-toolchain | tr " " "\n" | head -1`/lib")
- export LD_LIBRARY_PATH="drone-cache/build_files/ffi:$rust_libs"
- echo "LD_LIBRARY_PATH - $LD_LIBRARY_PATH"
- drone-cache/build_files/light-node --config-file "drone-cache/build_files/tezedge/tezedge_drone.config" --disable-bootstrap-lookup --peer-thresh-low=0 --peer-thresh-high=0 --identity-file "drone-cache/build_files/identities/identity_4.json" --network "mainnet" --protocol-runner "drone-cache/build_files/protocol-runner" --p2p-port 19732 --init-sapling-spend-params-file drone-cache/build_files/ffi/sapling-spend.params --init-sapling-output-params-file drone-cache/build_files/ffi/sapling-output.params --tezos-data-dir /data/tezedge-data --bootstrap-db-path bootstrap_db --tezos-context-storage irmin
- name: wait-for-snapshoted-nodes
image: tezedge/tezos-node-bootstrap:latest
commands:
- export TO_BLOCK_HEADER=$${TO_BLOCK_HEADER_FOR_RPC}
- tezos-node-bootstrap bootstrap --level=$${TO_BLOCK_HEADER} --nodes $${OCTEZ_NODE_RPC_CONTEXT_ROOT} $${TEZEDGE_NODE_RPC_CONTEXT_ROOT}
- name: rpc-test
image: tezedge/tezedge-ci-builder:rust-1.58.1-v13.0-octez
pull: if-not-exists
user: root
environment:
RUST_BACKTRACE: 1
commands:
- export NODE_RPC_CONTEXT_ROOT_1=$${TEZEDGE_NODE_RPC_CONTEXT_ROOT}
- export NODE_RPC_CONTEXT_ROOT_2=$${OCTEZ_NODE_RPC_CONTEXT_ROOT}
- export IGNORE_PATH_PATTERNS=votes/listings,/minimal_valid_time,/operations_metadata_hash,/metadata_hash,/operation_metadata_hashes,/context/raw/bytes
- export TO_BLOCK_HEADER=$${TO_BLOCK_HEADER_FOR_RPC}
- export LD_LIBRARY_PATH="drone-cache/build_files/ffi:$rust_libs"
- drone-cache/tests/rpc_integration_test --nocapture --ignored test_rpc_compare_rights_mainnet
volumes:
- name: octez-node-mainnet-snapshot-data
host:
path: /home/dev/octez-data/archive-1672200
- name: tezedge-node-mainnet-snapshot-data
host:
path: /home/dev/tezedge-data/tezedge-1678542
trigger:
branch: develop
event: push