Skip to content

Commit 31340d5

Browse files
authored
Merge pull request #2 from jpartlow/pr-test-other-os
(gha) Test install in gha on other os's using containers
2 parents 0ca5c9a + d024afe commit 31340d5

File tree

2 files changed

+73
-8
lines changed

2 files changed

+73
-8
lines changed

.github/workflows/pr_testing.yaml

Lines changed: 66 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -20,15 +20,22 @@ jobs:
2020
run: shellcheck tasks/*.sh
2121

2222
test-install-task-on-ubuntu:
23+
strategy:
24+
matrix:
25+
os-details:
26+
- os: ubuntu-20.04
27+
codename: focal
28+
- os: ubuntu-22.04
29+
codename: jammy
2330
# Perforce hasn't yet released bolt on 24.04.
24-
runs-on: ubuntu-22.04
31+
runs-on: ${{ matrix.os-details.os }}
2532
needs: shellcheck
2633
steps:
2734
- uses: actions/checkout@v4
2835
- name: Install Bolt
2936
run: |-
30-
wget https://apt.puppet.com/puppet-tools-release-jammy.deb
31-
sudo dpkg -i puppet-tools-release-jammy.deb
37+
wget https://apt.puppet.com/puppet-tools-release-${{ matrix.os-details.codename }}.deb
38+
sudo dpkg -i puppet-tools-release-${{ matrix.os-details.codename }}.deb
3239
sudo apt update
3340
sudo apt install -y puppet-bolt
3441
- name: Install module dependencies
@@ -38,3 +45,59 @@ jobs:
3845
- name: Verify openvox-agent is installed
3946
run: |-
4047
[[ "$(/opt/puppetlabs/bin/puppet --version)" =~ [0-9]+\.[0-9]+\.[0-9]+ ]]
48+
49+
test-install-task-on-other-os-via-containers:
50+
strategy:
51+
matrix:
52+
image:
53+
- rockylinux:8
54+
- rockylinux:9
55+
- debian:10
56+
- debian:11
57+
- debian:12
58+
# Need to pull in the repo GPG keys for sles
59+
# - registry.suse.com/suse/sle15:15.6
60+
needs: shellcheck
61+
runs-on: ubuntu-latest
62+
container: ${{ matrix.image }}
63+
steps:
64+
- uses: actions/checkout@v4
65+
- uses: actions/checkout@v4
66+
with:
67+
repository: puppetlabs/puppetlabs-facts
68+
path: facts
69+
- name: debugging
70+
run: |
71+
pwd
72+
echo "Running on ${{ matrix.image }}"
73+
ls -l
74+
echo "${GITHUB_WORKSPACE}"
75+
ls -l "${GITHUB_WORKSPACE}/.."
76+
- name: Ensure wget is installed (apt)
77+
if: startsWith(matrix.image, 'debian')
78+
run: |
79+
if ! command -v wget &> /dev/null; then
80+
apt update
81+
apt install -y wget
82+
fi
83+
- name: Ensure wget is installed (dnf)
84+
if: startsWith(matrix.image, 'rocky')
85+
run: |
86+
if ! command -v wget &> /dev/null; then
87+
dnf install -y wget
88+
fi
89+
- name: Ensure wget is installed (zypper)
90+
if: contains(matrix.image, 'suse')
91+
run: |
92+
if ! command -v wget &> /dev/null; then
93+
zypper install -y wget
94+
fi
95+
- name: Run openvox-agent install task manually
96+
env:
97+
PT__installdir: ${{ github.workspace }}
98+
PT_collection: openvox8
99+
PT_apt_source: "https://apt.overlookinfratech.com"
100+
PT_yum_source: "https://yum.overlookinfratech.com"
101+
run: ./tasks/install_linux.sh
102+
- name: Verify openvox-agent is installed
103+
run: /opt/puppetlabs/bin/puppet --version | grep -E '[0-9]+\.[0-9]+'

tasks/install_linux.sh

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,7 @@ set_repository() {
7171
local _family="$1"
7272

7373
case $_family in
74-
amazon|fedora|rhel|sles)
74+
amazon|fedora|el|sles)
7575
repository=$yum_source
7676
;;
7777
debian|ubuntu)
@@ -88,7 +88,7 @@ set_package_type() {
8888
local _family="$1"
8989

9090
case $_family in
91-
amazon|fedora|rhel|sles)
91+
amazon|fedora|el|sles)
9292
package_type='rpm'
9393
package_file_suffix='noarch.rpm'
9494
;;
@@ -112,7 +112,7 @@ set_collection_url() {
112112
family='amazon'
113113
;;
114114
RHEL|RedHat|CentOS|Scientific|OracleLinux|Rocky|AlmaLinux)
115-
family='rhel'
115+
family='el'
116116
;;
117117
Fedora)
118118
family='fedora'
@@ -136,12 +136,14 @@ set_collection_url() {
136136
set_package_type $family
137137

138138
if [ "${package_type}" == 'rpm' ]; then
139-
package_name="${collection}-release-${family}-${full_version}.${package_file_suffix}"
139+
major_version=${full_version%%.*}
140+
assigned 'major_version'
141+
package_name="${collection}-release-${family}-${major_version}.${package_file_suffix}"
140142
else
141143
package_name="${collection}-release-${family}${full_version}.${package_file_suffix}"
142144
fi
143145
package_url="${repository}/${package_name}"
144-
146+
145147
assigned 'package_name'
146148
assigned 'package_url'
147149
}

0 commit comments

Comments
 (0)