Skip to content

Commit 0126647

Browse files
committed
(gh-19) Add an acceptance workflow to gha
Uses the nested_vms action to prepare a cluster of one primary node and one agent node, then installs openvox-agent and openvox-server, and preps and executes the acceptance/ suite with Beaker.
1 parent 5a6bed0 commit 0126647

1 file changed

Lines changed: 259 additions & 0 deletions

File tree

.github/workflows/acceptance.yml

Lines changed: 259 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,259 @@
1+
---
2+
name: Beaker Acceptance Tests
3+
run-name: |-
4+
Beaker acceptance tests for ${{ inputs.pre-release-build && 'pre-release' || 'release' }} packages of
5+
openvox-agent
6+
${{ (inputs.pre-release-build && inputs.openvox-agent-version) ||
7+
format(' collection: "{0}", version: "{1}" ',
8+
inputs.collection,
9+
((inputs.openvox-agent-version == '') && 'latest') ||
10+
inputs.openvox-agent-version) }}
11+
, openvox-server
12+
${{ (inputs.pre-release-build && inputs.openvox-server-version) ||
13+
format(' collection: "{0}", version: "{1}" ',
14+
inputs.collection,
15+
((inputs.openvox-server-version == '') && 'latest') ||
16+
inputs.openvox-server-version) }}
17+
and openvoxdb
18+
${{ (inputs.pre-release-build && inputs.openvoxdb-version) ||
19+
format(' collection: "{0}", version: "{1}" ',
20+
inputs.collection,
21+
((inputs.openvoxdb-version == '') && 'latest') ||
22+
inputs.openvoxdb-version) }}
23+
24+
on:
25+
workflow_dispatch:
26+
inputs:
27+
pre-release-build:
28+
description: |-
29+
(Pre-release Build) Whether to test unreleased version
30+
packages from the artifacts server, or released packages
31+
from the given collection.
32+
33+
If this is true, versions must be valid version numbers,
34+
not latest, and collection is ignored. The workflow will
35+
download and install the matching openvox package files
36+
from the artifacts-url server.
37+
38+
If this is false, version and collection must match, and the
39+
workflow will install the given openvox collection package
40+
and then let the system package manager install the latest
41+
or version packages from the collection repository.
42+
default: true
43+
type: boolean
44+
openvox-agent-version:
45+
description: |-
46+
(OpenVox Agent Version) The openvox-agent package version to
47+
test. (required if Pre-release Build is true)
48+
type: string
49+
openvox-server-version:
50+
description: |-
51+
(OpenVox Server Version) The openvox-server package version
52+
to test. (required if Pre-release Build is true)
53+
type: string
54+
openvoxdb-version:
55+
description: |-
56+
(OpenVoxDB Version) The openvoxdb package version
57+
to test. (required if Pre-release Build is true)
58+
type: string
59+
collection:
60+
description: |-
61+
(Collection) OpenVox collection to use. (ignored if
62+
Pre-release Build is true)
63+
64+
NOTE: This should really only be set to openvox8 when
65+
testing the main branch. If you need to test openvox7, you
66+
should run the pipeline from the 7.x branch instead.
67+
default: 'openvox8'
68+
type: string
69+
artifacts-url:
70+
description: |-
71+
URL to the artifacts server. (used if Pre-release Build is
72+
true)
73+
default: 'https://s3.osuosl.org/openvox-artifacts'
74+
type: string
75+
76+
permissions:
77+
contents: read
78+
79+
env:
80+
RUBY_VERSION: '3.3'
81+
# Suppress warnings about Bolt gem versus package use.
82+
BOLT_GEM: true
83+
84+
jobs:
85+
acceptance:
86+
name: Acceptance Tests
87+
runs-on: ubuntu-24.04
88+
strategy:
89+
fail-fast: false
90+
matrix:
91+
os:
92+
- [almalinux, '8']
93+
- [almalinux, '9']
94+
- [debian, '10']
95+
- [debian, '11']
96+
- [debian, '12']
97+
# No builds of openvox-server in artifacts.voxpupuli.org yet
98+
# - [debian, '13', 'amd64', 'daily-latest']
99+
- [rocky, '8']
100+
- [rocky, '9']
101+
- [ubuntu, '18.04']
102+
- [ubuntu, '20.04']
103+
- [ubuntu, '22.04']
104+
- [ubuntu, '24.04']
105+
steps:
106+
- uses: actions/checkout@v4
107+
- id: vm-cluster
108+
uses: jpartlow/nested_vms@v1
109+
with:
110+
os: ${{ matrix.os[0] }}
111+
os-version: ${{ matrix.os[1] }}
112+
os-arch: ${{ matrix.os[2] || 'x86_64' }}
113+
image_version: ${{ matrix.os[3] }}
114+
host-root-access: true
115+
ruby-version: ${{ env.RUBY_VERSION }}
116+
install-openvox: false
117+
# Note: the cpu_mode is set to host-model for the sake of
118+
# el-9 which expects at least x86_64-2 arch. This depends on
119+
# the runner's architecture being sufficient, and there is
120+
# probably a better way to get this set on the libvirt
121+
# domain instead.
122+
vms: |-
123+
[
124+
{
125+
"role": "primary",
126+
"count": 1,
127+
"cpus": 4,
128+
"mem_mb": 8192,
129+
"cpu_mode": "host-model"
130+
},
131+
{
132+
"role": "agent",
133+
"count": 1,
134+
"cpus": 2,
135+
"mem_mb": 2048,
136+
"cpu_mode": "host-model"
137+
}
138+
]
139+
- name: Write Install OpenVox Params
140+
working-directory: kvm_automation_tooling
141+
env:
142+
OPENVOX_ARTIFACTS_URL: |-
143+
${{ github.event.inputs.artifacts-url }}
144+
OPENVOX_RELEASED: |-
145+
${{ github.event.inputs.pre-release-build == 'false' }}
146+
OPENVOX_AGENT_VERSION: |-
147+
${{ ((github.event.inputs.openvox-agent-version == '') && 'latest') ||
148+
github.event.inputs.openvox-agent-version }}
149+
OPENVOX_SERVER_VERSION: |-
150+
${{ ((github.event.inputs.openvox-server-version == '') && 'latest') ||
151+
github.event.inputs.openvox-server-version }}
152+
OPENVOX_DB_VERSION: |-
153+
${{ ((github.event.inputs.openvoxdb-version == '') && 'latest') ||
154+
github.event.inputs.openvoxdb-version }}
155+
OPENVOX_COLLECTION: ${{ github.event.inputs.collection }}
156+
run: |-
157+
cat > install_openvox_params.json <<EOF
158+
{
159+
"openvox_agent_targets": "all",
160+
"openvox_server_targets": "primary",
161+
"openvox_db_targets": "primary",
162+
"openvox_agent_params": {
163+
"openvox_collection": "${OPENVOX_COLLECTION}",
164+
"openvox_version": "${OPENVOX_AGENT_VERSION}",
165+
"openvox_released": ${OPENVOX_RELEASED},
166+
"openvox_artifacts_url": "${OPENVOX_ARTIFACTS_URL}"
167+
},
168+
"openvox_server_params": {
169+
"openvox_collection": "${OPENVOX_COLLECTION}",
170+
"openvox_version": "${OPENVOX_SERVER_VERSION}",
171+
"openvox_released": ${OPENVOX_RELEASED},
172+
"openvox_artifacts_url": "${OPENVOX_ARTIFACTS_URL}"
173+
},
174+
"openvox_db_params": {
175+
"openvox_collection": "${OPENVOX_COLLECTION}",
176+
"openvox_version": "${OPENVOX_DB_VERSION}",
177+
"openvox_released": ${OPENVOX_RELEASED},
178+
"openvox_artifacts_url": "${OPENVOX_ARTIFACTS_URL}"
179+
},
180+
"install_defaults": {
181+
"openvox_version": "latest",
182+
"openvox_collection": "${OPENVOX_COLLECTION}",
183+
"openvox_released": true
184+
}
185+
}
186+
EOF
187+
cat install_openvox_params.json
188+
- name: Install OpenVox Components
189+
working-directory: kvm_automation_tooling
190+
env:
191+
# Generated by the nested_vms action.
192+
INVENTORY: terraform/instances/inventory.test.yaml
193+
run: |-
194+
bundle exec bolt plan run \
195+
kvm_automation_tooling::install_openvox \
196+
--inventory "${INVENTORY}" \
197+
--params @install_openvox_params.json
198+
- name: Construct hosts.yaml
199+
working-directory: kvm_automation_tooling
200+
env:
201+
HOSTS_YAML: ${{ github.workspace }}/acceptance/hosts.yaml
202+
# Generated by the nested_vms action.
203+
INVENTORY: terraform/instances/inventory.test.yaml
204+
run: |-
205+
bundle exec bolt plan run \
206+
kvm_automation_tooling::dev::generate_beaker_hosts_file \
207+
--inventory "${INVENTORY}" \
208+
hosts_yaml="${HOSTS_YAML}"
209+
cat "${HOSTS_YAML}"
210+
- name: Install Ruby and Run Bundler for Acceptance Tests
211+
uses: ruby/setup-ruby@v1
212+
with:
213+
ruby-version: ${{ env.RUBY_VERSION }}
214+
bundler-cache: true
215+
- name: Write .beaker.yml
216+
env:
217+
# Generated by the nested_vms action.
218+
SSH_KEY: ~/.ssh/ssh-id-test
219+
run: |-
220+
cat > .beaker.yml <<EOF
221+
---
222+
ssh:
223+
keys:
224+
- ${SSH_KEY}
225+
xml: true
226+
timesync: false
227+
repo_proxy: true
228+
add_el_extras: false
229+
'master-start-curl-retries': 30
230+
log_level: debug
231+
preserve_hosts: always
232+
helper: acceptance/lib/helper.rb
233+
load_path: acceptance/lib
234+
tests: acceptance/suites/tests
235+
type: aio
236+
options_file: acceptance/config/beaker/options.rb
237+
pre_suite:
238+
- acceptance/suites/pre_suite/openvox/configure_type_defaults.rb
239+
- acceptance/suites/pre_suite/foss/00_setup_environment.rb
240+
- acceptance/suites/pre_suite/foss/070_InstallCACerts.rb
241+
- acceptance/suites/pre_suite/foss/10_update_ca_certs.rb
242+
- acceptance/suites/pre_suite/foss/15_prep_locales.rb
243+
- acceptance/suites/pre_suite/foss/71_smoke_test_puppetserver.rb
244+
- acceptance/suites/pre_suite/foss/80_configure_puppet.rb
245+
- acceptance/suites/pre_suite/foss/85_configure_sut.rb
246+
- acceptance/suites/pre_suite/foss/90_validate_sign_cert.rb
247+
- acceptance/suites/pre_suite/foss/95_install_pdb.rb
248+
- acceptance/suites/pre_suite/foss/99_collect_data.rb
249+
EOF
250+
cat .beaker.yml
251+
- name: Run Beaker
252+
run: |-
253+
# Options feed in from .beaker.yml generated above
254+
bundle exec beaker init --hosts acceptance/hosts.yaml
255+
# The provision step is still needed here, see notes in the
256+
# kvm_automation_tooling/templates/beaker-hosts.yaml.epp
257+
# template...
258+
bundle exec beaker provision
259+
bundle exec beaker exec

0 commit comments

Comments
 (0)