Skip to content

Conversation

@gavindidrichsen
Copy link
Contributor

@gavindidrichsen gavindidrichsen commented Oct 7, 2025

Fix bolt dependency constraint to support bolt 5.x

Problem

puppet_litmus causes a dependency failure when trying to use bolt 5.0.0 due to an overly restrictive dependency constraint:

Because puppet_litmus >= 1.6.1 depends on bolt ~> 4.0
  and Gemfile depends on puppet_litmus ~> 2.0,
  bolt ~> 4.0 is required.
So, because Gemfile depends on bolt ~> 5.0,
  version solving has failed.

The current gemspec constraint bolt ~> 4.0 only allows bolt version 4.x, preventing users from upgrading to bolt 5.x.

Solution

Updated the bolt dependency constraint from ~> 4.0 to >= 4.0, < 6.0 to:

  • Maintain backward compatibility with bolt 4.x
  • Allow forward compatibility with bolt 5.x
  • Prevent breaking changes from bolt 6.x (when it's released)

Testing

Manual testing confirms backward compatibility and forward compatibility (see comments below for more details):

With bolt 4.0.0:

bolt (4.0.0)
puppet_litmus (2.3.2)

With bolt 5.0.0:

bolt (5.0.0) 
puppet_litmus (2.3.2)

Both configurations resolve dependencies successfully without errors, demonstrating that this change maintains backward compatibility while enabling use of newer bolt versions.

@gavindidrichsen
Copy link
Contributor Author

gavindidrichsen commented Oct 7, 2025

Verifification

Using bolt 5.0.0

Create a puppetcore enabled Gemfile as follows

# export a valid forge-key
export PUPPET_FORGE_TOKEN="<API_KEY>"

# create a test directory
mkdir test
cd test
            
# set the local configuration
bundle config --local bin vendor/bin
bundle config --local gemfile Gemfile
bundle config --local path vendor/bundle
bundle config set --global https://rubygems-puppetcore.puppet.com "forge-key:${PUPPET_FORGE_TOKEN}"
            
# create the Gemfile
cat << 'EOF' > Gemfile
source 'https://rubygems.org'
gem "puppet_litmus", :path => '/path/to/my/puppet_litmus'
source 'https://rubygems-puppetcore.puppet.com' do
  gem 'puppet', '~> 8.15'
  gem 'facter', '~> 4.15'
  gem 'bolt', '~> 5.0'
end
EOF
            
# install!
bundle install

This will cause the error:

➜  testit git:(development) bundle install
Fetching gem metadata from https://rubygems-puppetcore.puppet.com/..
Fetching gem metadata from https://rubygems.org/............
Resolving dependencies...
Could not find compatible versions

Because puppet_litmus >= 1.6.1 depends on bolt ~> 4.0
  and Gemfile depends on puppet_litmus ~> 2.0,
  bolt ~> 4.0 is required.
So, because Gemfile depends on bolt ~> 5.0,
  version solving has failed.
➜  testit git:(development)

However, after changing the puppet_litmus gemspec to be

➜  puppet_litmus_cat_2463_bolt git:(cat_2463_support_bolt_500) ✗ git diff main..HEAD
diff --git a/puppet_litmus.gemspec b/puppet_litmus.gemspec
index f0aa524..6cd07ec 100644
--- a/puppet_litmus.gemspec
+++ b/puppet_litmus.gemspec
@@ -25,7 +25,7 @@ Gem::Specification.new do |spec|
   EOF
   spec.summary = 'Providing a simple command line tool for puppet content creators, to enable simple and complex test deployments.'
   spec.required_ruby_version = Gem::Requirement.new('>= 3.1.0')
-  spec.add_runtime_dependency 'bolt', '~> 4.0'
+  spec.add_runtime_dependency 'bolt', '>= 4.0', '< 6.0'
   spec.add_runtime_dependency 'docker-api', '>= 1.34', '< 3.0.0'
   spec.add_runtime_dependency 'parallel'
   spec.add_runtime_dependency 'puppet-modulebuilder', '>= 0.3.0'
➜  puppet_litmus_cat_2463_bolt git:(cat_2463_support_bolt_500) 

then the bundle install works just fine

➜  testit git:(development) bundle install
Fetching gem metadata from https://rubygems-puppetcore.puppet.com/..
Resolving dependencies...
Fetching gem metadata from https://rubygems.org/............
Fetching concurrent-ruby 1.3.5
Fetching base64 0.3.0
Fetching nkf 0.2.0
Fetching public_suffix 6.0.
...
...
➜  testit git:(development) cat Gemfile.lock | ruby -ne 'puts $_ if $_ =~ /remote:|^\s{4}(puppet|facter|bolt|puppet_litmus)\s\(/'
  remote: /Users/gavin.didrichsen/@REFERENCES/github/app/development/tools/@troubleshooting/@jira/cat-2357-pdk-templates-bolt-puppetcore/repos/puppet_litmus_cat_2463_bolt
    puppet_litmus (2.3.2)
  remote: https://rubygems-puppetcore.puppet.com/
    bolt (5.0.0)
    facter (4.15.0)
    puppet (8.15.0)
    puppet (8.15.0-universal-darwin)
  remote: https://rubygems.org/
➜  testit git:(development) 

Using bolt 4.0.0

Changing the Gemfile to use the public bolt 4.0.0, e.g.,

source 'https://rubygems.org'
gem "puppet_litmus", :path => '/path/to/my/puppet_litmus'
source 'https://rubygems-puppetcore.puppet.com' do
  gem 'puppet', '~> 8.15'
  gem 'facter', '~> 4.15'
end

and the bundle installation works as expected:

➜  testit git:(development) cat Gemfile.lock | ruby -ne 'puts $_ if $_ =~ /remote:|^\s{4}(puppet|facter|bolt|puppet_litmus)\s\(/'
  remote: /Users/gavin.didrichsen/@REFERENCES/github/app/development/tools/@troubleshooting/@jira/cat-2357-pdk-templates-bolt-puppetcore/repos/puppet_litmus_cat_2463_bolt
    puppet_litmus (2.3.2)
  remote: https://rubygems-puppetcore.puppet.com/
    facter (4.15.0)
    puppet (8.15.0)
    puppet (8.15.0-universal-darwin)
  remote: https://rubygems.org/
    bolt (4.0.0)
➜  testit git:(development) 

So it's backward compatible.

@gavindidrichsen gavindidrichsen marked this pull request as ready for review October 8, 2025 10:01
@gavindidrichsen gavindidrichsen requested a review from a team as a code owner October 8, 2025 10:02
@gavindidrichsen gavindidrichsen merged commit f12fe00 into main Oct 8, 2025
5 checks passed
@gavindidrichsen gavindidrichsen deleted the cat_2463_support_bolt_500 branch October 8, 2025 10:02
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants