Skip to content

Commit 090a165

Browse files
committed
(maint) update PDK to 1.8.0; update all templates
1 parent 1ff4207 commit 090a165

10 files changed

+115
-39
lines changed

Diff for: .gitattributes

+1
Original file line numberDiff line numberDiff line change
@@ -2,3 +2,4 @@
22
*.erb eol=lf
33
*.pp eol=lf
44
*.sh eol=lf
5+
*.epp eol=lf

Diff for: .gitlab-ci.yml

+2-2
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ before_script:
1616
- bundle install --without system_tests --path vendor/bundle --jobs $(nproc)
1717

1818
parallel_spec-Ruby 2.1.9-Puppet ~> 4.0:
19-
stage: syntax
19+
stage: unit
2020
image: ruby:2.1.9
2121
script:
2222
- bundle exec rake parallel_spec
@@ -32,7 +32,7 @@ syntax lint metadata_lint check:symlinks check:git_ignore check:dot_underscore c
3232
PUPPET_GEM_VERSION: '~> 5.5'
3333

3434
parallel_spec-Ruby 2.4.4-Puppet ~> 5.5:
35-
stage: syntax
35+
stage: unit
3636
image: ruby:2.4.4
3737
script:
3838
- bundle exec rake parallel_spec

Diff for: .rubocop.yml

