diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 11802fdb3..a20a00f46 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -439,3 +439,34 @@ zombienet-scale-net-config: retry: 2 tags: - zombienet-polkadot-integration-test + +zombienet-upgrade-node: + stage: deploy + <<: *kubernetes-env + image: "paritypr/zombienet:${CI_COMMIT_SHORT_SHA}" + rules: + - if: $CI_PIPELINE_SOURCE == "schedule" + - if: $CI_COMMIT_REF_NAME == "master" + - if: $CI_COMMIT_REF_NAME =~ /^[0-9]+$/ # PRs + - if: $CI_COMMIT_REF_NAME =~ /^v[0-9]+\.[0-9]+.*$/ # i.e. v1.0, v2.1rc1 + # needs: + # - job: publish-docker-pr + + variables: + GH_DIR: 'https://github.com/paritytech/zombienet/tree/${CI_COMMIT_SHORT_SHA}/tests/k8s' + + before_script: + - echo "Zombienet Upgrade node" + - echo "paritypr/zombienet:${CI_COMMIT_SHORT_SHA}" + - echo "${GH_DIR}" + - export DEBUG=zombie* + - export ZOMBIENET_INTEGRATION_TEST_IMAGE="docker.io/paritypr/polkadot-debug:master" + - export COL_IMAGE="docker.io/paritypr/colander:4519" + + script: + - /home/nonroot/zombie-net/scripts/ci/run-test-local-env-manager.sh + --test="0001-upgrade-node.feature" + allow_failure: true + retry: 2 + tags: + - zombienet-polkadot-integration-test diff --git a/scripts/zombie-wrapper.sh b/scripts/zombie-wrapper.sh index d5027abf1..d086a88b9 100755 --- a/scripts/zombie-wrapper.sh +++ b/scripts/zombie-wrapper.sh @@ -65,7 +65,7 @@ do if [[ $line =~ [^0-9]+([0-9]+) ]]; then restart "${BASH_REMATCH[1]}" else - restart + restart 0 fi; elif [[ "$line" == "pause" ]]; then pause diff --git a/src/providers/k8s/dynResourceDefinition.ts b/src/providers/k8s/dynResourceDefinition.ts index 741464532..046afd3b7 100644 --- a/src/providers/k8s/dynResourceDefinition.ts +++ b/src/providers/k8s/dynResourceDefinition.ts @@ -110,7 +110,17 @@ function make_transfer_containter(): any { command: [ "ash", "-c", - `until [ -f ${FINISH_MAGIC_FILE} ]; do echo waiting for tar to finish; sleep 1; done; echo copy files has finished`, + [ + "wget https://github.com/moparisthebest/static-curl/releases/download/v7.83.1/curl-amd64 -O /cfg/curl", + "&&", + "echo downloaded", + "&&", + "chmod +x /cfg/curl", + "&&", + "echo chmoded", + "&&", + `until [ -f ${FINISH_MAGIC_FILE} ]; do echo waiting for tar to finish; sleep 1; done; echo copy files has finished`, + ].join(" "), ], }; } diff --git a/tests/k8s/0001-upgrade-node.feature b/tests/k8s/0001-upgrade-node.feature new file mode 100644 index 000000000..f35a0088d --- /dev/null +++ b/tests/k8s/0001-upgrade-node.feature @@ -0,0 +1,11 @@ +Description: Upgrade node +Network: ./0001-upgrade-node.toml +Creds: config + + +validator-0: reports block height is at least 10 within 120 seconds +# 15 secs to download aprox +validator-0: run ./downloadPolkadot.sh within 200 seconds +validator-0: restart +sleep 20 seconds +validator-0: reports block height is at least 25 within 120 seconds diff --git a/tests/k8s/0001-upgrade-node.toml b/tests/k8s/0001-upgrade-node.toml new file mode 100644 index 000000000..f15fef975 --- /dev/null +++ b/tests/k8s/0001-upgrade-node.toml @@ -0,0 +1,14 @@ +[settings] +timeout = 1000 +bootnode = true + +[relaychain] +default_image = "docker.io/parity/polkadot:v0.9.25" +chain = "rococo-local" +default_command = "polkadot" + + + [[relaychain.node_groups]] + name = "validator" + count = 2 + args = ["-lparachain=debug", "--db=paritydb"] diff --git a/tests/k8s/downloadPolkadot.sh b/tests/k8s/downloadPolkadot.sh new file mode 100644 index 000000000..25b2f66a0 --- /dev/null +++ b/tests/k8s/downloadPolkadot.sh @@ -0,0 +1,11 @@ +#!/bin/bash + +set -euxo pipefail + +# add /cfg as first `looking dir` to allow to overrides commands. +export PATH="/cfg":$PATH + +cd /cfg +curl -L -O https://github.com/paritytech/polkadot/releases/download/v0.9.26/polkadot +chmod +x /cfg/polkadot +echo $(polkadot --version)