Skip to content

Commit 4e7aa63

Browse files
authored
automated postrelease testing (#1460)
* wip postrelease testing * fix replicated CLI install * f * fix bin download * disable CI again * needs get-tag * test reset+reinstall with actual build, not previous k0s * add previous-stable upgrade tests, build 'previous-k0s' app version * that's silly * f * fix previous-stable test * reenable CI * disable almost all of CI again * pass the post-upgrade target ec version to the check instead of expecting a static suffix * add new param in CI as well * reenable CI * fix previous version upgrade onrelease test * fix upgrade version specifier * include upgrade version specifier in docker tests
1 parent 116f264 commit 4e7aa63

File tree

8 files changed

+212
-34
lines changed

8 files changed

+212
-34
lines changed

.github/actions/e2e/action.yml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,9 @@ inputs:
4343
version-specifier:
4444
description: 'the git sha or tag used to generate application version strings'
4545
required: true
46+
upgrade-target-ec-version:
47+
description: 'the embedded cluster version to expect after upgrades complete'
48+
required: false # this is only set by post-release testing
4649

4750
runs:
4851
using: composite
@@ -110,6 +113,7 @@ runs:
110113
export EXPECT_K0S_VERSION=${{ inputs.k0s-version }}
111114
export EXPECT_K0S_VERSION_PREVIOUS=${{ inputs.k0s-version-previous }}
112115
export EXPECT_K0S_VERSION_PREVIOUS_STABLE=${{ inputs.k0s-version-previous-stable }}
116+
export EXPECT_EMBEDDED_CLUSTER_UPGRADE_TARGET_VERSION=${{ inputs.upgrade-target-ec-version }}
113117
make e2e-test TEST_NAME=${{ inputs.test-name }}
114118
- name: Troubleshoot
115119
if: ${{ !cancelled() }}

.github/workflows/ci.yaml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -552,6 +552,7 @@ jobs:
552552
- build-upgrade
553553
- build-previous-stable
554554
- release-app
555+
- export-version-specifier
555556
strategy:
556557
fail-fast: false
557558
matrix:

.github/workflows/release-prod.yaml

Lines changed: 165 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -211,3 +211,168 @@ jobs:
211211
files: |
212212
build/*.tgz
213213
build/metadata.json
214+
215+
build-previous-stable:
216+
name: Build previous stable
217+
runs-on: embedded-cluster
218+
needs:
219+
- get-tag
220+
outputs:
221+
ec_version: ${{ steps.export.outputs.ec_version }}
222+
k0s_version: ${{ steps.export.outputs.k0s_version }}
223+
steps:
224+
- name: Checkout
225+
uses: actions/checkout@v4
226+
- name: Export k0s version
227+
id: export
228+
env:
229+
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
230+
run: |
231+
k0s_majmin_version="$(make print-PREVIOUS_K0S_VERSION | sed 's/v\([0-9]*\.[0-9]*\).*/\1/')"
232+
EC_VERSION="$(gh release list --repo replicatedhq/embedded-cluster \
233+
--exclude-drafts --exclude-pre-releases --json name \
234+
--jq '.[] | .name' \
235+
| grep "k8s-${k0s_majmin_version}" \
236+
| head -n1)"
237+
238+
gh release download "$EC_VERSION" --repo replicatedhq/embedded-cluster --pattern 'metadata.json'
239+
K0S_VERSION="$(jq -r '.Versions.Kubernetes' metadata.json)"
240+
241+
echo "EC_VERSION=\"$EC_VERSION\""
242+
echo "K0S_VERSION=\"$K0S_VERSION\""
243+
echo "ec_version=$EC_VERSION" >> "$GITHUB_OUTPUT"
244+
echo "k0s_version=$K0S_VERSION" >> "$GITHUB_OUTPUT"
245+
246+
release-app:
247+
name: Create app releases
248+
runs-on: ubuntu-latest
249+
permissions:
250+
pull-requests: write
251+
needs:
252+
- release
253+
- get-tag
254+
- build-previous-stable
255+
steps:
256+
- name: Checkout
257+
uses: actions/checkout@v4
258+
with:
259+
fetch-depth: 0
260+
- name: Install replicated CLI
261+
env:
262+
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
263+
run: |
264+
gh release download --repo replicatedhq/replicated --pattern '*linux_amd64.tar.gz' --output replicated.tar.gz
265+
tar xf replicated.tar.gz replicated && rm replicated.tar.gz
266+
mv replicated /usr/local/bin/replicated
267+
- name: Create CI releases
268+
env:
269+
REPLICATED_APP: "embedded-cluster-smoke-test-staging-app"
270+
REPLICATED_API_TOKEN: ${{ secrets.STAGING_REPLICATED_API_TOKEN }}
271+
REPLICATED_API_ORIGIN: "https://api.staging.replicated.com/vendor"
272+
APP_CHANNEL: CI
273+
USES_DEV_BUCKET: "0"
274+
run: |
275+
# install the current k0s version
276+
export EC_VERSION="${{ needs.get-tag.outputs.tag-name }}"
277+
export APP_VERSION="appver-${{ needs.get-tag.outputs.tag-name }}"
278+
export RELEASE_YAML_DIR=e2e/kots-release-install
279+
./scripts/ci-release-app.sh
280+
# and finally an app upgrade
281+
export EC_VERSION="${{ needs.get-tag.outputs.tag-name }}-upgrade"
282+
export APP_VERSION="appver-${{ needs.get-tag.outputs.tag-name }}-upgrade"
283+
export RELEASE_YAML_DIR=e2e/kots-release-upgrade
284+
./scripts/ci-release-app.sh
285+
- name: Create airgap releases
286+
env:
287+
REPLICATED_APP: "embedded-cluster-smoke-test-staging-app"
288+
REPLICATED_API_TOKEN: ${{ secrets.STAGING_REPLICATED_API_TOKEN }}
289+
REPLICATED_API_ORIGIN: "https://api.staging.replicated.com/vendor"
290+
APP_CHANNEL: CI-airgap
291+
USES_DEV_BUCKET: "0"
292+
run: |
293+
# re-promote a release containing an old version of embedded-cluster to test upgrades
294+
export APP_VERSION="appver-${{ needs.get-tag.outputs.tag-name }}-1.8.0-k8s-1.28"
295+
replicated release promote 11615 2cHXb1RCttzpR0xvnNWyaZCgDBP --version "${APP_VERSION}"
296+
replicated release promote 11615 2eAqMYG1IEtX8cwpaO1kgNV6EB3 --version "${APP_VERSION}"
297+
298+
# promote a release containing the previous stable version of embedded-cluster to test upgrades
299+
export EC_VERSION="${{ needs.build-previous-stable.outputs.ec_version }}"
300+
export APP_VERSION="appver-${{ needs.get-tag.outputs.tag-name }}-previous-stable"
301+
export RELEASE_YAML_DIR=e2e/kots-release-install-stable
302+
./scripts/ci-release-app.sh
303+
# promote a release with the current k0s version, but call it the previous version to test noop upgrades
304+
export EC_VERSION="${{ needs.get-tag.outputs.tag-name }}"
305+
export APP_VERSION="appver-${{ needs.get-tag.outputs.tag-name }}-previous-k0s"
306+
export RELEASE_YAML_DIR=e2e/kots-release-install
307+
./scripts/ci-release-app.sh
308+
# promote a release with the current k0s version
309+
export EC_VERSION="${{ needs.get-tag.outputs.tag-name }}"
310+
export APP_VERSION="appver-${{ needs.get-tag.outputs.tag-name }}"
311+
export RELEASE_YAML_DIR=e2e/kots-release-install
312+
./scripts/ci-release-app.sh
313+
# and finally an app upgrade
314+
export EC_VERSION="${{ needs.get-tag.outputs.tag-name }}"
315+
export APP_VERSION="appver-${{ needs.get-tag.outputs.tag-name }}-upgrade"
316+
export RELEASE_YAML_DIR=e2e/kots-release-upgrade
317+
./scripts/ci-release-app.sh
318+
e2e:
319+
name: E2E
320+
runs-on: ${{ matrix.runner || 'ubuntu-22.04' }}
321+
needs:
322+
- release
323+
- release-app
324+
- get-tag
325+
- build-previous-stable
326+
strategy:
327+
fail-fast: false
328+
matrix:
329+
test:
330+
- TestResetAndReinstallAirgap
331+
- TestSingleNodeAirgapUpgrade
332+
include:
333+
- test: TestMultiNodeAirgapUpgrade
334+
runner: embedded-cluster
335+
- test: TestAirgapUpgradeFromEC18
336+
runner: embedded-cluster
337+
- test: TestMultiNodeAirgapUpgradePreviousStable
338+
runner: embedded-cluster
339+
steps:
340+
- name: Checkout
341+
uses: actions/checkout@v4
342+
343+
- uses: ./.github/actions/e2e
344+
with:
345+
test-name: '${{ matrix.test }}'
346+
is-large-runner: ${{ matrix.runner == 'embedded-cluster' }}
347+
airgap-license-id: ${{ secrets.STAGING_EMBEDDED_CLUSTER_AIRGAP_LICENSE_ID }}
348+
snapshot-license-id: ${{ secrets.STAGING_EMBEDDED_CLUSTER_SNAPSHOT_LICENSE_ID }}
349+
snapshot-license: ${{ secrets.STAGING_EMBEDDED_CLUSTER_SNAPSHOT_LICENSE }}
350+
airgap-snapshot-license-id: ${{ secrets.STAGING_EMBEDDED_CLUSTER_AIRGAP_SNAPSHOT_LICENSE_ID }}
351+
license-id: ${{ secrets.STAGING_EMBEDDED_CLUSTER_LICENSE_ID }}
352+
license: ${{ secrets.STAGING_EMBEDDED_CLUSTER_LICENSE }}
353+
dr-aws-access-key-id: ${{ secrets.TESTIM_AWS_ACCESS_KEY_ID }}
354+
dr-aws-secret-access-key: ${{ secrets.TESTIM_AWS_SECRET_ACCESS_KEY }}
355+
version-specifier: ${{ needs.get-tag.outputs.tag-name }}
356+
357+
k0s-version: ${{ needs.get-tag.outputs.k0s_version }}
358+
k0s-version-previous: ${{ needs.get-tag.outputs.k0s_version }} # we do not run k8s upgrade tests on release
359+
k0s-version-previous-stable: ${{ needs.build-previous-stable.outputs.k0s_version }}
360+
upgrade-target-ec-version: ${{ needs.get-tag.outputs.tag-name }}
361+
362+
# this job will validate that all the tests passed
363+
# it is used for the github branch protection rule
364+
validate-release-success:
365+
name: Validate success
366+
runs-on: ubuntu-20.04
367+
needs:
368+
- e2e
369+
- release
370+
- release-app
371+
if: always()
372+
steps:
373+
# https://docs.github.com/en/actions/learn-github-actions/contexts#needs-context
374+
- name: fail if e2e job was not successful
375+
if: needs.e2e.result != 'success'
376+
run: exit 1
377+
- name: succeed if everything else passed
378+
run: echo "Validation succeeded"

0 commit comments

Comments
 (0)