From 27e529db2d9fbce3e033d4c50caca0d1a52e5a07 Mon Sep 17 00:00:00 2001 From: Cosmic Vagabond <121588426+cosmic-vagabond@users.noreply.github.com> Date: Mon, 8 Apr 2024 12:10:32 +0200 Subject: [PATCH] ci: upgrade assure run in two stages (#449) * ci: upgrade assure run in two stages * ci: fix var name * ci: chmod +x old binary path * ci: combine old binary download + chmod cmds * ci: wrong var name * ci: use newest upgrade-assure script * ci: wait longer when upgrade block height reached * ci: use highstakes snap --- .github/workflows/software-upgrade-test.yml | 40 +++++++++++++++++---- scripts/upgrade-assure/README.md | 13 +++++-- scripts/upgrade-assure/upgrade-assure.go | 4 +-- 3 files changed, 46 insertions(+), 11 deletions(-) diff --git a/.github/workflows/software-upgrade-test.yml b/.github/workflows/software-upgrade-test.yml index 471815052..d1878718d 100644 --- a/.github/workflows/software-upgrade-test.yml +++ b/.github/workflows/software-upgrade-test.yml @@ -9,23 +9,49 @@ jobs: steps: - name: Checkout repository - uses: actions/checkout@v2 + uses: actions/checkout@v4 with: fetch-depth: 0 - tags: true + fetch-tags: true - - name: Retrieve latest tag + - name: Retrieve latest snapshot + run: | + DOWNLOAD_URL=https://tools.highstakes.ch/files/elys.tar.gz + SNAPSHOT_PATH=/tmp/snapshot.tar.gz + curl -L $DOWNLOAD_URL -o $SNAPSHOT_PATH + echo "SNAPSHOT_PATH=$SNAPSHOT_PATH" >> $GITHUB_ENV + + - name: Retrieve latest binary run: | LATEST_TAG=$(git describe --tags `git rev-list --tags --max-count=1`) + DOWNLOAD_URL=https://github.com/elys-network/elys/releases/download/$LATEST_TAG/elysd-$LATEST_TAG-linux-amd64 + OLD_BINARY_PATH=/tmp/elysd-$LATEST_TAG + curl -L $DOWNLOAD_URL -o $OLD_BINARY_PATH && chmod +x $OLD_BINARY_PATH echo "LATEST_TAG=$LATEST_TAG" >> $GITHUB_ENV + echo "OLD_BINARY_PATH=$OLD_BINARY_PATH" >> $GITHUB_ENV - name: Create git tag run: git tag v999.999.999 - name: Run make build - run: make build + run: | + make build + NEW_BINARY_PATH=./build/elysd + echo "NEW_BINARY_PATH=$NEW_BINARY_PATH" >> $GITHUB_ENV + + - name: Copy upgrade-assure scripts + run: cp -a scripts/upgrade-assure scripts/upgrade-assure-skip + + - name: Check out latest tag + run: git checkout $LATEST_TAG + + - name: Chain initialization + run: | + go run ./scripts/upgrade-assure-skip/... $SNAPSHOT_PATH $OLD_BINARY_PATH $NEW_BINARY_PATH --skip-node-start + + - name: Check out new branch + run: git checkout ${{ github.head_ref }} - - name: Execute upgrade-assure script + - name: Software upgrade run: | - DOWNLOAD_URL=https://snapshots-testnet.stake-town.com/elys/elystestnet-1_latest.tar.lz4 - go run ./scripts/upgrade-assure/... $DOWNLOAD_URL https://github.com/elys-network/elys/releases/download/$LATEST_TAG/elysd-$LATEST_TAG-linux-amd64 ./build/elysd + go run ./scripts/upgrade-assure-skip/... $SNAPSHOT_PATH $OLD_BINARY_PATH $NEW_BINARY_PATH --skip-snapshot --skip-chain-init diff --git a/scripts/upgrade-assure/README.md b/scripts/upgrade-assure/README.md index 121eea2e1..eece217eb 100644 --- a/scripts/upgrade-assure/README.md +++ b/scripts/upgrade-assure/README.md @@ -1,5 +1,14 @@ # How to use a testnet snapshot in localnet? +## High Stakes testnet snapshots + +You can find the latest High Stakes testnet snapshot [here](https://tools.highstakes.ch/files/elys.tar.gz). + +``` +make install +go run ./scripts/upgrade-assure/... https://tools.highstakes.ch/files/elys.tar.gz ~/go/bin/elysd ~/go/bin/elysd --skip-proposal +``` + ## Stake Town testnet snapshots You can find the latest Stake Town testnet snapshot [here](https://snapshots-testnet.stake-town.com/elys/elystestnet-1_latest.tar.lz4). @@ -36,7 +45,7 @@ cp -a ~/go/bin/elysd /tmp/elysd-v0.28.30 ``` ``` -go run ./scripts/upgrade-assure/... --home /tmp/elys --home2 /tmp/elysd2 https://snapshots-testnet.stake-town.com/elys/elystestnet-1_latest.tar.lz4 /tmp/elysd-v0.29.30 /tmp/elysd-v0.29.31 --skip-node-start +go run ./scripts/upgrade-assure/... --home /tmp/elys --home2 /tmp/elysd2 https://tools.highstakes.ch/files/elys.tar.gz /tmp/elysd-v0.29.30 /tmp/elysd-v0.29.31 --skip-node-start ``` ``` @@ -46,5 +55,5 @@ cp -a ~/go/bin/elysd /tmp/elysd-v0.29.31 ``` ``` -go run ./scripts/upgrade-assure/... --home /tmp/elys --home2 /tmp/elysd2 https://snapshots-testnet.stake-town.com/elys/elystestnet-1_latest.tar.lz4 /tmp/elysd-v0.29.30 /tmp/elysd-v0.29.31 --skip-snapshot --skip-chain-init +go run ./scripts/upgrade-assure/... --home /tmp/elys --home2 /tmp/elysd2 https://tools.highstakes.ch/files/elys.tar.gz /tmp/elysd-v0.29.30 /tmp/elysd-v0.29.31 --skip-snapshot --skip-chain-init ``` diff --git a/scripts/upgrade-assure/upgrade-assure.go b/scripts/upgrade-assure/upgrade-assure.go index a980a512a..bd8bfde4d 100644 --- a/scripts/upgrade-assure/upgrade-assure.go +++ b/scripts/upgrade-assure/upgrade-assure.go @@ -171,8 +171,8 @@ func main() { // wait for upgrade block height waitForBlockHeight(oldBinaryPath, rpc, upgradeBlockHeight) - // wait 5 seconds - time.Sleep(10 * time.Second) + // wait 20 seconds + time.Sleep(20 * time.Second) // stop old binaries stop(oldBinaryCmd, oldBinaryCmd2)