Skip to content

Commit 18f83c4

Browse files
authored
Merge pull request #734 from puppetlabs/CAT-2383-Puppetcore_upgrade
(CAT-2383) PDK update for puppetcore changes
2 parents f75d36c + 2bebd01 commit 18f83c4

File tree

15 files changed

+67
-305
lines changed

15 files changed

+67
-305
lines changed

.fixtures.yml

Lines changed: 1 addition & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -4,15 +4,7 @@ fixtures:
44
facts: 'https://github.com/puppetlabs/puppetlabs-facts.git'
55
"stdlib": "https://github.com/puppetlabs/puppetlabs-stdlib.git"
66
provision: "https://github.com/puppetlabs/provision.git"
7-
puppet_agent:
8-
repo: 'https://github.com/puppetlabs/puppetlabs-puppet_agent.git'
9-
ref: v4.25.0
10-
package: "https://github.com/puppetlabs/puppetlabs-package.git"
11-
deploy_pe: "https://github.com/jarretlavallee/puppet-deploy_pe"
12-
sign_cert: "https://github.com/m0dular/sign_cert"
13-
ruby_task_helper: "https://[email protected]/puppetlabs/puppetlabs-ruby_task_helper"
14-
bootstrap: "https://github.com/puppetlabs/puppetlabs-bootstrap"
15-
puppet_conf: "https://github.com/puppetlabs/puppetlabs-puppet_conf"
7+
puppet_agent: "https://github.com/puppetlabs/puppetlabs-puppet_agent.git"
168
symlinks:
179
"ntp": "#{source_dir}"
1810
"my_ntp": "#{source_dir}/spec/fixtures/my_ntp"

.github/workflows/ci.yml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,12 +11,13 @@ jobs:
1111
uses: "puppetlabs/cat-github-actions/.github/workflows/module_ci.yml@main"
1212
with:
1313
runs_on: "ubuntu-24.04"
14+
flags: "--nightly"
1415
secrets: "inherit"
1516

1617
Acceptance:
1718
needs: Spec
1819
uses: "puppetlabs/cat-github-actions/.github/workflows/module_acceptance.yml@main"
1920
with:
2021
runs_on: "ubuntu-24.04"
21-
flags: "--nightly"
22+
flags: "--nightly --platform-exclude centos-7 --platform-exclude oraclelinux-7 --platform-exclude scientific-7"
2223
secrets: "inherit"

.github/workflows/integration_test.yml

Lines changed: 0 additions & 107 deletions
This file was deleted.

.github/workflows/nightly.yml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,14 +10,15 @@ jobs:
1010
uses: "puppetlabs/cat-github-actions/.github/workflows/module_ci.yml@main"
1111
with:
1212
runs_on: "ubuntu-24.04"
13+
flags: "--nightly"
1314
secrets: "inherit"
1415

1516
Acceptance:
1617
needs: Spec
1718
uses: "puppetlabs/cat-github-actions/.github/workflows/module_acceptance.yml@main"
1819
with:
1920
runs_on: "ubuntu-24.04"
20-
flags: "--nightly"
21+
flags: "--nightly --platform-exclude centos-7 --platform-exclude oraclelinux-7 --platform-exclude scientific-7"
2122
secrets: "inherit"
2223

2324
Integration:

.puppet-lint.rc

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1 +1,9 @@
1+
--fail-on-warnings
12
--relative
3+
--no-80chars-check
4+
--no-140chars-check
5+
--no-class_inherits_from_params_class-check
6+
--no-autoloader_layout-check
7+
--no-documentation-check
8+
--no-single_quote_string_with_variables-check
9+
--ignore-paths=.vendor/**/*.pp,.bundle/**/*.pp,pkg/**/*.pp,spec/**/*.pp,tests/**/*.pp,types/**/*.pp,vendor/**/*.pp

.rubocop.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ require:
55
AllCops:
66
NewCops: enable
77
DisplayCopNames: true
8-
TargetRubyVersion: '2.6'
8+
TargetRubyVersion: 3.1
99
Include:
1010
- "**/*.rb"
1111
Exclude:

.sync.yml

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -13,15 +13,6 @@ Gemfile:
1313
version: '= 1.15.2'
1414
Rakefile:
1515
changelog_user: puppetlabs
16-
extras:
17-
- |
18-
require 'rspec/core/rake_task'
19-
namespace :ntp do
20-
RSpec::Core::RakeTask.new(:integration) do |t|
21-
t.pattern = 'spec/acceptance/**{,/*/**}/*_spec.rb'
22-
t.rspec_opts = "--tag integration"
23-
end
24-
end
2516
spec/spec_helper.rb:
2617
mock_with: ":rspec"
2718
coverage_report: true

Gemfile

