From 6816d6726d5c55354a117251d5502894d4c01ac9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Romain=20Tarti=C3=A8re?= Date: Tue, 27 Jun 2023 08:26:24 -1000 Subject: [PATCH] Sync with Vox Pupuli Sync our config with the one from Vox Pupuli which has support for running CI against Puppet 8. --- config_defaults.yml | 52 +++++++++++---- moduleroot/.github/workflows/ci.yml.erb | 10 +-- moduleroot/.github/workflows/release.yml.erb | 3 - moduleroot/.gitignore.erb | 36 +++++------ moduleroot/.msync.yml.erb | 2 +- moduleroot/.pmtignore.erb | 64 +++++++++---------- moduleroot/.rubocop.yml.erb | 12 ++-- moduleroot/Gemfile.erb | 2 +- moduleroot/Rakefile.erb | 39 ++--------- moduleroot/spec/spec_helper.rb.erb | 4 ++ moduleroot/spec/spec_helper_acceptance.rb.erb | 4 +- 11 files changed, 119 insertions(+), 109 deletions(-) diff --git a/config_defaults.yml b/config_defaults.yml index cad772fe..7edebe30 100644 --- a/config_defaults.yml +++ b/config_defaults.yml @@ -9,40 +9,41 @@ .github/SECURITY.md: delete: true .github/workflows/ci.yml: - beaker_fact_matrix: {} excludes: [] pidfile_workaround: false - timeout_minutes: 40 + additional_packages: '' + acceptance_tests: true +# PDK creates this +.github/workflows/puppet-lint.yml: + delete: true .travis.yml: delete: true Jenkinsfile: delete: true Gemfile: - puppet_version: '>= 6.0' + puppet_version: '~> 7.24' required: ':test': - gem: voxpupuli-test - version: '~> 5.0' + version: '~> 6.0' - gem: coveralls - gem: simplecov-console - gem: puppet_metadata - version: '~> 1.0' + version: '~> 3.0' ':development': - gem: guard-rake - gem: overcommit version: '>= 0.39.1' ':system_tests': - gem: voxpupuli-acceptance - version: '~> 1.0' + version: '~> 2.0' ':release': - gem: github_changelog_generator version: '>= 1.16.1' - ruby-version: '2.5' - ruby-operator: '>=' - gem: voxpupuli-release - version: '>= 1.2.0' - - gem: puppet-strings - version: '>= 2.2' + version: '~> 3.0' + - gem: faraday-retry + version: '~> 2.1' Rakefile: config.user: ccin2p3 puppet_strings_patterns: [] @@ -61,6 +62,8 @@ spec/default_facts.yml: delete: true spec/classes/coverage_spec.rb: delete: true +spec/acceptance/nodesets/default.yml: + delete: true spec/acceptance/nodesets/archlinux-2-x64.yml: delete: true spec/acceptance/nodesets/centos-511-x64.yml: @@ -89,6 +92,16 @@ spec/acceptance/nodesets/fedora-26-x64.yml: delete: true spec/acceptance/nodesets/fedora-27-x64.yml: delete: true +spec/acceptance/nodesets/debian-7-x64.yml: + delete: true +spec/acceptance/nodesets/debian-8-x64.yml: + delete: true +spec/acceptance/nodesets/sles-11-x64.yml: + delete: true +spec/acceptance/nodesets/sles-12-x64.yml: + delete: true +spec/acceptance/nodesets/ubuntu-1604-x64.yml: + delete: true spec/acceptance/nodesets/ubuntu-server-1204-x64.yml: delete: true spec/acceptance/nodesets/ubuntu-server-1404-x64.yml: @@ -114,9 +127,12 @@ spec/acceptance/nodesets/ec2/ubuntu-1604-x64.yml: spec/acceptance/nodesets/ec2/windows-2016-base-x64.yml: delete: true spec/spec_helper.rb: + add_mocked_facts: true mock_with: false spec/spec_helper_acceptance.rb: unmanaged: true + configure_beaker: + modules: ':metadata' CONTRIBUTING.md: delete: true .yardopts: @@ -130,5 +146,19 @@ appveyor.yml: delete: true pdk.yaml: delete: true +.ruby-version: + delete: true +.tool-versions: + delete: true +CODE_OF_CONDUCT.md: + delete: true +.github/CODE_OF_CONDUCT.md: + delete: true +SECURITY.md: + delete: true +.github/SECURITY.md: + delete: true +Modulefile: + delete: true ... # vim: syntax=yaml diff --git a/moduleroot/.github/workflows/ci.yml.erb b/moduleroot/.github/workflows/ci.yml.erb index 83c8231e..2cfd1656 100644 --- a/moduleroot/.github/workflows/ci.yml.erb +++ b/moduleroot/.github/workflows/ci.yml.erb @@ -17,13 +17,15 @@ jobs: uses: voxpupuli/gha-puppet/.github/workflows/beaker.yml@v1 with: pidfile_workaround: '<%= @configs['pidfile_workaround'] %>' -<%- unless @configs['additional_packages'].empty? -%> - additional_packages: '<%= @configs['additional_packages'] %>' -<%- end -%> <%- else -%> uses: voxpupuli/gha-puppet/.github/workflows/basic.yml@v1 -<%- unless @configs['additional_packages'].empty? -%> +<%- if @configs.key?('rubocop') || !@configs['additional_packages'].empty? -%> with: +<%- end -%> +<%- end -%> +<%- unless @configs['additional_packages'].empty? -%> additional_packages: '<%= @configs['additional_packages'] %>' <%- end -%> +<%- if @configs.key?('rubocop') -%> + rubocop: <%= @configs['rubocop'] %> <%- end -%> diff --git a/moduleroot/.github/workflows/release.yml.erb b/moduleroot/.github/workflows/release.yml.erb index ddc6a1e3..464edae0 100644 --- a/moduleroot/.github/workflows/release.yml.erb +++ b/moduleroot/.github/workflows/release.yml.erb @@ -9,9 +9,6 @@ on: tags: - '*' -env: - BUNDLE_WITHOUT: development:test:system_tests - jobs: release: name: Release diff --git a/moduleroot/.gitignore.erb b/moduleroot/.gitignore.erb index 6e230360..df67d1dd 100644 --- a/moduleroot/.gitignore.erb +++ b/moduleroot/.gitignore.erb @@ -1,26 +1,26 @@ # Managed by modulesync - DO NOT EDIT # https://voxpupuli.org/docs/updating-files-managed-with-modulesync/ -pkg/ -Gemfile.lock -Gemfile.local -vendor/ -.vendor/ -spec/fixtures/manifests/ -spec/fixtures/modules/ -.vagrant/ -.bundle/ -.ruby-version -coverage/ -log/ -.idea/ -.dependencies/ -.librarian/ -Puppetfile.lock +/pkg/ +/Gemfile.lock +/Gemfile.local +/vendor/ +/.vendor/ +/spec/fixtures/manifests/ +/spec/fixtures/modules/ +/.vagrant/ +/.bundle/ +/.ruby-version +/coverage/ +/log/ +/.idea/ +/.dependencies/ +/.librarian/ +/Puppetfile.lock *.iml .*.sw? -.yardoc/ -Guardfile +/.yardoc/ +/Guardfile <% if ! @configs['paths'].nil? -%> <% @configs['paths'].each do |path| -%> <%= path %> diff --git a/moduleroot/.msync.yml.erb b/moduleroot/.msync.yml.erb index a83abd9b..b929160c 100644 --- a/moduleroot/.msync.yml.erb +++ b/moduleroot/.msync.yml.erb @@ -2,4 +2,4 @@ # Managed by modulesync - DO NOT EDIT # https://voxpupuli.org/docs/updating-files-managed-with-modulesync/ -modulesync_config_version: '5.1.0' +modulesync_config_version: '6.0.0' diff --git a/moduleroot/.pmtignore.erb b/moduleroot/.pmtignore.erb index 49b2fd25..71feddc9 100644 --- a/moduleroot/.pmtignore.erb +++ b/moduleroot/.pmtignore.erb @@ -1,40 +1,40 @@ # Managed by modulesync - DO NOT EDIT # https://voxpupuli.org/docs/updating-files-managed-with-modulesync/ -docs/ -pkg/ -Gemfile -Gemfile.lock -Gemfile.local -vendor/ -.vendor/ -spec/ -Rakefile -.vagrant/ -.bundle/ -.ruby-version -coverage/ -log/ -.idea/ -.dependencies/ -.github/ -.librarian/ -Puppetfile.lock +/docs/ +/pkg/ +/Gemfile +/Gemfile.lock +/Gemfile.local +/vendor/ +/.vendor/ +/spec/ +/Rakefile +/.vagrant/ +/.bundle/ +/.ruby-version +/coverage/ +/log/ +/.idea/ +/.dependencies/ +/.github/ +/.librarian/ +/Puppetfile.lock *.iml -.editorconfig -.fixtures.yml -.gitignore -.msync.yml -.overcommit.yml -.pmtignore -.rspec -.rspec_parallel -.rubocop.yml -.sync.yml +/.editorconfig +/.fixtures.yml +/.gitignore +/.msync.yml +/.overcommit.yml +/.pmtignore +/.rspec +/.rspec_parallel +/.rubocop.yml +/.sync.yml .*.sw? -.yardoc/ -.yardopts -Dockerfile +/.yardoc/ +/.yardopts +/Dockerfile <% if ! @configs['paths'].nil? -%> <% @configs['paths'].each do |path| -%> <%= path %> diff --git a/moduleroot/.rubocop.yml.erb b/moduleroot/.rubocop.yml.erb index aebb8e56..9d599663 100644 --- a/moduleroot/.rubocop.yml.erb +++ b/moduleroot/.rubocop.yml.erb @@ -2,11 +2,11 @@ # Managed by modulesync - DO NOT EDIT # https://voxpupuli.org/docs/updating-files-managed-with-modulesync/ +<% if File.exist?(File.join(@metadata[:workdir], '.rubocop_todo.yml')) -%> +inherit_from: .rubocop_todo.yml +<% end -%> inherit_gem: voxpupuli-test: rubocop.yml - -Style/TrailingCommaInArguments: - EnforcedStyleForMultiline: consistent_comma - -Style/WordArray: - EnforcedStyle: brackets +<% if @configs['extra'] -%> +<%= @configs['extra'].to_yaml.sub(/\A---\n/, '') -%> +<% end -%> diff --git a/moduleroot/Gemfile.erb b/moduleroot/Gemfile.erb index 54932525..a67b4685 100644 --- a/moduleroot/Gemfile.erb +++ b/moduleroot/Gemfile.erb @@ -1,7 +1,7 @@ # Managed by modulesync - DO NOT EDIT # https://voxpupuli.org/docs/updating-files-managed-with-modulesync/ -source ENV['GEM_SOURCE'] || "https://rubygems.org" +source ENV['GEM_SOURCE'] || 'https://rubygems.org' <% groups = {} -%> <% (@configs['required'].keys + ((@configs['optional'] || {}).keys)).uniq.each do |key| -%> diff --git a/moduleroot/Rakefile.erb b/moduleroot/Rakefile.erb index 0ffdf4e8..0f378b2c 100644 --- a/moduleroot/Rakefile.erb +++ b/moduleroot/Rakefile.erb @@ -24,6 +24,13 @@ end begin require 'voxpupuli/release/rake_tasks' rescue LoadError + # voxpupuli-release not present +else + GCGConfig.user = '<%= @configs['config.user'] || @configs[:namespace] %>' + GCGConfig.project = '<%= @configs['config.project'] || @configs[:puppet_module] %>' + <%- if @configs['config.tag_pattern'] -%> + GCGConfig.tag_pattern = '<%= @configs['config.tag_pattern'] -%>' + <%- end -%> end desc "Run main 'test' task and report merged results to coveralls" @@ -37,36 +44,4 @@ task test_with_coveralls: [:test] do end end -desc 'Generate REFERENCE.md' -task :reference, [:debug, :backtrace] do |t, args| - patterns = '<%= @configs['puppet_strings_patterns'].join(" ") %>' - Rake::Task['strings:generate:reference'].invoke(patterns, args[:debug], args[:backtrace]) -end - -begin - require 'github_changelog_generator/task' - require 'puppet_blacksmith' - GitHubChangelogGenerator::RakeTask.new :changelog do |config| - metadata = Blacksmith::Modulefile.new - config.future_release = "v#{metadata.version}" if metadata.version =~ /^\d+\.\d+.\d+$/ - config.header = "# Changelog\n\nAll notable changes to this project will be documented in this file.\nEach new release typically also includes the latest modulesync defaults.\nThese should not affect the functionality of the module." - config.exclude_labels = %w{duplicate question invalid wontfix wont-fix modulesync skip-changelog} - config.user = '<%= @configs['config.user'] -%>' - config.project = "puppet-#{metadata.metadata['name'].split('-').last}" - end - - # Workaround for https://github.com/github-changelog-generator/github-changelog-generator/issues/715 - require 'rbconfig' - if RbConfig::CONFIG['host_os'] =~ /linux/ - task :changelog do - puts 'Fixing line endings...' - changelog_file = File.join(__dir__, 'CHANGELOG.md') - changelog_txt = File.read(changelog_file) - new_contents = changelog_txt.gsub(%r{\r\n}, "\n") - File.open(changelog_file, "w") {|file| file.puts new_contents } - end - end - -rescue LoadError -end # vim: syntax=ruby diff --git a/moduleroot/spec/spec_helper.rb.erb b/moduleroot/spec/spec_helper.rb.erb index d2c508f4..f3178f75 100644 --- a/moduleroot/spec/spec_helper.rb.erb +++ b/moduleroot/spec/spec_helper.rb.erb @@ -20,6 +20,10 @@ RSpec.configure do |c| c.hiera_config = <%= @configs['hiera_config'] %> end <%- end -%> +<%- if @configs['add_mocked_facts'] -%> + +add_mocked_facts! +<%- end -%> if File.exist?(File.join(__dir__, 'default_module_facts.yml')) facts = YAML.safe_load(File.read(File.join(__dir__, 'default_module_facts.yml'))) diff --git a/moduleroot/spec/spec_helper_acceptance.rb.erb b/moduleroot/spec/spec_helper_acceptance.rb.erb index d3a6e23c..570755a6 100644 --- a/moduleroot/spec/spec_helper_acceptance.rb.erb +++ b/moduleroot/spec/spec_helper_acceptance.rb.erb @@ -5,6 +5,8 @@ require 'voxpupuli/acceptance/spec_helper_acceptance' -configure_beaker +<%- unless @configs['configure_beaker'].nil? -%> +configure_beaker(modules: <%= @configs['configure_beaker']['modules'] || ':metadata' %>) +<%- end -%> Dir['./spec/support/acceptance/**/*.rb'].sort.each { |f| require f }