+4
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,10 @@ Metrics/LineLength:
2020
Description: People have wide screens, use them.
2121
Max: 200
2222
Enabled: false
23+
GetText/DecorateString:
24+
Description: We don't want to decorate test output.
25+
Exclude:
26+
- spec/*
2327
RSpec/BeforeAfterAll:
2428
Description: Beware of using after(:all) as it may cause state to leak between tests.
2529
A necessary evil in acceptance testing.

Diff for: .travis.yml

+3-3
Original file line numberDiff line numberDiff line change
@@ -13,10 +13,10 @@ script:
1313
- 'bundle exec rake $CHECK'
1414
bundler_args: --without system_tests
1515
rvm:
16-
- 2.5.3
16+
- 2.5.1
1717
env:
1818
global:
19-
- PUPPET_GEM_VERSION="~> 6.0"
19+
- BEAKER_PUPPET_COLLECTION=puppet6 PUPPET_GEM_VERSION="~> 6.0"
2020
matrix:
2121
fast_finish: true
2222
include:
@@ -26,7 +26,7 @@ matrix:
2626
env: CHECK=parallel_spec
2727
-
2828
env: PUPPET_GEM_VERSION="~> 5.0" CHECK=parallel_spec
29-
rvm: 2.4.5
29+
rvm: 2.4.4
3030
-
3131
env: PUPPET_GEM_VERSION="~> 4.0" CHECK=parallel_spec
3232
rvm: 2.1.9

Diff for: Gemfile

+7-15
Original file line numberDiff line numberDiff line change
@@ -1,22 +1,15 @@
11
source ENV['GEM_SOURCE'] || 'https://rubygems.org'
22

33
def location_for(place_or_version, fake_version = nil)
4-
if place_or_version =~ %r{\A(git[:@][^#]*)#(.*)}
5-
[fake_version, { git: Regexp.last_match(1), branch: Regexp.last_match(2), require: false }].compact
6-
elsif place_or_version =~ %r{\Afile:\/\/(.*)}
7-
['>= 0', { path: File.expand_path(Regexp.last_match(1)), require: false }]
8-
else
9-
[place_or_version, { require: false }]
10-
end
11-
end
4+
git_url_regex = %r{\A(?<url>(https?|git)[:@][^#]*)(#(?<branch>.*))?}
5+
file_url_regex = %r{\Afile:\/\/(?<path>.*)}
126

13-
def gem_type(place_or_version)
14-
if place_or_version =~ %r{\Agit[:@]}
15-
:git
16-
elsif !place_or_version.nil? && place_or_version.start_with?('file:')
17-
:file
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 }]
1811
else
19-
:gem
12+
[place_or_version, { require: false }]
2013
end
2114
end
2215

@@ -47,7 +40,6 @@ group :system_tests do
4740
end
4841

4942
puppet_version = ENV['PUPPET_GEM_VERSION']
50-
puppet_type = gem_type(puppet_version)
5143
facter_version = ENV['FACTER_GEM_VERSION']
5244
hiera_version = ENV['HIERA_GEM_VERSION']
5345

Diff for: Rakefile

+70
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,76 @@
11
require 'puppetlabs_spec_helper/rake_tasks'
22
require 'puppet-syntax/tasks/puppet-syntax'
33
require 'puppet_blacksmith/rake_tasks' if Bundler.rubygems.find_name('puppet-blacksmith').any?
4+
require 'github_changelog_generator/task' if Bundler.rubygems.find_name('github_changelog_generator').any?
5+
require 'puppet-strings/tasks' if Bundler.rubygems.find_name('puppet-strings').any?
6+
7+
def changelog_user
8+
return unless Rake.application.top_level_tasks.include? "changelog"
9+
returnVal = nil || JSON.load(File.read('metadata.json'))['author']
10+
raise "unable to find the changelog_user in .sync.yml, or the author in metadata.json" if returnVal.nil?
11+
puts "GitHubChangelogGenerator user:#{returnVal}"
12+
returnVal
13+
end
14+
15+
def changelog_project
16+
return unless Rake.application.top_level_tasks.include? "changelog"
17+
returnVal = nil || JSON.load(File.read('metadata.json'))['name']
18+
raise "unable to find the changelog_project in .sync.yml or the name in metadata.json" if returnVal.nil?
19+
puts "GitHubChangelogGenerator project:#{returnVal}"
20+
returnVal
21+
end
22+
23+
def changelog_future_release
24+
return unless Rake.application.top_level_tasks.include? "changelog"
25+
returnVal = JSON.load(File.read('metadata.json'))['version']
26+
raise "unable to find the future_release (version) in metadata.json" if returnVal.nil?
27+
puts "GitHubChangelogGenerator future_release:#{returnVal}"
28+
returnVal
29+
end
430

531
PuppetLint.configuration.send('disable_relative')
632

33+
if Bundler.rubygems.find_name('github_changelog_generator').any?
34+
GitHubChangelogGenerator::RakeTask.new :changelog do |config|
35+
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?
36+
config.user = "#{changelog_user}"
37+
config.project = "#{changelog_project}"
38+
config.future_release = "#{changelog_future_release}"
39+
config.exclude_labels = ['maintenance']
40+
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)."
41+
config.add_pr_wo_labels = true
42+
config.issues = false
43+
config.merge_prefix = "### UNCATEGORIZED PRS; GO LABEL THEM"
44+
config.configure_sections = {
45+
"Changed" => {
46+
"prefix" => "### Changed",
47+
"labels" => ["backwards-incompatible"],
48+
},
49+
"Added" => {
50+
"prefix" => "### Added",
51+
"labels" => ["feature", "enhancement"],
52+
},
53+
"Fixed" => {
54+
"prefix" => "### Fixed",
55+
"labels" => ["bugfix"],
56+
},
57+
}
58+
end
59+
else
60+
desc 'Generate a Changelog from GitHub'
61+
task :changelog do
62+
raise <<EOM
63+
The changelog tasks depends on unreleased features of the github_changelog_generator gem.
64+
Please manually add it to your .sync.yml for now, and run `pdk update`:
65+
---
66+
Gemfile:
67+
optional:
68+
':development':
69+
- gem: 'github_changelog_generator'
70+
git: 'https://github.com/skywinder/github-changelog-generator'
71+
ref: '20ee04ba1234e9e83eb2ffb5056e23d641c7a018'
72+
condition: "Gem::Version.new(RUBY_VERSION.dup) >= Gem::Version.new('2.2.2')"
73+
EOM
74+
end
75+
end
76+

Diff for: appveyor.yml

+11
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,8 @@
11
---
22
version: 1.1.x.{build}
3+
branches:
4+
only:
5+
- master
36
skip_commits:
47
message: /^\(?doc\)?.*/
58
clone_depth: 10
@@ -30,6 +33,14 @@ environment:
3033
PUPPET_GEM_VERSION: ~> 5.0
3134
RUBY_VERSION: 24-x64
3235
CHECK: parallel_spec
36+
-
37+
PUPPET_GEM_VERSION: ~> 6.0
38+
RUBY_VERSION: 25
39+
CHECK: parallel_spec
40+
-
41+
PUPPET_GEM_VERSION: ~> 6.0
42+
RUBY_VERSION: 25-x64
43+
CHECK: parallel_spec
3344
matrix:
3445
fast_finish: true
3546
install:

