Skip to content

Commit 647c285

Browse files
authored
Merge pull request #4 from jpartlow/install-from-build-artifacts
Install from build artifacts
2 parents d7cdfd0 + 6051ab6 commit 647c285

File tree

10 files changed

+582
-227
lines changed

10 files changed

+582
-227
lines changed

.github/actions/bolt/action.yaml

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
---
2+
name: Install and Prepare Bolt
3+
description: "Helps with installing Bolt from the Puppet repository on Ubuntu distributions."
4+
5+
inputs:
6+
os-codename:
7+
description: The Ubuntu codename of the OS to install Bolt on.
8+
required: true
9+
type: string
10+
11+
runs:
12+
using: "composite"
13+
steps:
14+
- name: Install Bolt
15+
shell: bash
16+
env:
17+
OS_CODENAME: ${{ inputs.os-codename }}
18+
run: |-
19+
wget https://apt.puppet.com/puppet-tools-release-${OS_CODENAME}.deb
20+
sudo dpkg -i puppet-tools-release-${OS_CODENAME}.deb
21+
sudo apt update
22+
sudo apt install -y puppet-bolt
23+
- name: Install module dependencies
24+
shell: bash
25+
run: bolt module install
Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,48 @@
1+
---
2+
name: Prepare Container for Task
3+
description: "Checkouts module dependencies and ensures a wget is installed so that we can run the task scripts manually."
4+
5+
runs:
6+
using: "composite"
7+
steps:
8+
- uses: actions/checkout@v4
9+
with:
10+
repository: puppetlabs/puppetlabs-facts
11+
path: facts
12+
- name: Ensure wget is installed
13+
shell: bash
14+
env:
15+
PT__installdir: ${{ github.workspace }}
16+
run: |-
17+
source openvox_bootstrap/files/common.sh
18+
19+
# Ensure wget is installed.
20+
if exists 'apt'; then
21+
exec_and_capture apt update
22+
elif exists 'apt-get'; then
23+
exec_and_capture apt-get update
24+
elif exists 'dnf'; then
25+
exec_and_capture dnf clean all
26+
elif exists 'yum'; then
27+
exec_and_capture yum clean all
28+
elif exists 'zypper'; then
29+
exec_and_capture zypper refresh
30+
else
31+
echo "No package manager found."
32+
exit 1
33+
fi
34+
install_package wget
35+
36+
# Deal with missing package dependencies in the containers.
37+
# ...possibly this should be moved into the
38+
# install_build_artifact task scripts.
39+
set_platform
40+
if [[ "${platform}" == 'Rocky' ]]; then
41+
# The Rocky9 container, at least, is missing openvox-agent's
42+
# systemd dependency...
43+
exec_and_capture dnf install -y systemd
44+
if [[ "${major_version}" == '8' ]]; then
45+
# ...and the Rocky8 container is missing findutils.
46+
exec_and_capture dnf install -y findutils
47+
fi
48+
fi

.github/workflows/pr_testing.yaml

