From f48142f18498b951e770ee770759e5cb8ec16b03 Mon Sep 17 00:00:00 2001 From: Cosmic Vagabond <121588426+cosmic-vagabond@users.noreply.github.com> Date: Wed, 15 May 2024 11:01:26 +0200 Subject: [PATCH 1/3] ci: split into multiple jobs --- .github/workflows/software-upgrade-test.yml | 63 ++++++++++++++------- 1 file changed, 41 insertions(+), 22 deletions(-) diff --git a/.github/workflows/software-upgrade-test.yml b/.github/workflows/software-upgrade-test.yml index c43733189..07e233e28 100644 --- a/.github/workflows/software-upgrade-test.yml +++ b/.github/workflows/software-upgrade-test.yml @@ -7,10 +7,8 @@ on: - main jobs: - software-upgrade-test: + checkout-and-setup: runs-on: ubuntu-latest - timeout-minutes: 120 - steps: - name: Checkout repository uses: actions/checkout@v4 @@ -24,6 +22,7 @@ jobs: go-version: "1.21" - name: Get latest tag + id: get-latest-tag run: | git fetch --tags LATEST_TAG=$(git describe --tags `git rev-list --tags --max-count=1`) @@ -31,6 +30,7 @@ jobs: echo "Latest tag: $LATEST_TAG" - name: Retrieve info.json and set snapshot path + id: retrieve-info run: | DOWNLOAD_URL=https://snapshots-testnet.stake-town.com/elys/info.json curl -L $DOWNLOAD_URL -o /tmp/info.json @@ -45,6 +45,10 @@ jobs: SNAPSHOT_DOWNLOAD_URL=https://snapshots-testnet.stake-town.com/elys/elystestnet-1_latest.tar.lz4 echo "SNAPSHOT_DOWNLOAD_URL=$SNAPSHOT_DOWNLOAD_URL" >> $GITHUB_ENV + cache-and-retrieve: + runs-on: ubuntu-latest + needs: checkout-and-setup + steps: - name: Cache Directories uses: actions/cache@v4 id: cache-elys-folders @@ -52,21 +56,22 @@ jobs: path: | /tmp/elys-backup /tmp/elys2-backup - key: ${{ runner.os }}-elys-folders-${{ env.LATEST_TAG }} + key: ${{ runner.os }}-elys-folders-${{ needs.checkout-and-setup.outputs['get-latest-tag'].LATEST_TAG }} - name: Retrieve latest binary run: | - DOWNLOAD_URL=https://github.com/elys-network/elys/releases/download/$LATEST_TAG/elysd-$LATEST_TAG-linux-amd64 - OLD_BINARY_PATH=/tmp/elysd-$LATEST_TAG + DOWNLOAD_URL=https://github.com/elys-network/elys/releases/download/${{ needs.checkout-and-setup.outputs['get-latest-tag'].LATEST_TAG }}/elysd-${{ needs.checkout-and-setup.outputs['get-latest-tag'].LATEST_TAG }}-linux-amd64 + OLD_BINARY_PATH=/tmp/elysd-${{ needs.checkout-and-setup.outputs['get-latest-tag'].LATEST_TAG }} curl -L $DOWNLOAD_URL -o $OLD_BINARY_PATH && chmod +x $OLD_BINARY_PATH echo "OLD_BINARY_PATH=$OLD_BINARY_PATH" >> $GITHUB_ENV - # TODO: retrieve upgrade-assure and upload-snapshot binaries - if: steps.cache-elys-folders.outputs.cache-hit != 'true' - - name: Create git tag run: git tag v999.999.999 + build-new-binaries: + runs-on: ubuntu-latest + needs: cache-and-retrieve + steps: - name: Build new binaries run: | # build new elys binary @@ -85,23 +90,22 @@ jobs: UPLOAD_SNAPSHOT_BINARY_PATH=./build/upload-snapshot echo "UPLOAD_SNAPSHOT_BINARY_PATH=$UPLOAD_SNAPSHOT_BINARY_PATH" >> $GITHUB_ENV - # TODO: to remove when upgrade-assure binary is available in previous release + build-old-binaries: + runs-on: ubuntu-latest + needs: cache-and-retrieve + if: steps.cache-elys-folders.outputs.cache-hit != 'true' + steps: - name: Copy upgrade assure folder run: | cp -a ./cmd/upgrade-assure ./cmd/upgrade-assure-skip - if: steps.cache-elys-folders.outputs.cache-hit != 'true' - name: Check out latest tag - run: git checkout $LATEST_TAG - if: steps.cache-elys-folders.outputs.cache-hit != 'true' + run: git checkout ${{ needs.checkout-and-setup.outputs['get-latest-tag'].LATEST_TAG }} - # TODO: to remove when upgrade-assure binary is available in previous release - name: Copy old upgrade assure types.go file run: | cp -a ./scripts/upgrade-assure/types.go ./cmd/upgrade-assure-skip/types.go - if: steps.cache-elys-folders.outputs.cache-hit != 'true' - # TODO: to remove when upgrade-assure binary is available in previous release - name: Build old binaries run: | # build old upgrade assure binary @@ -109,8 +113,12 @@ jobs: OLD_UPGRADE_ASSURE_BINARY_PATH=./build/old-upgrade-assure mv ./build/upgrade-assure-skip $OLD_UPGRADE_ASSURE_BINARY_PATH echo "OLD_UPGRADE_ASSURE_BINARY_PATH=$OLD_UPGRADE_ASSURE_BINARY_PATH" >> $GITHUB_ENV - if: steps.cache-elys-folders.outputs.cache-hit != 'true' + chain-operations: + runs-on: ubuntu-latest + needs: build-old-binaries + if: steps.cache-elys-folders.outputs.cache-hit != 'true' + steps: - name: Chain snapshot and export run: | GOMEMLIMIT=8GiB $OLD_UPGRADE_ASSURE_BINARY_PATH $SNAPSHOT_DOWNLOAD_URL $OLD_BINARY_PATH $NEW_BINARY_PATH \ @@ -118,7 +126,6 @@ jobs: --skip-node-start \ --timeout-next-block 100000 \ --timeout-wait-for-node 100000 - if: steps.cache-elys-folders.outputs.cache-hit != 'true' - name: Chain initialization run: | @@ -127,8 +134,11 @@ jobs: --skip-node-start \ --timeout-next-block 100000 \ --timeout-wait-for-node 100000 - if: steps.cache-elys-folders.outputs.cache-hit != 'true' + create-validator: + runs-on: ubuntu-latest + needs: chain-operations + steps: - name: Check out new branch run: git checkout ${{ github.head_ref }} @@ -146,7 +156,6 @@ jobs: --skip-upgrade-to-new-binary \ --timeout-next-block 100000 \ --timeout-wait-for-node 100000 - if: steps.cache-elys-folders.outputs.cache-hit != 'true' - name: Save up space run: | @@ -162,7 +171,6 @@ jobs: --skip-upgrade-to-new-binary \ --timeout-next-block 100000 \ --timeout-wait-for-node 100000 - if: steps.cache-elys-folders.outputs.cache-hit != 'true' - name: Submit new proposal uses: nick-fields/retry@v3 @@ -178,8 +186,11 @@ jobs: --skip-upgrade-to-new-binary \ --timeout-next-block 100000 \ --timeout-wait-for-node 100000 - if: steps.cache-elys-folders.outputs.cache-hit != 'true' + backup-restore: + runs-on: ubuntu-latest + needs: create-validator + steps: - name: Backup elys folders run: | cp -a $HOME/.elys /tmp/elys-backup @@ -192,6 +203,10 @@ jobs: mv /tmp/elys2-backup $HOME/.elys2 if: steps.cache-elys-folders.outputs.cache-hit == 'true' + upgrade-binary: + runs-on: ubuntu-latest + needs: backup-restore + steps: - name: Upgrade to new binary uses: nick-fields/retry@v3 with: @@ -207,6 +222,10 @@ jobs: --timeout-next-block 100000 \ --timeout-wait-for-node 100000 + create-snapshot: + runs-on: ubuntu-latest + needs: upgrade-binary + steps: - name: Create new snapshot file run: | SANITIZED_HEAD_REF=${{ github.head_ref || github.ref }} From 386941274d9e02fa75af37950d001f147da0dd6b Mon Sep 17 00:00:00 2001 From: Cosmic Vagabond <121588426+cosmic-vagabond@users.noreply.github.com> Date: Wed, 15 May 2024 11:05:31 +0200 Subject: [PATCH 2/3] ci: set outputs --- .github/workflows/software-upgrade-test.yml | 27 ++++++++++++++------- 1 file changed, 18 insertions(+), 9 deletions(-) diff --git a/.github/workflows/software-upgrade-test.yml b/.github/workflows/software-upgrade-test.yml index 07e233e28..5effb13bb 100644 --- a/.github/workflows/software-upgrade-test.yml +++ b/.github/workflows/software-upgrade-test.yml @@ -9,6 +9,10 @@ on: jobs: checkout-and-setup: runs-on: ubuntu-latest + outputs: + LATEST_TAG: ${{ steps.get-latest-tag.outputs.LATEST_TAG }} + SNAPSHOT_BLOCK_HEIGHT: ${{ steps.retrieve-info.outputs.SNAPSHOT_BLOCK_HEIGHT }} + SNAPSHOT_DOWNLOAD_URL: ${{ steps.retrieve-info.outputs.SNAPSHOT_DOWNLOAD_URL }} steps: - name: Checkout repository uses: actions/checkout@v4 @@ -26,6 +30,7 @@ jobs: run: | git fetch --tags LATEST_TAG=$(git describe --tags `git rev-list --tags --max-count=1`) + echo "::set-output name=LATEST_TAG::$LATEST_TAG" echo "LATEST_TAG=$LATEST_TAG" >> $GITHUB_ENV echo "Latest tag: $LATEST_TAG" @@ -38,30 +43,34 @@ jobs: # retrieve blockHeight field value from info.json SNAPSHOT_BLOCK_HEIGHT=$(cat /tmp/info.json | awk -F'"' '/"blockHeight":/{print $4}') + echo "::set-output name=SNAPSHOT_BLOCK_HEIGHT::$SNAPSHOT_BLOCK_HEIGHT" echo "SNAPSHOT_BLOCK_HEIGHT=$SNAPSHOT_BLOCK_HEIGHT" >> $GITHUB_ENV echo "Snapshot block height: $SNAPSHOT_BLOCK_HEIGHT" # set snapshot download url SNAPSHOT_DOWNLOAD_URL=https://snapshots-testnet.stake-town.com/elys/elystestnet-1_latest.tar.lz4 + echo "::set-output name=SNAPSHOT_DOWNLOAD_URL::$SNAPSHOT_DOWNLOAD_URL" echo "SNAPSHOT_DOWNLOAD_URL=$SNAPSHOT_DOWNLOAD_URL" >> $GITHUB_ENV cache-and-retrieve: runs-on: ubuntu-latest needs: checkout-and-setup + outputs: + CACHE_HIT: ${{ steps.cache-elys-folders.outputs.cache-hit }} steps: - name: Cache Directories - uses: actions/cache@v4 id: cache-elys-folders + uses: actions/cache@v4 with: path: | /tmp/elys-backup /tmp/elys2-backup - key: ${{ runner.os }}-elys-folders-${{ needs.checkout-and-setup.outputs['get-latest-tag'].LATEST_TAG }} + key: ${{ runner.os }}-elys-folders-${{ needs.checkout-and-setup.outputs.LATEST_TAG }} - name: Retrieve latest binary run: | - DOWNLOAD_URL=https://github.com/elys-network/elys/releases/download/${{ needs.checkout-and-setup.outputs['get-latest-tag'].LATEST_TAG }}/elysd-${{ needs.checkout-and-setup.outputs['get-latest-tag'].LATEST_TAG }}-linux-amd64 - OLD_BINARY_PATH=/tmp/elysd-${{ needs.checkout-and-setup.outputs['get-latest-tag'].LATEST_TAG }} + DOWNLOAD_URL=https://github.com/elys-network/elys/releases/download/${{ needs.checkout-and-setup.outputs.LATEST_TAG }}/elysd-${{ needs.checkout-and-setup.outputs.LATEST_TAG }}-linux-amd64 + OLD_BINARY_PATH=/tmp/elysd-${{ needs.checkout-and-setup.outputs.LATEST_TAG }} curl -L $DOWNLOAD_URL -o $OLD_BINARY_PATH && chmod +x $OLD_BINARY_PATH echo "OLD_BINARY_PATH=$OLD_BINARY_PATH" >> $GITHUB_ENV @@ -93,14 +102,14 @@ jobs: build-old-binaries: runs-on: ubuntu-latest needs: cache-and-retrieve - if: steps.cache-elys-folders.outputs.cache-hit != 'true' + if: needs.cache-and-retrieve.outputs.CACHE_HIT != 'true' steps: - name: Copy upgrade assure folder run: | cp -a ./cmd/upgrade-assure ./cmd/upgrade-assure-skip - name: Check out latest tag - run: git checkout ${{ needs.checkout-and-setup.outputs['get-latest-tag'].LATEST_TAG }} + run: git checkout ${{ needs.checkout-and-setup.outputs.LATEST_TAG }} - name: Copy old upgrade assure types.go file run: | @@ -117,7 +126,7 @@ jobs: chain-operations: runs-on: ubuntu-latest needs: build-old-binaries - if: steps.cache-elys-folders.outputs.cache-hit != 'true' + if: needs.cache-and-retrieve.outputs.CACHE_HIT != 'true' steps: - name: Chain snapshot and export run: | @@ -195,13 +204,13 @@ jobs: run: | cp -a $HOME/.elys /tmp/elys-backup cp -a $HOME/.elys2 /tmp/elys2-backup - if: steps.cache-elys-folders.outputs.cache-hit != 'true' + if: needs.cache-and-retrieve.outputs.CACHE_HIT != 'true' - name: Restore elys folders from backup run: | mv /tmp/elys-backup $HOME/.elys mv /tmp/elys2-backup $HOME/.elys2 - if: steps.cache-elys-folders.outputs.cache-hit == 'true' + if: needs.cache-and-retrieve.outputs.CACHE_HIT == 'true' upgrade-binary: runs-on: ubuntu-latest From 953b8da546cdf5fd22f454e65eeff3f80a23f483 Mon Sep 17 00:00:00 2001 From: Cosmic Vagabond <121588426+cosmic-vagabond@users.noreply.github.com> Date: Wed, 15 May 2024 11:37:30 +0200 Subject: [PATCH 3/3] ci: use steps output vars --- .github/workflows/software-upgrade-test.yml | 90 ++++++++++++++------- 1 file changed, 61 insertions(+), 29 deletions(-) diff --git a/.github/workflows/software-upgrade-test.yml b/.github/workflows/software-upgrade-test.yml index 5effb13bb..41d2b3901 100644 --- a/.github/workflows/software-upgrade-test.yml +++ b/.github/workflows/software-upgrade-test.yml @@ -30,8 +30,7 @@ jobs: run: | git fetch --tags LATEST_TAG=$(git describe --tags `git rev-list --tags --max-count=1`) - echo "::set-output name=LATEST_TAG::$LATEST_TAG" - echo "LATEST_TAG=$LATEST_TAG" >> $GITHUB_ENV + echo "LATEST_TAG=$LATEST_TAG" >> $GITHUB_OUTPUT echo "Latest tag: $LATEST_TAG" - name: Retrieve info.json and set snapshot path @@ -43,20 +42,19 @@ jobs: # retrieve blockHeight field value from info.json SNAPSHOT_BLOCK_HEIGHT=$(cat /tmp/info.json | awk -F'"' '/"blockHeight":/{print $4}') - echo "::set-output name=SNAPSHOT_BLOCK_HEIGHT::$SNAPSHOT_BLOCK_HEIGHT" - echo "SNAPSHOT_BLOCK_HEIGHT=$SNAPSHOT_BLOCK_HEIGHT" >> $GITHUB_ENV + echo "SNAPSHOT_BLOCK_HEIGHT=$SNAPSHOT_BLOCK_HEIGHT" >> $GITHUB_OUTPUT echo "Snapshot block height: $SNAPSHOT_BLOCK_HEIGHT" # set snapshot download url SNAPSHOT_DOWNLOAD_URL=https://snapshots-testnet.stake-town.com/elys/elystestnet-1_latest.tar.lz4 - echo "::set-output name=SNAPSHOT_DOWNLOAD_URL::$SNAPSHOT_DOWNLOAD_URL" - echo "SNAPSHOT_DOWNLOAD_URL=$SNAPSHOT_DOWNLOAD_URL" >> $GITHUB_ENV + echo "SNAPSHOT_DOWNLOAD_URL=$SNAPSHOT_DOWNLOAD_URL" >> $GITHUB_OUTPUT cache-and-retrieve: runs-on: ubuntu-latest needs: checkout-and-setup outputs: CACHE_HIT: ${{ steps.cache-elys-folders.outputs.cache-hit }} + OLD_BINARY_PATH: ${{ steps.retrieve-latest-binary.outputs.OLD_BINARY_PATH }} steps: - name: Cache Directories id: cache-elys-folders @@ -72,7 +70,7 @@ jobs: DOWNLOAD_URL=https://github.com/elys-network/elys/releases/download/${{ needs.checkout-and-setup.outputs.LATEST_TAG }}/elysd-${{ needs.checkout-and-setup.outputs.LATEST_TAG }}-linux-amd64 OLD_BINARY_PATH=/tmp/elysd-${{ needs.checkout-and-setup.outputs.LATEST_TAG }} curl -L $DOWNLOAD_URL -o $OLD_BINARY_PATH && chmod +x $OLD_BINARY_PATH - echo "OLD_BINARY_PATH=$OLD_BINARY_PATH" >> $GITHUB_ENV + echo "OLD_BINARY_PATH=$OLD_BINARY_PATH" >> $GITHUB_OUTPUT - name: Create git tag run: git tag v999.999.999 @@ -80,28 +78,34 @@ jobs: build-new-binaries: runs-on: ubuntu-latest needs: cache-and-retrieve + outputs: + NEW_BINARY_PATH: ${{ steps.build-new-binaries.outputs.NEW_BINARY_PATH }} + NEW_UPGRADE_ASSURE_BINARY_PATH: ${{ steps.build-new-binaries.outputs.NEW_UPGRADE_ASSURE_BINARY_PATH }} + UPLOAD_SNAPSHOT_BINARY_PATH: ${{ steps.build-new-binaries.outputs.UPLOAD_SNAPSHOT_BINARY_PATH }} steps: - name: Build new binaries run: | # build new elys binary make build NEW_BINARY_PATH=./build/elysd - echo "NEW_BINARY_PATH=$NEW_BINARY_PATH" >> $GITHUB_ENV + echo "NEW_BINARY_PATH=$NEW_BINARY_PATH" >> $GITHUB_OUTPUT # build new upgrade assure binary make build-upgrade-assure NEW_UPGRADE_ASSURE_BINARY_PATH=./build/new-upgrade-assure mv ./build/upgrade-assure $NEW_UPGRADE_ASSURE_BINARY_PATH - echo "NEW_UPGRADE_ASSURE_BINARY_PATH=$NEW_UPGRADE_ASSURE_BINARY_PATH" >> $GITHUB_ENV + echo "NEW_UPGRADE_ASSURE_BINARY_PATH=$NEW_UPGRADE_ASSURE_BINARY_PATH" >> $GITHUB_OUTPUT # build upload snapshot binary make build-upload-snapshot UPLOAD_SNAPSHOT_BINARY_PATH=./build/upload-snapshot - echo "UPLOAD_SNAPSHOT_BINARY_PATH=$UPLOAD_SNAPSHOT_BINARY_PATH" >> $GITHUB_ENV + echo "UPLOAD_SNAPSHOT_BINARY_PATH=$UPLOAD_SNAPSHOT_BINARY_PATH" >> $GITHUB_OUTPUT build-old-binaries: runs-on: ubuntu-latest needs: cache-and-retrieve + outputs: + OLD_UPGRADE_ASSURE_BINARY_PATH: ${{ steps.build-old-binaries.outputs.OLD_UPGRADE_ASSURE_BINARY_PATH }} if: needs.cache-and-retrieve.outputs.CACHE_HIT != 'true' steps: - name: Copy upgrade assure folder @@ -121,7 +125,7 @@ jobs: go build -o build ./cmd/upgrade-assure-skip OLD_UPGRADE_ASSURE_BINARY_PATH=./build/old-upgrade-assure mv ./build/upgrade-assure-skip $OLD_UPGRADE_ASSURE_BINARY_PATH - echo "OLD_UPGRADE_ASSURE_BINARY_PATH=$OLD_UPGRADE_ASSURE_BINARY_PATH" >> $GITHUB_ENV + echo "OLD_UPGRADE_ASSURE_BINARY_PATH=$OLD_UPGRADE_ASSURE_BINARY_PATH" >> $GITHUB_OUTPUT chain-operations: runs-on: ubuntu-latest @@ -130,7 +134,11 @@ jobs: steps: - name: Chain snapshot and export run: | - GOMEMLIMIT=8GiB $OLD_UPGRADE_ASSURE_BINARY_PATH $SNAPSHOT_DOWNLOAD_URL $OLD_BINARY_PATH $NEW_BINARY_PATH \ + GOMEMLIMIT=8GiB \ + ${{ needs.build-old-binaries.outputs.OLD_UPGRADE_ASSURE_BINARY_PATH }} \ + ${{ needs.checkout-and-setup.outputs.SNAPSHOT_DOWNLOAD_URL }} \ + ${{ needs.cache-and-retrieve.outputs.OLD_BINARY_PATH }} \ + ${{ needs.build-new-binaries.outputs.NEW_BINARY_PATH }} \ --skip-chain-init \ --skip-node-start \ --timeout-next-block 100000 \ @@ -138,7 +146,11 @@ jobs: - name: Chain initialization run: | - GOMEMLIMIT=8GiB $OLD_UPGRADE_ASSURE_BINARY_PATH $SNAPSHOT_DOWNLOAD_URL $OLD_BINARY_PATH $NEW_BINARY_PATH \ + GOMEMLIMIT=8GiB \ + ${{ needs.build-old-binaries.outputs.OLD_UPGRADE_ASSURE_BINARY_PATH }} \ + ${{ needs.checkout-and-setup.outputs.SNAPSHOT_DOWNLOAD_URL }} \ + ${{ needs.cache-and-retrieve.outputs.OLD_BINARY_PATH }} \ + ${{ needs.build-new-binaries.outputs.NEW_BINARY_PATH }} \ --skip-snapshot \ --skip-node-start \ --timeout-next-block 100000 \ @@ -157,7 +169,11 @@ jobs: timeout_minutes: 30 max_attempts: 3 command: | - GOMEMLIMIT=8GiB $NEW_UPGRADE_ASSURE_BINARY_PATH $SNAPSHOT_DOWNLOAD_URL $OLD_BINARY_PATH $NEW_BINARY_PATH \ + GOMEMLIMIT=8GiB \ + ${{ needs.build-old-binaries.outputs.NEW_UPGRADE_ASSURE_BINARY_PATH }} \ + ${{ needs.checkout-and-setup.outputs.SNAPSHOT_DOWNLOAD_URL }} \ + ${{ needs.cache-and-retrieve.outputs.OLD_BINARY_PATH }} \ + ${{ needs.build-new-binaries.outputs.NEW_BINARY_PATH }} \ --skip-snapshot \ --skip-chain-init \ --skip-prepare-validator-data \ @@ -172,14 +188,18 @@ jobs: - name: Prepare second validator data run: | - GOMEMLIMIT=8GiB $NEW_UPGRADE_ASSURE_BINARY_PATH $SNAPSHOT_DOWNLOAD_URL $OLD_BINARY_PATH $NEW_BINARY_PATH \ - --skip-snapshot \ - --skip-chain-init \ - --skip-create-validator \ - --skip-submit-proposal \ - --skip-upgrade-to-new-binary \ - --timeout-next-block 100000 \ - --timeout-wait-for-node 100000 + GOMEMLIMIT=8GiB \ + ${{ needs.build-old-binaries.outputs.NEW_UPGRADE_ASSURE_BINARY_PATH }} \ + ${{ needs.checkout-and-setup.outputs.SNAPSHOT_DOWNLOAD_URL }} \ + ${{ needs.cache-and-retrieve.outputs.OLD_BINARY_PATH }} \ + ${{ needs.build-new-binaries.outputs.NEW_BINARY_PATH }} \ + --skip-snapshot \ + --skip-chain-init \ + --skip-create-validator \ + --skip-submit-proposal \ + --skip-upgrade-to-new-binary \ + --timeout-next-block 100000 \ + --timeout-wait-for-node 100000 - name: Submit new proposal uses: nick-fields/retry@v3 @@ -187,7 +207,11 @@ jobs: timeout_minutes: 30 max_attempts: 3 command: | - GOMEMLIMIT=8GiB $NEW_UPGRADE_ASSURE_BINARY_PATH $SNAPSHOT_DOWNLOAD_URL $OLD_BINARY_PATH $NEW_BINARY_PATH \ + GOMEMLIMIT=8GiB \ + ${{ needs.build-old-binaries.outputs.NEW_UPGRADE_ASSURE_BINARY_PATH }} \ + ${{ needs.checkout-and-setup.outputs.SNAPSHOT_DOWNLOAD_URL }} \ + ${{ needs.cache-and-retrieve.outputs.OLD_BINARY_PATH }} \ + ${{ needs.build-new-binaries.outputs.NEW_BINARY_PATH }} \ --skip-snapshot \ --skip-chain-init \ --skip-create-validator \ @@ -222,7 +246,11 @@ jobs: timeout_minutes: 30 max_attempts: 3 command: | - GOMEMLIMIT=4GiB $NEW_UPGRADE_ASSURE_BINARY_PATH $SNAPSHOT_DOWNLOAD_URL $NEW_BINARY_PATH $NEW_BINARY_PATH \ + GOMEMLIMIT=8GiB \ + ${{ needs.build-old-binaries.outputs.NEW_UPGRADE_ASSURE_BINARY_PATH }} \ + ${{ needs.checkout-and-setup.outputs.SNAPSHOT_DOWNLOAD_URL }} \ + ${{ needs.cache-and-retrieve.outputs.NEW_BINARY_PATH }} \ + ${{ needs.build-new-binaries.outputs.NEW_BINARY_PATH }} \ --skip-snapshot \ --skip-chain-init \ --skip-create-validator \ @@ -234,15 +262,19 @@ jobs: create-snapshot: runs-on: ubuntu-latest needs: upgrade-binary + outputs: + NEW_SNAPSHOT_FILENAME: ${{ steps.create-snapshot.outputs.NEW_SNAPSHOT_FILENAME }} + NEW_SNAPSHOT_PATH: ${{ steps.create-snapshot.outputs.NEW_SNAPSHOT_PATH }} steps: - name: Create new snapshot file + id: create-snapshot run: | SANITIZED_HEAD_REF=${{ github.head_ref || github.ref }} SANITIZED_HEAD_REF=$(echo "$SANITIZED_HEAD_REF" | sed 's|refs/heads/||; s|/|_|g') NEW_SNAPSHOT_FILENAME="elys-snapshot-${SANITIZED_HEAD_REF}.tar.lz4" NEW_SNAPSHOT_PATH="/tmp/${NEW_SNAPSHOT_FILENAME}" - echo "NEW_SNAPSHOT_FILENAME=$NEW_SNAPSHOT_FILENAME" >> $GITHUB_ENV - echo "NEW_SNAPSHOT_PATH=$NEW_SNAPSHOT_PATH" >> $GITHUB_ENV + echo "NEW_SNAPSHOT_FILENAME=$NEW_SNAPSHOT_FILENAME" >> $GITHUB_OUTPUT + echo "NEW_SNAPSHOT_PATH=$NEW_SNAPSHOT_PATH" >> $GITHUB_OUTPUT cd $HOME tar -cf - .elys | lz4 -z - > "$NEW_SNAPSHOT_PATH" @@ -252,12 +284,12 @@ jobs: export R2_SECRET_KEY=${{ secrets.R2_SECRET_KEY }} export R2_ENDPOINT=${{ secrets.R2_ENDPOINT }} export R2_BUCKET_NAME=${{ secrets.R2_BUCKET_NAME }} - $UPLOAD_SNAPSHOT_BINARY_PATH $NEW_SNAPSHOT_PATH + ${{ needs.build-new-binaries.outputs.UPLOAD_SNAPSHOT_BINARY_PATH }} ${{ steps.create-snapshot.outputs.NEW_SNAPSHOT_PATH }} - name: Remove snapshot file run: | - rm -f $NEW_SNAPSHOT_PATH + rm -f ${{ steps.create-snapshot.outputs.NEW_SNAPSHOT_PATH }} - name: Info about the snapshot run: | - echo "Snapshot URL: https://snapshots.elys.network/$NEW_SNAPSHOT_FILENAME" + echo "Snapshot URL: https://snapshots.elys.network/${{ steps.create-snapshot.outputs.NEW_SNAPSHOT_FILENAME }}"