Skip to content

Commit 5213ae0

Browse files
Merge pull request #234 from puppetlabs/CAT-2455-Puppetcore_upgrade
(CAT-2455) Puppetcore upgrade
2 parents 49fe689 + 5437e56 commit 5213ae0

File tree

6 files changed

+92
-85
lines changed

6 files changed

+92
-85
lines changed

.github/workflows/ci.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,4 +14,6 @@ jobs:
1414
Acceptance:
1515
needs: Spec
1616
uses: "puppetlabs/cat-github-actions/.github/workflows/module_acceptance.yml@main"
17+
with:
18+
flags: "--latest-agent"
1719
secrets: "inherit"

.github/workflows/nightly.yml

Lines changed: 2 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -13,24 +13,6 @@ jobs:
1313
Acceptance:
1414
needs: Spec
1515
uses: "puppetlabs/cat-github-actions/.github/workflows/module_acceptance.yml@main"
16+
with:
17+
flags: "--latest-agent"
1618
secrets: "inherit"
17-
18-
on-failure-workflow-restarter-proxy:
19-
# (1) run this job after the "acceptance" job and...
20-
needs: [Acceptance, Spec]
21-
# (2) continue ONLY IF "acceptance" fails
22-
if: always() && needs.Acceptance.result == 'failure' || needs.Spec.result == 'failure'
23-
runs-on: ubuntu-latest
24-
steps:
25-
# (3) checkout this repository in order to "see" the following custom action
26-
- name: Checkout repository
27-
uses: actions/checkout@v4
28-
29-
# (4) "use" the custom action to retrigger the failed "acceptance job" above
30-
- name: Trigger reusable workflow
31-
uses: "puppetlabs/cat-github-actions/.github/actions/workflow-restarter-proxy@main"
32-
env:
33-
SOURCE_GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
34-
with:
35-
repository: ${{ github.repository }}
36-
run_id: ${{ github.run_id }}

.rubocop.yml

Lines changed: 31 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,16 @@
11
---
22
inherit_from: .rubocop_todo.yml
33

