diff --git a/.woodpecker/release.yaml b/.woodpecker/release.yaml index 0678a45b..396fbc20 100644 --- a/.woodpecker/release.yaml +++ b/.woodpecker/release.yaml @@ -35,7 +35,15 @@ steps: - matrix: ARCH: i386 - - name: upgrade tests + - name: upgrade tests from v1.0.0 + image: nixpkgs/nix:nixos-22.05 + commands: + - nix-shell --attr ci --run "./script/test-upgrade.sh v1.0.0 x86_64-unknown-linux-musl" || (cat /tmp/garage.log; false) + when: + - matrix: + ARCH: amd64 + + - name: upgrade tests from v0.8.4 image: nixpkgs/nix:nixos-22.05 commands: - nix-shell --attr ci --run "./script/test-upgrade.sh v0.8.4 x86_64-unknown-linux-musl" || (cat /tmp/garage.log; false) diff --git a/script/dev-bucket.sh b/script/dev-bucket.sh index 708c2c43..82e73652 100755 --- a/script/dev-bucket.sh +++ b/script/dev-bucket.sh @@ -17,13 +17,19 @@ else fi $GARAGE_BIN -c /tmp/config.1.toml bucket create eprouvette -if [ "$GARAGE_08" = "1" ]; then +if [ "$GARAGE_OLDVER" = "v08" ]; then KEY_INFO=$($GARAGE_BIN -c /tmp/config.1.toml key new --name opérateur) -else + ACCESS_KEY=`echo $KEY_INFO|grep -Po 'GK[a-f0-9]+'` + SECRET_KEY=`echo $KEY_INFO|grep -Po 'Secret key: [a-f0-9]+'|grep -Po '[a-f0-9]+$'` +elif [ "$GARAGE_OLDVER" = "v1" ]; then KEY_INFO=$($GARAGE_BIN -c /tmp/config.1.toml key create opérateur) + ACCESS_KEY=`echo $KEY_INFO|grep -Po 'GK[a-f0-9]+'` + SECRET_KEY=`echo $KEY_INFO|grep -Po 'Secret key: [a-f0-9]+'|grep -Po '[a-f0-9]+$'` +else + KEY_INFO=$($GARAGE_BIN -c /tmp/config.1.toml json-api CreateKey '{"name":"opérateur"}') + ACCESS_KEY=`echo $KEY_INFO|jq -r .accessKeyId` + SECRET_KEY=`echo $KEY_INFO|jq -r .secretAccessKey` fi -ACCESS_KEY=`echo $KEY_INFO|grep -Po 'GK[a-f0-9]+'` -SECRET_KEY=`echo $KEY_INFO|grep -Po 'Secret key: [a-f0-9]+'|grep -Po '[a-f0-9]+$'` $GARAGE_BIN -c /tmp/config.1.toml bucket allow eprouvette --read --write --owner --key $ACCESS_KEY echo "$ACCESS_KEY $SECRET_KEY" > /tmp/garage.s3 diff --git a/script/dev-configure.sh b/script/dev-configure.sh index 0649cdbe..86fa84c5 100755 --- a/script/dev-configure.sh +++ b/script/dev-configure.sh @@ -29,7 +29,7 @@ until $GARAGE_BIN -c /tmp/config.1.toml status 2>&1|grep -q HEALTHY ; do sleep 1 done -if [ "$GARAGE_08" = "1" ]; then +if [ "$GARAGE_OLDVER" = "v08" ]; then $GARAGE_BIN -c /tmp/config.1.toml status \ | grep 'NO ROLE' \ | grep -Po '^[0-9a-f]+' \ diff --git a/script/test-upgrade.sh b/script/test-upgrade.sh index dc25e7c6..45eb3c43 100755 --- a/script/test-upgrade.sh +++ b/script/test-upgrade.sh @@ -24,7 +24,10 @@ echo "============= insert data into old version cluster =================" export GARAGE_BIN=/tmp/old_garage if echo $OLD_VERSION | grep 'v0\.8\.'; then echo "Detected Garage v0.8.x" - export GARAGE_08=1 + export GARAGE_OLDVER=v08 +elif (echo $OLD_VERSION | grep 'v0\.9\.') || (echo $OLD_VERSION | grep 'v1\.'); then + echo "Detected Garage v0.9.x / v1.x" + export GARAGE_OLDVER=v1 fi echo "⏳ Setup cluster using old version" @@ -47,7 +50,7 @@ killall -9 old_garage || true echo "🏁 Removing old garage version" rm -rv $GARAGE_BIN export -n GARAGE_BIN -export -n GARAGE_08 +export -n GARAGE_OLDVER echo "================ read data from new cluster ==================="