Lines changed: 43 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -1,22 +1,41 @@
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
17-
gem "json", '= 2.1.0', require: false if Gem::Requirement.create(['>= 2.5.0', '< 2.7.0']).satisfied_by?(Gem::Version.new(RUBY_VERSION.dup))
18-
gem "json", '= 2.3.0', require: false if Gem::Requirement.create(['>= 2.7.0', '< 3.0.0']).satisfied_by?(Gem::Version.new(RUBY_VERSION.dup))
19-
gem "json", '= 2.5.1', require: false if Gem::Requirement.create(['>= 3.0.0', '< 3.0.5']).satisfied_by?(Gem::Version.new(RUBY_VERSION.dup))
2039
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))
2140
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))
2241
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))
@@ -43,6 +62,7 @@ end
4362
group :development, :release_prep do
4463
gem "puppet-strings", '~> 4.0', require: false
4564
gem "puppetlabs_spec_helper", '~> 8.0', require: false
65+
gem "puppet-blacksmith", '~> 7.0', require: false
4666
end
4767
group :system_tests do
4868
gem "puppet_litmus", '~> 2.0', require: false, platforms: [:ruby, :x64_mingw] if !ENV['PUPPET_FORGE_TOKEN'].to_s.empty?
@@ -51,41 +71,32 @@ group :system_tests do
5171
gem "serverspec", '~> 2.41', require: false
5272
end
5373

54-
puppet_version = ENV['PUPPET_GEM_VERSION']
55-
facter_version = ENV['FACTER_GEM_VERSION']
56-
hiera_version = ENV['HIERA_GEM_VERSION']
57-
5874
gems = {}
59-
6075
puppet_version = ENV.fetch('PUPPET_GEM_VERSION', nil)
6176
facter_version = ENV.fetch('FACTER_GEM_VERSION', nil)
6277
hiera_version = ENV.fetch('HIERA_GEM_VERSION', nil)
6378

64-
# If PUPPET_FORGE_TOKEN is set then use authenticated source for both puppet and facter, since facter is a transitive dependency of puppet
65-
# Otherwise, do as before and use location_for to fetch gems from the default source
66-
if !ENV['PUPPET_FORGE_TOKEN'].to_s.empty?
67-
gems['puppet'] = ['~> 8.11', { require: false, source: 'https://rubygems-puppetcore.puppet.com' }]
68-
gems['facter'] = ['~> 4.11', { require: false, source: 'https://rubygems-puppetcore.puppet.com' }]
69-
else
70-
gems['puppet'] = location_for(puppet_version)
71-
gems['facter'] = location_for(facter_version) if facter_version
72-
end
73-
74-
gems['hiera'] = location_for(hiera_version) if hiera_version
79+
gems['puppet'] = location_for(puppet_version, nil, { source: gemsource_puppetcore })
80+
gems['facter'] = location_for(facter_version, nil, { source: gemsource_puppetcore })
81+
gems['hiera'] = location_for(hiera_version, nil, {}) if hiera_version
7582

83+
# Generate the gem definitions
84+
print_gem_statement_for(gems) if ENV['DEBUG']
7685
gems.each do |gem_name, gem_params|
7786
gem gem_name, *gem_params
7887
end
7988

8089
# Evaluate Gemfile.local and ~/.gemfile if they exist
8190
extra_gemfiles = [
8291
"#{__FILE__}.local",
83-
File.join(Dir.home, '.gemfile'),
92+
File.join(Dir.home, '.gemfile')
8493
]
8594

8695
extra_gemfiles.each do |gemfile|
87-
if File.file?(gemfile) && File.readable?(gemfile)
88-
eval(File.read(gemfile), binding)
89-
end
96+
next unless File.file?(gemfile) && File.readable?(gemfile)
97+
98+
# rubocop:disable Security/Eval
99+
eval(File.read(gemfile), binding)
100+
# rubocop:enable Security/Eval
90101
end
91102
# vim: syntax=ruby

Rakefile

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -7,11 +7,11 @@ require 'puppet-syntax/tasks/puppet-syntax'
77
require 'puppet-strings/tasks' if Gem.loaded_specs.key? 'puppet-strings'
88

99
PuppetLint.configuration.send('disable_relative')
10-
11-
require 'rspec/core/rake_task'
12-
namespace :ntp do
13-
RSpec::Core::RakeTask.new(:integration) do |t|
14-
t.pattern = 'spec/acceptance/**{,/*/**}/*_spec.rb'
15-
t.rspec_opts = "--tag integration"
16-
end
17-
end
10+
PuppetLint.configuration.send('disable_80chars')
11+
PuppetLint.configuration.send('disable_140chars')
12+
PuppetLint.configuration.send('disable_class_inherits_from_params_class')
13+
PuppetLint.configuration.send('disable_autoloader_layout')
14+
PuppetLint.configuration.send('disable_documentation')
15+
PuppetLint.configuration.send('disable_single_quote_string_with_variables')
16+
PuppetLint.configuration.fail_on_warnings = true
17+
PuppetLint.configuration.ignore_paths = [".vendor/**/*.pp", ".bundle/**/*.pp", "pkg/**/*.pp", "spec/**/*.pp", "tests/**/*.pp", "types/**/*.pp", "vendor/**/*.pp"]

metadata.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -83,6 +83,6 @@
8383
],
8484
"description": "NTP Module for Debian, Ubuntu, CentOS, RHEL, OEL, Fedora, FreeBSD, ArchLinux, Amazon Linux and Gentoo.",
8585
"template-url": "https://github.com/puppetlabs/pdk-templates.git#main",
86-
"template-ref": "tags/3.2.0.4-0-g5d17ec1",
87-
"pdk-version": "3.2.0"
86+
"template-ref": "heads/main-0-g9d5b193",
87+
"pdk-version": "3.5.0"
8888
}

0 commit comments

Comments
 (0)