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/.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..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: '5.4.0' +modulesync_config_version: '7.0.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/.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/CHANGELOG.md b/CHANGELOG.md index 35d52b5f2..8ed0a4b8c 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -4,6 +4,20 @@ All notable changes to this project will be documented in this file. Each new release typically also includes the latest modulesync defaults. These should not affect the functionality of the module. +## [v4.0.0](https://github.com/voxpupuli/puppet-jenkins/tree/v4.0.0) (2023-09-29) + +[Full Changelog](https://github.com/voxpupuli/puppet-jenkins/compare/v3.3.0...v4.0.0) + +**Breaking changes:** + +- Drop Ubuntu 18.04, add 20.04 and 22.04 support [\#1080](https://github.com/voxpupuli/puppet-jenkins/pull/1080) ([evgeni](https://github.com/evgeni)) +- Drop Puppet 6 support [\#1074](https://github.com/voxpupuli/puppet-jenkins/pull/1074) ([bastelfreak](https://github.com/bastelfreak)) + +**Implemented enhancements:** + +- Add support for EL9, document Alma/Oracle/Rocky support [\#1081](https://github.com/voxpupuli/puppet-jenkins/pull/1081) ([evgeni](https://github.com/evgeni)) +- Allow puppetlabs/stdlib 9.x, puppetlabs/java 10.x, puppet/archive 7.x, puppet/zypprepo 5.x, puppet/systemd 6.x [\#1076](https://github.com/voxpupuli/puppet-jenkins/pull/1076) ([bastelfreak](https://github.com/bastelfreak)) + ## [v3.3.0](https://github.com/voxpupuli/puppet-jenkins/tree/v3.3.0) (2023-04-19) [Full Changelog](https://github.com/voxpupuli/puppet-jenkins/compare/v3.2.1...v3.3.0) @@ -71,6 +85,7 @@ These should not affect the functionality of the module. - Should we include the puppet-jenkinstracking code? [\#110](https://github.com/voxpupuli/puppet-jenkins/issues/110) - The module should support FreeBSD 10 and pkgng [\#105](https://github.com/voxpupuli/puppet-jenkins/issues/105) - Install Java 11 JDK on Red Hat OSes [\#1054](https://github.com/voxpupuli/puppet-jenkins/pull/1054) ([ekohl](https://github.com/ekohl)) +- Install Java 11 on Red Hat OSes [\#1053](https://github.com/voxpupuli/puppet-jenkins/pull/1053) ([ekohl](https://github.com/ekohl)) - Drop-in file systemd configuration [\#1044](https://github.com/voxpupuli/puppet-jenkins/pull/1044) ([jan-win1993](https://github.com/jan-win1993)) - Allow up-to-date dependencies [\#1019](https://github.com/voxpupuli/puppet-jenkins/pull/1019) ([smortex](https://github.com/smortex)) - puppet/archive: allow 5.x [\#1010](https://github.com/voxpupuli/puppet-jenkins/pull/1010) ([bastelfreak](https://github.com/bastelfreak)) @@ -133,7 +148,6 @@ These should not affect the functionality of the module. **Merged pull requests:** - Remove unused plugins\_from\_updatecenter [\#1056](https://github.com/voxpupuli/puppet-jenkins/pull/1056) ([ekohl](https://github.com/ekohl)) -- Install Java 11 on Red Hat OSes [\#1053](https://github.com/voxpupuli/puppet-jenkins/pull/1053) ([ekohl](https://github.com/ekohl)) - Remove old RHEL 5 example [\#1052](https://github.com/voxpupuli/puppet-jenkins/pull/1052) ([ekohl](https://github.com/ekohl)) - Remove PIDFile workaround and deprecated code [\#1045](https://github.com/voxpupuli/puppet-jenkins/pull/1045) ([ekohl](https://github.com/ekohl)) - Fix acceptance tests [\#1041](https://github.com/voxpupuli/puppet-jenkins/pull/1041) ([ekohl](https://github.com/ekohl)) diff --git a/Gemfile b/Gemfile index fe7ccdeeb..7e02fe691 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', '~> 7.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,19 +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', '>= 1.2.0', :require => false - gem 'puppet-strings', '>= 2.2', :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 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 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/metadata.json b/metadata.json index f4c58f5ab..f27c75554 100644 --- a/metadata.json +++ b/metadata.json @@ -1,6 +1,6 @@ { "name": "puppet-jenkins", - "version": "3.3.1-rc0", + "version": "4.0.0", "author": "Vox Pupuli", "license": "Apache-2.0", "summary": "Manage the Jenkins continuous integration service with Puppet", 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/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 } 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