@@ -53,18 +53,22 @@ group :system_tests do
5353 gem "voxpupuli-acceptance" , require : false
5454end
5555
56- puppet_version = ENV [ 'PUPPET_GEM_VERSION' ]
57- facter_version = ENV [ 'FACTER_GEM_VERSION' ]
58- hiera_version = ENV [ 'HIERA_GEM_VERSION' ]
56+ puppet_version = ENV . fetch ( 'PUPPET_GEM_VERSION' , nil )
57+ facter_version = ENV . fetch ( 'FACTER_GEM_VERSION' , nil )
58+ hiera_version = ENV . fetch ( 'HIERA_GEM_VERSION' , nil )
5959
6060gems = { }
6161
62- gems [ 'puppet' ] = location_for ( puppet_version )
63-
64- # If facter or hiera versions have been specified via the environment
65- # variables
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' ] = [ '~> 8.11' , { require : false , source : 'https://rubygems-puppetcore.puppet.com' } ]
66+ gems [ 'facter' ] = [ '~> 4.11' , { require : false , source : 'https://rubygems-puppetcore.puppet.com' } ]
67+ else
68+ gems [ 'puppet' ] = location_for ( puppet_version )
69+ gems [ 'facter' ] = location_for ( facter_version ) if facter_version
70+ end
6671
67- gems [ 'facter' ] = location_for ( facter_version ) if facter_version
6872gems [ 'hiera' ] = location_for ( hiera_version ) if hiera_version
6973
7074gems . each do |gem_name , gem_params |
0 commit comments