Skip to content

CD_Release

CD_Release #163

Workflow file for this run

name: CD_Release
permissions:
contents: read
on:
# pull_request:
# branches: [master]
workflow_run:
workflows: ["Release"]
types:
- completed
workflow_dispatch:
inputs:
alt_version:
required: false
description: Provide expected semver. If empty VERSION in repo will be used
default: ""
env:
USE_VERSION: ${{ github.event.inputs.alt_version }}
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: [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
# Utilizes the env var set in the previous step
- name: Curl Install
run: curl -fsS https://hub.infinyon.cloud/install/install.sh | 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, k8s]
env:
FLV_SOCKET_WAIT: 600
steps:
- uses: actions/checkout@v4
- name: Setup K3d
run: curl -s https://raw.githubusercontent.com/rancher/k3d/main/install.sh | TAG=${{ env.K3D_VERSION }} bash
- name: Create K3d cluster
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: Install Fluvio
run: |
curl -fsS https://hub.infinyon.cloud/install/install.sh | bash
echo "$HOME/.fluvio/bin" >> $GITHUB_PATH
- name: Pre-Start - local cluster
if: matrix.cluster_type == 'local'
run: echo "IF_LOCAL=--local" | tee -a $GITHUB_ENV
- name: Pre-Start - Kubernetes cluster
if: matrix.cluster_type == 'k8s'
run: echo "IF_LOCAL=" | tee -a $GITHUB_ENV
- name: Start cluster
timeout-minutes: 3
run: |
fluvio version
fluvio cluster start ${IF_LOCAL}
- name: Run diagnostics
if: failure()
timeout-minutes: 5
run: |
fluvio cluster diagnostics
- name: Upload diagnostics
uses: actions/upload-artifact@v3
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
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [ubuntu-latest]
env:
FLV_SOCKET_WAIT: 600
FLV_DISPATCHER_WAIT: 300
steps:
- uses: actions/checkout@v4
- name: Setup K3d
run: curl -s https://raw.githubusercontent.com/rancher/k3d/main/install.sh | TAG=${{ env.K3D_VERSION }} bash
- name: Create K3d cluster
run: |
./k8-util/cluster/reset-k3d.sh
- name: Login GH CLI
run: gh auth login --with-token < <(echo ${{ secrets.GITHUB_TOKEN }})
- name: Get previous stable version number
run: |
echo "PREV_STABLE_VERSION=$(gh release list | awk '{print $1}' | sed 's/^dev//' | grep "v" | sed 's/^v//' | head -2 | tail -1)" | tee -a $GITHUB_ENV
PREV_STABLE_VERSION=$(gh release list | awk '{print $1}' | sed 's/^dev//' | grep "v" | sed 's/^v//' | head -2 | tail -1)
- name: Install last stable Fluvio CLI and start cluster
run: |
curl -fsS https://hub.infinyon.cloud/install/install.sh | FLUVIO_VERSION=$PREV_STABLE_VERSION bash
~/.fluvio/bin/fluvio cluster start
~/.fluvio/bin/fluvio version
- name: Set the expected fluvio version for upgrade
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: Install current stable Fluvio CLI and upgrade cluster
run: |
~/.fvm/bin/fvm install stable
~/.fluvio/bin/fluvio cluster upgrade
~/.fluvio/bin/fluvio version
# TODO: Verify platform version
- name: Run diagnostics
if: ${{ !success() }}
timeout-minutes: 5
run: ~/.fluvio/bin/fluvio cluster diagnostics
- name: Upload diagnostics
uses: actions/upload-artifact@v3
timeout-minutes: 5
if: ${{ !success() }}
with:
name: upgrade-prev-stable-diagnostics
path: diagnostics*.gz