From 6b4797aaa55b0452d9410c870099e4452d61a52f Mon Sep 17 00:00:00 2001 From: Lukas Audzevicius Date: Thu, 13 Aug 2026 12:39:26 +0100 Subject: [PATCH 1/2] Add Ruby 4.0 / Puppet 9 support With the arrival of Puppetcore 9, we need to ensure our tools are compatible with Ruby 4. Adds a ruby_version: 4.0 / puppet_gem_version: ~> 9.0 lane to ci.yml and nightly.yml's spec and acceptance jobs. The Gemfile had no puppetcore-sourcing logic at all - it just used the default rubygems.org source unconditionally. Sources puppet from rubygems-puppetcore.puppet.com when a forge token is present, same pattern as rspec-puppet/puppetlabs_spec_helper. --- .github/workflows/ci.yml | 6 ++++++ .github/workflows/nightly.yml | 6 ++++++ Gemfile | 15 +++++++++++---- 3 files changed, 23 insertions(+), 4 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 42f3e975..85b9881e 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -19,9 +19,12 @@ jobs: matrix: ruby_version: - "3.2" + - "4.0" include: - ruby_version: '3.2' puppet_gem_version: '~> 8.0' + - ruby_version: '4.0' + puppet_gem_version: '~> 9.0' runs_on: - "ubuntu-latest" - "windows-latest" @@ -40,9 +43,12 @@ jobs: matrix: ruby_version: - "3.2" + - "4.0" include: - ruby_version: '3.2' puppet_gem_version: 'https://github.com/puppetlabs/puppet' # puppet8' + - ruby_version: '4.0' + puppet_gem_version: '~> 9.0' runs_on: - "ubuntu-latest" - "windows-latest" diff --git a/.github/workflows/nightly.yml b/.github/workflows/nightly.yml index 304e9722..63aee7f1 100644 --- a/.github/workflows/nightly.yml +++ b/.github/workflows/nightly.yml @@ -12,9 +12,12 @@ jobs: matrix: ruby_version: - "3.2" + - "4.0" include: - ruby_version: '3.2' puppet_gem_version: '~> 8.0' + - ruby_version: '4.0' + puppet_gem_version: '~> 9.0' runs_on: - "ubuntu-latest" - "windows-latest" @@ -32,9 +35,12 @@ jobs: matrix: ruby_version: - "3.2" + - "4.0" include: - ruby_version: '3.2' puppet_gem_version: 'https://github.com/puppetlabs/puppet' # puppet8' + - ruby_version: '4.0' + puppet_gem_version: '~> 9.0' runs_on: - "ubuntu-latest" - "windows-latest" diff --git a/Gemfile b/Gemfile index 00823ad9..e8831962 100644 --- a/Gemfile +++ b/Gemfile @@ -1,10 +1,17 @@ # frozen_string_literal: true -source ENV['GEM_SOURCE'] || "https://rubygems.org" +# 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'].to_s.empty? + 'https://rubygems-puppetcore.puppet.com' + else + ENV['GEM_SOURCE_PUPPETCORE'] || gemsource_default + end +source gemsource_default gemspec -def location_for(place_or_version, fake_version = nil) +def location_for(place_or_version, fake_version = nil, opts = {}) git_url_regex = %r{\A(?(https?|git)[:@][^#]*)(#(?.*))?} file_url_regex = %r{\Afile:\/\/(?.*)} @@ -13,12 +20,12 @@ def location_for(place_or_version, fake_version = nil) 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 }] + [place_or_version, { require: false }.merge(opts)] end end group :development do - gem 'puppet', *location_for(ENV['PUPPET_GEM_VERSION']) + gem 'puppet', *location_for(ENV.fetch('PUPPET_GEM_VERSION', nil), nil, { source: gemsource_puppetcore }) gem 'json_spec', '~> 1.1', '>= 1.1.5' From b3419e470dc950f8e20131b59e2ea6e30010b8e0 Mon Sep 17 00:00:00 2001 From: Lukas Audzevicius Date: Thu, 13 Aug 2026 12:53:03 +0100 Subject: [PATCH 2/2] Source bolt from puppetcore too puppet_litmus pulls in bolt as a transitive dependency, which otherwise resolves from rubygems.org (a stale 4.0.0 dragging in an old faraday/patron native-extension chain that fails to build - libcurl headers aren't present on the CI runner). Same fix as puppetlabs/provision. --- Gemfile | 2 ++ 1 file changed, 2 insertions(+) diff --git a/Gemfile b/Gemfile index e8831962..c202b28e 100644 --- a/Gemfile +++ b/Gemfile @@ -55,6 +55,8 @@ group :development do end group :acceptance do + # Source bolt from puppetcore too, since it's a transitive puppet_litmus dependency. + gem 'bolt', *location_for(ENV.fetch('BOLT_GEM_VERSION', nil), nil, { source: gemsource_puppetcore }) gem 'puppet_litmus' gem 'net-ssh' end