4-
plugins:
5-
- rubocop-rspec
6-
- rubocop-rspec_rails
7-
- rubocop-performance
8-
- rubocop-factory_bot
9-
- rubocop-capybara
4+
plugins:
5+
- rubocop-performance
6+
- rubocop-rspec
7+
- rubocop-rspec_rails
8+
- rubocop-factory_bot
9+
- rubocop-capybara
1010
AllCops:
1111
NewCops: enable
1212
DisplayCopNames: true
13-
TargetRubyVersion: '3.1'
13+
TargetRubyVersion: 3.1
1414
Include:
1515
- "**/*.rb"
1616
Exclude:
@@ -125,6 +125,12 @@ Capybara/CurrentPathExpectation:
125125
Enabled: false
126126
Capybara/VisibilityMatcher:
127127
Enabled: false
128+
FactoryBot/AttributeDefinedStatically:
129+
Enabled: false
130+
FactoryBot/CreateList:
131+
Enabled: false
132+
FactoryBot/FactoryClassName:
133+
Enabled: false
128134
Gemspec/DuplicatedAssignment:
129135
Enabled: false
130136
Gemspec/OrderedDependencies:
@@ -299,8 +305,6 @@ Performance/UriDefaultParser:
299305
Enabled: false
300306
RSpec/Be:
301307
Enabled: false
302-
RSpec/Dialect:
303-
Enabled: false
304308
RSpec/ContainExactly:
305309
Enabled: false
306310
RSpec/ContextMethod:
@@ -309,6 +313,8 @@ RSpec/ContextWording:
309313
Enabled: false
310314
RSpec/DescribeClass:
311315
Enabled: false
316+
RSpec/Dialect:
317+
Enabled: false
312318
RSpec/EmptyHook:
313319
Enabled: false
314320
RSpec/EmptyLineAfterExample:
@@ -325,12 +331,6 @@ RSpec/ExpectChange:
325331
Enabled: false
326332
RSpec/ExpectInHook:
327333
Enabled: false
328-
FactoryBot/AttributeDefinedStatically:
329-
Enabled: false
330-
FactoryBot/CreateList:
331-
Enabled: false
332-
FactoryBot/FactoryClassName:
333-
Enabled: false
334334
RSpec/HooksBeforeExamples:
335335
Enabled: false
336336
RSpec/ImplicitBlockExpectation:
@@ -505,6 +505,12 @@ Capybara/SpecificFinders:
505505
Enabled: false
506506
Capybara/SpecificMatcher:
507507
Enabled: false
508+
FactoryBot/ConsistentParenthesesStyle:
509+
Enabled: false
510+
FactoryBot/FactoryNameStyle:
511+
Enabled: false
512+
FactoryBot/SyntaxMethods:
513+
Enabled: false
508514
Gemspec/DeprecatedAttributeAssignment:
509515
Enabled: false
510516
Gemspec/DevelopmentDependencies:
@@ -605,28 +611,12 @@ RSpec/DuplicatedMetadata:
605611
Enabled: false
606612
RSpec/ExcessiveDocstringSpacing:
607613
Enabled: false
608-
FactoryBot/ConsistentParenthesesStyle:
609-
Enabled: false
610-
FactoryBot/FactoryNameStyle:
611-
Enabled: false
612-
FactoryBot/SyntaxMethods:
613-
Enabled: false
614614
RSpec/IdenticalEqualityAssertion:
615615
Enabled: false
616616
RSpec/NoExpectationExample:
617617
Enabled: false
618618
RSpec/PendingWithoutReason:
619619
Enabled: false
620-
RSpecRails/AvoidSetupHook:
621-
Enabled: false
622-
RSpecRails/HaveHttpStatus:
623-
Enabled: false
624-
RSpecRails/InferredSpecType:
625-
Enabled: false
626-
RSpecRails/MinitestAssertions:
627-
Enabled: false
628-
RSpecRails/TravelAround:
629-
Enabled: false
630620
RSpec/RedundantAround:
631621
Enabled: false
632622
RSpec/SkipBlockInsideExample:
@@ -637,6 +627,16 @@ RSpec/SubjectDeclaration:
637627
Enabled: false
638628
RSpec/VerifiedDoubleReference:
639629
Enabled: false
630+
RSpecRails/AvoidSetupHook:
631+
Enabled: false
632+
RSpecRails/HaveHttpStatus:
633+
Enabled: false
634+
RSpecRails/InferredSpecType:
635+
Enabled: false
636+
RSpecRails/MinitestAssertions:
637+
Enabled: false
638+
RSpecRails/TravelAround:
639+
Enabled: false
640640
Security/CompoundHash:
641641
Enabled: false
642642
Security/IoMethods:

.rubocop_todo.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# This configuration was generated by
22
# `rubocop --auto-gen-config`
3-
# on 2025-09-30 14:23:25 UTC using RuboCop version 1.73.2.
3+
# on 2025-10-01 08:51:22 UTC using RuboCop version 1.73.2.
44
# The point is for the user to remove these configuration records
55
# one by one as the offenses are removed from the code base.
66
# Note that changes in the inspected code, or installation of new

Gemfile

Lines changed: 54 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -1,39 +1,65 @@
1-
source ENV['GEM_SOURCE'] || 'https://rubygems.org'
1+
# frozen_string_literal: true
22

