From 86dd9614ff033e6b735af0a6db7cbb836d5574cd Mon Sep 17 00:00:00 2001 From: Massimiliano Adamo Date: Sat, 15 Apr 2023 09:58:21 +0200 Subject: [PATCH 1/4] modulesync 5.5.0 --- .github/SECURITY.md | 3 --- .gitignore | 36 ++++++++++++------------- .msync.yml | 2 +- .pmtignore | 64 ++++++++++++++++++++++----------------------- Gemfile | 3 +-- Rakefile | 36 +++---------------------- 6 files changed, 56 insertions(+), 88 deletions(-) delete mode 100644 .github/SECURITY.md diff --git a/.github/SECURITY.md b/.github/SECURITY.md deleted file mode 100644 index cacadf220..000000000 --- a/.github/SECURITY.md +++ /dev/null @@ -1,3 +0,0 @@ -# Vox Pupuli Security Policy - -Our vulnerabilities reporting process is at https://voxpupuli.org/security/ diff --git a/.gitignore b/.gitignore index 9b95224ce..84fd904ca 100644 --- a/.gitignore +++ b/.gitignore @@ -1,23 +1,23 @@ # 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 diff --git a/.msync.yml b/.msync.yml index f3156d15e..a4b006918 100644 --- a/.msync.yml +++ b/.msync.yml @@ -2,4 +2,4 @@ # Managed by modulesync - DO NOT EDIT # https://voxpupuli.org/docs/updating-files-managed-with-modulesync/ -modulesync_config_version: '5.4.0' +modulesync_config_version: '5.5.0' diff --git a/.pmtignore b/.pmtignore index 65f505149..58a040887 100644 --- a/.pmtignore +++ b/.pmtignore @@ -1,37 +1,37 @@ # 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 diff --git a/Gemfile b/Gemfile index fe7ccdeeb..9889a1502 100644 --- a/Gemfile +++ b/Gemfile @@ -22,8 +22,7 @@ end group :release do gem 'github_changelog_generator', '>= 1.16.1', :require => false if RUBY_VERSION >= '2.5' - gem 'voxpupuli-release', '>= 1.2.0', :require => false - gem 'puppet-strings', '>= 2.2', :require => false + gem 'voxpupuli-release', '~> 2.0', :require => false end gem 'rake', :require => false diff --git a/Rakefile b/Rakefile index e019a9596..0945791e2 100644 --- a/Rakefile +++ b/Rakefile @@ -24,6 +24,10 @@ end begin require 'voxpupuli/release/rake_tasks' rescue LoadError + # voxpupuli-release not present +else + GCGConfig.user = 'voxpupuli' + GCGConfig.project = 'puppet-jenkins' end desc "Run main 'test' task and report merged results to coveralls" @@ -37,36 +41,4 @@ task test_with_coveralls: [:test] do end end -desc 'Generate REFERENCE.md' -task :reference, [:debug, :backtrace] do |t, args| - patterns = '' - 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 = 'voxpupuli' - config.project = 'puppet-jenkins' - 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 From 12acdd8105249b24e137534ccd89d514aa1569a0 Mon Sep 17 00:00:00 2001 From: Tim Meusel Date: Fri, 12 May 2023 12:22:37 +0200 Subject: [PATCH 2/4] modulesync 6.0.0 --- .msync.yml | 2 +- Gemfile | 13 +++++++------ 2 files changed, 8 insertions(+), 7 deletions(-) diff --git a/.msync.yml b/.msync.yml index a4b006918..b929160c9 100644 --- a/.msync.yml +++ b/.msync.yml @@ -2,4 +2,4 @@ # Managed by modulesync - DO NOT EDIT # https://voxpupuli.org/docs/updating-files-managed-with-modulesync/ -modulesync_config_version: '5.5.0' +modulesync_config_version: '6.0.0' diff --git a/Gemfile b/Gemfile index 9889a1502..3278df0e2 100644 --- a/Gemfile +++ b/Gemfile @@ -4,10 +4,10 @@ source ENV['GEM_SOURCE'] || 'https://rubygems.org' group :test do - gem 'voxpupuli-test', '~> 5.4', :require => false + gem 'voxpupuli-test', '~> 6.0', :require => false gem 'coveralls', :require => false gem 'simplecov-console', :require => false - gem 'puppet_metadata', '~> 2.0', :require => false + gem 'puppet_metadata', '~> 3.0', :require => false gem 'retries', :require => false end @@ -17,18 +17,19 @@ group :development do end group :system_tests do - gem 'voxpupuli-acceptance', '~> 1.0', :require => false + gem 'voxpupuli-acceptance', '~> 2.0', :require => false end group :release do - gem 'github_changelog_generator', '>= 1.16.1', :require => false if RUBY_VERSION >= '2.5' - gem 'voxpupuli-release', '~> 2.0', :require => false + gem 'github_changelog_generator', '>= 1.16.1', :require => false + gem 'voxpupuli-release', '~> 3.0', :require => false + gem 'faraday-retry', '~> 2.1', :require => false end gem 'rake', :require => false gem 'facter', ENV['FACTER_GEM_VERSION'], :require => false, :groups => [:test] -puppetversion = ENV['PUPPET_GEM_VERSION'] || '>= 6.0' +puppetversion = ENV['PUPPET_GEM_VERSION'] || '~> 7.24' gem 'puppet', puppetversion, :require => false, :groups => [:test] # vim: syntax=ruby From bd182c3cf7e4a1ab6abcf7d989c3d9a2872fca70 Mon Sep 17 00:00:00 2001 From: Tim Meusel Date: Thu, 17 Aug 2023 15:56:44 +0200 Subject: [PATCH 3/4] modulesync 7.0.0 --- .github/CONTRIBUTING.md | 11 +++++++---- .msync.yml | 2 +- Gemfile | 2 +- spec/spec_helper.rb | 1 + 4 files changed, 10 insertions(+), 6 deletions(-) diff --git a/.github/CONTRIBUTING.md b/.github/CONTRIBUTING.md index 8b466cfb9..6aaa603ff 100644 --- a/.github/CONTRIBUTING.md +++ b/.github/CONTRIBUTING.md @@ -232,18 +232,21 @@ simple tests against it after applying the module. You can run this with: ```sh -BEAKER_setfile=debian11-64 bundle exec rake beaker +BEAKER_PUPPET_COLLECTION=puppet7 BEAKER_setfile=debian11-64 bundle exec rake beaker ``` -You can replace the string `debian10` with any common operating system. +You can replace the string `debian11` with any common operating system. The following strings are known to work: -* ubuntu1804 * ubuntu2004 -* debian10 +* ubuntu2204 * debian11 * centos7 * centos8 +* centos9 +* almalinux8 +* almalinux9 +* fedora36 For more information and tips & tricks, see [voxpupuli-acceptance's documentation](https://github.com/voxpupuli/voxpupuli-acceptance#running-tests). diff --git a/.msync.yml b/.msync.yml index b929160c9..dd3e95722 100644 --- a/.msync.yml +++ b/.msync.yml @@ -2,4 +2,4 @@ # Managed by modulesync - DO NOT EDIT # https://voxpupuli.org/docs/updating-files-managed-with-modulesync/ -modulesync_config_version: '6.0.0' +modulesync_config_version: '7.0.0' diff --git a/Gemfile b/Gemfile index 3278df0e2..7e02fe691 100644 --- a/Gemfile +++ b/Gemfile @@ -4,7 +4,7 @@ source ENV['GEM_SOURCE'] || 'https://rubygems.org' group :test do - gem 'voxpupuli-test', '~> 6.0', :require => false + gem 'voxpupuli-test', '~> 7.0', :require => false gem 'coveralls', :require => false gem 'simplecov-console', :require => false gem 'puppet_metadata', '~> 3.0', :require => false diff --git a/spec/spec_helper.rb b/spec/spec_helper.rb index 6515b7bf7..9efb4ae62 100644 --- a/spec/spec_helper.rb +++ b/spec/spec_helper.rb @@ -17,3 +17,4 @@ add_custom_fact name.to_sym, value end end +Dir['./spec/support/spec/**/*.rb'].sort.each { |f| require f } From b6608c3f95a2abefb57604500fb4130b231962bf Mon Sep 17 00:00:00 2001 From: Tim Meusel Date: Fri, 18 Aug 2023 00:23:02 +0200 Subject: [PATCH 4/4] rubocop: autofix --- .rubocop.yml | 2 ++ .rubocop_todo.yml | 27 +++++++++++++++++++ lib/puppet/parser/functions/jenkins_port.rb | 2 +- lib/puppet/parser/functions/jenkins_prefix.rb | 2 +- .../jenkins_authorization_strategy/cli.rb | 2 -- .../provider/jenkins_security_realm/cli.rb | 2 -- spec/acceptance/job_spec.rb | 12 ++++----- spec/acceptance/plugin_spec.rb | 2 +- spec/acceptance/xtypes/jenkins_job_spec.rb | 16 +++++------ spec/defines/jenkins_credentials_spec.rb | 4 +-- spec/unit/puppet/x/jenkins/config_spec.rb | 2 +- spec/unit/puppet/x/spec_jenkins_providers.rb | 4 +-- 12 files changed, 51 insertions(+), 26 deletions(-) create mode 100644 .rubocop_todo.yml diff --git a/.rubocop.yml b/.rubocop.yml index f9cf639c7..84c118c0b 100644 --- a/.rubocop.yml +++ b/.rubocop.yml @@ -1,4 +1,6 @@ --- +inherit_from: .rubocop_todo.yml + inherit_gem: voxpupuli-test: rubocop.yml diff --git a/.rubocop_todo.yml b/.rubocop_todo.yml new file mode 100644 index 000000000..b9e5cd743 --- /dev/null +++ b/.rubocop_todo.yml @@ -0,0 +1,27 @@ +# This configuration was generated by +# `rubocop --auto-gen-config` +# on 2023-08-17 21:33:46 UTC using RuboCop version 1.50.2. +# The point is for the user to remove these configuration records +# one by one as the offenses are removed from the code base. +# Note that changes in the inspected code, or installation of new +# versions of RuboCop, may require this file to be generated again. + +# Offense count: 9 +# This cop supports unsafe autocorrection (--autocorrect-all). +RSpec/BeEq: + Exclude: + - 'spec/unit/puppet/provider/jenkins_job/cli_spec.rb' + - 'spec/unit/puppet/x/jenkins/provider/cli_spec.rb' + +# Offense count: 2 +# This cop supports unsafe autocorrection (--autocorrect-all). +# Configuration parameters: . +# SupportedStyles: constant, string +RSpec/VerifiedDoubleReference: + EnforcedStyle: string + +# Offense count: 1 +# This cop supports unsafe autocorrection (--autocorrect-all). +Style/SlicingWithRange: + Exclude: + - 'lib/puppet/jenkins/plugins.rb' diff --git a/lib/puppet/parser/functions/jenkins_port.rb b/lib/puppet/parser/functions/jenkins_port.rb index ce060846c..3461b050b 100644 --- a/lib/puppet/parser/functions/jenkins_port.rb +++ b/lib/puppet/parser/functions/jenkins_port.rb @@ -1,7 +1,7 @@ # frozen_string_literal: true module Puppet::Parser::Functions - newfunction(:jenkins_port, type: :rvalue, doc: <<-'ENDHEREDOC') do |_args| + newfunction(:jenkins_port, type: :rvalue, doc: <<-ENDHEREDOC) do |_args| Return the configurad Jenkins port value (corresponds to /etc/defaults/jenkins -> JENKINS_PORT diff --git a/lib/puppet/parser/functions/jenkins_prefix.rb b/lib/puppet/parser/functions/jenkins_prefix.rb index c0f5f9747..80a6a55bd 100644 --- a/lib/puppet/parser/functions/jenkins_prefix.rb +++ b/lib/puppet/parser/functions/jenkins_prefix.rb @@ -1,7 +1,7 @@ # frozen_string_literal: true module Puppet::Parser::Functions - newfunction(:jenkins_prefix, type: :rvalue, doc: <<-'ENDHEREDOC') do |_args| + newfunction(:jenkins_prefix, type: :rvalue, doc: <<-ENDHEREDOC) do |_args| Return the configured Jenkins prefix value (corresponds to /etc/defaults/jenkins -> PREFIX) diff --git a/lib/puppet/provider/jenkins_authorization_strategy/cli.rb b/lib/puppet/provider/jenkins_authorization_strategy/cli.rb index 950d7a966..71dcc2c3e 100644 --- a/lib/puppet/provider/jenkins_authorization_strategy/cli.rb +++ b/lib/puppet/provider/jenkins_authorization_strategy/cli.rb @@ -76,7 +76,6 @@ def self.get_authorization_strategy(catalog = nil) end private_class_method :get_authorization_strategy - # rubocop:disable Naming/AccessorMethodName def set_jenkins_instance(input = nil) input ||= to_hash @@ -91,5 +90,4 @@ def set_strategy_unsecured } set_jenkins_instance(input) end - # rubocop:enable Naming/AccessorMethodName end diff --git a/lib/puppet/provider/jenkins_security_realm/cli.rb b/lib/puppet/provider/jenkins_security_realm/cli.rb index 098174240..f5f25648b 100644 --- a/lib/puppet/provider/jenkins_security_realm/cli.rb +++ b/lib/puppet/provider/jenkins_security_realm/cli.rb @@ -77,7 +77,6 @@ def self.get_security_realm(catalog = nil) end private_class_method :get_security_realm - # rubocop:disable Naming/AccessorMethodName def set_jenkins_instance(input = nil) input ||= to_hash @@ -92,5 +91,4 @@ def set_security_none } set_jenkins_instance(input) end - # rubocop:enable Naming/AccessorMethodName end diff --git a/spec/acceptance/job_spec.rb b/spec/acceptance/job_spec.rb index bf56c3d9d..b34c8e59f 100644 --- a/spec/acceptance/job_spec.rb +++ b/spec/acceptance/job_spec.rb @@ -4,7 +4,7 @@ describe 'jenkins::job' do let(:test_build_job) do - example = <<~'EOS' + example = <<~EOS @@ -39,7 +39,7 @@ # the historical assumption is that this will work without cli => true # set on the jenkins class jenkins::job { 'test-build-job': - config => \'#{test_build_job}\', + config => '#{test_build_job}', } EOS @@ -65,14 +65,14 @@ pp_create = <<-EOS include jenkins jenkins::job {'test-noreplace-job': - config => \'#{test_build_job.gsub('test job', 'do not overwrite me')}\', + config => '#{test_build_job.gsub('test job', 'do not overwrite me')}', } EOS pp_update = <<-EOS include jenkins jenkins::job {'test-noreplace-job': - config => \'#{test_build_job}\', + config => '#{test_build_job}', replace => false, } EOS @@ -97,7 +97,7 @@ pp = <<-EOS include jenkins jenkins::job { 'test-build-job': - config => \'#{test_build_job}\', + config => '#{test_build_job}', } EOS @@ -108,7 +108,7 @@ include jenkins jenkins::job { 'test-build-job': ensure => 'absent', - config => \'#{test_build_job}\', + config => '#{test_build_job}', } EOS diff --git a/spec/acceptance/plugin_spec.rb b/spec/acceptance/plugin_spec.rb index c3785a6ff..8631bb338 100644 --- a/spec/acceptance/plugin_spec.rb +++ b/spec/acceptance/plugin_spec.rb @@ -96,7 +96,7 @@ class {'jenkins': end end - describe command("unzip -p #{PDIR}/jquery3-api.hpi META-INF/MANIFEST.MF | sed 's/Plugin-Version: \\\(.*\\\)/\\1/;tx;d;:x'") do + describe command("unzip -p #{PDIR}/jquery3-api.hpi META-INF/MANIFEST.MF | sed 's/Plugin-Version: \\(.*\\)/\\1/;tx;d;:x'") do its(:stdout) { is_expected.to eq("3.6.0-3\n") } end diff --git a/spec/acceptance/xtypes/jenkins_job_spec.rb b/spec/acceptance/xtypes/jenkins_job_spec.rb index 49bf074e8..21e9d8c99 100644 --- a/spec/acceptance/xtypes/jenkins_job_spec.rb +++ b/spec/acceptance/xtypes/jenkins_job_spec.rb @@ -6,7 +6,7 @@ # on existing state as a performance optimization. describe 'jenkins_job', order: :defined do let(:test_build_job) do - example = <<~'EOS' + example = <<~EOS @@ -34,7 +34,7 @@ end let(:test_folder_job) do - example = <<~'EOS' + example = <<~EOS @@ -65,7 +65,7 @@ include jenkins::cli::config jenkins_job { 'foo': ensure => present, - config => \'#{test_build_job}\', + config => '#{test_build_job}', } EOS @@ -118,17 +118,17 @@ #{manifest} jenkins_job { 'foo': ensure => present, - config => \'#{test_folder_job}\', + config => '#{test_folder_job}', } jenkins_job { 'foo/bar': ensure => present, - config => \'#{test_folder_job}\', + config => '#{test_folder_job}', } jenkins_job { 'foo/bar/baz': ensure => present, - config => \'#{test_build_job}\', + config => '#{test_build_job}', } EOS @@ -190,7 +190,7 @@ #{super()} jenkins_job { 'foo': ensure => present, - config => \'#{test_build_job}\', + config => '#{test_build_job}', } PUPPET end @@ -204,7 +204,7 @@ #{super()} jenkins_job { 'foo': ensure => present, - config => \'#{test_folder_job}\', + config => '#{test_folder_job}', } PUPPET end diff --git a/spec/defines/jenkins_credentials_spec.rb b/spec/defines/jenkins_credentials_spec.rb index d0c9b0623..31496d89f 100644 --- a/spec/defines/jenkins_credentials_spec.rb +++ b/spec/defines/jenkins_credentials_spec.rb @@ -38,7 +38,7 @@ it { is_expected.to contain_jenkins__cli__exec('create-jenkins-credentials-foo').with(command: ['create_or_update_credentials', title.to_s, "'mypass'", "''", "'Managed by Puppet'", "''"], - unless: "for i in \$(seq 1 10); do \$HELPER_CMD credential_info #{title} && break || sleep 10; done | grep #{title}") + unless: "for i in $(seq 1 10); do $HELPER_CMD credential_info #{title} && break || sleep 10; done | grep #{title}") } end @@ -65,7 +65,7 @@ it { is_expected.to contain_jenkins__cli__exec('create-jenkins-credentials-foo').with(command: ['create_or_update_credentials', title.to_s, "'mypass'", "'e94d3b98-5ba4-43b9-89ed-79a08ea97f6f'", "'Managed by Puppet'", "''"], - unless: "for i in \$(seq 1 10); do \$HELPER_CMD credential_info #{title} && break || sleep 10; done | grep #{title}") + unless: "for i in $(seq 1 10); do $HELPER_CMD credential_info #{title} && break || sleep 10; done | grep #{title}") } end end diff --git a/spec/unit/puppet/x/jenkins/config_spec.rb b/spec/unit/puppet/x/jenkins/config_spec.rb index 186b5585d..02221d7d1 100644 --- a/spec/unit/puppet/x/jenkins/config_spec.rb +++ b/spec/unit/puppet/x/jenkins/config_spec.rb @@ -56,7 +56,7 @@ # we are relying on a side effect of this method being to test features / # load libs describe '#initialize' do - it { expect(described_class.new).to be_kind_of described_class } + it { expect(described_class.new).to be_a described_class } end describe '#[]' do diff --git a/spec/unit/puppet/x/spec_jenkins_providers.rb b/spec/unit/puppet/x/spec_jenkins_providers.rb index 4bfefe9e2..4e144433d 100644 --- a/spec/unit/puppet/x/spec_jenkins_providers.rb +++ b/spec/unit/puppet/x/spec_jenkins_providers.rb @@ -15,7 +15,7 @@ context 'feature :retries' do it do expect(confines).to include( - be_kind_of(Puppet::Confine::Feature). + be_a(Puppet::Confine::Feature). and(have_attributes(values: [:retries])) ) end @@ -24,7 +24,7 @@ context 'commands :java' do it do expect(confines).to include( - be_kind_of(Puppet::Confine::Exists). + be_a(Puppet::Confine::Exists). and(have_attributes(values: ['java'])) ) end