From 2c00b837d4340455718da4b31db770d61897844b Mon Sep 17 00:00:00 2001 From: Felipe Cardozo Date: Fri, 13 Sep 2024 16:05:28 -0300 Subject: [PATCH] fix: upgrade cluster cd release --- .github/workflows/cd_release.yml | 241 ++++++++++++++++--------------- 1 file changed, 122 insertions(+), 119 deletions(-) diff --git a/.github/workflows/cd_release.yml b/.github/workflows/cd_release.yml index 4b07c790154..52f1ad5011e 100644 --- a/.github/workflows/cd_release.yml +++ b/.github/workflows/cd_release.yml @@ -4,8 +4,8 @@ permissions: contents: read on: -# pull_request: -# branches: [master] + pull_request: + branches: [master] workflow_run: workflows: ["Release"] types: @@ -22,122 +22,122 @@ env: K3D_VERSION: v5.4.1 jobs: - release_check: - name: Release success check - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v4 - - name: Login GH CLI - run: gh auth login --with-token < <(echo ${{ secrets.GITHUB_TOKEN }}) - - name: Get status of latest RELEASE_CHECK run - id: release_check - run: | - gh api /repos/{owner}/{repo}/actions/workflows/release.yml/runs | jq .workflow_runs[0] > /tmp/release_latest.txt - echo "Latest Release run: $(cat /tmp/release_latest.txt | jq .html_url | tr -d '"')" - RELEASE_CHECK=$(cat /tmp/release_latest.txt | jq .conclusion | tr -d '"') - if [[ "$RELEASE_CHECK" = "success" ]] - then - echo ✅ Most recent RELEASE_CHECK run passed - exit 0; - else - echo ❌ Most recent RELEASE_CHECK run failed - exit 1; - fi - installer_check: - name: Installer check - needs: [release_check] - runs-on: ${{ matrix.os }} - strategy: - matrix: - os: [ubuntu-latest] - version: [semver] - # version: [none, stable, semver] - steps: - - uses: actions/checkout@v4 - - name: Set the expected fluvio version - run: | - if [[ -z "${{ env.USE_VERSION }}" ]]; then - echo "EXPECTED_VERSION=$(cat VERSION)" | tee -a $GITHUB_ENV - else - echo "EXPECTED_VERSION=${{ github.event.inputs.alt_version }}" | tee -a $GITHUB_ENV - fi - echo "EXPECTED_VERSION: $EXPECTED_VERSION" - - - name: Set the VERSION env var for installer script - if: matrix.version == 'none' - run: echo "Leave VERSION unset" - - name: Curl Install - stable - if: matrix.version == 'stable' - run: echo "VERSION=stable" | tee -a $GITHUB_ENV - - name: Curl Install - Version number - if: matrix.version == 'semver' - run: echo "VERSION=$EXPECTED_VERSION" | tee -a $GITHUB_ENV - - name: Curl Install - FLUVIO_VERSION=${{ env.VERSION }} - run: | - curl -fsS https://hub.infinyon.cloud/install/install.sh | \ - FLUVIO_VERSION=${{ env.VERSION }} bash | \ - tee /tmp/installer.version - - name: Verify installer output - run: | - INSTALLER_VERSION=$(cat /tmp/installer.version | grep "fluvio@" | awk '{print $4}' | cut -b 8-) - if [ "$INSTALLER_VERSION" = "$EXPECTED_VERSION" ]; then - echo "✅ Installer version check passed: $EXPECTED_VERSION"; - else - echo "❌ Installer version check failed"; - echo "Version reported by installer: $INSTALLER_VERSION"; - echo "Expected version: $EXPECTED_VERSION"; - exit 1; - fi - - start_cluster: - name: Start cluster test - runs-on: ${{ matrix.os }} - strategy: - matrix: - os: [ubuntu-latest] - cluster_type: [local, k8] - env: - FLV_SOCKET_WAIT: 600 - steps: - - uses: actions/checkout@v4 - - name: Setup K3d - if: ${{ matrix.cluster_type == 'k8' }} - run: curl -s https://raw.githubusercontent.com/rancher/k3d/main/install.sh | TAG=${{ env.K3D_VERSION }} bash - - name: Create K3d cluster - if: ${{ matrix.cluster_type == 'k8' }} - run: | - ./k8-util/cluster/reset-k3d.sh - - - name: Set the expected fluvio version - run: | - if [[ -z "${{ env.USE_VERSION }}" ]]; then - echo "EXPECTED_VERSION=$(cat VERSION)" | tee -a $GITHUB_ENV - else - echo "EXPECTED_VERSION=${{ github.event.inputs.alt_version }}" | tee -a $GITHUB_ENV - fi - echo "EXPECTED_VERSION: $EXPECTED_VERSION" - - - run: echo "VERSION=$EXPECTED_VERSION" | tee -a $GITHUB_ENV - - name: Setup Fluvio - uses: infinyon/fluvio/.github/actions/setup-fluvio@master - - name: Start cluster - timeout-minutes: 10 - run: | - fluvio version - fluvio cluster start --${{ matrix.cluster_type }} - - name: Run diagnostics - if: failure() - timeout-minutes: 5 - run: | - fluvio cluster diagnostics - - name: Upload diagnostics - uses: actions/upload-artifact@v4 - timeout-minutes: 5 - if: ${{ !success() }} - with: - name: start_cluster_${{ matrix.cluster_type }} - path: diagnostics*.gz - # TODO: Verify platform version + # release_check: + # name: Release success check + # runs-on: ubuntu-latest + # steps: + # - uses: actions/checkout@v4 + # - name: Login GH CLI + # run: gh auth login --with-token < <(echo ${{ secrets.GITHUB_TOKEN }}) + # - name: Get status of latest RELEASE_CHECK run + # id: release_check + # run: | + # gh api /repos/{owner}/{repo}/actions/workflows/release.yml/runs | jq .workflow_runs[0] > /tmp/release_latest.txt + # echo "Latest Release run: $(cat /tmp/release_latest.txt | jq .html_url | tr -d '"')" + # RELEASE_CHECK=$(cat /tmp/release_latest.txt | jq .conclusion | tr -d '"') + # if [[ "$RELEASE_CHECK" = "success" ]] + # then + # echo ✅ Most recent RELEASE_CHECK run passed + # exit 0; + # else + # echo ❌ Most recent RELEASE_CHECK run failed + # exit 1; + # fi + # installer_check: + # name: Installer check + # needs: [release_check] + # runs-on: ${{ matrix.os }} + # strategy: + # matrix: + # os: [ubuntu-latest] + # version: [semver] + # # version: [none, stable, semver] + # steps: + # - uses: actions/checkout@v4 + # - name: Set the expected fluvio version + # run: | + # if [[ -z "${{ env.USE_VERSION }}" ]]; then + # echo "EXPECTED_VERSION=$(cat VERSION)" | tee -a $GITHUB_ENV + # else + # echo "EXPECTED_VERSION=${{ github.event.inputs.alt_version }}" | tee -a $GITHUB_ENV + # fi + # echo "EXPECTED_VERSION: $EXPECTED_VERSION" + # + # - name: Set the VERSION env var for installer script + # if: matrix.version == 'none' + # run: echo "Leave VERSION unset" + # - name: Curl Install - stable + # if: matrix.version == 'stable' + # run: echo "VERSION=stable" | tee -a $GITHUB_ENV + # - name: Curl Install - Version number + # if: matrix.version == 'semver' + # run: echo "VERSION=$EXPECTED_VERSION" | tee -a $GITHUB_ENV + # - name: Curl Install - FLUVIO_VERSION=${{ env.VERSION }} + # run: | + # curl -fsS https://hub.infinyon.cloud/install/install.sh | \ + # FLUVIO_VERSION=${{ env.VERSION }} bash | \ + # tee /tmp/installer.version + # - name: Verify installer output + # run: | + # INSTALLER_VERSION=$(cat /tmp/installer.version | grep "fluvio@" | awk '{print $4}' | cut -b 8-) + # if [ "$INSTALLER_VERSION" = "$EXPECTED_VERSION" ]; then + # echo "✅ Installer version check passed: $EXPECTED_VERSION"; + # else + # echo "❌ Installer version check failed"; + # echo "Version reported by installer: $INSTALLER_VERSION"; + # echo "Expected version: $EXPECTED_VERSION"; + # exit 1; + # fi + # + # start_cluster: + # name: Start cluster test + # runs-on: ${{ matrix.os }} + # strategy: + # matrix: + # os: [ubuntu-latest] + # cluster_type: [local, k8] + # env: + # FLV_SOCKET_WAIT: 600 + # steps: + # - uses: actions/checkout@v4 + # - name: Setup K3d + # if: ${{ matrix.cluster_type == 'k8' }} + # run: curl -s https://raw.githubusercontent.com/rancher/k3d/main/install.sh | TAG=${{ env.K3D_VERSION }} bash + # - name: Create K3d cluster + # if: ${{ matrix.cluster_type == 'k8' }} + # run: | + # ./k8-util/cluster/reset-k3d.sh + # + # - name: Set the expected fluvio version + # run: | + # if [[ -z "${{ env.USE_VERSION }}" ]]; then + # echo "EXPECTED_VERSION=$(cat VERSION)" | tee -a $GITHUB_ENV + # else + # echo "EXPECTED_VERSION=${{ github.event.inputs.alt_version }}" | tee -a $GITHUB_ENV + # fi + # echo "EXPECTED_VERSION: $EXPECTED_VERSION" + # + # - run: echo "VERSION=$EXPECTED_VERSION" | tee -a $GITHUB_ENV + # - name: Setup Fluvio + # uses: infinyon/fluvio/.github/actions/setup-fluvio@master + # - name: Start cluster + # timeout-minutes: 10 + # run: | + # fluvio version + # fluvio cluster start --${{ matrix.cluster_type }} + # - name: Run diagnostics + # if: failure() + # timeout-minutes: 5 + # run: | + # fluvio cluster diagnostics + # - name: Upload diagnostics + # uses: actions/upload-artifact@v4 + # timeout-minutes: 5 + # if: ${{ !success() }} + # with: + # name: start_cluster_${{ matrix.cluster_type }} + # path: diagnostics*.gz + # # TODO: Verify platform version upgrade_prev_stable: name: Upgrade cluster test @@ -183,10 +183,13 @@ jobs: fi echo "EXPECTED_VERSION: $EXPECTED_VERSION" + - name: Setup Fluvio + uses: infinyon/fluvio/.github/actions/setup-fluvio@master + - run: echo "VERSION=$EXPECTED_VERSION" | tee -a $GITHUB_ENV - name: Install current stable Fluvio CLI and upgrade cluster run: | - ~/.fvm/bin/fvm install stable + ~/.fvm/bin/fvm install latest ~/.fluvio/bin/fluvio cluster upgrade --force ~/.fluvio/bin/fluvio version