Skip to content

Commit de05629

Browse files
Guillaume001Guillaume001
Guillaume001
authored andcommitted
(MODULES-11135) Add tests and specs for Rocky 8
1 parent d3cc6c0 commit de05629

File tree

9 files changed

+170
-3
lines changed

9 files changed

+170
-3
lines changed

.github/workflows/task_acceptance_tests.yaml

+2-2
Original file line numberDiff line numberDiff line change
@@ -12,10 +12,10 @@ jobs:
1212
name: On ${{ matrix.os }}
1313
strategy:
1414
matrix:
15-
os: [ 'centos-7', 'ubuntu-18.04' ]
15+
os: [ 'centos-7', 'ubuntu-18.04', 'rocky-8' ]
1616

1717
env:
18-
ruby_version: 2.5
18+
ruby_version: 2.5.9
1919
GEM_BOLT: true
2020
BEAKER_debug: true
2121
BEAKER_set: docker/${{ matrix.os }}

docker/bin/upgrade.sh

+1
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99
# supports comma-separated lists. Available:
1010
# - `ubuntu`
1111
# - `centos`
12+
# - `rocky`
1213
# Default: `ubuntu`
1314
# - BEFORE: The puppet-agent package version that is installed prior to upgrade.
1415
# Default: 1.10.14

docker/bin/versions.sh

+2-1
Original file line numberDiff line numberDiff line change
@@ -8,13 +8,14 @@
88
# - PLATFORM: The platform on which the upgrade should occur. Available:
99
# - `ubuntu`
1010
# - `centos`
11+
# - `rocky`
1112
# Default: `ubuntu`
1213
set -e
1314

1415
platform=${1:-ubuntu}
1516

1617
case "${platform}" in
17-
ubuntu|centos)
18+
ubuntu|centos|rocky)
1819
;;
1920
*) echo "Invalid platform: '${platform}'. Must be 'ubuntu' or 'centos'"
2021
exit 1

docker/rocky/Dockerfile

+103
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,103 @@
1+
# This Dockerfile enables an iterative development workflow where you can make
2+
# a change and test it out quickly. The majority of commands in this file will
3+
# be cached, making the feedback loop typically quite short. The workflow is
4+
# as follows:
5+
# 1. Set up pre-conditions for the system in puppet code using `deploy.pp`.
6+
# 2. Make a change to the module.
7+
# 3. Run `docker build -f docker/Dockerfile .` or
8+
# `./docker/bin/upgrade.sh rocky` from the project directory. If you would
9+
# like to test specific version upgrades, you can add run this like so:
10+
# `docker build -f docker/rocky/Dockerfile . \
11+
# -t pa-dev:rocky --build-arg before=1.10.14`
12+
# 4. Upgrade the container by running the image:
13+
# `docker run -it pa-dev:rocky`
14+
# Specify your upgrade TO version as an argument to the `docker run`
15+
# command.
16+
# 5. Review the output. Repeat steps 2-5 as needed.
17+
#
18+
# At the end of execution, you will see a line like:
19+
#
20+
# Notice: /Stage[main]/Puppet_agent::Install/Package[puppet-agent]/ensure: ensure changed '1.10.14-1.el8' to '6.2.0'
21+
#
22+
# This specifies the versions that were used for upgrade.
23+
#
24+
# Arguments:
25+
# - before: The version to do upgrade FROM. Default: "1.10.14"
26+
27+
FROM rockylinux/rockylinux:8
28+
29+
# Use this to force a cache reset (e.g. for output purposes)
30+
#COPY $0 /tmp/Dockerfile
31+
32+
# Install some other dependencies for ease of life.
33+
RUN dnf update -y \
34+
&& dnf install -y wget git \
35+
&& dnf clean all
36+
37+
ARG before=1.10.14
38+
LABEL before=${before}
39+
40+
# Install proper FROM repo: puppet 6 or puppet 7.
41+
RUN if [[ ${before} == 6.* ]]; then \
42+
echo Installing puppet6 repo; \
43+
wget -O puppet6.rpm http://yum.puppet.com/puppet6-release-el-8.noarch.rpm && \
44+
rpm -i puppet6.rpm; \
45+
elif [[ ${before} == 7.* ]]; then \
46+
echo Installing puppet7 repo; \
47+
wget -O puppet7.rpm http://yum.puppet.com/puppet7-release-el-8.noarch.rpm && \
48+
rpm -i puppet7.rpm; \
49+
else echo no; \
50+
fi
51+
52+
# Print out which versions of the puppet-agent package are available (for reference).
53+
#RUN dnf list puppet-agent --showduplicates
54+
55+
# Install FROM version of puppet-agent.
56+
RUN dnf -y update && \
57+
dnf install -y puppet-agent-${before}-1.el8
58+
59+
# This is also duplicated in the docker/bin/helpers/run-upgrade.sh.
60+
ENV module_path=/tmp/modules
61+
WORKDIR "${module_path}/puppet_agent"
62+
COPY metadata.json ./
63+
64+
# Dependency installation: Forge or source? The former is what the user will
65+
# have downloaded, but the latter allows testing of version bumps.
66+
# Install module dependencies from the Forge using Puppet Module Tool (PMT).
67+
RUN /opt/puppetlabs/puppet/bin/puppet module install --modulepath $module_path --target-dir .. puppetlabs-stdlib
68+
RUN /opt/puppetlabs/puppet/bin/puppet module install --modulepath $module_path --target-dir .. puppetlabs-inifile
69+
RUN /opt/puppetlabs/puppet/bin/puppet module install --modulepath $module_path --target-dir .. puppetlabs-apt
70+
71+
# Installing dependencies from source. These versions should be within the range
72+
# of `dependencies` in metadata.json. `translate` is a dependency for inifile.
73+
#RUN git clone https://github.com/puppetlabs/puppetlabs-stdlib ../stdlib --branch 5.2.0
74+
#RUN git clone https://github.com/puppetlabs/puppetlabs-inifile ../inifile --branch 2.5.0
75+
#RUN git clone https://github.com/puppetlabs/puppetlabs-translate ../translate --branch 1.2.0
76+
#RUN git clone https://github.com/puppetlabs/puppetlabs-apt ../apt --branch 6.3.0
77+
78+
# Check that all dependencies are installed.
79+
RUN /opt/puppetlabs/puppet/bin/puppet module --modulepath $module_path list --tree
80+
COPY docker/deploy.pp /tmp/deploy.pp
81+
RUN ["sh", "-c", "/opt/puppetlabs/puppet/bin/puppet apply --modulepath $module_path /tmp/deploy.pp"]
82+
83+
# Now move the project directory's files into the image. That way, if these
84+
# files change, caching will skip everything before this.
85+
COPY docker/bin/helpers/run-upgrade.sh /tmp/bin/run-upgrade.sh
86+
COPY files/ ./files/
87+
COPY locales/ ./locales/
88+
COPY spec/ ./spec/
89+
COPY task_spec/ ./task_spec/
90+
COPY tasks/ ./tasks/
91+
COPY templates/ ./templates
92+
COPY types/ ./types/
93+
COPY Gemfile Gemfile.lock Rakefile ./
94+
COPY lib/ ./lib/
95+
COPY manifests/ ./manifests/
96+
97+
COPY docker/upgrade.pp /tmp/upgrade.pp
98+
99+
# Print out which versions of the puppet-agent package are available (for reference).
100+
#RUN yum list puppet-agent --showduplicates
101+
102+
# Perform the upgrade.
103+
ENTRYPOINT ["/tmp/bin/run-upgrade.sh"]

