Skip to content

Commit b971093

Browse files
span786claude
andcommitted
(MODULES-11721) Add Puppet 9 support
Widens the puppet requirement in metadata.json to >= 8.0.0 < 10.0.0. The module's CI tooling can't resolve or lint under Puppet 9 as-is, so most of this change is dependency and workflow plumbing to make the Puppet 9 lane actually run: voxpupuli-puppet-lint-plugins bumped to ~> 7.0 (puppet-lint 5.x), puppetlabs_spec_helper and puppet_litmus temporarily pinned to git main (their released versions don't yet carry the puppet-lint relaxation and --collection-platform-exclude respectively), and the Gemfile resolves Puppet 9 (8.99.x) prereleases from PUPPET_GEM_SOURCE with a puppetcore fallback and warning when that secret isn't configured. ci.yml, nightly.yml and mend.yml gain ruby_version: "3.2" (voxpupuli puppet-lint-plugins 7.0 requires ruby >= 3.2). The Acceptance flags in ci.yml/nightly.yml gain --collection-platform-exclude for 9:redhat-7, 9:centos-7, 9:oraclelinux-7, 9:scientific-7 (all el7, no Puppet 9 agent), 9:debian-10, 9:ubuntu-18.04 and 9:ubuntu-20.04 -- confirmed against this module's own metadata.json and matrix_from_metadata_v3 output, not copied from another module. ci.yml/nightly.yml are marked unmanaged in .sync.yml since pdk-templates can't express ruby_version or the collection excludes. On the Ruby 4 / Puppet 9 lane, puppet_litmus pulls in bolt 4.x, which depends on faraday-patron -> patron; patron builds a libcurl native extension and the CI runner has no libcurl headers, so the Spec job in ci.yml/nightly.yml now sets additional_packages: "libcurl4-openssl-dev" to install them before bundle install (same fix as puppetlabs-lvm#391). No manifest/type/provider/function/spec behaviour changes. Follow-up: the two temporary git-branch pins from the paragraph above have since been superseded by released gems -- puppetlabs_spec_helper 9.0.0 (relaxes puppet-lint to ~> 5.x, matching voxpupuli-puppet-lint-plugins ~> 7.0) and puppet_litmus 2.8.0 (adds --collection-platform-exclude to matrix_from_metadata_v3). Both Gemfile entries are now plain, released version constraints, matching the pattern puppetlabs-lvm#391 landed with. puppetlabs_spec_helper 9.0.0 also renamed its puppet-syntax dependency to puppetlabs-syntax, so the Rakefile's require was updated to match -- without it, nothing in the bundle provides the old puppet-syntax path and the Rakefile raises LoadError. Opus review pass: tightened the Gemfile's puppet_litmus constraint from '~> 2.5' to '~> 2.8', since --collection-platform-exclude (which ci.yml/nightly.yml pass unconditionally) only exists from 2.8.0 onward and older 2.x releases hard-fail with OptionParser::InvalidOption instead of degrading gracefully. Added a Gemfile: overrides: block in .sync.yml pinning puppetlabs_spec_helper to '~> 9.0' and puppet_litmus to '~> 2.8', so a scheduled `pdk update` can't silently widen back to pdk-templates' own looser defaults ('>= 8.0' / '~> 2.5') and reintroduce the puppet-lint 4.0/collection-exclude problems this PR fixes. Also corrected the existing .sync.yml comment on ci.yml/nightly.yml's unmanaged: true: it previously implied --collection-platform-exclude/acceptance_flags couldn't be expressed via the templates, but acceptance_flags is a real, supported .sync.yml key (this file already uses it below) -- the only genuinely inexpressible inputs are ruby_version and additional_packages, which are now the sole stated reason. Co-Authored-By: Claude <noreply@anthropic.com>
1 parent 2690f72 commit b971093

7 files changed

Lines changed: 96 additions & 11 deletions

File tree

‎.github/workflows/ci.yml‎

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,11 +9,21 @@ on:
99
jobs:
1010
Spec:
1111
uses: "puppetlabs/cat-github-actions/.github/workflows/module_ci.yml@main"
12+
with:
13+
# voxpupuli-puppet-lint-plugins 7.0 (needed for Puppet 9 support) requires
14+
# ruby >= 3.2; the default (3.1) can no longer resolve the :development group.
15+
ruby_version: "3.2"
16+
# puppet_litmus -> bolt 4.x -> faraday-patron -> patron builds a libcurl native extension;
17+
# the runner has no libcurl headers, so install them before bundle (Puppet 9 lane, Ruby 4).
18+
additional_packages: "libcurl4-openssl-dev"
1219
secrets: "inherit"
1320

1421
Acceptance:
1522
needs: Spec
1623
uses: "puppetlabs/cat-github-actions/.github/workflows/module_acceptance.yml@main"
1724
secrets: "inherit"
1825
with:
19-
flags: "--nightly"
26+
flags: "--nightly --collection-platform-exclude 9:redhat-7 --collection-platform-exclude 9:centos-7 --collection-platform-exclude 9:oraclelinux-7 --collection-platform-exclude 9:scientific-7 --collection-platform-exclude 9:debian-10 --collection-platform-exclude 9:ubuntu-18.04 --collection-platform-exclude 9:ubuntu-20.04"
27+
# voxpupuli-puppet-lint-plugins 7.0 (needed for Puppet 9 support) requires
28+
# ruby >= 3.2; the default (3.1) can no longer resolve the :development group.
29+
ruby_version: "3.2"

‎.github/workflows/mend.yml‎

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,4 +12,8 @@ jobs:
1212

1313
mend:
1414
uses: "puppetlabs/cat-github-actions/.github/workflows/mend_ruby.yml@main"
15+
with:
16+
# voxpupuli-puppet-lint-plugins 7.0 (needed for Puppet 9 support) requires
17+
# ruby >= 3.2; `bundle lock` resolves all groups at the default ruby (3.1).
18+
ruby_version: "3.2"
1519
secrets: "inherit"

‎.github/workflows/nightly.yml‎

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,11 +8,19 @@ on:
88
jobs:
99
Spec:
1010
uses: "puppetlabs/cat-github-actions/.github/workflows/module_ci.yml@main"
11+
with:
12+
# voxpupuli-puppet-lint-plugins 7.0 (needed for Puppet 9 support) requires
13+
# ruby >= 3.2; the default (3.1) can no longer resolve the :development group.
14+
ruby_version: "3.2"
15+
# puppet_litmus -> bolt 4.x -> faraday-patron -> patron builds a libcurl native extension;
16+
# the runner has no libcurl headers, so install them before bundle (Puppet 9 lane, Ruby 4).
17+
additional_packages: "libcurl4-openssl-dev"
1118
secrets: "inherit"
1219

1320
Acceptance:
1421
needs: Spec
1522
uses: "puppetlabs/cat-github-actions/.github/workflows/module_acceptance.yml@main"
1623
secrets: "inherit"
1724
with:
18-
flags: "--nightly"
25+
flags: "--nightly --collection-platform-exclude 9:redhat-7 --collection-platform-exclude 9:centos-7 --collection-platform-exclude 9:oraclelinux-7 --collection-platform-exclude 9:scientific-7 --collection-platform-exclude 9:debian-10 --collection-platform-exclude 9:ubuntu-18.04 --collection-platform-exclude 9:ubuntu-20.04"
26+
ruby_version: "3.2"

‎.sync.yml‎

Lines changed: 40 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,17 @@ Gemfile:
88
optional:
99
":development":
1010
- gem: ruby-pwsh
11+
# MODULES-11721: pin puppetlabs_spec_helper and puppet_litmus above pdk-templates'
12+
# own defaults (>= 8.0 and ~> 2.5 respectively), which are loose enough for a
13+
# scheduled `pdk update` to silently revert this PR: puppetlabs_spec_helper 8.0.0
14+
# still pins puppet-lint ~> 4.0 (conflicts with voxpupuli-puppet-lint-plugins ~> 7.0,
15+
# needed for Puppet 9), and puppet_litmus below 2.8.0 doesn't support
16+
# --collection-platform-exclude, which ci.yml/nightly.yml pass unconditionally.
17+
overrides:
18+
- gem: 'puppetlabs_spec_helper'
19+
version: '~> 9.0'
20+
- gem: 'puppet_litmus'
21+
version: '~> 2.8'
1122
spec/spec_helper.rb:
1223
mock_with: ":rspec"
1324
coverage_report: true
@@ -17,10 +28,37 @@ spec/spec_helper.rb:
1728
unmanaged: false
1829
.github/workflows/auto_release.yml:
1930
unmanaged: false
31+
# MODULES-11721: ci.yml and nightly.yml are maintained by hand because they carry
32+
# Puppet 9 customisations that pdk-templates cannot express -- the `ruby_version`
33+
# and `additional_packages` inputs (no such keys in the templates). Leaving them
34+
# managed means the scheduled `pdk update` PR silently reverts Puppet 9 support.
35+
# acceptance_flags below is kept in step with the hand-written `flags:` -- that part
36+
# IS expressible via the template's own acceptance_flags key, so it isn't itself a
37+
# reason for unmanaged: true; these files stay unmanaged solely for ruby_version and
38+
# additional_packages. They can go back to template management once pdk-templates
39+
# supports those two inputs.
2040
.github/workflows/ci.yml:
21-
unmanaged: false
41+
unmanaged: true
42+
acceptance_flags:
43+
- '--nightly'
44+
- '--collection-platform-exclude 9:redhat-7'
45+
- '--collection-platform-exclude 9:centos-7'
46+
- '--collection-platform-exclude 9:oraclelinux-7'
47+
- '--collection-platform-exclude 9:scientific-7'
48+
- '--collection-platform-exclude 9:debian-10'
49+
- '--collection-platform-exclude 9:ubuntu-18.04'
50+
- '--collection-platform-exclude 9:ubuntu-20.04'
2251
.github/workflows/nightly.yml:
23-
unmanaged: false
52+
unmanaged: true
53+
acceptance_flags:
54+
- '--nightly'
55+
- '--collection-platform-exclude 9:redhat-7'
56+
- '--collection-platform-exclude 9:centos-7'
57+
- '--collection-platform-exclude 9:oraclelinux-7'
58+
- '--collection-platform-exclude 9:scientific-7'
59+
- '--collection-platform-exclude 9:debian-10'
60+
- '--collection-platform-exclude 9:ubuntu-18.04'
61+
- '--collection-platform-exclude 9:ubuntu-20.04'
2462
.github/workflows/release.yml:
2563
unmanaged: false
2664
.travis.yml:

‎Gemfile‎

Lines changed: 30 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ group :development do
1818
gem "json", '= 2.6.3', require: false if Gem::Requirement.create(['>= 3.2.0', '< 4.0.0']).satisfied_by?(Gem::Version.new(RUBY_VERSION.dup))
1919
gem "racc", '~> 1.4.0', require: false if Gem::Requirement.create(['>= 2.7.0', '< 3.0.0']).satisfied_by?(Gem::Version.new(RUBY_VERSION.dup))
2020
gem "deep_merge", '~> 1.2.2', require: false
21-
gem "voxpupuli-puppet-lint-plugins", '~> 5.0', require: false
21+
gem "voxpupuli-puppet-lint-plugins", '~> 7.0', require: false
2222
gem "facterdb", '~> 2.1', require: false if Gem::Requirement.create(['< 3.0.0']).satisfied_by?(Gem::Version.new(RUBY_VERSION.dup))
2323
gem "facterdb", '~> 3.0', require: false if Gem::Requirement.create(['>= 3.0.0']).satisfied_by?(Gem::Version.new(RUBY_VERSION.dup))
2424
gem "metadata-json-lint", '~> 4.0', require: false
@@ -39,12 +39,11 @@ group :development do
3939
end
4040
group :development, :release_prep do
4141
gem "puppet-strings", '~> 4.0', require: false
42-
gem "puppetlabs_spec_helper", '~> 8.0', require: false
42+
gem "puppetlabs_spec_helper", '~> 9.0', require: false
4343
gem "puppet-blacksmith", '~> 7.0', require: false
4444
end
4545
group :system_tests do
46-
gem "puppet_litmus", '~> 2.0', require: false, platforms: [:ruby, :x64_mingw] if !ENV['PUPPET_FORGE_TOKEN'].to_s.empty?
47-
gem "puppet_litmus", '~> 1.0', require: false, platforms: [:ruby, :x64_mingw] if ENV['PUPPET_FORGE_TOKEN'].to_s.empty?
46+
gem "puppet_litmus", '~> 2.8', require: false, platforms: [:ruby, :x64_mingw]
4847
gem "CFPropertyList", '< 3.0.7', require: false, platforms: [:mswin, :mingw, :x64_mingw]
4948
gem "serverspec", '~> 2.41', require: false
5049
end
@@ -61,7 +60,33 @@ hiera_version = ENV.fetch('HIERA_GEM_VERSION', nil)
6160

6261
# If PUPPET_FORGE_TOKEN is set then use authenticated source for both puppet and facter, since facter is a transitive dependency of puppet
6362
# Otherwise, do as before and use location_for to fetch gems from the default source
64-
if !ENV['PUPPET_FORGE_TOKEN'].to_s.empty?
63+
if puppet_version.to_s.match?(/\A(?:~>\s*)?(?:8\.99|9)/)
64+
# Puppet 9 (8.99.x) prereleases are served from an internal source injected via
65+
# PUPPET_GEM_SOURCE (see cat-github-actions module_ci.yml, which fetches it over
66+
# Twingate); '' is truthy in Ruby, so guard on emptiness rather than falling back
67+
# with `||`. Falls back to puppetcore for local runs without the secret.
68+
puppet9_source = ENV['PUPPET_GEM_SOURCE'].to_s.empty? ? 'https://rubygems-puppetcore.puppet.com' : ENV['PUPPET_GEM_SOURCE']
69+
if ENV['PUPPET_GEM_SOURCE'].to_s.empty?
70+
# No public source publishes an 8.99.x/9.x gem, so resolution below is certain to
71+
# fail. Say so plainly: without this, bundler reports only "Could not find gem
72+
# 'puppet (>= 8.99.0.a, < 9)'" followed by every 7.x/8.x version it did find,
73+
# which reads like a version-constraint bug rather than a missing setting.
74+
warn 'WARNING: PUPPET_GEM_SOURCE is not set, so the Puppet 9 (8.99.x) prerelease ' \
75+
"cannot be resolved (falling back to #{puppet9_source}, which does not carry it). " \
76+
'In CI this secret must be configured on the repository; see MODULES-11721.'
77+
end
78+
puppet9_req = puppet_version.to_s.match?(/\d+\.\d+\.\d/) ? [puppet_version] : ['>= 8.99.0.a', '< 9']
79+
gems['puppet'] = [*puppet9_req, { require: false, source: puppet9_source }]
80+
# Honour FACTER_GEM_VERSION when the workflow sets one (module_ci.yml passes '~> 4.10');
81+
# only fall back to a floor when it is unset. Don't hardcode a floor above the newest
82+
# published facter -- that is unsatisfiable whenever puppet9_source is the puppetcore
83+
# fallback rather than the internal prerelease source.
84+
gems['facter'] = if facter_version.to_s.empty?
85+
['>= 4.10', { require: false, source: puppet9_source }]
86+
else
87+
[facter_version, { require: false, source: puppet9_source }]
88+
end
89+
elsif !ENV['PUPPET_FORGE_TOKEN'].to_s.empty?
6590
gems['puppet'] = ['~> 8.11', { require: false, source: 'https://rubygems-puppetcore.puppet.com' }]
6691
gems['facter'] = ['~> 4.11', { require: false, source: 'https://rubygems-puppetcore.puppet.com' }]
6792
else

‎Rakefile‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
require 'bundler'
44
require 'puppet_litmus/rake_tasks' if Gem.loaded_specs.key? 'puppet_litmus'
55
require 'puppetlabs_spec_helper/rake_tasks'
6-
require 'puppet-syntax/tasks/puppet-syntax'
6+
require 'puppetlabs-syntax/tasks/puppetlabs-syntax'
77
require 'puppet-strings/tasks' if Gem.loaded_specs.key? 'puppet-strings'
88

99
PuppetLint.configuration.send('disable_relative')

‎metadata.json‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -100,7 +100,7 @@
100100
"requirements": [
101101
{
102102
"name": "puppet",
103-
"version_requirement": ">= 8.0.0 < 9.0.0"
103+
"version_requirement": ">= 8.0.0 < 10.0.0"
104104
}
105105
],
106106
"description": "Uses a combination of keytool and Ruby openssl library to manage entries in a Java keystore.",

0 commit comments

Comments
 (0)