Skip to content

Commit 0df6de3

Browse files
committed
Updates for 8.11.0
Default to 8.11.0 Fix sles Dockerfile for installs Fix sles release package installation
1 parent 7e6a78d commit 0df6de3

File tree

5 files changed

+98
-26
lines changed

5 files changed

+98
-26
lines changed

docker/bin/helpers/run-install.sh

Lines changed: 17 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,11 @@
22

33
set -e
44

5-
to_version=${1:-8.10.0}
5+
to_version="${1}"
6+
if [[ -z "${to_version}" ]]; then
7+
echo "$0: The version to install must be passed as an argument"
8+
exit 1
9+
fi
610
puppet_version=( ${to_version//./ } )
711
puppet_major=${puppet_version[0]}
812
case $puppet_major in
@@ -13,16 +17,27 @@ case $puppet_major in
1317
to_collection=puppet8
1418
;;
1519
*)
16-
echo "Invalid version supplied" 1>&2
20+
echo "$0: Invalid version supplied" 1>&2
1721
exit 1
1822
esac
1923

2024
export PT__installdir=../
2125
export PT_version=${to_version}
26+
export PT_collection=${to_collection}
2227
export PT_password=${PUPPET_FORGE_TOKEN}
2328
chmod u+x tasks/install_shell.sh
2429
tasks/install_shell.sh
2530

2631
echo "puppet $(/opt/puppetlabs/puppet/bin/puppet --version)"
2732
echo "facter $(/opt/puppetlabs/puppet/bin/facter --version)"
2833
/opt/puppetlabs/puppet/bin/puppet apply -e 'notice("puppet apply")'
34+
35+
# Make e.g. `puppet --version` work out of the box.
36+
PATH=/opt/puppetlabs/bin:$PATH \
37+
read -p "Explore the container? [y/N]: " choice && \
38+
choice=${choice:-N} && \
39+
if [ "${choice}" = "y" ]; then \
40+
bash; \
41+
else \
42+
echo "Moving on..."; \
43+
fi

docker/bin/install.sh

Lines changed: 27 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -19,45 +19,56 @@
1919
# Default: 8.1.0
2020
set -e
2121

22-
if [ -z "${PUPPET_FORGE_TOKEN}" ]; then
23-
echo "Environment variable PUPPET_FORGE_TOKEN must be set"
22+
if [[ -z "${PUPPET_FORGE_TOKEN}" ]]; then
23+
echo "$0: Environment variable PUPPET_FORGE_TOKEN must be set"
2424
exit 1
2525
fi
2626

2727
cd "$(dirname "$0")/../.."
2828
platforms=${1:-rocky}
29-
version=${2:-8.10.0}
29+
version=${2:-8.11.0}
3030
for platform in ${platforms//,/ }
3131
do
32+
dockerfile='docker/install/dnf/Dockerfile'
33+
3234
case $platform in
33-
amazon)
35+
amazon*)
3436
base_image='amazonlinux:2023'
3537
;;
3638

37-
fedora)
39+
fedora40)
3840
base_image='fedora:40'
3941
;;
4042

41-
rocky)
43+
fedora36)
44+
base_image='fedora:36'
45+
;;
46+
47+
fedora*)
48+
base_image='fedora:41'
49+
;;
50+
51+
rocky8)
4252
base_image='rockylinux/rockylinux:8'
4353
;;
4454

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
55+
rocky*)
56+
base_image='rockylinux/rockylinux:9'
57+
;;
58+
59+
sles*)
60+
base_image='registry.suse.com/suse/sle15:15.6'
61+
dockerfile='docker/install/sles/Dockerfile'
5062
;;
5163

5264
*)
53-
echo "$0: Usage install.sh [amazon|fedora|rocky]"
65+
echo "$0: Usage install.sh [amazon|fedora|rocky|sles]"
5466
exit 1
5567
;;
5668
esac
5769

58-
docker build --rm -f docker/install/dnf/Dockerfile . -t pa-dev:$platform.install \
59-
--build-arg version=${version} \
60-
--build-arg BASE_IMAGE=${base_image}
61-
docker run -e PUPPET_FORGE_TOKEN --rm -ti pa-dev:$platform.install
70+
docker build --rm -f "${dockerfile}" . -t pa-dev:$platform.install \
71+
--build-arg BASE_IMAGE="${base_image}"
72+
docker run -e PUPPET_FORGE_TOKEN --rm -ti pa-dev:$platform.install "${version}"
6273
done
6374
echo Complete

