-
Notifications
You must be signed in to change notification settings - Fork 2
341 lines (309 loc) · 11.1 KB
/
master_rancher_ui_workflow.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
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
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
# This workflow is a reusable one called by other workflows
name: Master Rancher UI workflow (template)
on:
workflow_call:
# Variables to set when calling this reusable workflow
inputs:
browser:
description: Web browser to test
required: true
type: string
cypress_image:
description: Cypress docker image to use
required: true
type: string
cypress_install_test:
description: Epinio installation test
required: true
type: string
cypress_test:
description: Scenario to test
required: true
type: string
docker_options:
description: Set other docker options
required: false
type: string
ext_reg:
description: Enable external registry test
required: false
type: string
runner:
description: Runner on which to execute tests
required: true
type: string
grep_test_by_tag:
description: Grep tags. For multiple selection separate with spaces
required: false
type: string
default: ''
s3_store_type:
description: Select s3Storage type for installation (s3gw, s3, <none> = minio)
required: false
type: string
default: ''
jobs:
installation:
runs-on: ${{ inputs.runner }}
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Cache Tools
uses: actions/cache@v3
with:
path: ${{ github.workspace }}/tools
key: ${{ runner.os }}-tools
- name: Add Tools to PATH
run: |
echo "`pwd`/output/bin" >> $GITHUB_PATH
- name: Install K3s / Helm / Rancher
id: installation
env:
DASHBOARD_VERSION: epinio-dev
KUBECONFIG: /etc/rancher/k3s/k3s.yaml
HELM_VERSION: 3.12.0
K3S_VERSION: v1.25.9+k3s1
EXT_REG: ${{ inputs.ext_reg }}
EXT_REG_USER: ${{ secrets.EPINIO_DOCKER_USER }}
EXT_REG_PASSWORD: ${{ secrets.EPINIO_DOCKER_PASSWORD }}
GHCR_USER: ${{ secrets.GHCR_USER }}
GHCR_PASSWORD: ${{ secrets.GHCR_PASSWORD }}
S3_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }}
S3_KEY_SECRET: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
run: |
## Export information to other jobs
export PATH=$PATH:/usr/local/bin
ETH_DEV=$(ip route | awk '/default via / { print $5 }')
MY_IP=$(ip a s ${ETH_DEV} | egrep -o 'inet [0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}' | cut -d' ' -f2)
export MY_HOSTNAME=$(hostname)
export EPINIO_SYSTEM_DOMAIN="${MY_IP}.omg.howdoi.website"
echo "MY_IP=${MY_IP}" >> $GITHUB_OUTPUT
echo "MY_HOSTNAME=${MY_HOSTNAME}" >> $GITHUB_OUTPUT
make prepare-e2e-ci-rancher
outputs:
MY_HOSTNAME: ${{ steps.installation.outputs.MY_HOSTNAME }}
MY_IP: ${{ steps.installation.outputs.MY_IP }}
# Use a first Cypress container to install Epinio on Rancher
cypress-epinio-installation:
needs:
- installation
runs-on: ${{ inputs.runner }}
container:
image: ${{ inputs.cypress_image }}
env:
CLUSTER_NAME: local
# CORS: https://${{ needs.installation.outputs.MY_HOSTNAME }}
EXT_REG_USER: ${{ secrets.EPINIO_DOCKER_USER }}
EXT_REG_PASSWORD: ${{ secrets.EPINIO_DOCKER_PASSWORD }}
RANCHER_USER: admin
RANCHER_PASSWORD: rancherpassword
RANCHER_URL: https://${{ needs.installation.outputs.MY_HOSTNAME }}/dashboard
S3_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }}
S3_KEY_SECRET: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
SYSTEM_DOMAIN: ${{ needs.installation.outputs.MY_IP }}.omg.howdoi.website
UI: rancher
S3_STORE_TYPE: ${{ inputs.s3_store_type }}
# EXTRAENV_NAME: SESSION_KEY
# EXTRAENV_VALUE: 12345
options: --add-host ${{ needs.installation.outputs.MY_HOSTNAME }}:${{ needs.installation.outputs.MY_IP }} --ipc=host ${{ inputs.docker_options }}
steps:
- name: Cypress run
uses: cypress-io/github-action@v5
with:
browser: ${{ inputs.browser }}
# headless: true
spec: |
cypress/e2e/unit_tests/first_connexion.spec.ts
cypress/e2e/unit_tests/${{ inputs.cypress_install_test }}
config-file: cypress.config.ts
- name: Copying screenshots and videos to Mochawesome report
if: always()
run: |
mkdir -p mochawesome-report
cp -r cypress/screenshots mochawesome-report || echo "No screenshots found in this run, probably all tests were OK"
# cp -r cypress/videos mochawesome-report
- name: Upload Cypress screenshots
uses: actions/upload-artifact@v3
if: failure()
with:
name: cypress-screenshots-install
path: cypress/screenshots
retention-days: 7
# Test run video was always captured, so this action uses "always()" condition
# - name: Upload Cypress videos
# uses: actions/upload-artifact@v3
# if: always()
# with:
# name: cypress-videos-install
# path: cypress/videos
# retention-days: 7
- name: Upload Mochawesome report
uses: actions/upload-artifact@v3
if: always()
with:
name: mochawesome-report
path: mochawesome-report
retention-days: 7
# Patch Epinio to use the latest code version (main)
# It can only be done with CLI
epinio-patching:
needs:
- cypress-epinio-installation
runs-on: ${{ inputs.runner }}
steps:
- name: Checkout Epinio repository
uses: actions/checkout@v3
with:
repository: epinio/epinio
submodules: recursive
fetch-depth: 0
path: epinio
- name: Cache Tools
uses: actions/cache@v3
with:
path: ${{ github.workspace }}/tools
key: ${{ runner.os }}-tools
- name: Add Tools to PATH
run: |
echo "`pwd`/output/bin" >> $GITHUB_PATH
- name: Setup Go
uses: actions/setup-go@v4
env:
SETUP_GO_VERSION: '^1.20'
with:
go-version: ${{ env.SETUP_GO_VERSION }}
cache: false
- name: Patch epinio-server
env:
KUBECONFIG: /etc/rancher/k3s/k3s.yaml
run: |
cd epinio
make build
make patch-epinio-deployment
- name: Patch epinio-ui with latest QA image
env:
KUBECONFIG: /etc/rancher/k3s/k3s.yaml
run: |
make patch-epinio-ui
# Use a second Cypress container to run all Epinio's tests
cypress-epinio-tests:
needs:
- installation
- cypress-epinio-installation
- epinio-patching
runs-on: ${{ inputs.runner }}
container:
image: ${{ inputs.cypress_image }}
env:
CLUSTER_NAME: local
RANCHER_USER: admin
RANCHER_PASSWORD: password
RANCHER_URL: https://epinio.${{ needs.installation.outputs.MY_IP }}.omg.howdoi.website
SYSTEM_DOMAIN: ${{ needs.installation.outputs.MY_IP }}.omg.howdoi.website
# set UI value to something else than 'rancher'
UI: epinio-rancher
GREPTAGS: ${{ inputs.grep_test_by_tag }}
options: --add-host ${{ needs.installation.outputs.MY_HOSTNAME }}:${{ needs.installation.outputs.MY_IP }} --ipc=host ${{ inputs.docker_options }}
steps:
- name: Cypress run
uses: cypress-io/github-action@v5
with:
browser: ${{ inputs.browser }}
# headless: true
spec: |
cypress/e2e/unit_tests/${{ inputs.cypress_test }}
config-file: cypress.config.ts
- name: Copying screenshots and videos to Mochawesome report
if: always()
run: |
mkdir -p mochawesome-report
cp -r cypress/screenshots mochawesome-report || echo "No screenshots found in this run, probably all tests were OK"
# cp -r cypress/videos mochawesome-report
- name: Upload Cypress screenshots
uses: actions/upload-artifact@v3
if: failure()
with:
name: cypress-screenshots-tests
path: cypress/screenshots
retention-days: 7
# Test run video was always captured, so this action uses "always()" condition
# - name: Upload Cypress videos
# uses: actions/upload-artifact@v3
# if: always()
# with:
# name: cypress-videos-tests
# path: cypress/videos
# retention-days: 7
- name: Upload Mochawesome report
uses: actions/upload-artifact@v3
if: always()
with:
name: mochawesome-report
path: mochawesome-report
retention-days: 7
cypress-epinio-uninstall:
needs:
- installation
- cypress-epinio-installation
- epinio-patching
- cypress-epinio-tests
runs-on: ${{ inputs.runner }}
container:
image: ${{ inputs.cypress_image }}
env:
CLUSTER_NAME: local
RANCHER_USER: admin
RANCHER_PASSWORD: rancherpassword
RANCHER_URL: https://${{ needs.installation.outputs.MY_HOSTNAME }}/dashboard
SYSTEM_DOMAIN: ${{ needs.installation.outputs.MY_IP }}.omg.howdoi.website
UI: rancher
options: --add-host ${{ needs.installation.outputs.MY_HOSTNAME }}:${{ needs.installation.outputs.MY_IP }} --ipc=host ${{ inputs.docker_options }}
steps:
- name: Cypress run
uses: cypress-io/github-action@v5
with:
browser: ${{ inputs.browser }}
# headless: true
spec: |
cypress/e2e/unit_tests/uninstall.spec.ts
config-file: cypress.config.ts
- name: Copying screenshots and videos to Mochawesome report
if: always()
run: |
mkdir -p mochawesome-report
cp -r cypress/screenshots mochawesome-report || echo "No screenshots found in this run, probably all tests were OK"
# cp -r cypress/videos mochawesome-report
- name: Upload Cypress screenshots
uses: actions/upload-artifact@v3
if: failure()
with:
name: cypress-screenshots-uninstall
path: cypress/screenshots
retention-days: 7
# Test run video was always captured, so this action uses "always()" condition
# - name: Upload Cypress videos
# uses: actions/upload-artifact@v3
# if: always()
# with:
# name: cypress-videos-uninstall
# path: cypress/videos
# retention-days: 7
- name: Upload Mochawesome report
uses: actions/upload-artifact@v3
if: always()
with:
name: mochawesome-report
path: mochawesome-report
retention-days: 7
delete-cluster:
if: always()
needs: [installation, cypress-epinio-installation, epinio-patching, cypress-epinio-tests, cypress-epinio-uninstall]
runs-on: ${{ inputs.runner }}
steps:
- name: Delete k3s cluster
if: always()
run: |
make clean-all
- name: Clean all
if: always()
uses: colpal/actions-clean@v1