Skip to content

Commit 17b2e8b

Browse files
(PE-42498) Gemfile updates to use puppetcore
1 parent af84902 commit 17b2e8b

File tree

2 files changed

+18
-7
lines changed

2 files changed

+18
-7
lines changed

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

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,7 @@ jobs:
3232
BOLT_GEM: true
3333
BOLT_DISABLE_ANALYTICS: true
3434
LANG: en_US.UTF-8
35+
PUPPET_FORGE_TOKEN: ${{ secrets.FORGE_API_KEY }}
3536
strategy:
3637
fail-fast: false
3738
matrix:

Gemfile

Lines changed: 17 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -52,17 +52,27 @@ group :release_prep do
5252
gem "puppetlabs_spec_helper", '~> 6.0', require: false
5353
end
5454

55-
puppet_version = ENV['PUPPET_GEM_VERSION']
56-
facter_version = ENV['FACTER_GEM_VERSION']
57-
hiera_version = ENV['HIERA_GEM_VERSION']
58-
5955
gems = {}
6056

61-
gems['puppet'] = location_for(puppet_version)
57+
puppet_version = ENV.fetch('PUPPET_GEM_VERSION', nil)
58+
facter_version = ENV.fetch('FACTER_GEM_VERSION', nil)
59+
hiera_version = ENV.fetch('HIERA_GEM_VERSION', nil)
60+
bolt_version = ENV.fetch('BOLT_GEM_VERSION', nil)
61+
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['puppet'] = [puppet_version || '~> 8.11', { require: false, source: 'https://rubygems-puppetcore.puppet.com' }]
66+
gems['facter'] = [facter_version || '~> 4.0', { require: false, source: 'https://rubygems-puppetcore.puppet.com' }]
67+
gems['bolt'] = [bolt_version || '~> 5.0', { require: false, source: 'https://rubygems-puppetcore.puppet.com' }]
68+
else
69+
gems['puppet'] = location_for(puppet_version)
70+
gems['bolt'] = location_for(bolt_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|

0 commit comments

Comments
 (0)