Lines changed: 14 additions & 42 deletions
Original file line numberDiff line numberDiff line change
@@ -13,33 +13,29 @@ jobs:
1313
shellcheck:
1414
runs-on: ubuntu-latest
1515
steps:
16-
- uses: actions/checkout@v2
16+
- uses: actions/checkout@v4
1717
- name: Install ShellCheck
1818
run: sudo apt-get install shellcheck
1919
- name: Run ShellCheck
20-
run: shellcheck tasks/*.sh
20+
run: shellcheck -x tasks/*.sh files/*.sh
2121

2222
test-install-task-on-ubuntu:
2323
strategy:
2424
matrix:
2525
os-details:
26-
- os: ubuntu-20.04
27-
codename: focal
2826
- os: ubuntu-22.04
2927
codename: jammy
28+
# - os: ubuntu-24.04
29+
# codename: noble
3030
# Perforce hasn't yet released bolt on 24.04.
3131
runs-on: ${{ matrix.os-details.os }}
3232
needs: shellcheck
3333
steps:
3434
- uses: actions/checkout@v4
35-
- name: Install Bolt
36-
run: |-
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
39-
sudo apt update
40-
sudo apt install -y puppet-bolt
41-
- name: Install module dependencies
42-
run: bolt module install
35+
- id: install-bolt
36+
uses: ./.github/actions/bolt
37+
with:
38+
os-codename: ${{ matrix.os-details.codename }}
4339
- name: Run openvox-agent install task
4440
run: bolt task run openvox_bootstrap::install --targets localhost --run-as root
4541
- name: Verify openvox-agent is installed
@@ -55,49 +51,25 @@ jobs:
5551
- debian:10
5652
- debian:11
5753
- debian:12
54+
- fedora:42
55+
- ubuntu:24.04
5856
# Need to pull in the repo GPG keys for sles
5957
# - registry.suse.com/suse/sle15:15.6
6058
needs: shellcheck
6159
runs-on: ubuntu-latest
6260
container: ${{ matrix.image }}
6361
steps:
64-
- uses: actions/checkout@v4
6562
- uses: actions/checkout@v4
6663
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
64+
path: openvox_bootstrap
65+
- id: prep
66+
uses: ./openvox_bootstrap/.github/actions/container_task_prep
9567
- name: Run openvox-agent install task manually
9668
env:
9769
PT__installdir: ${{ github.workspace }}
9870
PT_collection: openvox8
9971
PT_apt_source: "https://apt.overlookinfratech.com"
10072
PT_yum_source: "https://yum.overlookinfratech.com"
101-
run: ./tasks/install_linux.sh
73+
run: ./openvox_bootstrap/tasks/install_linux.sh
10274
- name: Verify openvox-agent is installed
10375
run: /opt/puppetlabs/bin/puppet --version | grep -E '[0-9]+\.[0-9]+'
Lines changed: 64 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,64 @@
1+
---
2+
name: 'PR Tests of the install_build_artifact task'
3+
4+
on:
5+
push:
6+
branches:
7+
- main
8+
pull_request:
9+
branches:
10+
- main
11+
12+
jobs:
13+
test-install-build-artifact-task-on-ubuntu:
14+
strategy:
15+
matrix:
16+
os-details:
17+
- os: ubuntu-22.04
18+
codename: jammy
19+
# - os: ubuntu-24.04
20+
# codename: noble
21+
# Perforce hasn't yet released bolt on 24.04.
22+
runs-on: ${{ matrix.os-details.os }}
23+
steps:
24+
- uses: actions/checkout@v4
25+
- id: install-bolt
26+
uses: ./.github/actions/bolt
27+
with:
28+
os-codename: ${{ matrix.os-details.codename }}
29+
- name: Run openvox-agent install task
30+
run: bolt task run openvox_bootstrap::install_build_artifact version=8.15.0 --targets localhost --run-as root
31+
- name: Verify openvox-agent is installed
32+
run: |-
33+
[[ "$(/opt/puppetlabs/bin/puppet --version)" = "8.15.0" ]]
34+
35+
test-install-build-artifact-task-on-other-os-via-containers:
36+
strategy:
37+
matrix:
38+
image:
39+
- rockylinux:8
40+
- rockylinux:9
41+
- debian:10
42+
- debian:11
43+
- debian:12
44+
- fedora:42
45+
- ubuntu:24.04
46+
# Need to pull in the repo GPG keys for sles
47+
# - registry.suse.com/suse/sle15:15.6
48+
runs-on: ubuntu-latest
49+
container: ${{ matrix.image }}
50+
steps:
51+
- uses: actions/checkout@v4
52+
with:
53+
path: openvox_bootstrap
54+
- id: prep
55+
uses: ./openvox_bootstrap/.github/actions/container_task_prep
56+
- name: Run openvox-agent install task manually
57+
env:
58+
PT__installdir: ${{ github.workspace }}
59+
PT_version: "8.15.0"
60+
run: ./openvox_bootstrap/tasks/install_build_artifact_linux.sh
61+
- name: Verify openvox-agent is installed
62+
shell: bash
63+
run: |-
64+
[[ "$(/opt/puppetlabs/bin/puppet --version)" = "8.15.0" ]]

README.md

Lines changed: 86 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1,86 @@
1-
Bolt module for bootstrapping installation of the openvox-agent package.
1+
# openvox_bootstrap
2+
3+
[Bolt](https://www.puppet.com/docs/bolt/latest/bolt.html) module for
4+
bootstrapping installation of the openvox-agent package.
5+
6+
Provides some of the functionality of the [puppet_agent::install
7+
tasks](https://github.com/puppetlabs/puppetlabs-puppet_agent/tree/main?tab=readme-ov-file#puppet_agentinstall)
8+
for [openvox](https://voxpupuli.org/openvox/) packages from
9+
https://apt.overlookinfratech.com, https://yum.overlookinfratech.com.
10+
11+
The puppet_agent module makes use of the Perforce repositories instead.
12+
13+
## Usage
14+
15+
Assumes you have Bolt installed.
16+
17+
### openvox_boostrap::install
18+
19+
Installs the openvox8 collection by default (Puppet:tm: 8).
20+
21+
```sh
22+
bolt task run openvox_bootstrap::install \
23+
--targets <target> \
24+
--run-as root
25+
```
26+
27+
#### Usage with Bolt apply_prep() function
28+
29+
Bolt's
30+
[apply_prep](https://www.puppet.com/docs/bolt/latest/plan_functions#apply-prep)
31+
function ensures that the latest version of Puppet:tm: is installed on
32+
a node by calling the puppet_agent::install task if the agent is not
33+
detected on the node.
34+
35+
The openvox_bootstrap::install task can be used in its place to
36+
instead ensure that openvox-agent is installed.
37+
38+
The apply_prep() function relies on Bolt's
39+
[puppet_library](https://www.puppet.com/docs/bolt/latest/using_plugins#puppet-library-plugins)
40+
plugin configuration.
41+
42+
To use openvox_bootstrap instead, configure your bolt_project.yaml
43+
with:
44+
45+
```yaml
46+
plugin-hooks:
47+
puppet_library:
48+
plugin: task
49+
task: openvox_bootstrap::install
50+
```
51+
52+
### openvox_bootstrap::install_build_artifact
53+
54+
The openvox_bootstrap::install_build_artifact task is a development
55+
task that can be used to install a build artifact package directly
56+
from the https://artifact.overlookinfratech.com repository for testing
57+
prior to release.
58+
59+
```sh
60+
bolt task run openvox_bootstrap::install \
61+
--targets <target> \
62+
--run-as root
63+
```
64+
65+
## TODO
66+
67+
* Windows support
68+
* Sles support (handle repository gpg key)
69+
* MacOS support
70+
71+
## License
72+
73+
Copyright (C) 2025 Joshua Partlow
74+
75+
This program is free software: you can redistribute it and/or modify
76+
it under the terms of the GNU Affero General Public License as published
77+
by the Free Software Foundation, either version 3 of the License, or
78+
(at your option) any later version.
79+
80+
This program is distributed in the hope that it will be useful,
81+
but WITHOUT ANY WARRANTY; without even the implied warranty of
82+
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
83+
GNU Affero General Public License for more details.
84+
85+
You should have received a copy of the GNU Affero General Public License
86+
along with this program. If not, see <https://www.gnu.org/licenses/>.

0 commit comments

Comments
 (0)