Skip to content

Commit ba21588

Browse files
committed
pdk convert 3.4.0
1 parent b2cb4ab commit ba21588

File tree

9 files changed

+69
-109
lines changed

9 files changed

+69
-109
lines changed

.github/workflows/pr.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ jobs:
3939
name: 'Unit tests Legacy Puppet'
4040
runs-on: ubuntu-latest
4141
timeout-minutes: 60
42-
container: puppet/puppet-dev-tools:4.x
42+
container: puppet/pdk:3.4.0.1.55.g4519dd0
4343
steps:
4444
- uses: actions/checkout@v4
4545
- name: Run unit tests on Puppet 6

.gitignore

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,10 +19,17 @@
1919
/spec/fixtures/modules/*
2020
/tmp/
2121
/vendor/
22+
/.vendor/
2223
/convert_report.txt
2324
/update_report.txt
2425
.DS_Store
2526
.project
2627
.envrc
2728
/inventory.yaml
2829
/spec/fixtures/litmus_inventory.yaml
30+
.resource_types
31+
.modules
32+
.task_cache.json
33+
.plan_cache.json
34+
.rerun.json
35+
bolt-debug.log

.pdkignore

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,16 +19,24 @@
1919
/spec/fixtures/modules/*
2020
/tmp/
2121
/vendor/
22+
/.vendor/
2223
/convert_report.txt
2324
/update_report.txt
2425
.DS_Store
2526
.project
2627
.envrc
2728
/inventory.yaml
2829
/spec/fixtures/litmus_inventory.yaml
30+
.resource_types
31+
.modules
32+
.task_cache.json
33+
.plan_cache.json
34+
.rerun.json
35+
bolt-debug.log
2936
/.fixtures.yml
3037
/Gemfile
3138
/.gitattributes
39+
/.github/
3240
/.gitignore
3341
/.pdkignore
3442
/.puppet-lint.rc

.puppet-lint.rc

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,9 @@
1+
--fail-on-warnings
12
--relative
2-
--no-parameter_documentation-check
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

.vscode/extensions.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"recommendations": [
33
"puppet.puppet-vscode",
4-
"rebornix.Ruby"
4+
"Shopify.ruby-lsp"
55
]
66
}

Gemfile

Lines changed: 31 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -14,46 +14,53 @@ def location_for(place_or_version, fake_version = nil)
1414
end
1515

1616
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))
2017
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))
2118
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))
2219
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))
20+
gem "deep_merge", '~> 1.2.2', require: false
2321
gem "voxpupuli-puppet-lint-plugins", '~> 5.0', require: false
24-
gem "facterdb", '~> 1.18', require: false
25-
gem "metadata-json-lint", '~> 3.0', require: false
26-
gem "puppetlabs_spec_helper", '~> 6.0', require: false
27-
gem "rspec-puppet-facts", '~> 2.0', require: false
28-
gem "codecov", '~> 0.2', require: false
22+
gem "facterdb", '~> 2.1', require: false if Gem::Requirement.create(['< 3.0.0']).satisfied_by?(Gem::Version.new(RUBY_VERSION.dup))
23+
gem "facterdb", '~> 3.0', require: false if Gem::Requirement.create(['>= 3.0.0']).satisfied_by?(Gem::Version.new(RUBY_VERSION.dup))
24+
gem "metadata-json-lint", '~> 4.0', require: false
25+
gem "json-schema", '< 5.1.1', require: false
26+
gem "rspec-puppet-facts", '~> 4.0', require: false if Gem::Requirement.create(['< 3.0.0']).satisfied_by?(Gem::Version.new(RUBY_VERSION.dup))
27+
gem "rspec-puppet-facts", '~> 5.0', require: false if Gem::Requirement.create(['>= 3.0.0']).satisfied_by?(Gem::Version.new(RUBY_VERSION.dup))
2928
gem "dependency_checker", '~> 1.0.0', require: false
3029
gem "parallel_tests", '= 3.12.1', require: false
3130
gem "pry", '~> 0.10', require: false
32-
gem "simplecov-console", '~> 0.5', require: false
31+
gem "simplecov-console", '~> 0.9', require: false
3332
gem "puppet-debugger", '~> 1.0', require: false
34-
gem "rubocop", '= 1.48.1', require: false
33+
gem "rubocop", '~> 1.50.0', require: false
3534
gem "rubocop-performance", '= 1.16.0', require: false
3635
gem "rubocop-rspec", '= 2.19.0', require: false
37-
gem "puppet-strings", '~> 2.0', require: false
3836
gem "rb-readline", '= 0.5.5', require: false, platforms: [:mswin, :mingw, :x64_mingw]
3937
end
40-
#group :system_tests do
41-
# gem "puppet_litmus", '~> 1.0', require: false, platforms: [:ruby, :x64_mingw]
42-
# gem "serverspec", '~> 2.41', require: false
43-
#end
44-
45-
puppet_version = ENV['PUPPET_GEM_VERSION']
46-
facter_version = ENV['FACTER_GEM_VERSION']
47-
hiera_version = ENV['HIERA_GEM_VERSION']
38+
group :development, :release_prep do
39+
gem "puppet-strings", '~> 4.0', require: false
40+
gem "puppetlabs_spec_helper", '~> 8.0', require: false
41+
gem "puppet-blacksmith", '~> 7.0', require: false
42+
end
43+
group :system_tests do
44+
gem "puppet_litmus", '~> 1.0', require: false, platforms: [:ruby, :x64_mingw]
45+
gem "CFPropertyList", '< 3.0.7', require: false, platforms: [:mswin, :mingw, :x64_mingw]
46+
gem "serverspec", '~> 2.41', require: false
47+
end
4848

4949
gems = {}
50+
puppet_version = ENV.fetch('PUPPET_GEM_VERSION', nil)
51+
facter_version = ENV.fetch('FACTER_GEM_VERSION', nil)
52+
hiera_version = ENV.fetch('HIERA_GEM_VERSION', nil)
5053

51-
gems['puppet'] = location_for(puppet_version)
52-
53-
# If facter or hiera versions have been specified via the environment
54-
# variables
54+
# If PUPPET_FORGE_TOKEN is set then use authenticated source for both puppet and facter, since facter is a transitive dependency of puppet
55+
# Otherwise, do as before and use location_for to fetch gems from the default source
56+
if !ENV['PUPPET_FORGE_TOKEN'].to_s.empty?
57+
gems['puppet'] = ['~> 8.11', { require: false, source: 'https://rubygems-puppetcore.puppet.com' }]
58+
gems['facter'] = ['~> 4.11', { require: false, source: 'https://rubygems-puppetcore.puppet.com' }]
59+
else
60+
gems['puppet'] = location_for(puppet_version)
61+
gems['facter'] = location_for(facter_version) if facter_version
62+
end
5563

56-
gems['facter'] = location_for(facter_version) if facter_version
5764
gems['hiera'] = location_for(hiera_version) if hiera_version
5865

5966
gems.each do |gem_name, gem_params|

Rakefile

Lines changed: 8 additions & 78 deletions
Original file line numberDiff line numberDiff line change
@@ -4,85 +4,15 @@ require 'bundler'
44
require 'puppet_litmus/rake_tasks' if Gem.loaded_specs.key? 'puppet_litmus'
55
require 'puppetlabs_spec_helper/rake_tasks'
66
require 'puppet-syntax/tasks/puppet-syntax'
7-
require 'github_changelog_generator/task' if Gem.loaded_specs.key? 'github_changelog_generator'
87
require 'puppet-strings/tasks' if Gem.loaded_specs.key? 'puppet-strings'
98

10-
def changelog_user
11-
return unless Rake.application.top_level_tasks.include? "changelog"
12-
returnVal = nil || JSON.load(File.read('metadata.json'))['author']
13-
raise "unable to find the changelog_user in .sync.yml, or the author in metadata.json" if returnVal.nil?
14-
puts "GitHubChangelogGenerator user:#{returnVal}"
15-
returnVal
16-
end
17-
18-
def changelog_project
19-
return unless Rake.application.top_level_tasks.include? "changelog"
20-
21-
returnVal = nil
22-
returnVal ||= begin
23-
metadata_source = JSON.load(File.read('metadata.json'))['source']
24-
metadata_source_match = metadata_source && metadata_source.match(%r{.*\/([^\/]*?)(?:\.git)?\Z})
25-
26-
metadata_source_match && metadata_source_match[1]
27-
end
28-
29-
raise "unable to find the changelog_project in .sync.yml or calculate it from the source in metadata.json" if returnVal.nil?
30-
31-
puts "GitHubChangelogGenerator project:#{returnVal}"
32-
returnVal
33-
end
34-
35-
def changelog_future_release
36-
return unless Rake.application.top_level_tasks.include? "changelog"
37-
returnVal = "v%s" % JSON.load(File.read('metadata.json'))['version']
38-
raise "unable to find the future_release (version) in metadata.json" if returnVal.nil?
39-
puts "GitHubChangelogGenerator future_release:#{returnVal}"
40-
returnVal
41-
end
42-
439
PuppetLint.configuration.send('disable_relative')
44-
45-
46-
if Gem.loaded_specs.key? 'github_changelog_generator'
47-
GitHubChangelogGenerator::RakeTask.new :changelog do |config|
48-
raise "Set CHANGELOG_GITHUB_TOKEN environment variable eg 'export CHANGELOG_GITHUB_TOKEN=valid_token_here'" if Rake.application.top_level_tasks.include? "changelog" and ENV['CHANGELOG_GITHUB_TOKEN'].nil?
49-
config.user = "#{changelog_user}"
50-
config.project = "#{changelog_project}"
51-
config.future_release = "#{changelog_future_release}"
52-
config.exclude_labels = ['maintenance']
53-
config.header = "# Change log\n\nAll notable changes to this project will be documented in this file. The format is based on [Keep a Changelog](http://keepachangelog.com/en/1.0.0/) and this project adheres to [Semantic Versioning](http://semver.org)."
54-
config.add_pr_wo_labels = true
55-
config.issues = false
56-
config.merge_prefix = "### UNCATEGORIZED PRS; LABEL THEM ON GITHUB"
57-
config.configure_sections = {
58-
"Changed" => {
59-
"prefix" => "### Changed",
60-
"labels" => ["backwards-incompatible"],
61-
},
62-
"Added" => {
63-
"prefix" => "### Added",
64-
"labels" => ["enhancement", "feature"],
65-
},
66-
"Fixed" => {
67-
"prefix" => "### Fixed",
68-
"labels" => ["bug", "documentation", "bugfix"],
69-
},
70-
}
71-
end
72-
else
73-
desc 'Generate a Changelog from GitHub'
74-
task :changelog do
75-
raise <<EOM
76-
The changelog tasks depends on recent features of the github_changelog_generator gem.
77-
Please manually add it to your .sync.yml for now, and run `pdk update`:
78-
---
79-
Gemfile:
80-
optional:
81-
':development':
82-
- gem: 'github_changelog_generator'
83-
version: '~> 1.15'
84-
condition: "Gem::Version.new(RUBY_VERSION.dup) >= Gem::Version.new('2.3.0')"
85-
EOM
86-
end
87-
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"]
8818

metadata.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -95,7 +95,7 @@
9595
"version_requirement": ">= 7.0.0 < 9.0.0"
9696
}
9797
],
98-
"pdk-version": "3.0.0",
98+
"pdk-version": "3.4.0",
9999
"template-url": "https://github.com/puppetlabs/pdk-templates#main",
100-
"template-ref": "heads/main-0-g1cc0d22"
100+
"template-ref": "heads/main-0-g05d2de4"
101101
}

spec/spec_helper.rb

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,15 +25,16 @@
2525
next unless File.exist?(f) && File.readable?(f) && File.size?(f)
2626

2727
begin
28-
default_facts.merge!(YAML.safe_load(File.read(f), permitted_classes: [], permitted_symbols: [], aliases: true))
28+
require 'deep_merge'
29+
default_facts.deep_merge!(YAML.safe_load(File.read(f), permitted_classes: [], permitted_symbols: [], aliases: true))
2930
rescue StandardError => e
3031
RSpec.configuration.reporter.message "WARNING: Unable to load #{f}: #{e}"
3132
end
3233
end
3334

3435
# read default_facts and merge them over what is provided by facterdb
3536
default_facts.each do |fact, value|
36-
add_custom_fact fact, value
37+
add_custom_fact fact, value, merge_facts: true
3738
end
3839

3940
RSpec.configure do |c|

0 commit comments

Comments
 (0)