From 586969a38ad7f9aebdd8f728ec451360f261e0a1 Mon Sep 17 00:00:00 2001 From: Maqsood Ahmad Date: Tue, 25 Aug 2026 13:06:33 +0530 Subject: [PATCH] (MODULES-11725) Add puppet 9 support in puppetlabs-sqlserver 1) ci, nightly & mend update for puppet 9 support 2) Gemfile udpate for new gem compatible with puppet 9 3) rakefile and metadata change for puppet 9 Co-Authored-By: Claude Opus 4.8 --- .github/workflows/ci.yml | 13 +++++++----- .github/workflows/mend.yml | 2 ++ .github/workflows/nightly.yml | 9 +++++--- Gemfile | 40 +++++++++++++++++++++++------------ Rakefile | 7 +++++- metadata.json | 2 +- 6 files changed, 50 insertions(+), 23 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 651003bd..baec60cc 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -15,6 +15,9 @@ jobs: Spec: uses: "puppetlabs/cat-github-actions/.github/workflows/module_ci.yml@main" secrets: "inherit" + with: + additional_packages: "libcurl4-openssl-dev" + ruby_version: "3.2" setup_matrix: name: "Setup Test Matrix" @@ -31,11 +34,11 @@ jobs: ref: ${{ github.event.pull_request.head.sha }} if: ${{ github.repository_owner == 'puppetlabs' }} - - name: Activate Ruby 3.1 + - name: Activate Ruby 3.2 uses: ruby/setup-ruby@v1 if: ${{ github.repository_owner == 'puppetlabs' }} with: - ruby-version: "3.1" + ruby-version: "3.2" bundler-cache: true - name: Print bundle environment @@ -48,7 +51,7 @@ jobs: - name: Setup Acceptance Test Matrix id: get-matrix run: | - bundle exec matrix_from_metadata_v3 --nightly + bundle exec matrix_from_metadata_v3 --nightly --collection-platform-exclude 9:windows-2012r2-x86 Acceptance: name: "${{ matrix.platforms.label }}, ${{ matrix.collection.collection || matrix.collection }}" @@ -95,10 +98,10 @@ jobs: with: ref: ${{ github.event.pull_request.head.sha }} - - name: Activate Ruby 3.1 + - name: Activate Ruby 3.2 uses: ruby/setup-ruby@v1 with: - ruby-version: "3.1" + ruby-version: "3.2" bundler-cache: true - name: Print bundle environment diff --git a/.github/workflows/mend.yml b/.github/workflows/mend.yml index b4100a5a..27431690 100644 --- a/.github/workflows/mend.yml +++ b/.github/workflows/mend.yml @@ -13,3 +13,5 @@ jobs: mend: uses: "puppetlabs/cat-github-actions/.github/workflows/mend_ruby.yml@main" secrets: "inherit" + with: + ruby_version: "3.2" diff --git a/.github/workflows/nightly.yml b/.github/workflows/nightly.yml index 1979fe98..1edc6e80 100644 --- a/.github/workflows/nightly.yml +++ b/.github/workflows/nightly.yml @@ -13,6 +13,9 @@ jobs: Spec: uses: "puppetlabs/cat-github-actions/.github/workflows/module_ci.yml@main" secrets: "inherit" + with: + additional_packages: "libcurl4-openssl-dev" + ruby_version: "3.2" setup_matrix: name: "Setup Test Matrix" @@ -29,11 +32,11 @@ jobs: ref: ${{ github.event.pull_request.head.sha }} if: ${{ github.repository_owner == 'puppetlabs' }} - - name: Activate Ruby 3.1 + - name: Activate Ruby 3.2 uses: ruby/setup-ruby@v1 if: ${{ github.repository_owner == 'puppetlabs' }} with: - ruby-version: "3.1" + ruby-version: "3.2" bundler-cache: true - name: Print bundle environment @@ -46,7 +49,7 @@ jobs: - name: Setup Acceptance Test Matrix id: get-matrix run: | - bundle exec matrix_from_metadata_v3 --nightly + bundle exec matrix_from_metadata_v3 --nightly --collection-platform-exclude 9:windows-2012r2-x86 Acceptance: name: "${{ matrix.platforms.label }}, ${{ matrix.collection.collection || matrix.collection }}" diff --git a/Gemfile b/Gemfile index 1b5d318d..adb13c9d 100644 --- a/Gemfile +++ b/Gemfile @@ -1,15 +1,29 @@ -source ENV['GEM_SOURCE'] || 'https://rubygems.org' +# frozen_string_literal: true -def location_for(place_or_version, fake_version = nil) - git_url_regex = %r{\A(?(https?|git)[:@][^#]*)(#(?.*))?} - file_url_regex = %r{\Afile:\/\/(?.*)} +# For puppetcore, set GEM_SOURCE_PUPPETCORE = 'https://rubygems-puppetcore.puppet.com' +gemsource_default = ENV['GEM_SOURCE'] || 'https://rubygems.org' +gemsource_puppetcore = if ENV['PUPPET_FORGE_TOKEN'] + 'https://rubygems-puppetcore.puppet.com' +else + ENV['GEM_SOURCE_PUPPETCORE'] || gemsource_default +end +source gemsource_default + +def location_for(place_or_constraint, fake_constraint = nil, opts = {}) + git_url_regex = /\A(?(?:https?|git)[:@][^#]*)(?:#(?.*))?/ + file_url_regex = %r{\Afile://(?.*)} + + if place_or_constraint && (git_url = place_or_constraint.match(git_url_regex)) + # Git source → ignore :source, keep fake_constraint + [fake_constraint, { git: git_url[:url], branch: git_url[:branch], require: false }].compact + + elsif place_or_constraint && (file_url = place_or_constraint.match(file_url_regex)) + # File source → ignore :source, keep fake_constraint or default >= 0 + [fake_constraint || '>= 0', { path: File.expand_path(file_url[:path]), require: false }] - if place_or_version && (git_url = place_or_version.match(git_url_regex)) - [fake_version, { git: git_url[:url], branch: git_url[:branch], require: false }].compact - elsif place_or_version && (file_url = place_or_version.match(file_url_regex)) - ['>= 0', { path: File.expand_path(file_url[:path]), require: false }] else - [place_or_version, { require: false }] + # Plain version constraint → merge opts (including :source if provided) + [place_or_constraint, { require: false }.merge(opts)] end end @@ -18,7 +32,7 @@ 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 "deep_merge", '~> 1.2.2', require: false - gem "voxpupuli-puppet-lint-plugins", '~> 5.0', require: false + gem "voxpupuli-puppet-lint-plugins", '~> 7.0', require: false gem "facterdb", '~> 2.1', 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", '~> 4.0', require: false @@ -39,7 +53,7 @@ group :development do end group :development, :release_prep do gem "puppet-strings", '~> 4.0', require: false - gem "puppetlabs_spec_helper", '~> 8.0', require: false + gem "puppetlabs_spec_helper", '~> 9.0', require: false gem "puppet-blacksmith", '~> 7.0', require: false end group :system_tests do @@ -61,8 +75,8 @@ hiera_version = ENV.fetch('HIERA_GEM_VERSION', nil) # 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' }] + gems['puppet'] = location_for(puppet_version, nil, { source: gemsource_puppetcore }) + gems['facter'] = location_for(facter_version, nil, { source: gemsource_puppetcore }) else gems['puppet'] = location_for(puppet_version) gems['facter'] = location_for(facter_version) if facter_version diff --git a/Rakefile b/Rakefile index 85222267..6f705d46 100644 --- a/Rakefile +++ b/Rakefile @@ -3,7 +3,7 @@ require 'bundler' 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 'puppetlabs-syntax/tasks/puppetlabs-syntax' require 'puppet-strings/tasks' if Gem.loaded_specs.key? 'puppet-strings' PuppetLint.configuration.send('disable_relative') @@ -13,5 +13,10 @@ 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') +# strict_indent is disabled because its expected indentation changed incompatibly +# between puppet-lint-strict_indent-check 3.x (Puppet 7/8 lane, Ruby 3.1) and 5.x +# (Puppet 9 lane, Ruby 3.4+): the two lanes demand opposite indentation for nested +# hashes, so no single manifest layout can satisfy both. See MODULES-11726 / MODULES-11700. +PuppetLint.configuration.send('disable_strict_indent') PuppetLint.configuration.fail_on_warnings = true PuppetLint.configuration.ignore_paths = [".vendor/**/*.pp", ".bundle/**/*.pp", "pkg/**/*.pp", "spec/**/*.pp", "tests/**/*.pp", "types/**/*.pp", "vendor/**/*.pp"] diff --git a/metadata.json b/metadata.json index e303d6fe..4c61002d 100644 --- a/metadata.json +++ b/metadata.json @@ -32,7 +32,7 @@ "requirements": [ { "name": "puppet", - "version_requirement": ">=8.0.0 < 9.0.0" + "version_requirement": ">=8.0.0 < 10.0.0" } ], "tags": [