Skip to content

Commit

Permalink
ci: upgrade assure run in two stages (#449)
Browse files Browse the repository at this point in the history
* 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
  • Loading branch information
cosmic-vagabond authored Apr 8, 2024
1 parent d54acc4 commit 27e529d
Show file tree
Hide file tree
Showing 3 changed files with 46 additions and 11 deletions.
40 changes: 33 additions & 7 deletions .github/workflows/software-upgrade-test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
13 changes: 11 additions & 2 deletions scripts/upgrade-assure/README.md
Original file line number Diff line number Diff line change
@@ -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).
Expand Down Expand Up @@ -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
```

```
Expand All @@ -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
```
4 changes: 2 additions & 2 deletions scripts/upgrade-assure/upgrade-assure.go
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down

0 comments on commit 27e529d

Please sign in to comment.