From 53486982805060eacf9011a39b741a000cf5599d Mon Sep 17 00:00:00 2001 From: David Schmitt Date: Thu, 21 Nov 2019 17:17:50 +0000 Subject: [PATCH 1/5] (maint) sort and canonicalise .sync.yml --- .sync.yml | 56 ++++++++++++++++++++++++------------------------------- 1 file changed, 24 insertions(+), 32 deletions(-) diff --git a/.sync.yml b/.sync.yml index ae3b3c80..a724c008 100644 --- a/.sync.yml +++ b/.sync.yml @@ -1,38 +1,30 @@ --- +".gitlab-ci.yml": + delete: true +".rubocop.yml": + include_todos: true + selected_profile: false +".travis.yml": + unmanaged: true +appveyor.yml: + unmanaged: true Gemfile: optional: - ':development': - - gem: 'ruby-pwsh' + ":development": + - gem: ruby-pwsh required: - ':system_tests': - - gem: 'puppet-module-posix-system-r#{minor_version}' - platforms: ruby - - gem: 'puppet-module-win-system-r#{minor_version}' - platforms: - - mswin - - mingw - - x64_mingw - - gem: beaker-testmode_switcher - version: '~> 0.4' - - gem: master_manipulator - - gem: puppet-blacksmith - version: '~> 3.4' - -# For the moment don't do any rubocop checks. -.rubocop.yml: - include_todos: true - selected_profile: off - + ":system_tests": + - gem: puppet-module-posix-system-r#{minor_version} + platforms: ruby + - gem: puppet-module-win-system-r#{minor_version} + platforms: + - mswin + - mingw + - x64_mingw + - gem: beaker-testmode_switcher + version: "~> 0.4" + - gem: master_manipulator + - gem: puppet-blacksmith + version: "~> 3.4" spec/default_facts.yml: unmanaged: true - -# Due to https://github.com/puppetlabs/pdk-templates/issues/133 we can't manage Travis CI yet. -.travis.yml: - unmanaged: true - -# Due to https://github.com/puppetlabs/pdk-templates/issues/229 we can't manage Appveyor yet. -appveyor.yml: - unmanaged: true - -.gitlab-ci.yml: - delete: true From b797faa1665e8cd2a453474f2c1600d9d5641f69 Mon Sep 17 00:00:00 2001 From: David Schmitt Date: Thu, 21 Nov 2019 17:41:51 +0000 Subject: [PATCH 2/5] (maint) enable puppet coverage reports --- .sync.yml | 2 ++ spec/spec_helper.rb | 1 + 2 files changed, 3 insertions(+) diff --git a/.sync.yml b/.sync.yml index a724c008..50f0188f 100644 --- a/.sync.yml +++ b/.sync.yml @@ -28,3 +28,5 @@ Gemfile: version: "~> 3.4" spec/default_facts.yml: unmanaged: true +spec/spec_helper.rb: + coverage_report: true diff --git a/spec/spec_helper.rb b/spec/spec_helper.rb index 3ac4f0da..d650528a 100644 --- a/spec/spec_helper.rb +++ b/spec/spec_helper.rb @@ -34,6 +34,7 @@ end c.filter_run_excluding(bolt: true) unless ENV['GEM_BOLT'] c.after(:suite) do + RSpec::Puppet::Coverage.report!(0) end end From cfa79f3e72a09ed599f3314e18dde86b10d7398a Mon Sep 17 00:00:00 2001 From: David Schmitt Date: Thu, 21 Nov 2019 18:22:08 +0000 Subject: [PATCH 3/5] (maint) deploy new default_facts.yml for testing --- .sync.yml | 2 -- 1 file changed, 2 deletions(-) diff --git a/.sync.yml b/.sync.yml index 50f0188f..dbea7956 100644 --- a/.sync.yml +++ b/.sync.yml @@ -26,7 +26,5 @@ Gemfile: - gem: master_manipulator - gem: puppet-blacksmith version: "~> 3.4" -spec/default_facts.yml: - unmanaged: true spec/spec_helper.rb: coverage_report: true From a3d8bb254709c500d2d0199f3f402749d1d1d0ac Mon Sep 17 00:00:00 2001 From: David Schmitt Date: Wed, 27 Nov 2019 13:18:03 +0000 Subject: [PATCH 4/5] (maint) update appveyor and travis config for coverage and new templates Also removes obsolete gems. --- .sync.yml | 14 -------------- .travis.yml | 39 +++++++++++++++++++++------------------ Gemfile | 7 ------- appveyor.yml | 2 ++ 4 files changed, 23 insertions(+), 39 deletions(-) diff --git a/.sync.yml b/.sync.yml index dbea7956..2dff0b2d 100644 --- a/.sync.yml +++ b/.sync.yml @@ -12,19 +12,5 @@ Gemfile: optional: ":development": - gem: ruby-pwsh - required: - ":system_tests": - - gem: puppet-module-posix-system-r#{minor_version} - platforms: ruby - - gem: puppet-module-win-system-r#{minor_version} - platforms: - - mswin - - mingw - - x64_mingw - - gem: beaker-testmode_switcher - version: "~> 0.4" - - gem: master_manipulator - - gem: puppet-blacksmith - version: "~> 3.4" spec/spec_helper.rb: coverage_report: true diff --git a/.travis.yml b/.travis.yml index afa7f115..1150d515 100644 --- a/.travis.yml +++ b/.travis.yml @@ -23,34 +23,37 @@ before_install: - gem --version - bundle -v script: - - 'bundle exec rake $CHECK' + - 'SIMPLECOV=yes bundle exec rake $CHECK' bundler_args: --without system_tests rvm: - - 2.5.1 -env: - global: - - BEAKER_PUPPET_COLLECTION=puppet6 PUPPET_GEM_VERSION="~> 6.0" - - CHECK=parallel_spec + - 2.5.3 +stages: + - static + - spec + - acceptance + - + if: tag =~ ^v\d + name: deploy matrix: fast_finish: true include: - - env: CHECK="syntax lint metadata_lint check:symlinks check:git_ignore check:dot_underscore check:test_file rubocop" + env: CHECK="check:symlinks check:git_ignore check:dot_underscore check:test_file rubocop syntax lint metadata_lint" + stage: static - - env: PUPPET_GEM_VERSION="~> 5.0" - rvm: 2.4.4 + env: PUPPET_GEM_VERSION="~> 5.0" CHECK=parallel_spec + rvm: 2.4.5 + stage: spec + - + env: PUPPET_GEM_VERSION="~> 6.0" CHECK=parallel_spec + rvm: 2.5.3 + stage: spec + - + env: DEPLOY_TO_FORGE=yes + stage: deploy branches: only: - master - /^v\d/ notifications: email: false -deploy: - provider: puppetforge - user: puppet - password: - secure: "" - on: - tags: true - all_branches: true -condition: "$DEPLOY_TO_FORGE = yes" diff --git a/Gemfile b/Gemfile index e80c4710..a80bd006 100644 --- a/Gemfile +++ b/Gemfile @@ -30,13 +30,6 @@ group :development do gem "puppet-module-win-dev-r#{minor_version}", '~> 0.3', require: false, platforms: [:mswin, :mingw, :x64_mingw] gem "ruby-pwsh", require: false end -group :system_tests do - gem "puppet-module-posix-system-r#{minor_version}", require: false, platforms: [:ruby] - gem "puppet-module-win-system-r#{minor_version}", require: false, platforms: [:mswin, :mingw, :x64_mingw] - gem "beaker-testmode_switcher", '~> 0.4', require: false - gem "master_manipulator", require: false - gem "puppet-blacksmith", '~> 3.4', require: false -end puppet_version = ENV['PUPPET_GEM_VERSION'] facter_version = ENV['FACTER_GEM_VERSION'] diff --git a/appveyor.yml b/appveyor.yml index f5ede449..19ce756b 100644 --- a/appveyor.yml +++ b/appveyor.yml @@ -3,6 +3,7 @@ version: 1.1.x.{build} branches: only: - master + - release skip_commits: message: /^\(?doc\)?.*/ clone_depth: 10 @@ -13,6 +14,7 @@ init: - 'mkdir C:\ProgramData\PuppetLabs\hiera && exit 0' - 'mkdir C:\ProgramData\PuppetLabs\puppet\var && exit 0' environment: + SIMPLECOV: yes matrix: - RUBY_VERSION: 24-x64 From 125ac5ab6ea3fe6e6538edcff1a5bc99c8345881 Mon Sep 17 00:00:00 2001 From: David Schmitt Date: Wed, 27 Nov 2019 18:31:35 +0000 Subject: [PATCH 5/5] (maint) Update to PDK 1.14.1 --- .rubocop.yml | 8 ++++++++ Gemfile | 4 ++-- Rakefile | 13 +++++++++++-- metadata.json | 6 +++--- spec/default_facts.yml | 1 + spec/spec_helper.rb | 5 +++++ 6 files changed, 30 insertions(+), 7 deletions(-) diff --git a/.rubocop.yml b/.rubocop.yml index 787c09bd..0da419f6 100644 --- a/.rubocop.yml +++ b/.rubocop.yml @@ -23,6 +23,14 @@ Bundler/DuplicatedGem: Enabled: false Bundler/OrderedGems: Enabled: false +GetText/DecorateFunctionMessage: + Enabled: false +GetText/DecorateString: + Enabled: false +GetText/DecorateStringFormattingUsingInterpolation: + Enabled: false +GetText/DecorateStringFormattingUsingPercent: + Enabled: false Layout/AccessModifierIndentation: Enabled: false Layout/AlignArray: diff --git a/Gemfile b/Gemfile index a80bd006..5169c0d3 100644 --- a/Gemfile +++ b/Gemfile @@ -1,5 +1,4 @@ source ENV['GEM_SOURCE'] || 'https://rubygems.org' -gem 'pdk', git: 'https://github.com/puppetlabs/pdk.git', branch: 'master' def location_for(place_or_version, fake_version = nil) git_url_regex = %r{\A(?(https?|git)[:@][^#]*)(#(?.*))?} @@ -24,6 +23,7 @@ group :development do gem "json", '= 1.8.1', require: false if Gem::Version.new(RUBY_VERSION.dup) == Gem::Version.new('2.1.9') gem "json", '= 2.0.4', require: false if Gem::Requirement.create('~> 2.4.2').satisfied_by?(Gem::Version.new(RUBY_VERSION.dup)) 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)) + gem "rb-readline", '= 0.5.5', require: false, platforms: [:mswin, :mingw, :x64_mingw] gem "puppet-module-posix-default-r#{minor_version}", '~> 0.3', require: false, platforms: [:ruby] gem "puppet-module-posix-dev-r#{minor_version}", '~> 0.3', require: false, platforms: [:ruby] gem "puppet-module-win-default-r#{minor_version}", '~> 0.3', require: false, platforms: [:mswin, :mingw, :x64_mingw] @@ -70,4 +70,4 @@ extra_gemfiles.each do |gemfile| eval(File.read(gemfile), binding) end end -# vim: syntax=ruby \ No newline at end of file +# vim: syntax=ruby diff --git a/Rakefile b/Rakefile index d9b223c6..395df547 100644 --- a/Rakefile +++ b/Rakefile @@ -15,8 +15,17 @@ end def changelog_project return unless Rake.application.top_level_tasks.include? "changelog" - returnVal = nil || JSON.load(File.read('metadata.json'))['source'].match(%r{.*/([^/]*)})[1] - raise "unable to find the changelog_project in .sync.yml or the name in metadata.json" if returnVal.nil? + + returnVal = nil + returnVal ||= begin + metadata_source = JSON.load(File.read('metadata.json'))['source'] + metadata_source_match = metadata_source && metadata_source.match(%r{.*\/([^\/]*?)(?:\.git)?\Z}) + + metadata_source_match && metadata_source_match[1] + end + + raise "unable to find the changelog_project in .sync.yml or calculate it from the source in metadata.json" if returnVal.nil? + puts "GitHubChangelogGenerator project:#{returnVal}" returnVal end diff --git a/metadata.json b/metadata.json index 676b618f..e1c99c88 100644 --- a/metadata.json +++ b/metadata.json @@ -77,7 +77,7 @@ "version_requirement": ">= 4.7.0 < 7.0.0" } ], - "pdk-version": "1.14.0", - "template-url": "https://github.com/puppetlabs/pdk-templates#1.11.1", - "template-ref": "1.11.1-0-g2ff8c24" + "pdk-version": "1.14.1", + "template-url": "https://github.com/puppetlabs/pdk-templates#master", + "template-ref": "heads/master-0-gfaf9e8b" } diff --git a/spec/default_facts.yml b/spec/default_facts.yml index ea1e4808..f777abfc 100644 --- a/spec/default_facts.yml +++ b/spec/default_facts.yml @@ -3,5 +3,6 @@ # Facts specified here will override the values provided by rspec-puppet-facts. --- ipaddress: "172.16.254.254" +ipaddress6: "FE80:0000:0000:0000:AAAA:AAAA:AAAA" is_pe: false macaddress: "AA:AA:AA:AA:AA:AA" diff --git a/spec/spec_helper.rb b/spec/spec_helper.rb index d650528a..eab931d6 100644 --- a/spec/spec_helper.rb +++ b/spec/spec_helper.rb @@ -25,6 +25,11 @@ end end +# read default_facts and merge them over what is provided by facterdb +default_facts.each do |fact, value| + add_custom_fact fact, value +end + RSpec.configure do |c| c.default_facts = default_facts c.before :each do