Skip to content

Commit 526b1b0

Browse files
authoredOct 8, 2024
New schedule for e2e tests (kubewarden#554)
Signed-off-by: Martin Kravec <[email protected]>

File tree

3 files changed

+108
-20
lines changed

3 files changed

+108
-20
lines changed
 

‎.github/workflows/e2e-tests.yml

+106-15
Original file line numberDiff line numberDiff line change
@@ -2,15 +2,64 @@ name: End-to-end tests
22

33
on:
44
workflow_dispatch:
5-
push:
6-
tags:
7-
- "*"
5+
inputs:
6+
mode:
7+
type: choice
8+
description: Test mode
9+
options:
10+
- install
11+
- upgrade
12+
version:
13+
description: App version [local|next|prev|v1.17.0]
14+
required: true
15+
default: local
16+
CONTROLLER_ARGS:
17+
description: Controller helm flags
18+
DEFAULTS_ARGS:
19+
description: Defaults helm flags
20+
LATEST:
21+
description: Use latest images
22+
type: boolean
23+
default: false
24+
K3S_VERSION:
25+
description: K3S version
26+
type: choice
27+
default: 'v1.30'
28+
options:
29+
- v1.23
30+
- v1.24
31+
- v1.25
32+
- v1.26
33+
- v1.27
34+
- v1.28
35+
- v1.29
36+
- v1.30
37+
- v1.31
38+
39+
# PR: install + tests from PR
840
pull_request:
941
branches:
1042
- "main"
43+
44+
# Nightly:
45+
# - install from main with latest images (to check if we can tag and release)
46+
# - install tagged charts (refrence job to make sure product works, most stable case)
1147
schedule:
1248
- cron: '0 21 * * *'
1349

50+
# Release (stable, rc, beta):
51+
# - install release
52+
# - upgrade from previous stable to this release
53+
# - install on oldest supported k8s
54+
workflow_run:
55+
workflows: ["Release helm chart"]
56+
types:
57+
- completed
58+
59+
concurrency:
60+
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}
61+
cancel-in-progress: true
62+
1463
defaults:
1564
run:
1665
shell: bash
@@ -24,15 +73,34 @@ jobs:
2473
strategy:
2574
fail-fast: false
2675
matrix:
27-
mode: [install, upgrade]
76+
mode: ${{
77+
(github.event_name == 'workflow_run') && fromJSON('["install", "upgrade"]') ||
78+
(github.event_name == 'schedule') && fromJSON('["install"]') ||
79+
(github.event_name == 'pull_request') && fromJSON('["install"]') ||
80+
fromJSON(format('["{0}"]', inputs.mode || 'install')) }}
81+
version: ${{
82+
(github.event_name == 'workflow_run') && fromJSON('["next"]') ||
83+
(github.event_name == 'schedule') && fromJSON('["local", "next"]') ||
84+
(github.event_name == 'pull_request') && fromJSON('["local"]') ||
85+
fromJSON(format('["{0}"]', inputs.version || 'local')) }}
86+
k3s: ${{ (github.event_name == 'workflow_run') && fromJSON('["k3d", "1.23"]') || fromJSON(format('["{0}"]', inputs.K3S_VERSION || 'k3d' )) }}
87+
exclude:
88+
- k3s: ${{ (github.event_name == 'workflow_run') && '1.23' }}
89+
mode: upgrade
2890

2991
# Run schedule workflows only on original repo, not forks
30-
if: github.event_name != 'schedule' || github.repository_owner == 'kubewarden'
92+
if: (github.event_name != 'schedule' || github.repository_owner == 'kubewarden') &&
93+
(github.event_name != 'workflow_run' || github.event.workflow_run.conclusion == 'success')
3194