docker/install/dnf/Dockerfile

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -14,11 +14,6 @@
1414
# ========================================================================================================================================
1515
# Installing:
1616
# puppet-agent x86_64 8.10.0-1.el8 puppet8 27 M
17-
#
18-
# This specifies the versions that were used for upgrade.
19-
#
20-
# Arguments:
21-
# - before: The version to do upgrade FROM. Default: "7.34.0"
2217

2318
ARG BASE_IMAGE=rocky:8
2419
FROM ${BASE_IMAGE}

docker/install/sles/Dockerfile

Lines changed: 50 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,50 @@
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/bin/install.sh rocky` from the project directory.
8+
# 4. Review the output. Repeat steps 2-3 as needed.
9+
#
10+
# At the end of execution, you will see a line like:
11+
#
12+
# (19/19) Installing: puppet-agent-8.11.0-1.sles15.x86_64 ..........................................................................[done]
13+
14+
ARG BASE_IMAGE=registry.suse.com/suse/sle15:15.6
15+
FROM ${BASE_IMAGE}
16+
17+
# Use this to force a cache reset (e.g. for output purposes)
18+
#COPY $0 /tmp/Dockerfile
19+
20+
# Install some other dependencies for ease of life.
21+
RUN zypper install --no-confirm wget git-core
22+
23+
# This is also duplicated in the docker/bin/helpers/run-upgrade.sh.
24+
ENV module_path=/tmp/modules
25+
WORKDIR "${module_path}/puppet_agent"
26+
COPY metadata.json ./
27+
28+
# Installing dependencies from source. These versions should be within the range
29+
# of `dependencies` in metadata.json.
30+
RUN git clone --depth 1 https://github.com/puppetlabs/puppetlabs-stdlib ../stdlib --branch v9.7.0
31+
RUN git clone --depth 1 https://github.com/puppetlabs/puppetlabs-inifile ../inifile --branch v6.2.0
32+
RUN git clone --depth 1 https://github.com/puppetlabs/puppetlabs-apt ../apt --branch v10.0.1
33+
RUN git clone --depth 1 https://github.com/puppetlabs/puppetlabs-facts ../facts --branch 1.7.0
34+
35+
# Now move the project directory's files into the image. That way, if these
36+
# files change, caching will skip everything before this.
37+
COPY docker/bin/helpers/run-install.sh /tmp/bin/run-install.sh
38+
COPY files/ ./files/
39+
COPY locales/ ./locales/
40+
COPY spec/ ./spec/
41+
COPY task_spec/ ./task_spec/
42+
COPY tasks/ ./tasks/
43+
COPY templates/ ./templates
44+
COPY types/ ./types/
45+
COPY Gemfile Gemfile.lock Rakefile ./
46+
COPY lib/ ./lib/
47+
COPY manifests/ ./manifests/
48+
49+
# Perform the install.
50+
ENTRYPOINT ["/tmp/bin/run-install.sh"]

tasks/install_shell.sh

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -597,8 +597,8 @@ install_file() {
597597
fi
598598

599599
rpm -Uvh --oldpackage --replacepkgs "$2"
600-
sed -i "s/^#\?username=.*/username=${username}/" "/etc/yum.repos.d/puppet8-release.repo"
601-
sed -i "s/^#\?password=.*/password=${password}/" "/etc/yum.repos.d/puppet8-release.repo"
600+
sed -i "s/^#\?username=.*/username=${username}/" "/etc/yum.repos.d/${collection}-release.repo"
601+
sed -i "s/^#\?password=.*/password=${password}/" "/etc/yum.repos.d/${collection}-release.repo"
602602
exists dnf && PKGCMD=dnf || PKGCMD=yum
603603
if test "$version" = 'latest'; then
604604
run_cmd "${PKGCMD} install -y puppet-agent && ${PKGCMD} upgrade -y puppet-agent"
@@ -622,7 +622,8 @@ install_file() {
622622
fi
623623
fi
624624

625-
sed -i 's/^baseurl/baseurl=https:\/\/${username}:${password}@yum-puppetcore.puppet.com\/puppet8\/sles\/\$basearch?auth=basic' "/etc/zypp/repos.d/puppet8-release.repo"
625+
run_cmd "zypper install --no-confirm '$2'"
626+
sed -i -E "s/^baseurl=https:\/\/.*yum-puppetcore.puppet.com(.*)/baseurl=https:\/\/${username}:${password}@yum-puppetcore.puppet.com\\1/" "/etc/zypp/repos.d/${collection}-release.repo"
626627
if test "$version" = "latest"; then
627628
run_cmd "zypper install --no-confirm 'puppet-agent'"
628629
else

0 commit comments

Comments
 (0)