-
Notifications
You must be signed in to change notification settings - Fork 29
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
2 changed files
with
49 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
#!/bin/bash | ||
|
||
# this bash will prepare cosmosvisor to the build folder so that it can perform upgrade | ||
# this script is supposed to be run by Makefile | ||
|
||
# These fields should be fetched automatically in the future | ||
# Need to do more upgrade to see upgrade patterns | ||
OLD_VERSION=v3.0.4 | ||
# this command will retrieve the folder with the largest number in format v<number> | ||
SOFTWARE_UPGRADE_NAME=$(ls -d -- ./app/upgrades/v* | sort -Vr | head -n 1 | xargs basename) | ||
BUILDDIR=$1 | ||
TESTNET_NVAL=$2 | ||
TESTNET_CHAINID=$3 | ||
|
||
# check if BUILDDIR is set | ||
if [ -z "$BUILDDIR" ]; then | ||
echo "BUILDDIR is not set" | ||
exit 1 | ||
fi | ||
|
||
# install old binary if not exist | ||
if [ ! -f "_build/$OLD_VERSION.zip" ] &> /dev/null | ||
then | ||
mkdir -p _build/old | ||
wget -c "https://github.com/White-Whale-Defi-Platform/migaloo-chain/archive/refs/tags/${OLD_VERSION}.zip" -O _build/${OLD_VERSION}.zip | ||
unzip _build/${OLD_VERSION}.zip -d _build | ||
fi | ||
|
||
|
||
if [ ! -f "$BUILDDIR/$OLD_VERSION.zip" ] &> /dev/null | ||
then | ||
mkdir -p BUILDDIR/old | ||
docker build --platform linux/amd64 --no-cache --build-arg source=./_build/migaloo-chain-${OLD_VERSION:1}/ --tag migaloo/migalood.binary.old . | ||
docker create --platform linux/amd64 --name old-temp migaloo/migalood.binary.old:latest | ||
docker cp old-temp:/usr/local/bin/migalood $BUILDDIR/old/ | ||
docker rm old-temp | ||
fi |