Skip to content

Commit bf0f398

Browse files
authored
Merge pull request #11 from jpartlow/add-package-parameter-to-install
(doc) Add and test for current REFERENCE.md using puppet-strings
2 parents f059cce + bbbfa5b commit bf0f398

File tree

12 files changed

+355
-149
lines changed

12 files changed

+355
-149
lines changed

.github/actions/container_task_prep/action.yaml

Lines changed: 3 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -17,31 +17,18 @@ runs:
1717
source openvox_bootstrap/files/common.sh
1818
1919
# 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
20+
refresh_package_cache
3421
install_package wget
3522
3623
# Deal with missing package dependencies in the containers.
3724
# ...possibly this should be moved into the
3825
# install_build_artifact task scripts.
39-
set_platform
26+
set_platform_globals
4027
if [[ "${platform}" == 'Rocky' ]]; then
4128
# The Rocky9 container, at least, is missing openvox-agent's
4229
# systemd dependency...
4330
exec_and_capture dnf install -y systemd
44-
if [[ "${major_version}" == '8' ]]; then
31+
if [[ "${os_major_version}" == '8' ]]; then
4532
# ...and the Rocky8 container is missing findutils.
4633
exec_and_capture dnf install -y findutils
4734
fi

.github/workflows/pr_testing.yaml

