From e037ff7810fe79fc535ecc74b14ed701bdf02526 Mon Sep 17 00:00:00 2001 From: skyamgarp <130442619+skyamgarp@users.noreply.github.com> Date: Mon, 22 Sep 2025 19:17:14 +0530 Subject: [PATCH] (CAT-2370) Prepare module for Puppetcore Updated gemfile Fix rubocop Update puppetlabs/apt version Remove --provision-service flag Test with latest released agent (CAT-2370) Test with --latest-agent flag --- .fixtures.yml | 4 +--- .github/workflows/ci.yml | 2 +- .github/workflows/nightly.yml | 2 +- .puppet-lint.rc | 9 +++++++++ .rubocop.yml | 4 +++- Gemfile | 33 +++++++++++++++++++++++---------- Rakefile | 8 ++++++++ metadata.json | 8 ++++---- 8 files changed, 50 insertions(+), 20 deletions(-) diff --git a/.fixtures.yml b/.fixtures.yml index f812b84d..6cfc04e8 100644 --- a/.fixtures.yml +++ b/.fixtures.yml @@ -6,9 +6,7 @@ fixtures: reboot: 'puppetlabs-reboot' repositories: facts: 'https://github.com/puppetlabs/puppetlabs-facts.git' - puppet_agent: - repo: 'https://github.com/puppetlabs/puppetlabs-puppet_agent.git' - ref: v4.13.0 + puppet_agent: 'https://github.com/puppetlabs/puppetlabs-puppet_agent.git' provision: 'https://github.com/puppetlabs/provision.git' yumrepo_core: repo: https://github.com/puppetlabs/puppetlabs-yumrepo_core.git diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 1d65cf00..68ece214 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -17,5 +17,5 @@ jobs: needs: Spec uses: "puppetlabs/cat-github-actions/.github/workflows/module_acceptance.yml@main" with: - flags: '--provision-service' + flags: '--latest-agent' secrets: "inherit" diff --git a/.github/workflows/nightly.yml b/.github/workflows/nightly.yml index a305aa4f..39e68eed 100644 --- a/.github/workflows/nightly.yml +++ b/.github/workflows/nightly.yml @@ -16,5 +16,5 @@ jobs: needs: Spec uses: "puppetlabs/cat-github-actions/.github/workflows/module_acceptance.yml@main" with: - flags: '--provision-service' + flags: '--latest-agent' secrets: "inherit" diff --git a/.puppet-lint.rc b/.puppet-lint.rc index cc96ece0..646fc145 100644 --- a/.puppet-lint.rc +++ b/.puppet-lint.rc @@ -1 +1,10 @@ +--fail-on-warnings --relative +--no-80chars-check +--no-140chars-check +--no-class_inherits_from_params_class-check +--no-autoloader_layout-check +--no-documentation-check +--no-single_quote_string_with_variables-check +--no-anchor_resource-check +--ignore-paths=.vendor/**/*.pp,.bundle/**/*.pp,pkg/**/*.pp,spec/**/*.pp,tests/**/*.pp,types/**/*.pp,vendor/**/*.pp \ No newline at end of file diff --git a/.rubocop.yml b/.rubocop.yml index 7a66e083..b8d09b89 100644 --- a/.rubocop.yml +++ b/.rubocop.yml @@ -5,7 +5,7 @@ require: AllCops: NewCops: enable DisplayCopNames: true - TargetRubyVersion: '2.7' + TargetRubyVersion: '3.1' Include: - "**/*.rb" Exclude: @@ -723,3 +723,5 @@ Style/StringChars: Enabled: false Style/SwapValues: Enabled: false +Style/HashSyntax: + EnforcedShorthandSyntax: never diff --git a/Gemfile b/Gemfile index 8fc6479d..a1b064e9 100644 --- a/Gemfile +++ b/Gemfile @@ -21,16 +21,18 @@ group :development do gem "json", '= 2.6.3', require: false if Gem::Requirement.create(['>= 3.2.0', '< 4.0.0']).satisfied_by?(Gem::Version.new(RUBY_VERSION.dup)) gem "racc", '~> 1.4.0', require: false if Gem::Requirement.create(['>= 2.7.0', '< 3.0.0']).satisfied_by?(Gem::Version.new(RUBY_VERSION.dup)) gem "voxpupuli-puppet-lint-plugins", '~> 5.0', require: false - gem "facterdb", '~> 1.18', require: false + gem "facterdb", '~> 1.18', require: false if Gem::Requirement.create(['< 3.0.0']).satisfied_by?(Gem::Version.new(RUBY_VERSION.dup)) + gem "facterdb", '~> 3.0', require: false if Gem::Requirement.create(['>= 3.0.0']).satisfied_by?(Gem::Version.new(RUBY_VERSION.dup)) gem "metadata-json-lint", '~> 3.0', require: false - gem "puppetlabs_spec_helper", '~> 6.0', require: false - gem "rspec-puppet-facts", '~> 2.0', require: false + gem "json-schema", '< 5.1.1', require: false + gem "rspec-puppet-facts", '~> 2.0', require: false if Gem::Requirement.create(['< 3.0.0']).satisfied_by?(Gem::Version.new(RUBY_VERSION.dup)) + gem "rspec-puppet-facts", '~> 5.0', require: false if Gem::Requirement.create(['>= 3.0.0']).satisfied_by?(Gem::Version.new(RUBY_VERSION.dup)) gem "codecov", '~> 0.2', require: false gem "dependency_checker", '~> 1.0.0', require: false gem "parallel_tests", '= 3.12.1', require: false gem "pry", '~> 0.10', require: false gem "simplecov-console", '~> 0.5', require: false - gem "puppet-debugger", '~> 1.0', require: false + gem "puppet-debugger", '~> 1.6', require: false gem "rubocop", '= 1.48.1', require: false gem "rubocop-performance", '= 1.16.0', require: false gem "rubocop-rspec", '= 2.19.0', require: false @@ -40,13 +42,15 @@ group :development do gem "mocha", '< 1.2.0', require: false end group :system_tests do - gem "puppet_litmus", '~> 1.0', require: false, platforms: [:ruby, :x64_mingw] + gem "puppet_litmus", '~> 2.0', require: false, platforms: [:ruby, :x64_mingw] if !ENV['PUPPET_FORGE_TOKEN'].to_s.empty? + gem "puppet_litmus", '~> 1.0', require: false, platforms: [:ruby, :x64_mingw] if ENV['PUPPET_FORGE_TOKEN'].to_s.empty? gem "serverspec", '~> 2.41', require: false gem "rspec-retry", require: false end -group :release_prep do +group :development, :release_prep do gem "puppet-strings", '~> 4.0', require: false - gem "puppetlabs_spec_helper", '~> 6.0', require: false + gem "puppetlabs_spec_helper", '~> 8.0', require: false + gem "puppet-blacksmith", '~> 7.0', require: false end puppet_version = ENV['PUPPET_GEM_VERSION'] @@ -55,12 +59,21 @@ hiera_version = ENV['HIERA_GEM_VERSION'] gems = {} -gems['puppet'] = location_for(puppet_version) +puppet_version = ENV.fetch('PUPPET_GEM_VERSION', nil) +facter_version = ENV.fetch('FACTER_GEM_VERSION', nil) +hiera_version = ENV.fetch('HIERA_GEM_VERSION', nil) # If facter or hiera versions have been specified via the environment # variables - -gems['facter'] = location_for(facter_version) if facter_version +# If PUPPET_FORGE_TOKEN is set then use authenticated source for both puppet and facter, since facter is a transitive dependency of puppet +# Otherwise, do as before and use location_for to fetch gems from the default source +if !ENV['PUPPET_FORGE_TOKEN'].to_s.empty? + gems['puppet'] = ['~> 8.11', { require: false, source: 'https://rubygems-puppetcore.puppet.com' }] + gems['facter'] = ['~> 4.11', { require: false, source: 'https://rubygems-puppetcore.puppet.com' }] +else + gems['puppet'] = location_for(puppet_version) + gems['facter'] = location_for(facter_version) if facter_version +end gems['hiera'] = location_for(hiera_version) if hiera_version gems.each do |gem_name, gem_params| diff --git a/Rakefile b/Rakefile index 77590fe6..2a0c533f 100644 --- a/Rakefile +++ b/Rakefile @@ -5,5 +5,13 @@ require 'puppet_litmus/rake_tasks' if Gem.loaded_specs.key? 'puppet_litmus' require 'puppetlabs_spec_helper/rake_tasks' require 'puppet-syntax/tasks/puppet-syntax' require 'puppet-strings/tasks' if Gem.loaded_specs.key? 'puppet-strings' +PuppetLint.configuration.send('disable_80chars') +PuppetLint.configuration.send('disable_140chars') +PuppetLint.configuration.send('disable_class_inherits_from_params_class') +PuppetLint.configuration.send('disable_autoloader_layout') +PuppetLint.configuration.send('disable_documentation') +PuppetLint.configuration.send('disable_single_quote_string_with_variables') +PuppetLint.configuration.fail_on_warnings = true +PuppetLint.configuration.ignore_paths = [".vendor/**/*.pp", ".bundle/**/*.pp", "pkg/**/*.pp", "spec/**/*.pp", "tests/**/*.pp", "types/**/*.pp", "vendor/**/*.pp"] PuppetLint.configuration.send('disable_relative') diff --git a/metadata.json b/metadata.json index 41764219..73c53003 100644 --- a/metadata.json +++ b/metadata.json @@ -14,7 +14,7 @@ }, { "name": "puppetlabs/apt", - "version_requirement": ">= 4.4.1 < 11.0.0" + "version_requirement": ">= 4.4.1 <= 11.1.0" }, { "name": "puppetlabs/powershell", @@ -61,10 +61,10 @@ "requirements": [ { "name": "puppet", - "version_requirement": ">= 7.0.0 < 9.0.0" + "version_requirement": ">= 8.0.0 < 9.0.0" } ], - "pdk-version": "3.0.0", + "pdk-version": "3.5.0 (ga43db72)", "template-url": "https://github.com/puppetlabs/pdk-templates.git#main", - "template-ref": "heads/main-0-g79a2f93" + "template-ref": "heads/main-0-g11c0f3d" }