Skip to content

Commit 24e3e6b

Browse files
(PE-42498) Update to support Bolt v5
1 parent 67899f0 commit 24e3e6b

File tree

3 files changed

+19
-5
lines changed

3 files changed

+19
-5
lines changed

.github/workflows/test-add-compiler-matrix.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,8 @@ jobs:
3232
BOLT_GEM: true
3333
BOLT_DISABLE_ANALYTICS: true
3434
LANG: en_US.UTF-8
35+
PUPPET_FORGE_TOKEN: ${{ secrets.PUPPET_FORGE_API_TOKEN }}
36+
BUNDLE_RUBYGEMS___PUPPETCORE__PUPPET__COM: forge-key:${{ secrets.PUPPET_FORGE_API_TOKEN }}
3537
strategy:
3638
fail-fast: false
3739
matrix:

Gemfile

Lines changed: 14 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ group :development do
3838
gem "rubocop-factory_bot", '~> 2.27.1', require: false
3939
gem "rubocop-capybara", '~> 2.22.1', require: false
4040
gem "rb-readline", '= 0.5.5', require: false, platforms: [:mswin, :mingw, :x64_mingw]
41-
gem "bolt", '>= 4.0.0', require: false
41+
#gem "bolt", '>= 4.0.0', require: false
4242
gem "github_changelog_generator", '1.16.4', require: false
4343
gem "octokit", '4.21.0', require: false
4444
gem "orchestrator_client", '< 0.7.1', require: false
@@ -55,14 +55,24 @@ end
5555
puppet_version = ENV['PUPPET_GEM_VERSION']
5656
facter_version = ENV['FACTER_GEM_VERSION']
5757
hiera_version = ENV['HIERA_GEM_VERSION']
58+
bolt_version = ENV.fetch('BOLT_GEM_VERSION', nil)
5859

5960
gems = {}
6061

61-
gems['puppet'] = location_for(puppet_version)
62+
# If PUPPET_FORGE_TOKEN is set then use authenticated source for both puppet and facter, since facter is a transitive dependency of puppet
63+
# Otherwise, do as before and use location_for to fetch gems from the default source
64+
if !ENV['PUPPET_FORGE_TOKEN'].to_s.empty?
65+
gems['bolt'] = [bolt_version || '~> 5.0', { require: false, source: 'https://rubygems-puppetcore.puppet.com' }]
66+
gems['puppet'] = [puppet_version || '~> 8.11', { require: false, source: 'https://rubygems-puppetcore.puppet.com' }]
67+
gems['facter'] = [facter_version || '~> 4.0', { require: false, source: 'https://rubygems-puppetcore.puppet.com' }]
68+
else
69+
gems['bolt'] = location_for(bolt_version)
70+
gems['puppet'] = location_for(puppet_version)
71+
gems['facter'] = location_for(facter_version) if facter_version
72+
end
6273

63-
# If facter or hiera versions have been specified via the environment
74+
# If hiera version have been specified via the environment
6475
# variables
65-
gems['facter'] = location_for(facter_version) if facter_version
6676
gems['hiera'] = location_for(hiera_version) if hiera_version
6777

6878
gems.each do |gem_name, gem_params|

functions/assert_supported_bolt_version.pp

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,10 @@
66
function peadm::assert_supported_bolt_version (
77
# No arguments
88
) >> Struct[{ 'supported' => Boolean }] {
9-
$supported_bolt_version = '>= 3.17.0 < 5.0.0'
9+
$supported_bolt_version = '>= 3.17.0 < 6.0.0'
10+
$current_bolt_version = peadm::bolt_version()
1011
$supported = (peadm::bolt_version() =~ SemVerRange($supported_bolt_version))
12+
out::message("Bolt version: ${current_bolt_version}")
1113
# lint:ignore:strict_indent
1214
unless $supported {
1315
fail(@("REASON"/L))

0 commit comments

Comments
 (0)