3295
runs-on: ubuntu-latest
3396
steps:
34-
- uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4
35-
- uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4
97+
98+
- uses: actions/checkout@v4
99+
if: ${{ matrix.version == 'local' }}
100+
- run: helm repo add kubewarden https://charts.kubewarden.io
101+
if: ${{ matrix.version != 'local' }}
102+
103+
- uses: actions/checkout@v4
36104
with:
37105
repository: ${{ github.repository_owner }}/kubewarden-end-to-end-tests
38106
path: e2e-tests
@@ -48,16 +116,39 @@ jobs:
48116
- name: "Create k3d cluster"
49117
run: |
50118
wget -q -O - https://raw.githubusercontent.com/k3d-io/k3d/main/install.sh | TAG=${{ env.K3D_VERSION }} sudo --preserve-env=TAG bash
51-
k3d cluster create ${{ env.K3D_CLUSTER_NAME }} --agents 1
119+
# Use k3d as placehoholder for default (empty) k3s version
120+
[[ "${{ matrix.k3s }}" != "k3d" ]] && export K3S=${{ matrix.k3s }}
121+
make --directory e2e-tests cluster
122+
env:
123+
CLUSTER_NAME: ${{ env.K3D_CLUSTER_NAME }}
124+
125+
- name: Install previous kubewarden
126+
if: ${{ matrix.mode == 'upgrade' }}
127+
working-directory: ./e2e-tests
128+
run: VERSION=prev REPO_NAME=kubewarden CHARTS_LOCATION=kubewarden make install
129+
env:
130+
CLUSTER_NAME: ${{ env.K3D_CLUSTER_NAME }}
52131

53-
- name: Execute tests
54-
working-directory: e2e-tests
132+
- name: Install kubewarden and run tests
133+
working-directory: ./e2e-tests
55134
run: |
56-
make KUBEWARDEN_CHARTS_LOCATION=../charts \
57-
CLUSTER_NAME=${{ env.K3D_CLUSTER_NAME }} \
58-
${{matrix.mode}} tests audit-scanner-installation.bats
135+
# Additional environment setup
136+
[[ "${{ matrix.version }}" == 'local' ]] && CHARTS_LOCATION=../charts || CHARTS_LOCATION=kubewarden
137+
[[ "${{ github.event_name }}" == 'schedule' && "${{ matrix.version }}" == 'local' ]] && LATEST=true
138+
export CHARTS_LOCATION LATEST
139+
140+
make ${{ matrix.mode }} tests audit-scanner-installation.bats
141+
./scripts/helmer.sh debug
142+
make uninstall
143+
env:
144+
CLUSTER_NAME: ${{ env.K3D_CLUSTER_NAME }}
145+
VERSION: ${{ matrix.version }}
146+
LATEST: ${{ inputs.LATEST }}
147+
DEFAULTS_ARGS: ${{ inputs.DEFAULTS_ARGS }}
148+
CONTROLLER_ARGS: ${{ inputs.CONTROLLER_ARGS }}
59149

60150
- name: Clean Up
61151
if: always()
62-
run: |
63-
k3d cluster delete ${{ env.K3D_CLUSTER_NAME }}
152+
run: make --directory e2e-tests clean
153+
env:
154+
CLUSTER_NAME: ${{ env.K3D_CLUSTER_NAME }}

‎.github/workflows/helm-chart-release.yml

-5
Original file line numberDiff line numberDiff line change
@@ -56,11 +56,6 @@ jobs:
5656
run: |
5757
make check-common-values
5858
59-
- name: Install Helm
60-
uses: azure/setup-helm@5119fcb9089d432beecbf79bb2c7915207344b78 # v3.5
61-
with:
62-
version: v3.8.0
63-
6459
- name: Install cosign
6560
uses: sigstore/cosign-installer@dc72c7d5c4d10cd6bcb8cf6e3fd625a9e5e537da # v3.7.0
6661

‎README.md

+2
Original file line numberDiff line numberDiff line change
@@ -2,4 +2,6 @@
22
[![Kubewarden Core Repository](https://github.com/kubewarden/community/blob/main/badges/kubewarden-core.svg)](https://github.com/kubewarden/community/blob/main/REPOSITORIES.md#core-scope)
33
[![Stable](https://img.shields.io/badge/status-stable-brightgreen?style=for-the-badge)](https://github.com/kubewarden/community/blob/main/REPOSITORIES.md#stable)
44

5+
[![E2E](https://github.com/kubewarden/helm-charts/actions/workflows/e2e-tests.yml/badge.svg?event=schedule)](https://github.com/kubewarden/helm-charts/actions/workflows/e2e-tests.yml?query=event%3Aschedule)
6+
57
This repository contains the helm charts used to deploy the Kubewarden stack.

0 commit comments

Comments
 (0)
Please sign in to comment.