-
Notifications
You must be signed in to change notification settings - Fork 39
308 lines (291 loc) · 11.4 KB
/
master_e2e.yaml
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
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
# This workflow is a reusable one called by other workflows
name: (template) Main template
on:
workflow_call:
# Variables to set when calling this reusable workflow
inputs:
backup_restore_version:
description: Version of backup-restore-operator to use
type: string
boot_type:
description: Choose booting type (pxe, iso, raw)
default: pxe
type: string
ca_type:
description: CA type to use (selfsigned or private)
default: selfsigned
type: string
cert-manager_version:
description: Version of cert-manager to use
type: string
cluster_name:
description: Name of the provisioned cluster
default: elemental-cluster
type: string
cluster_number:
description: Number of clusters to deploy in multi-cluster test
type: string
cluster_type:
description: Cluster type (empty if normal or hardened)
type: string
cypress_tags:
description: Tags to filter tests we want to run
default: main
type: string
destroy_runner:
description: Destroy the auto-generated self-hosted runner
default: true
type: boolean
elemental_ui_version:
description: Version of the elemental ui which will be installed (dev/stable)
default: dev
type: string
force_downgrade:
description: Force OS downgrade
default: false
type: boolean
full_backup_restore:
description: Test migration-like backup/restore functionality
default: false
type: boolean
k8s_downstream_version:
description: Rancher cluster downstream version to use
type: string
k8s_upstream_version:
description: Rancher cluster upstream version to use
type: string
node_number:
description: Number of nodes to deploy on the provisioned cluster
default: 5
type: string
operator_repo:
description: Elemental operator repository to use
type: string
default: oci://registry.opensuse.org/isv/rancher/elemental/dev/charts/rancher
operator_upgrade:
description: Elemental operator version to upgrade to
type: string
os_to_test:
description: OS repository to test (dev/staging/stable)
type: string
default: dev
os_version_install:
description: OS version to install
type: string
os_version_target:
description: OS version to target when upgrading
type: string
proxy:
description: Deploy a proxy
type: string
qase_run_id:
description: Case run ID where the results will be reported
default: auto
type: string
rancher_upgrade:
description: Rancher Manager channel/version to upgrade to
type: string
rancher_version:
description: Rancher Manager channel/version/head_version to use
default: stable/latest
type: string
reset:
description: Allow reset test (mainly used on CLI tests)
default: false
type: boolean
runner_template:
description: Runner template to use
default: elemental-e2e-ci-runner-spot-x86-64-template-n2-standard-16-v5
type: string
selinux:
description: Use/configure SELinux
default: false
type: boolean
sequential:
description: Defines if bootstrapping is done sequentially (true) or in parallel (false)
default: false
type: boolean
snap_type:
description: Type to use for snapshot partitions (btrfs/loopdevice)
default: btrfs
type: string
test_type:
description: Type of test to run (cli/ui)
required: true
type: string
ui_account:
description: Account used to test RBAC role in UI
type: string
upgrade_from_version:
description: Elemental operator version to upgrade from
type: string
upgrade_image:
description: Image to use for the Elemental OS upgrade
type: string
upgrade_os_channel:
description: Channel to use for the Elemental OS upgrade
type: string
upgrade_type:
description: Type of upgrade to use for the Elemental OS upgrade
type: string
zone:
description: GCP zone to host the runner
default: us-central1-f
type: string
# Secrets to set when calling this reusable workflow
secrets:
credentials:
description: Credentials to use to connect
required: true
pat_token:
# A token is needed to be able to add runner on the repo, maybe this can be changed later
# This token is linked to a personal account
# So in case of token issue you have to check (no specific order and for example):
# - the expiration date
# - if the account associated still exists
# - if the person still has access to the repo
description: PAT token used to add runner
required: true
qase_api_token:
description: Qase API token to use for Qase reporting
jobs:
create-runner:
uses: ./.github/workflows/sub_create-runner.yaml
secrets:
credentials: ${{ secrets.credentials }}
pat_token: ${{ secrets.pat_token }}
with:
runner_template: ${{ inputs.runner_template }}
zone: ${{ inputs.zone }}
pre-qase:
needs: create-runner
runs-on: ubuntu-latest
env:
QASE_API_TOKEN: ${{ secrets.qase_api_token }}
QASE_PROJECT_CODE: ELEMENTAL
outputs:
qase_run_description: ${{ steps.qase.outputs.qase_run_description }}
qase_run_id: ${{ steps.qase.outputs.qase_run_id }}
qase_run_name: ${{ steps.qase.outputs.qase_run_name }}
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Setup Go
uses: actions/setup-go@v5
with:
cache-dependency-path: tests/go.sum
go-version-file: tests/go.mod
- name: Create/Export Qase Run
id: qase
run: |
if ${{ inputs.qase_run_id == 'auto' }}; then
# Define and export URL of GH test run in Qase run description
GH_RUN_URL="${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}"
export QASE_RUN_DESCRIPTION="${GH_RUN_URL}"
# Define and export the Qase run name, as it cannot be done
# in 'env:' because GITHUB_WORKFLOW is a shell variable
# Export them also to be used locally
export QASE_RUN_NAME="${GITHUB_WORKFLOW}-RM_${{inputs.rancher_version}}-UP_${{inputs.k8s_upstream_version}}-DOWN_${{inputs.k8s_downstream_version}}"
# Create a Qase run, get its ID
ID=$(cd tests && make create-qase-run)
# Export outputs for future use
echo "qase_run_description=${QASE_RUN_DESCRIPTION}" >> ${GITHUB_OUTPUT}
echo "qase_run_id=${ID}" >> ${GITHUB_OUTPUT}
echo "qase_run_name=${QASE_RUN_NAME}" >> ${GITHUB_OUTPUT}
# Just an info for debugging purposes
echo -e "Exported values:\nQASE_RUN_ID=${ID}\nQASE_RUN_DESCRIPTION=${QASE_RUN_DESCRIPTION}\nQASE_RUN_NAME=${QASE_RUN_NAME}"
elif ${{ inputs.qase_run_id != '' }}; then
# If the run ID has been specified
echo "qase_run_id=${{ inputs.qase_run_id }}" >> ${GITHUB_OUTPUT}
fi
e2e:
needs: [create-runner, pre-qase]
uses: ./.github/workflows/sub_test_choice.yaml
secrets:
credentials: ${{ secrets.credentials }}
qase_api_token: ${{ secrets.qase_api_token }}
with:
backup_restore_version: ${{ inputs.backup_restore_version }}
boot_type: ${{ inputs.boot_type }}
ca_type: ${{ inputs.ca_type }}
cert-manager_version: ${{ inputs.cert-manager_version }}
cluster_name: ${{ inputs.cluster_name }}
cluster_namespace: fleet-default
cluster_number: ${{ inputs.cluster_number }}
cluster_type: ${{ inputs.cluster_type }}
cypress_tags: ${{ inputs.cypress_tags }}
destroy_runner: ${{ inputs.destroy_runner }}
elemental_ui_version: ${{ inputs.elemental_ui_version }}
force_downgrade: ${{ inputs.force_downgrade }}
full_backup_restore: ${{ inputs.full_backup_restore }}
k8s_downstream_version: ${{ inputs.k8s_downstream_version }}
node_number: ${{ inputs.node_number }}
operator_repo: ${{ inputs.operator_repo }}
operator_upgrade: ${{ inputs.operator_upgrade }}
os_to_test: ${{ inputs.os_to_test }}
os_version_install: ${{ inputs.os_version_install }}
os_version_target: ${{ inputs.os_version_target }}
proxy: ${{ inputs.proxy }}
public_domain: ${{ needs.create-runner.outputs.public_domain }}
public_fqdn: ${{ needs.create-runner.outputs.public_fqdn }}
qase_project_code: ELEMENTAL
qase_run_id: ${{ needs.pre-qase.outputs.qase_run_id }}
rancher_upgrade: ${{ inputs.rancher_upgrade }}
rancher_version: ${{ inputs.rancher_version }}
reset: ${{ inputs.reset }}
runner_label: ${{ needs.create-runner.outputs.runner_label }}
selinux: ${{ inputs.selinux }}
sequential: ${{ inputs.sequential }}
snap_type: ${{ inputs.snap_type }}
test_type: ${{ inputs.test_type }}
ui_account: ${{ inputs.ui_account }}
upgrade_from_version: ${{ inputs.upgrade_from_version }}
upgrade_image: ${{ inputs.upgrade_image }}
upgrade_os_channel: ${{ inputs.upgrade_os_channel }}
upgrade_type: ${{ inputs.upgrade_type }}
k8s_upstream_version: ${{ inputs.k8s_upstream_version }}
clean-and-delete-runner:
needs: [create-runner, e2e]
if: ${{ always() }}
uses: ./.github/workflows/sub_clean-and-delete-runner.yaml
secrets:
credentials: ${{ secrets.credentials }}
pat_token: ${{ secrets.pat_token }}
with:
create_runner_result: ${{ needs.create-runner.result }}
destroy_runner: ${{ inputs.destroy_runner }}
runner_hostname: ${{ needs.create-runner.outputs.runner_hostname }}
runner_label: ${{ needs.create-runner.outputs.runner_label }}
zone: ${{ inputs.zone }}
post-qase:
needs: [pre-qase, e2e]
if: ${{ always() && needs.pre-qase.outputs.qase_run_id != '' }}
runs-on: ubuntu-latest
env:
QASE_API_TOKEN: ${{ secrets.qase_api_token }}
QASE_PROJECT_CODE: ELEMENTAL
QASE_REPORT: 1
QASE_RUN_COMPLETE: 1
QASE_RUN_ID: ${{ needs.pre-qase.outputs.qase_run_id }}
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Setup Go
uses: actions/setup-go@v5
with:
cache-dependency-path: tests/go.sum
go-version-file: tests/go.mod
- name: Finalize Qase Run and publish Results
if: ${{ !contains(needs.e2e.outputs.steps_status, 'cancelled') }}
run: |
REPORT=$(cd tests && make publish-qase-run)
echo "${REPORT}"
# Extract report URL and put it in summary
REPORT_URL=$(awk '/available:/ { print $NF }' <<<${REPORT})
if [[ -n "${REPORT_URL}" ]]; then
echo "## QASE Reporting" >> ${GITHUB_STEP_SUMMARY}
echo "Public Qase report: ${REPORT_URL}" >> ${GITHUB_STEP_SUMMARY}
fi
- name: Delete Qase Run if job has been cancelled
if: ${{ contains(needs.e2e.outputs.steps_status, 'cancelled') }}
run: cd tests && make delete-qase-run