-
Notifications
You must be signed in to change notification settings - Fork 9
502 lines (484 loc) · 18.9 KB
/
beaker_acceptance.yml
File metadata and controls
502 lines (484 loc) · 18.9 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
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
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
name: Run Beaker acceptance tests on an OpenVox project
on:
workflow_call:
inputs:
suite-name:
description: The identifier of the Beaker test suite to run.
required: true
type: string
ref:
description: |-
The git ref of the suite-name repository to checkout and run.
required: true
type: string
fork:
description: |-
The github fork of the suite-name repository to checkout and run.
required: false
type: string
default: openvoxproject
openvox-collection:
description: |-
The OpenVox collection to install from.
required: false
type: string
default: openvox8
openvox-agent-version:
description: |-
The version of the openvox-agent package to install.
required: false
type: string
openvox-agent-pre-release-build:
description: |-
Whether to test unreleased openvox-agent-version packages
from the artifacts-url server, or released packages from the
given openvox-collection.
If this is true, openvox-agent-version must be a valid
version, not latest, and openvox-collection is ignored. The
workflow will download and install the matching
openvox-agent package file from the artifacts-url server.
If this is false, openvox-agent-version and
openvox-collection must match, and the workflow will install
the given openvox collection package and then let the system
package manager install the latest or openvox-agent-version
package from the collection repository.
required: false
type: boolean
default: true
openvox-server-version:
description: |-
The version of the openvox-server package to install.
required: false
type: string
openvox-server-pre-release-build:
description: |-
Whether to test unreleased openvox-server-version packages
from the artifacts-url server, or released packages from the
given openvox-collection.
(See openvox-agent-pre-release-build)
required: false
type: boolean
default: true
openvoxdb-version:
description: |-
The version of the openvoxdb package to install.
required: false
type: string
openvoxdb-pre-release-build:
description: |-
Whether to test unreleased openvoxdb-version packages
from the artifacts-url server, or released packages from the
given openvox-collection.
(See openvox-agent-pre-release-build)
required: false
type: boolean
default: true
artifacts-url:
description: |-
URL to the artifacts server. This is used to download
pre-release packages for openvox-agent, openvox-server, and
openvoxdb if their pre-release-build inputs are true.
required: false
type: string
default: 'https://s3.osuosl.org/openvox-artifacts'
env:
# Suppress warnings about Bolt gem versus package use.
BOLT_GEM: true
# The Ruby version to use for the project being tested.
# This is used to install Ruby and run Bundler when
# running the project's Beaker acceptance suite.
RUBY_VERSION: '3.3'
jobs:
set-project-defaults:
runs-on: ubuntu-24.04
outputs:
repository: ${{ steps.set-defaults.outputs.repository }}
install-openvox-server: ${{ steps.set-defaults.outputs.install_openvox_server }}
install-openvoxdb: ${{ steps.set-defaults.outputs.install_openvoxdb }}
install-termini: ${{ steps.set-defaults.outputs.install_termini }}
acceptance-working-dir: ${{ steps.set-defaults.outputs.acceptance_working_dir }}
acceptance-pre-suite: ${{ steps.set-defaults.outputs.acceptance_pre_suite }}
acceptance-tests: ${{ steps.set-defaults.outputs.acceptance_tests }}
beaker-options: ${{ steps.set-defaults.outputs.beaker_options }}
os: ${{ steps.set-defaults.outputs.os }}
os-add: ${{ steps.set-defaults.outputs.os_add }}
vms: ${{ steps.set-defaults.outputs.vms }}
steps:
- id: set-defaults
env:
SUITE_NAME: ${{ inputs.suite-name }}
DEFAULT_OS: |-
[
["almalinux", "8"],
["almalinux", "9"],
["debian", "11"],
["debian", "12"],
["rocky", "8"],
["rocky", "9"],
["ubuntu", "22.04"],
["ubuntu", "24.04"]
]
PROJECT_DEFAULTS: |-
{
"openvox": {
"repository": "openvox",
"install-openvox-server": true,
"install-openvoxdb": false,
"install-termini": false,
"acceptance-working-dir": "acceptance",
"acceptance-pre-suite": [
"pre-suite"
],
"acceptance-tests": [
"tests"
],
"beaker-options": {
"helper": "lib/helper.rb",
"options_file": "config/aio/options.rb"
},
"os-add": [],
"vms": [
{
"role": "primary",
"count": 1,
"cpus": 4,
"mem_mb": 8192,
"cpu_mode": "host-model"
}
]
},
"openvox-agent": {
"repository": "openvox",
"install-openvox-server": false,
"install-openvoxdb": false,
"install-termini": false,
"acceptance-working-dir": "packaging/acceptance",
"acceptance-pre-suite": [
"pre-suite/configure_type_defaults.rb"
],
"acceptance-tests": [
"tests"
],
"beaker-options": {
"helper": "lib/helper.rb"
},
"os-add": [
["debian", "13", "amd64", "daily-latest"]
],
"vms": [
{
"role": "agent",
"count": 1,
"cpus": 2,
"mem_mb": 4096,
"cpu_mode": "host-model"
}
]
},
"openvox-server": {
"repository": "openvox-server",
"install-openvox-server": true,
"install-openvoxdb": true,
"install-termini": true,
"acceptance-working-dir": "./",
"acceptance-pre-suite": [
"acceptance/suites/pre_suite/openvox/configure_type_defaults.rb",
"acceptance/suites/pre_suite/foss/00_setup_environment.rb",
"acceptance/suites/pre_suite/foss/070_InstallCACerts.rb",
"acceptance/suites/pre_suite/foss/10_update_ca_certs.rb",
"acceptance/suites/pre_suite/foss/15_prep_locales.rb",
"acceptance/suites/pre_suite/foss/71_smoke_test_puppetserver.rb",
"acceptance/suites/pre_suite/foss/80_configure_puppet.rb",
"acceptance/suites/pre_suite/foss/90_validate_sign_cert.rb",
"acceptance/suites/pre_suite/foss/95_install_pdb.rb",
"acceptance/suites/pre_suite/foss/99_collect_data.rb"
],
"acceptance-tests": [
"acceptance/suites/tests"
],
"beaker-options": {
"helper": "acceptance/lib/helper.rb",
"load_path": "acceptance/lib",
"options_file": "acceptance/config/beaker/options.rb"
},
"os-add": [],
"vms": [
{
"role": "primary",
"count": 1,
"cpus": 4,
"mem_mb": 8192,
"cpu_mode": "host-model"
},
{
"role": "agent",
"count": 1,
"cpus": 2,
"mem_mb": 2048,
"cpu_mode": "host-model"
}
]
},
"openvoxdb": {
"repository": "openvoxdb",
"install-openvox-server": true,
"install-openvoxdb": true,
"install-termini": true,
"acceptance-working-dir": "./",
"acceptance-pre-suite": [
"acceptance/setup/openvox/configure_type_defaults.rb",
"acceptance/setup/pre_suite/00_setup_test_env.rb",
"acceptance/setup/pre_suite/10_setup_proxies.rb",
"acceptance/setup/pre_suite/15_prep_locales.rb",
"acceptance/setup/pre_suite/20_install_puppet.rb",
"acceptance/setup/pre_suite/30_generate_ssl_certs.rb",
"acceptance/setup/pre_suite/40_install_deps.rb",
"acceptance/setup/pre_suite/50_install_modules.rb",
"acceptance/setup/pre_suite/75_clean_out_puppet5_repos.rb",
"acceptance/setup/pre_suite/80_add_dev_repo.rb",
"acceptance/setup/openvox/configure_openvoxdb.rb"
],
"acceptance-tests": [
"acceptance/tests"
],
"beaker-options": {
"helper": "acceptance/helper.rb",
"options_file": "acceptance/options/openvox.rb"
},
"os-add": [],
"vms": [
{
"role": "primary",
"count": 1,
"cpus": 4,
"mem_mb": 8192,
"cpu_mode": "host-model"
},
{
"role": "agent",
"count": 1,
"cpus": 2,
"mem_mb": 2048,
"cpu_mode": "host-model"
}
]
}
}
run: |-
set -e
# Pick out the defaults for the project being tested.
jq ".\"${SUITE_NAME}\" | .os = ${DEFAULT_OS}" <<< "${PROJECT_DEFAULTS}" > project_defaults.json
cat project_defaults.json
parameters=(
"repository"
"install-openvox-server"
"install-openvoxdb"
"install-termini"
"acceptance-working-dir"
"acceptance-pre-suite"
"acceptance-tests"
"beaker-options"
"os"
"os-add"
"vms"
)
for param in "${parameters[@]}"; do
output_name=${param//-/_}
default=$(jq -rMc ".\"${param}\"" project_defaults.json)
echo "Setting ${output_name} to ${default}"
echo "${output_name}=${default}" >> $GITHUB_OUTPUT
done
set-matrix:
needs: set-project-defaults
runs-on: ubuntu-24.04
outputs:
os-matrix: ${{ steps.set-matrix.outputs.os_matrix }}
steps:
- id: set-matrix
env:
OS: ${{ needs.set-project-defaults.outputs.os }}
OS_ADD: ${{ needs.set-project-defaults.outputs.os-add }}
run: |-
cat > matrix_inputs.json <<EOF
[
${OS},
${OS_ADD}
]
EOF
cat matrix_inputs.json
echo "os_matrix=$(jq --monochrome-output --compact-output 'add | unique' matrix_inputs.json)" >> $GITHUB_OUTPUT
acceptance:
name: Acceptance Tests
needs: [set-project-defaults, set-matrix]
runs-on: ubuntu-24.04
strategy:
fail-fast: false
matrix:
os: ${{ fromJson(needs.set-matrix.outputs.os-matrix) }}
env:
ACCEPTANCE_WORKING_DIR: |-
${{ format('{0}/{1}/{2}',
github.workspace,
needs.set-project-defaults.outputs.repository,
needs.set-project-defaults.outputs.acceptance-working-dir) }}
steps:
- uses: actions/checkout@v6
with:
# Ensure that we checkout the project we want to test rather
# than the repository that this workflow is being called
# from.
repository: ${{ format('{0}/{1}', inputs.fork, needs.set-project-defaults.outputs.repository) }}
ref: ${{ inputs.ref }}
path: ${{ needs.set-project-defaults.outputs.repository }}
- id: vm-cluster
uses: jpartlow/nested_vms@v1
with:
os: ${{ matrix.os[0] }}
os-version: ${{ matrix.os[1] }}
os-arch: ${{ matrix.os[2] || 'x86_64' }}
image_version: ${{ matrix.os[3] }}
host-root-access: true
install-openvox: false
# Note: the cpu_mode is set to host-model for the sake of
# el-9 which expects at least x86_64-2 arch. This depends on
# the runner's architecture being sufficient, and there is
# probably a better way to get this set on the libvirt
# domain instead.
vms: ${{ needs.set-project-defaults.outputs.vms }}
- name: Write Install OpenVox Params
working-directory: kvm_automation_tooling
env:
OPENVOX_ARTIFACTS_URL: |-
${{ inputs.artifacts-url }}
OPENVOX_COLLECTION: ${{ inputs.collection }}
OPENVOX_AGENT_VERSION: |-
${{ ((inputs.openvox-agent-version == '') && 'latest') ||
inputs.openvox-agent-version }}
OPENVOX_AGENT_RELEASED: |-
${{ !inputs.openvox-agent-pre-release-build }}
OPENVOX_SERVER_TARGETS: |-
${{ ((fromJson(needs.set-project-defaults.outputs.install-openvox-server) == true) && '"primary"') ||
'[]' }}
OPENVOX_SERVER_VERSION: |-
${{ ((inputs.openvox-server-version == '') && 'latest') ||
inputs.openvox-server-version }}
OPENVOX_SERVER_RELEASED: |-
${{ !inputs.openvox-server-pre-release-build }}
OPENVOX_DB_TARGETS: |-
${{ ((fromJson(needs.set-project-defaults.outputs.install-openvoxdb) == true) && '"primary"') ||
'[]' }}
OPENVOX_DB_VERSION: |-
${{ ((inputs.openvoxdb-version == '') && 'latest') ||
inputs.openvoxdb-version }}
OPENVOX_DB_RELEASED: |-
${{ !inputs.openvoxdb-pre-release-build }}
INSTALL_TERMINI: |-
${{ needs.set-project-defaults.outputs.install-termini }}
run: |-
cat > install_openvox_params.json <<EOF
{
"openvox_agent_targets": "all",
"openvox_server_targets": ${OPENVOX_SERVER_TARGETS},
"openvox_db_targets": ${OPENVOX_DB_TARGETS},
"openvox_agent_params": {
"openvox_collection": "${OPENVOX_COLLECTION}",
"openvox_version": "${OPENVOX_AGENT_VERSION}",
"openvox_released": ${OPENVOX_AGENT_RELEASED}
},
"openvox_server_params": {
"openvox_collection": "${OPENVOX_COLLECTION}",
"openvox_version": "${OPENVOX_SERVER_VERSION}",
"openvox_released": ${OPENVOX_SERVER_RELEASED}
},
"openvox_db_params": {
"openvox_collection": "${OPENVOX_COLLECTION}",
"openvox_version": "${OPENVOX_DB_VERSION}",
"openvox_released": ${OPENVOX_DB_RELEASED}
},
"install_defaults": {
"openvox_version": "latest",
"openvox_collection": "${OPENVOX_COLLECTION}",
"openvox_released": true,
"openvox_artifacts_url": "${OPENVOX_ARTIFACTS_URL}"
},
"install_termini": ${INSTALL_TERMINI}
}
EOF
cat install_openvox_params.json
- name: Install OpenVox Components
working-directory: kvm_automation_tooling
env:
# Generated by the nested_vms action.
INVENTORY: terraform/instances/inventory.test.yaml
run: |-
bundle exec bolt plan run \
kvm_automation_tooling::install_openvox \
--inventory "${INVENTORY}" \
--params @install_openvox_params.json
- name: Construct hosts.yaml
working-directory: kvm_automation_tooling
env:
HOSTS_YAML: ${{ env.ACCEPTANCE_WORKING_DIR }}/hosts.yaml
# Generated by the nested_vms action.
INVENTORY: terraform/instances/inventory.test.yaml
run: |-
bundle exec bolt plan run \
kvm_automation_tooling::dev::generate_beaker_hosts_file \
--inventory "${INVENTORY}" \
hosts_yaml="${HOSTS_YAML}"
cat "${HOSTS_YAML}"
- name: Install Ruby and Run Bundler for Acceptance Tests
uses: ruby/setup-ruby@v1
with:
ruby-version: ${{ env.RUBY_VERSION }}
working-directory: ${{ env.ACCEPTANCE_WORKING_DIR }}
bundler-cache: true
- name: Write .beaker.yml
working-directory: ${{ env.ACCEPTANCE_WORKING_DIR }}
# for pipefail
shell: bash
env:
# Generated by the nested_vms action.
SSH_KEY: ~/.ssh/ssh-id-test
PRE_SUITE_ARRAY: |-
${{ needs.set-project-defaults.outputs.acceptance-pre-suite || '[]' }}
TESTS_ARRAY: |-
${{ needs.set-project-defaults.outputs.acceptance-tests || '[]' }}
BEAKER_OPTIONS: |-
${{ needs.set-project-defaults.outputs.beaker-options || '{}' }}
run: |-
cat > beaker.yml.inputs <<EOF
[
{
"ssh": {
"keys": [
"${SSH_KEY}"
]
},
"xml": true,
"timesync": false,
"repo_proxy": true,
"add_el_extras": false,
"master-start-curl-retries": 30,
"log_level": "debug",
"preserve_hosts": "always",
"type": "aio",
"pre_suite": ${PRE_SUITE_ARRAY},
"tests": ${TESTS_ARRAY}
},
${BEAKER_OPTIONS}
]
EOF
cat beaker.yml.inputs
jq 'add' beaker.yml.inputs | yq -P > .beaker.yml
cat .beaker.yml
- name: Run Beaker
working-directory: ${{ env.ACCEPTANCE_WORKING_DIR }}
run: |-
# Options feed in from .beaker.yml generated above
bundle exec beaker init --hosts hosts.yaml
# The provision step is still needed here, see notes in the
# kvm_automation_tooling/templates/beaker-hosts.yaml.epp
# template...
bundle exec beaker provision
bundle exec beaker exec