Skip to content

Commit 7e6a78d

Browse files
committed
Add SLES
1 parent ee94f43 commit 7e6a78d

File tree

4 files changed

+111
-1
lines changed

4 files changed

+111
-1
lines changed

docker/bin/install.sh

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,13 @@ do
4242
base_image='rockylinux/rockylinux:8'
4343
;;
4444

45+
sles)
46+
docker build --rm -f docker/sles/Dockerfile . -t pa-dev:$platform.install \
47+
--build-arg version=${version}
48+
docker run -e PUPPET_FORGE_TOKEN --rm -ti pa-dev:$platform.install
49+
exit 0
50+
;;
51+
4552
*)
4653
echo "$0: Usage install.sh [amazon|fedora|rocky]"
4754
exit 1

docker/bin/upgrade.sh

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@
1010
# - `amazon`
1111
# - `fedora`
1212
# - `rocky`
13+
# - `sles`
1314
# - `ubuntu`
1415
# Default: `ubuntu`
1516
# - BEFORE: The puppet-agent package version that is installed prior to upgrade.
@@ -45,6 +46,13 @@ do
4546
release_package='http://yum.puppet.com/puppet7-release-el-8.noarch.rpm'
4647
;;
4748

49+
sles)
50+
docker build --rm -f docker/sles/Dockerfile . -t pa-dev:$platform \
51+
--build-arg before=${before}
52+
docker run -e PUPPET_FORGE_TOKEN --rm -ti pa-dev:$platform 8.10.0
53+
exit 0
54+
;;
55+
4856
*)
4957
echo "$0: Usage upgrade.sh [amazon|fedora|rocky]"
5058
exit 1

docker/sles/Dockerfile

Lines changed: 91 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,91 @@
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: "7.34.0"
26+
27+
FROM registry.suse.com/suse/sle15:15.6
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 zypper install --no-confirm wget git-core
34+
35+
ARG before=7.34.0
36+
LABEL before=${before}
37+
38+
# Install proper FROM repo pupet 7
39+
RUN if [[ ${before} == 7.* ]]; then \
40+
wget -O puppet7.rpm http://yum.puppet.com/puppet7-release-sles-15.noarch.rpm && \
41+
rpm -i puppet7.rpm; \
42+
else echo no; \
43+
fi
44+
45+
# Install FROM version of puppet-agent.
46+
RUN rpm --import https://yum.puppet.com/RPM-GPG-KEY-puppet-20250406 && \
47+
zypper install --no-confirm --oldpackage --no-recommends --no-confirm puppet-agent-${before}
48+
49+
# This is also duplicated in the docker/bin/helpers/run-upgrade.sh.
50+
ENV module_path=/tmp/modules
51+
WORKDIR "${module_path}/puppet_agent"
52+
COPY metadata.json ./
53+
54+
# Dependency installation: Forge or source? The former is what the user will
55+
# have downloaded, but the latter allows testing of version bumps.
56+
# Install module dependencies from the Forge using Puppet Module Tool (PMT).
57+
RUN /opt/puppetlabs/puppet/bin/puppet module install --modulepath $module_path --target-dir .. puppetlabs-stdlib
58+
RUN /opt/puppetlabs/puppet/bin/puppet module install --modulepath $module_path --target-dir .. puppetlabs-inifile
59+
RUN /opt/puppetlabs/puppet/bin/puppet module install --modulepath $module_path --target-dir .. puppetlabs-apt
60+
RUN /opt/puppetlabs/puppet/bin/puppet module install --modulepath $module_path --target-dir .. puppetlabs-facts
61+
62+
# Installing dependencies from source. These versions should be within the range
63+
# of `dependencies` in metadata.json.
64+
#RUN git clone https://github.com/puppetlabs/puppetlabs-stdlib ../stdlib --branch 9.7.0
65+
#RUN git clone https://github.com/puppetlabs/puppetlabs-inifile ../inifile --branch 6.2.0
66+
#RUN git clone https://github.com/puppetlabs/puppetlabs-apt ../apt --branch 10.0.1
67+
#RUN git clone https://github.com/puppetlabs/puppetlabs-facts ../facts --branch 1.7.0
68+
69+
# Check that all dependencies are installed.
70+
RUN /opt/puppetlabs/puppet/bin/puppet module --modulepath $module_path list --tree
71+
COPY docker/deploy.pp /tmp/deploy.pp
72+
RUN ["sh", "-c", "/opt/puppetlabs/puppet/bin/puppet apply --modulepath $module_path /tmp/deploy.pp"]
73+
74+
# Now move the project directory's files into the image. That way, if these
75+
# files change, caching will skip everything before this.
76+
COPY docker/bin/helpers/run-upgrade.sh /tmp/bin/run-upgrade.sh
77+
COPY files/ ./files/
78+
COPY locales/ ./locales/
79+
COPY spec/ ./spec/
80+
COPY task_spec/ ./task_spec/
81+
COPY tasks/ ./tasks/
82+
COPY templates/ ./templates
83+
COPY types/ ./types/
84+
COPY Gemfile Gemfile.lock Rakefile ./
85+
COPY lib/ ./lib/
86+
COPY manifests/ ./manifests/
87+
88+
COPY docker/upgrade.pp /tmp/upgrade.pp
89+
90+
# Perform the upgrade.
91+
ENTRYPOINT ["/tmp/bin/run-upgrade.sh"]

manifests/osfamily/suse.pp

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -134,6 +134,10 @@
134134
# 'auto' versus X.Y.Z
135135
$_package_version = getvar('puppet_agent::master_or_package_version')
136136

137+
$pw = unwrap($puppet_agent::password)
138+
$url = URI($source)
139+
$baseurl = "${url.scheme}://${puppet_agent::username}:${pw}@${url.host}/${url.path}?auth=basic&ssl_verify=no"
140+
137141
# In Puppet Enterprise, agent packages are served by the same server
138142
# as the master, which can be using either a self signed CA, or an external CA.
139143
# Zypper has issues with validating a self signed CA, so for now disable ssl verification.
@@ -142,7 +146,7 @@
142146
'enabled' => '1',
143147
'gpgcheck' => '1',
144148
'autorefresh' => '0',
145-
'baseurl' => "${source}?ssl_verify=no",
149+
'baseurl' => $baseurl,
146150
'type' => 'rpm-md',
147151
}
148152

0 commit comments

Comments
 (0)