Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions .github/actions/container_task_prep/action.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -24,9 +24,9 @@ runs:
# ...possibly this should be moved into the
# install_build_artifact task scripts.
set_platform_globals
if [[ "${platform}" == 'Rocky' ]]; then
# The Rocky9 container, at least, is missing openvox-agent's
# systemd dependency...
if [[ "${platform}" == 'Rocky' ]] || [[ "${platform}" == 'Fedora' ]]; then
# The Rocky9 and Fedora containers, at least, are missing
# openvox-agent's systemd dependency...
exec_and_capture dnf install -y systemd
if [[ "${os_major_version}" == '8' ]]; then
# ...and the Rocky8 container is missing findutils.
Expand Down
71 changes: 71 additions & 0 deletions .github/workflows/pr_testing_install_build_artifact.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -72,3 +72,74 @@ jobs:
PT__installdir: ${{ github.workspace }}
PT_version: "8.15.0"
run: ./openvox_bootstrap/tasks/install_build_artifact_linux.sh

test-install-build-artifact-task-noarch:
strategy:
matrix:
package:
- name: openvox-server
version: 8.8.0
- name: openvoxdb
version: 8.9.0
- name: openvoxdb-termini
version: 8.9.0
details:
- image: almalinux:9
prereqs:
- java-17-openjdk-headless
- net-tools
- procps-ng
- which
- image: debian:12
prereqs:
- openjdk-17-jre-headless
- net-tools
- procps
- image: ubuntu:24.04
prereqs:
- openjdk-17-jre-headless
- net-tools
- procps
runs-on: ubuntu-latest
container: ${{ matrix.details.image }}
steps:
- uses: actions/checkout@v4
with:
path: openvox_bootstrap
- id: prep
uses: ./openvox_bootstrap/.github/actions/container_task_prep
- name: Run openvox-agent install task manually
env:
PT__installdir: ${{ github.workspace }}
PT_version: "8.19.1"
run: ./openvox_bootstrap/tasks/install_build_artifact_linux.sh
- name: Install prerequisites
shell: bash
env:
PREREQ_PACKAGES: ${{ join(matrix.details.prereqs, ',') }}
run: |-
set +e
/opt/puppetlabs/bin/puppet apply --detailed-exitcodes <<EOS
package { [${PREREQ_PACKAGES}]:
ensure => installed
}
EOS
exitcode=$?
set -e
# Expect package changes and no failures.
[[ "${exitcode}" -eq 2 ]]
- name: Test noarch package installation
env:
PT__installdir: ${{ github.workspace }}
PT_package: ${{ matrix.package.name }}
PT_version: ${{ matrix.package.version }}
run: ./openvox_bootstrap/tasks/install_build_artifact_linux.sh
- name: Verify openvox-server is installed
shell: bash
env:
PACKAGE: ${{ matrix.package.name }}
VERSION: ${{ matrix.package.version }}
run: |-
/opt/puppetlabs/bin/puppet resource package "${PACKAGE}" > openvox-package.status
cat openvox-package.status
grep "ensure.*=>.*'${VERSION}" openvox-package.status
10 changes: 8 additions & 2 deletions .github/workflows/pr_testing_with_nested_vms.yml
Original file line number Diff line number Diff line change
Expand Up @@ -58,9 +58,15 @@ jobs:
"cpu_mode": "host-model"
}
]
- name: Capture dereferenced inventory for use with openvox_bootstrap
working-directory: kvm_automation_tooling
run: |-
bolt inventory --inventory terraform/instances/inventory.test.yaml show --format json --detail | \
jq '.inventory | with_entries(select(.key == "targets")) | del(.targets[0].groups)' | \
yq -P > ../inventory.yaml
- name: Run openvox_bootstrap::install task on nested vm
run: |-
bolt task run openvox_bootstrap::install --inventory kvm_automation_tooling/terraform/instances/inventory.test.yaml --targets test-agent-1
bolt task run openvox_bootstrap::install --inventory inventory.yaml --targets test-agent-1
- name: Verify openvox-agent is installed
run: |-
bolt task run openvox_bootstrap::check version=8 test=gt --inventory kvm_automation_tooling/terraform/instances/inventory.test.yaml --targets test-agent-1
bolt task run openvox_bootstrap::check version=8 test=gt --inventory inventory.yaml --targets test-agent-1
133 changes: 133 additions & 0 deletions files/common.sh
Original file line number Diff line number Diff line change
Expand Up @@ -377,3 +377,136 @@ refresh_package_cache() {
exit 1
fi
}

