forked from kubewarden/kubewarden-controller
-
Notifications
You must be signed in to change notification settings - Fork 0
152 lines (135 loc) · 5.27 KB
/
e2e-tests.yml
File metadata and controls
152 lines (135 loc) · 5.27 KB
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
name: End-to-end tests
run-name: ${{ github.event_name == 'workflow_run' && github.event.workflow_run.display_title || '' }}
on:
workflow_dispatch:
inputs:
version:
description: Kubewarden [local|next|prev|v1.17.0]
required: true
default: local
K3S_VERSION:
description: Kubernetes version
type: choice
options:
[
"k3d",
"1.27",
"1.28",
"1.29",
"1.30",
"1.31",
"1.32",
"1.33",
"1.34",
"1.35",
]
default: "k3d"
ARCH:
description: Runner architecture
type: choice
options: [x86, arm64]
default: x86
UPGRADE:
description: Enable upgrade test
type: boolean
default: false
MTLS:
description: Enable mutual TLS
type: boolean
default: false
LATEST:
description: Use latest images
type: boolean
default: false
CONTROLLER_ARGS:
description: Helm flags for controller
DEFAULTS_ARGS:
description: Helm flags for defaults
# PR: install + tests from PR
pull_request:
branches:
- "main"
paths:
- "charts/kubewarden-*/**"
concurrency:
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}
cancel-in-progress: true
defaults:
run:
shell: bash
env:
K3D_VERSION: # 'v5.6.3' - optionally pin version
K3D_CLUSTER_NAME: ${{ github.repository_owner }}-${{ github.event.repository.name }}
MTLS: ${{ github.event_name == 'pull_request' && 'true' || inputs.MTLS }}
jobs:
e2e:
# x86: ubuntu-latest, arm64: ubuntu-24.04-arm
runs-on: ${{ matrix.arch == 'arm64' && 'ubuntu-24.04-arm' || 'ubuntu-latest' }}
strategy:
fail-fast: false
matrix:
mode: ${{
(github.event_name == 'pull_request') && fromJSON('["install"]') ||
fromJSON(format('["{0}"]', inputs.UPGRADE && 'upgrade' || 'install')) }}
version: ${{
(github.event_name == 'pull_request') && fromJSON('["local"]') ||
fromJSON(format('["{0}"]', inputs.version || 'local')) }}
k3s: ${{ (github.event_name == 'workflow_run') && fromJSON('["k3d", "1.27"]') || fromJSON(format('["{0}"]', inputs.K3S_VERSION || 'k3d' )) }}
arch: ${{ (github.event_name == 'workflow_run') && fromJSON('["x86", "arm64"]') || fromJSON(format('["{0}"]', inputs.ARCH || 'x86')) }}
steps:
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
if: ${{ matrix.version == 'local' }}
- run: helm repo add kubewarden https://charts.kubewarden.io
if: ${{ matrix.version != 'local' || matrix.mode == 'upgrade' }}
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
with:
repository: ${{ github.repository_owner }}/kubewarden-end-to-end-tests
path: e2e-tests
submodules: "true"
- name: "Install kwctl"
uses: kubewarden/github-actions/kwctl-installer@main
with:
KWCTL_VERSION: latest
- run: sudo npm install -g bats
- name: "Create k3d cluster"
run: |
wget -q -O - https://raw.githubusercontent.com/k3d-io/k3d/main/install.sh | TAG=${{ env.K3D_VERSION }} sudo --preserve-env=TAG bash
# Use k3d as placehoholder for default (empty) k3s version
[[ "${{ matrix.k3s }}" != "k3d" ]] && export K3S=${{ matrix.k3s }}
make --directory e2e-tests cluster DOCKERHUB_USERNAME="${{ secrets.DOCKERHUB_USERNAME }}" DOCKERHUB_PASSWORD="${{ secrets.DOCKERHUB_PASSWORD }}"
env:
CLUSTER_NAME: ${{ env.K3D_CLUSTER_NAME }}
- name: Install previous kubewarden
if: ${{ matrix.mode == 'upgrade' }}
working-directory: ./e2e-tests
run: VERSION=prev REPO_NAME=kubewarden CHARTS_LOCATION=kubewarden make install
env:
MTLS: false # TODO: Remove after prev supports mTLS (kw >= 1.24-alpha)
CLUSTER_NAME: ${{ env.K3D_CLUSTER_NAME }}
- name: Install kubewarden and run tests
working-directory: ./e2e-tests
run: |
if [[ "${{ matrix.version }}" == 'local' ]]; then
export CHARTS_LOCATION=../charts
# Chart images are updated during release, use latest for nightly jobs
[[ "${{ github.event_name }}" == 'pull_request' ]] && export LATEST=true
fi
# mTLS should have been enabled during installation
make ${{ matrix.mode }} # MTLS="{{ matrix.mode == 'upgrade' && false || env.MTLS }}" # TODO: Uncomment after prev supports mTLS (kw >= 1.24-alpha)
./scripts/helmer.sh debug
# Run tests
make tests audit-scanner-installation.bats
make uninstall
env:
CLUSTER_NAME: ${{ env.K3D_CLUSTER_NAME }}
VERSION: ${{ matrix.version }}
LATEST: ${{ inputs.LATEST }}
DEFAULTS_ARGS: ${{ inputs.DEFAULTS_ARGS }}
CONTROLLER_ARGS: ${{ inputs.CONTROLLER_ARGS }}
# Override OTEL operator version by github variable
OTEL_OPERATOR: ${{ vars.OTEL_OPERATOR }}
- name: Clean Up
if: always()
run: make --directory e2e-tests clean
env:
CLUSTER_NAME: ${{ env.K3D_CLUSTER_NAME }}