3-
def location_for(place_or_version, fake_version = nil)
4-
git_url_regex = %r{\A(?<url>(https?|git)[:@][^#]*)(#(?<branch>.*))?}
5-
file_url_regex = %r{\Afile:\/\/(?<path>.*)}
3+
# For puppetcore, set GEM_SOURCE_PUPPETCORE = 'https://rubygems-puppetcore.puppet.com'
4+
gemsource_default = ENV['GEM_SOURCE'] || 'https://rubygems.org'
5+
gemsource_puppetcore = if ENV['PUPPET_FORGE_TOKEN']
6+
'https://rubygems-puppetcore.puppet.com'
7+
else
8+
ENV['GEM_SOURCE_PUPPETCORE'] || gemsource_default
9+
end
10+
source gemsource_default
11+
12+
def location_for(place_or_constraint, fake_constraint = nil, opts = {})
13+
git_url_regex = /\A(?<url>(?:https?|git)[:@][^#]*)(?:#(?<branch>.*))?/
14+
file_url_regex = %r{\Afile://(?<path>.*)}
15+
16+
if place_or_constraint && (git_url = place_or_constraint.match(git_url_regex))
17+
# Git source → ignore :source, keep fake_constraint
18+
[fake_constraint, { git: git_url[:url], branch: git_url[:branch], require: false }].compact
19+
20+
elsif place_or_constraint && (file_url = place_or_constraint.match(file_url_regex))
21+
# File source → ignore :source, keep fake_constraint or default >= 0
22+
[fake_constraint || '>= 0', { path: File.expand_path(file_url[:path]), require: false }]
623

7-
if place_or_version && (git_url = place_or_version.match(git_url_regex))
8-
[fake_version, { git: git_url[:url], branch: git_url[:branch], require: false }].compact
9-
elsif place_or_version && (file_url = place_or_version.match(file_url_regex))
10-
['>= 0', { path: File.expand_path(file_url[:path]), require: false }]
1124
else
12-
[place_or_version, { require: false }]
25+
# Plain version constraint → merge opts (including :source if provided)
26+
[place_or_constraint, { require: false }.merge(opts)]
27+
end
28+
end
29+
30+
# Print debug information if DEBUG_GEMS or VERBOSE is set
31+
def print_gem_statement_for(gems)
32+
puts 'DEBUG: Gem definitions that will be generated:'
33+
gems.each do |gem_name, gem_params|
34+
puts "DEBUG: gem #{([gem_name.inspect] + gem_params.map(&:inspect)).join(', ')}"
1335
end
1436
end
1537

1638
group :development do
1739
gem "json", '= 2.6.1', require: false if Gem::Requirement.create(['>= 3.1.0', '< 3.1.3']).satisfied_by?(Gem::Version.new(RUBY_VERSION.dup))
1840
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))
41+
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))
1942
gem "deep_merge", '~> 1.2.2', require: false
2043
gem "voxpupuli-puppet-lint-plugins", '~> 5.0', require: false
21-
gem "facterdb", '~> 3.0', require: false
44+
gem "facterdb", '~> 2.1', require: false if Gem::Requirement.create(['< 3.0.0']).satisfied_by?(Gem::Version.new(RUBY_VERSION.dup))
45+
gem "facterdb", '~> 3.0', require: false if Gem::Requirement.create(['>= 3.0.0']).satisfied_by?(Gem::Version.new(RUBY_VERSION.dup))
2246
gem "metadata-json-lint", '~> 4.0', require: false
2347
gem "json-schema", '< 5.1.1', require: false
24-
gem "rspec-puppet-facts", '~> 5.0', require: false
48+
gem "rspec-puppet-facts", '~> 4.0', require: false if Gem::Requirement.create(['< 3.0.0']).satisfied_by?(Gem::Version.new(RUBY_VERSION.dup))
49+
gem "rspec-puppet-facts", '~> 5.0', require: false if Gem::Requirement.create(['>= 3.0.0']).satisfied_by?(Gem::Version.new(RUBY_VERSION.dup))
2550
gem "dependency_checker", '~> 1.0.0', require: false
2651
gem "parallel_tests", '= 3.12.1', require: false
2752
gem "pry", '~> 0.10', require: false
2853
gem "simplecov-console", '~> 0.9', require: false
29-
gem "puppet-debugger", '~> 1.0', require: false
54+
gem "puppet-debugger", '~> 1.6', require: false
3055
gem "rubocop", '~> 1.73.0', require: false
3156
gem "rubocop-performance", '~> 1.24.0', require: false
3257
gem "rubocop-rspec", '~> 3.5.0', require: false
33-
gem 'rubocop-rspec_rails', '~> 2.31.0', require: false
34-
gem 'rubocop-factory_bot', '~> 2.27.0', require: false
35-
gem 'rubocop-capybara', '~> 2.22.0', require: false
58+
gem "rubocop-rspec_rails", '~> 2.31.0', require: false
59+
gem "rubocop-factory_bot", '~> 2.27.0', require: false
60+
gem "rubocop-capybara", '~> 2.22.0', require: false
3661
gem "rb-readline", '= 0.5.5', require: false, platforms: [:mswin, :mingw, :x64_mingw]
62+
gem "bigdecimal", '< 3.2.2', require: false, platforms: [:mswin, :mingw, :x64_mingw]
3763
gem "github_changelog_generator", require: false
3864
gem "ruby-pwsh", require: false
3965
end
@@ -43,7 +69,8 @@ group :development, :release_prep do
4369
gem "puppet-blacksmith", '~> 7.0', require: false
4470
end
4571
group :system_tests do
46-
gem "puppet_litmus", '~> 1.0', require: false, platforms: [:ruby, :x64_mingw]
72+
gem "puppet_litmus", '~> 2.0', require: false, platforms: [:ruby, :x64_mingw] if !ENV['PUPPET_FORGE_TOKEN'].to_s.empty?
73+
gem "puppet_litmus", '~> 1.0', require: false, platforms: [:ruby, :x64_mingw] if ENV['PUPPET_FORGE_TOKEN'].to_s.empty?
4774
gem "CFPropertyList", '< 3.0.7', require: false, platforms: [:mswin, :mingw, :x64_mingw]
4875
gem "serverspec", '~> 2.41', require: false
4976
end
@@ -53,31 +80,27 @@ puppet_version = ENV.fetch('PUPPET_GEM_VERSION', nil)
5380
facter_version = ENV.fetch('FACTER_GEM_VERSION', nil)
5481
hiera_version = ENV.fetch('HIERA_GEM_VERSION', nil)
5582

56-
# If PUPPET_FORGE_TOKEN is set then use authenticated source for both puppet and facter, since facter is a transitive dependency of puppet
57-
# Otherwise, do as before and use location_for to fetch gems from the default source
58-
if !ENV['PUPPET_FORGE_TOKEN'].to_s.empty?
59-
gems['puppet'] = ['~> 8.11', { require: false, source: 'https://rubygems-puppetcore.puppet.com' }]
60-
gems['facter'] = ['~> 4.11', { require: false, source: 'https://rubygems-puppetcore.puppet.com' }]
61-
else
62-
gems['puppet'] = location_for(puppet_version)
63-
gems['facter'] = location_for(facter_version) if facter_version
64-
end
65-
66-
gems['hiera'] = location_for(hiera_version) if hiera_version
83+
gems['puppet'] = location_for(puppet_version, nil, { source: gemsource_puppetcore })
84+
gems['facter'] = location_for(facter_version, nil, { source: gemsource_puppetcore })
85+
gems['hiera'] = location_for(hiera_version, nil, {}) if hiera_version
6786

87+
# Generate the gem definitions
88+
print_gem_statement_for(gems) if ENV['DEBUG']
6889
gems.each do |gem_name, gem_params|
6990
gem gem_name, *gem_params
7091
end
7192

7293
# Evaluate Gemfile.local and ~/.gemfile if they exist
7394
extra_gemfiles = [
7495
"#{__FILE__}.local",
75-
File.join(Dir.home, '.gemfile'),
96+
File.join(Dir.home, '.gemfile')
7697
]
7798

7899
extra_gemfiles.each do |gemfile|
79-
if File.file?(gemfile) && File.readable?(gemfile)
80-
eval(File.read(gemfile), binding)
81-
end
100+
next unless File.file?(gemfile) && File.readable?(gemfile)
101+
102+
# rubocop:disable Security/Eval
103+
eval(File.read(gemfile), binding)
104+
# rubocop:enable Security/Eval
82105
end
83106
# vim: syntax=ruby

metadata.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@
4141
"desired-state-configuration",
4242
"dsc"
4343
],
44-
"pdk-version": "3.4.0",
44+
"pdk-version": "3.5.0",
4545
"template-url": "https://github.com/puppetlabs/pdk-templates#main",
46-
"template-ref": "heads/main-0-g1a55f8d"
46+
"template-ref": "heads/main-0-g5c7dd04"
4747
}

0 commit comments

Comments
 (0)