Lines changed: 80 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,22 @@ jobs:
2626
- name: Run ShellCheck
2727
run: shellcheck -x tasks/*.sh files/*.sh
2828

29+
reference-check:
30+
runs-on: ubuntu-latest
31+
steps:
32+
- uses: actions/checkout@v4
33+
- uses: ruby/setup-ruby@v1
34+
with:
35+
# Not testing 3.4 yet, puppet fails to load here:
36+
# bundler: failed to load command: puppet (/home/jpartlow/.rbenv/versions/3.4.3/lib/ruby/gems/3.4.0/bin/puppet)
37+
# /home/jpartlow/.rbenv/versions/3.4.3/lib/ruby/gems/3.4.0/bundler/gems/puppet-6992edd1da38/lib/puppet/feature/base.rb:21:in '<top (required)>': Cannot determine basic system flavour (Puppet::Error)
38+
ruby-version: '3.3'
39+
bundler-cache: true
40+
- name: Regenerate REFERENCE.md
41+
run: bundle exec puppet strings generate --format markdown
42+
- name: Check whether REFERENCE.md has uncommitted changes
43+
run: git diff --exit-code REFERENCE.md
44+
2945
test-install-task-on-ubuntu:
3046
strategy:
3147
matrix:
@@ -115,3 +131,67 @@ jobs:
115131
env:
116132
PT_version: "8.14.0"
117133
run: ./openvox_bootstrap/tasks/install_linux.sh
134+
135+
test-install-package:
136+
strategy:
137+
matrix:
138+
image:
139+
- rockylinux:9
140+
# openvox-server not currently built for fedora
141+
# - fedora:41
142+
- debian:12
143+
- ubuntu:24.04
144+
# Need to pull in the repo GPG keys for sles
145+
# - registry.suse.com/suse/sle15:15.6
146+
needs: shellcheck
147+
runs-on: ubuntu-latest
148+
container: ${{ matrix.image }}
149+
steps:
150+
- uses: actions/checkout@v4
151+
with:
152+
path: openvox_bootstrap
153+
- id: prep
154+
uses: ./openvox_bootstrap/.github/actions/container_task_prep
155+
- name: Run openvox-agent install task manually
156+
env:
157+
PT_package: "openvox-server"
158+
run: ./openvox_bootstrap/tasks/install_linux.sh
159+
- name: Verify openvox-server is installed
160+
run: /opt/puppetlabs/bin/puppetserver --version | grep -E '8\.[0-9]+'
161+
- name: Verify idempotency
162+
env:
163+
PT_package: "openvox-server"
164+
run: ./openvox_bootstrap/tasks/install_linux.sh
165+
166+
test-install-package-version:
167+
strategy:
168+
matrix:
169+
image:
170+
- rockylinux:9
171+
# openvox-server not currently built for fedora
172+
#- fedora:41
173+
- debian:12
174+
- ubuntu:24.04
175+
# Need to pull in the repo GPG keys for sles
176+
# - registry.suse.com/suse/sle15:15.6
177+
needs: shellcheck
178+
runs-on: ubuntu-latest
179+
container: ${{ matrix.image }}
180+
steps:
181+
- uses: actions/checkout@v4
182+
with:
183+
path: openvox_bootstrap
184+
- id: prep
185+
uses: ./openvox_bootstrap/.github/actions/container_task_prep
186+
- name: Run openvox-agent install task manually
187+
env:
188+
PT_package: "openvox-server"
189+
PT_version: "8.8.0"
190+
run: ./openvox_bootstrap/tasks/install_linux.sh
191+
- name: Verify openvox-server is installed
192+
run: /opt/puppetlabs/bin/puppetserver --version | grep '8.8.0'
193+
- name: Verify idempotency
194+
env:
195+
PT_package: "openvox-server"
196+
PT_version: "8.8.0"
197+
run: ./openvox_bootstrap/tasks/install_linux.sh

.gitignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,4 +3,6 @@
33
.rerun.json
44
.resource_types
55
.task_cache.json
6+
.yardoc
7+
Gemfile.lock
68
Puppetfile

Gemfile

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
source 'https://rubygems.org'
2+
3+
group :development do
4+
# For puppet-strings, with some juggling to avoid the old puppet gem.
5+
gem 'openvox', git: 'https://github.com/openvoxproject/puppet.git', tag: '8.17.0'
6+
gem 'puppet', path: './puppet-stub'
7+
gem 'racc'
8+
# For REFERENCE.md generation.
9+
gem 'puppet-strings'
10+
end

README.md

Lines changed: 38 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,11 @@
11
# openvox_bootstrap
22

3-
[Bolt](https://www.puppet.com/docs/bolt/latest/bolt.html) module for
4-
bootstrapping installation of the openvox-agent package.
3+
[Bolt] module for bootstrapping installation of the [openvox]
4+
(Puppet<sup>:tm:</sup>) packages.
55

66
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.voxpupuli.org, https://yum.voxpupuli.org.
7+
tasks] for [openvox] packages from https://apt.voxpupuli.org,
8+
https://yum.voxpupuli.org.
109

1110
The puppet_agent module makes use of the Perforce repositories and
1211
collections instead.
@@ -17,28 +16,34 @@ Assumes you have Bolt installed.
1716

1817
### openvox_boostrap::install
1918

20-
Installs the openvox8 collection by default (Puppet<sup>:tm:</sup> 8).
19+
Installs the platform appropriate openvox8 collection release package
20+
and the openvox-agent package by default (Puppet<sup>:tm:</sup> 8).
2121

2222
```sh
2323
bolt task run openvox_bootstrap::install \
2424
--targets <target> \
2525
--run-as root
2626
```
27+
#### parameters
28+
29+
By default the task will install the openvox-agent package, but this
30+
can be overridden by setting the `package` parameter to install
31+
openvox-server, openvoxdb or another package from the openvox
32+
collection.
33+
34+
See the [install task](./REFERENCE.md#install) for details.
2735

2836
#### Usage with Bolt apply_prep() function
2937

30-
Bolt's
31-
[apply_prep](https://www.puppet.com/docs/bolt/latest/plan_functions#apply-prep)
32-
function ensures that the latest version of Puppet<sup>:tm:</sup> is installed on
33-
a node by calling the puppet_agent::install task if the agent is not
34-
detected on the node.
38+
Bolt's [apply_prep] function ensures that the latest version of
39+
Puppet<sup>:tm:</sup> is installed on a node by calling the
40+
`puppet_agent::install` task if the agent is not detected on the node.
3541

36-
The openvox_bootstrap::install task can be used in its place to
42+
The `openvox_bootstrap::install` task can be used in its place to
3743
instead ensure that openvox-agent is installed.
3844

39-
The apply_prep() function relies on Bolt's
40-
[puppet_library](https://www.puppet.com/docs/bolt/latest/using_plugins#puppet-library-plugins)
41-
plugin configuration.
45+
The apply_prep() function relies on Bolt's [puppet_library] plugin
46+
configuration.
4247

4348
To use openvox_bootstrap instead, configure your bolt_project.yaml
4449
with:
@@ -57,12 +62,22 @@ task that can be used to install a build artifact package directly
5762
from the https://artifact.voxpupuli.org repository for testing
5863
prior to release.
5964
65+
Minimally, you must supply the `version` parameter, but generally you
66+
would also supply `package` unless you are installing the
67+
openvox-agent package.
68+
69+
See [task ref](./REFERENCE.md#install_build_artifact) for details.
70+
6071
```sh
61-
bolt task run openvox_bootstrap::install \
62-
--targets <target> \
72+
bolt task run openvox_bootstrap::install_build_artifact \
73+
--targets <target> --version=8.17.0 \
6374
--run-as root
6475
```
6576

77+
## Reference
78+
79+
See [REFERENCE.md](./REFERENCE.md) for the generated reference doc.
80+
6681
## TODO
6782

6883
* Windows support
@@ -85,3 +100,9 @@ GNU Affero General Public License for more details.
85100

86101
You should have received a copy of the GNU Affero General Public License
87102
along with this program. If not, see <https://www.gnu.org/licenses/>.
103+
104+
[bolt]: https://puppet.com/docs/bolt/latest/bolt.html
105+
[openvox]: https://voxpupuli.org/openvox/
106+
[puppet_agent::install tasks]: https://github.com/puppetlabs/puppetlabs-puppet_agent/tree/main?tab=readme-ov-file#puppet_agentinstall
107+
[apply_prep]: https://www.puppet.com/docs/bolt/latest/plan_functions#apply-prep
108+
[puppet_library]: https://www.puppet.com/docs/bolt/latest/using_plugins#puppet-library-plugins

REFERENCE.md

Lines changed: 77 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,77 @@
1+
# Reference
2+
3+
<!-- DO NOT EDIT: This document was generated by Puppet Strings -->
4+
5+
## Table of Contents
6+
7+
### Tasks
8+
9+
* [`install`](#install): Installs an openvox package. By default, this will be the latest openvox-agent from the latest collection.
10+
* [`install_build_artifact`](#install_build_artifact): Downloads and installs a package directly from the openvox build artifact server.
11+
12+
## Tasks
13+
14+
### <a name="install"></a>`install`
15+
16+
Installs an openvox package. By default, this will be the latest openvox-agent from the latest collection.
17+
18+
**Supports noop?** false
19+
20+
#### Parameters
21+
22+
##### `package`
23+
24+
Data type: `String[1]`
25+
26+
The name of the package to install.
27+
28+
##### `version`
29+
30+
Data type: `Optional[String]`
31+
32+
The version of the openvox-agent package to install. Defaults to latest.
33+
34+
##### `collection`
35+
36+
Data type: `Optional[String]`
37+
38+
The openvox collection to install from.
39+
40+
##### `apt_source`
41+
42+
Data type: `Optional[String]`
43+
44+
The apt source repository to retrieve deb packages from.
45+
46+
##### `yum_source`
47+
48+
Data type: `Optional[String]`
49+
50+
The yum source repository to retrieve rpm packages from.
51+
52+
### <a name="install_build_artifact"></a>`install_build_artifact`
53+
54+
Downloads and installs a package directly from the openvox build artifact server.
55+
56+
**Supports noop?** false
57+
58+
#### Parameters
59+
60+
##### `package`
61+
62+
Data type: `String[1]`
63+
64+
The name of the package to install.
65+
66+
##### `version`
67+
68+
Data type: `String[1]`
69+
70+
The version of the package to install.
71+
72+
##### `artifacts_source`
73+
74+
Data type: `String[1]`
75+
76+
URL to the build artifacts server.
77+

0 commit comments

Comments
 (0)