Skip to content

Commit 184086f

Browse files
(PA-7366) Update testing to use puppetcore
1 parent 0f3c5c9 commit 184086f

File tree

2 files changed

+14
-5
lines changed

2 files changed

+14
-5
lines changed

.github/workflows/unit_tests.yaml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,8 @@ on:
1111
jobs:
1212
Nightly:
1313
uses: "puppetlabs/phoenix-github-actions/.github/workflows/unit_tests_with_nightly_puppet_gem.yaml@main"
14+
secrets: inherit
1415

1516
Released:
1617
uses: "puppetlabs/phoenix-github-actions/.github/workflows/unit_tests_with_released_puppet_gem.yaml@main"
18+
secrets: inherit

Gemfile

Lines changed: 12 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -58,13 +58,20 @@ facter_version = ENV['FACTER_GEM_VERSION']
5858
hiera_version = ENV['HIERA_GEM_VERSION']
5959

6060
gems = {}
61+
puppet_version = ENV.fetch('PUPPET_GEM_VERSION', nil)
62+
facter_version = ENV.fetch('FACTER_GEM_VERSION', nil)
63+
hiera_version = ENV.fetch('HIERA_GEM_VERSION', nil)
6164

62-
gems['puppet'] = location_for(puppet_version)
63-
64-
# If facter or hiera versions have been specified via the environment
65-
# variables
65+
# If PUPPET_FORGE_TOKEN is set then use authenticated source for both puppet and facter, since facter is a transitive dependency of puppet
66+
# Otherwise, do as before and use location_for to fetch gems from the default source
67+
if !ENV['PUPPET_FORGE_TOKEN'].to_s.empty?
68+
gems['puppet'] = ['~> 8.11', { require: false, source: 'https://rubygems-puppetcore.puppet.com' }]
69+
gems['facter'] = ['~> 4.11', { require: false, source: 'https://rubygems-puppetcore.puppet.com' }]
70+
else
71+
gems['puppet'] = location_for(puppet_version)
72+
gems['facter'] = location_for(facter_version) if facter_version
73+
end
6674

67-
gems['facter'] = location_for(facter_version) if facter_version
6875
gems['hiera'] = location_for(hiera_version) if hiera_version
6976

7077
gems.each do |gem_name, gem_params|

0 commit comments

Comments
 (0)