CD_Release #218
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
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: [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 | |
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: Setup Fluvio | |
uses: infinyon/fluvio/.github/actions/setup-fluvio@master | |
with: | |
version: ${{ env.PREV_STABLE_VERSION }} | |
- name: Start cluster | |
timeout-minutes: 10 | |
run: | | |
~/.fluvio/bin/fluvio cluster start --k8 | |
~/.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@v4 | |
timeout-minutes: 5 | |
if: ${{ !success() }} | |
with: | |
name: upgrade-prev-stable-diagnostics | |
path: diagnostics*.gz |