-
Notifications
You must be signed in to change notification settings - Fork 490
204 lines (188 loc) · 7.11 KB
/
cd_release.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
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 "Downloading Fluvio" | grep -v "channel" | awk '{print $5}')
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 | 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: |
curl -fsS https://hub.infinyon.cloud/install/install.sh | bash
~/.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