# Test whether the given package name matches a list of
# openvox packages that are noarch.
noarch_package() {
local _package="$1"

# List of noarch packages.
local noarch_packages=(
'openvox-server'
'openvoxdb'
'openvoxdb-termini'
)

for pkg in "${noarch_packages[@]}"; do
if [[ "${_package}" == "${pkg}" ]]; then
return 0
fi
done

return 1
}

# Lookup the cpu architecture and set it as cpu_arch.
# Translates x86_64 to amd64 and aarch64 to arm64 for debian/ubuntu.
set_cpu_architecture() {
local _family="$1"

local _arch
_arch=$(uname -m)
case "${_family}" in
debian|ubuntu)
case "${_arch}" in
x86_64)
cpu_arch="amd64"
;;
aarch64)
cpu_arch="arm64"
;;
*)
cpu_arch="${_arch}"
;;
esac
;;
*)
cpu_arch="${_arch}"
;;
esac
export cpu_arch # quiets shellcheck SC2034
assigned 'cpu_arch'
}

# Lookup the architecture for the given package and set it as
# package_arch.
#
# This will either be noarch/all depending on the platform and
# whether the package name matches an openvox noarch_package(),
# or it will be the cpu_arch.
set_package_architecture() {
local _package="$1"
local _os_family="${2:-${os_family}}"

if noarch_package "${_package}"; then
case "${_os_family}" in
debian|ubuntu)
package_arch='all'
;;
*)
package_arch='noarch'
;;
esac
else
set_cpu_architecture "${_os_family}"
package_arch="${cpu_arch}"
fi
export package_arch # quiets shellcheck SC2034
assigned 'package_arch'
}

# Based on platform, package and version set:
# package_name - the name of the build artifact package
# package_url - the url to download the build artifact package
#
# Currently this is based on the structure of the package repository
# at https://artifacts.voxpupuli.org, which is a page
# that provides a summary of links to artifacts contained in an S3
# bucket hosted by Oregon State University Open Source Lab.
#
# Example rpm:
# https://artifacts.voxpupuli.org/openvox-agent/8.15.0/openvox-agent-8.15.0-1.el8.x86_64.rpm
# Example deb:
# https://artifacts.voxpupuli.org/openvox-agent/8.15.0/openvox-agent_8.15.0-1%2Bdebian12_amd64.deb
set_artifacts_package_url() {
local _artifacts_source="$1"
local _package="$2"
local _version="$3"

set_package_type "${os_family}"
set_package_architecture "${_package}" "${os_family}"

case "${package_type}" in
rpm)
# Account for a fedora naming quirk in the build artifacts.
if [[ "${os_family}" == "fedora" ]]; then
_os_family="fc"
else
_os_family="${os_family}"
fi
package_name="${_package}-${_version}-1.${_os_family}${os_major_version}.${package_arch}.${package_type}"
;;
deb)
package_name="${_package}_${_version}-1%2B${os_family}${os_full_version}_${package_arch}.${package_type}"
;;
*)
fail "Unhandled package type: '${package_type}'"
;;
esac

case "${_package}" in
openvoxdb-termini)
local _package_dir='openvoxdb'
;;
*)
local _package_dir="${_package}"
;;
esac

package_url="${_artifacts_source}/${_package_dir}/${_version}/${package_name}"

export package_name # quiets shellcheck SC2034
assigned 'package_name'
export package_url # quiets shellcheck SC2034
assigned 'package_url'
}
Loading