diff --git a/.github/workflows/beaker_acceptance.yml b/.github/workflows/beaker_acceptance.yml index 007ce8a..d82ab97 100644 --- a/.github/workflows/beaker_acceptance.yml +++ b/.github/workflows/beaker_acceptance.yml @@ -3,38 +3,21 @@ name: Run Beaker acceptance tests on an OpenVox project on: workflow_call: inputs: - project-name: - description: The OpenVox project to test. + suite-name: + description: The identifier of the Beaker test suite to run. required: true type: string ref: description: |- - The git ref of the project-name Beaker test suite to run. + The git ref of the suite-name repository to checkout and run. required: true type: string fork: description: |- - The github fork of the project-name Beaker test suite to run. + The github fork of the suite-name repository to checkout and run. required: false type: string default: openvoxproject - install-openvox: - description: |- - Whether or not to install any openvox packages on the - virtual machines created for the tests. - - If true, then openvox-agent packages will be installed on - all nodes listed in the vms input, and openvox-server and - openvoxdb packages may be installed depending on the - install-openvox-server and install-openvoxdb flags, and on - whether the vms input has a node in the 'primary' role. - - If false, then no openvox packages will be installed, - regardless of the install-openvox-server or - install-openvoxdb flags. - required: false - type: boolean - default: true openvox-collection: description: |- The OpenVox collection to install from. @@ -65,13 +48,6 @@ on: required: false type: boolean default: true - install-openvox-server: - description: |- - If true, the openvox-server package will be installed on any - node in vms with the role 'primary'. - required: false - type: boolean - default: true openvox-server-version: description: |- The version of the openvox-server package to install. @@ -87,13 +63,6 @@ on: required: false type: boolean default: true - install-openvoxdb: - description: |- - If true, the openvoxdb package will be installed on any node - in vms with the role 'primary'. - required: false - type: boolean - default: false openvoxdb-version: description: |- The version of the openvoxdb package to install. @@ -109,15 +78,6 @@ on: required: false type: boolean default: true - install-openvoxdb-termini: - description: |- - In a production installation using openvoxdb, the - openvoxdb-termini package is installed alongside - openvox-server. Set this to false to install just - openvox-server without the openvoxdb-termini. - required: false - type: boolean - default: true artifacts-url: description: |- URL to the artifacts server. This is used to download @@ -126,134 +86,223 @@ on: required: false type: string default: 'https://s3.osuosl.org/openvox-artifacts' - ruby-version: - description: |- - 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. - required: false - type: string - default: '3.3' - acceptance-working-dir: - description: |- - The working directory for the acceptance tests, relative to - project root. - required: false - type: string - default: 'acceptance' - acceptance-pre-suite: - description: |- - JSON array of Beaker pre-suite files to run. - These should be relative to the acceptance-working-dir, or - absolute paths. - If not provided, no pre-suite will be run. - required: false - type: string - default: '[]' - acceptance-tests: - description: |- - JSON array of Beaker test files to run. - These should be relative to the acceptance-working-dir, or - absolute paths. - If not provided, no tests will be run. - required: false - type: string - default: '[]' - beaker-options: - description: |- - A JSON hash of Beaker options to be included in the - .beaker.yml generated for the test suite run. - - This is useful for setting details like 'helper', 'load_path' - and 'options_file', among others. - required: false - type: string - default: '{}' - os: - description: |- - JSON array of operating systems to run the tests on. - Each entry is an array of minimally [os, os-version], - with os-arch and image_version as optional third and fourth - elements. - The elements are passed to jpartlow/nested_vms os, - os-version, os-arch and image_version inputs. +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' - Ex: +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 }} + 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"], - ["debian", "12", "amd64", "daily-latest"] + ["almalinux", "9"], + ["debian", "11"], + ["debian", "12"], + ["rocky", "8"], + ["rocky", "9"], + ["ubuntu", "22.04"], + ["ubuntu", "24.04"] ] - - Generally the default array can be used, and - additional operating systems can be specified with the - os-add parameter. - required: false - type: string - default: |- - [ - ["almalinux", "8"], - ["almalinux", "9"], - ["debian", "11"], - ["debian", "12"], - ["rocky", "8"], - ["rocky", "9"], - ["ubuntu", "22.04"], - ["ubuntu", "24.04"] - ] - os-add: - description: |- - Additional operating systems to run the tests on. - This is a JSON array of the same format as the os input. - If provided, these will be added to the end of the os matrix. - required: false - type: string - default: '[]' - vms: - description: |- - JSON array of virtual machine descriptions to create for the - tests. This is passed to the jpartlow/nested_vms action and - is in a format handled by jpartlow/kvm_automation_tooling's - standup_cluster plan. - - Each entry is an object with the following properties: - - role: The role of the VM (e.g., "agent"). - - count: The number of VMs to create for this role. - - cpus: The number of CPUs to allocate to each VM. - - mem_mb: The amount of memory (in MB) to allocate to each VM. - - disk_gb: The amount of disk space (in GB) to allocate to - each VM. - - cpu_mode: The CPU mode to use for the VM (e.g., - "host-model"). (Necessary for el-9 which expects at least - x86_64-2 arch, and depends on the runner's architecture - being sufficient.) - required: false - type: string - default: |- - [ + PROJECT_DEFAULTS: |- { - "role": "agent", - "count": 1, - "cpus": 2, - "mem_mb": 4096, - "cpu_mode": "host-model" + "openvox": { + "repository": "openvox", + "install-openvox-server": true, + "install-openvoxdb": 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, + "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, + "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/85_configure_sut.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, + "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 -env: - # Suppress warnings about Bolt gem versus package use. - BOLT_GEM: true + # 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" + "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 -jobs: 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: ${{ inputs.os }} - OS_ADD: ${{ inputs.os-add }} + OS: ${{ needs.set-project-defaults.outputs.os }} + OS_ADD: ${{ needs.set-project-defaults.outputs.os-add }} run: |- cat > matrix_inputs.json < install_openvox_params.json < beaker.yml.inputs <