docker/rocky/Dockerfile.versions

+16
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
FROM rockylinux/rockylinux:8
2+
3+
# Install some other dependencies for ease of life.
4+
RUN dnf update -y \
5+
&& dnf install -y wget git \
6+
&& dnf clean all
7+
8+
# Install several repos: puppet 6, and puppet7.
9+
RUN wget -O puppet6.rpm http://yum.puppet.com/puppet6-release-el-8.noarch.rpm && \
10+
rpm -i puppet6.rpm --force --replacefiles --nodeps && \
11+
wget -O puppet7.rpm http://yum.puppet.com/puppet7-release-el-8.noarch.rpm && \
12+
rpm -i puppet7.rpm --force --replacefiles --nodeps
13+
14+
# Print out available package versions for puppet-agent. If a specific version
15+
# is desired, pass that in with e.g. `--build-arg before=1.1.1`
16+
ENTRYPOINT ["dnf", "list", "puppet-agent", "--showduplicates"]
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
HOSTS:
2+
rocky-8-x64:
3+
platform: el-8-x86_64
4+
hypervisor: docker
5+
image: rockylinux/rockylinux:8
6+
docker_preserve_image: true
7+
docker_cmd: '["/usr/sbin/init"]'
8+
# install various tools required to get the image up to usable levels
9+
docker_image_commands:
10+
- 'dnf install -y crontabs tar wget openssl iproute which initscripts'
11+
CONFIG:
12+
trace_limit: 200

spec/acceptance/nodesets/rocky-8.yml

+10
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
HOSTS:
2+
rocky-8-x64:
3+
roles:
4+
- agent
5+
- default
6+
platform: el-8-x86_64
7+
hypervisor: vagrant
8+
box: rockylinux/8
9+
CONFIG:
10+
type: foss
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
HOSTS:
2+
rocky-8-x64:
3+
roles:
4+
- target
5+
platform: el-8-x86_64
6+
hypervisor: docker
7+
image: rockylinux/rockylinux:8
8+
docker_preserve_image: true
9+
docker_cmd: '["/usr/sbin/init"]'
10+
# install various tools required to get the image up to usable levels
11+
docker_image_commands:
12+
- 'dnf install -y crontabs tar wget openssl iproute which initscripts'
13+
CONFIG:
14+
trace_limit: 200
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
HOSTS:
2+
rocky-8-x64:
3+
roles:
4+
- target
5+
- default
6+
platform: el-8-x86_64
7+
hypervisor: vagrant
8+
box: rockylinux/8
9+
CONFIG:
10+
type: foss

0 commit comments

Comments
 (0)