Diff for: metadata.json

+3-3
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@
6060
"version_requirement": ">= 6.0.0 < 7.0.0"
6161
}
6262
],
63-
"pdk-version": "1.6.0",
63+
"pdk-version": "1.8.0",
6464
"template-url": "file:///opt/puppetlabs/pdk/share/cache/pdk-templates.git",
65-
"template-ref": "1.6.0-0-gf5564c0"
66-
}
65+
"template-ref": "1.8.0-0-g0d9da00"
66+
}

Diff for: spec/default_facts.yml

-1
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@
22
#
33
# Facts specified here will override the values provided by rspec-puppet-facts.
44
---
5-
concat_basedir: "/tmp"
65
ipaddress: "172.16.254.254"
76
is_pe: false
87
macaddress: "AA:AA:AA:AA:AA:AA"

Diff for: spec/spec_helper.rb

+14-15
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,7 @@
1-
21
require 'puppetlabs_spec_helper/module_spec_helper'
32
require 'rspec-puppet-facts'
43

5-
begin
6-
require 'spec_helper_local' if File.file?(File.join(File.dirname(__FILE__), 'spec_helper_local.rb'))
7-
rescue LoadError => loaderror
8-
warn "Could not require spec_helper_local: #{loaderror.message}"
9-
end
4+
require 'spec_helper_local' if File.file?(File.join(File.dirname(__FILE__), 'spec_helper_local.rb'))
105

116
include RspecPuppetFacts
127

@@ -15,15 +10,19 @@
1510
facterversion: Facter.version,
1611
}
1712

18-
default_facts_path = File.expand_path(File.join(File.dirname(__FILE__), 'default_facts.yml'))
19-
default_module_facts_path = File.expand_path(File.join(File.dirname(__FILE__), 'default_module_facts.yml'))
13+
default_fact_files = [
14+
File.expand_path(File.join(File.dirname(__FILE__), 'default_facts.yml')),
15+
File.expand_path(File.join(File.dirname(__FILE__), 'default_module_facts.yml')),
16+
]
2017

21-
if File.exist?(default_facts_path) && File.readable?(default_facts_path)
22-
default_facts.merge!(YAML.safe_load(File.read(default_facts_path)))
23-
end
18+
default_fact_files.each do |f|
19+
next unless File.exist?(f) && File.readable?(f) && File.size?(f)
2420

25-
if File.exist?(default_module_facts_path) && File.readable?(default_module_facts_path)
26-
default_facts.merge!(YAML.safe_load(File.read(default_module_facts_path)))
21+
begin
22+
default_facts.merge!(YAML.safe_load(File.read(f)))
23+
rescue => e
24+
RSpec.configuration.reporter.message "WARNING: Unable to load #{f}: #{e}"
25+
end
2726
end
2827

2928
RSpec.configure do |c|
@@ -37,8 +36,8 @@
3736

3837
def ensure_module_defined(module_name)
3938
module_name.split('::').reduce(Object) do |last_module, next_module|
40-
last_module.const_set(next_module, Module.new) unless last_module.const_defined?(next_module)
41-
last_module.const_get(next_module)
39+
last_module.const_set(next_module, Module.new) unless last_module.const_defined?(next_module, false)
40+
last_module.const_get(next_module, false)
4241
end
4342
end
4443

0 commit comments

Comments
 (0)