Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
P
Pdk Templates
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Iterations
Requirements
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Test cases
Artifacts
Deploy
Releases
Package registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Code review analytics
Issue analytics
Insights
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
puppet-infra
Pdk Templates
Commits
2cbc2e57
Unverified
Commit
2cbc2e57
authored
5 months ago
by
Gavin Didrichsen
Browse files
Options
Downloads
Patches
Plain Diff
Update the Gemfile to switch on PUPPET_AUTH_TOKEN
Signed-off-by:
Gavin Didrichsen
<
gavin.didrichsen@gmail.com
>
parent
d5f5ac14
No related branches found
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
moduleroot/Gemfile.erb
+11
-9
11 additions, 9 deletions
moduleroot/Gemfile.erb
with
11 additions
and
9 deletions
moduleroot/Gemfile.erb
+
11
−
9
View file @
2cbc2e57
...
@@ -58,16 +58,20 @@ end
...
@@ -58,16 +58,20 @@ end
-%>
-%>
source ENV['GEM_SOURCE'] || 'https://rubygems.org'
source ENV['GEM_SOURCE'] || 'https://rubygems.org'
def location_for(place_or_version, fake_version = nil)
def location_for(place_or_version, fake_version =
nil, gem_name =
nil)
git_url_regex = %r{\A(?
<url>
(https?|git)[:@][^#]*)(#(?
<branch>
.*))?}
git_url_regex = %r{\A(?
<url>
(https?|git)[:@][^#]*)(#(?
<branch>
.*))?}
file_url_regex = %r{\Afile:\/\/(?
<path>
.*)}
file_url_regex = %r{\Afile:\/\/(?
<path>
.*)}
if place_or_version
&&
(git_url = place_or_version.match(git_url_regex))
version = place_or_version || '>= 0'
if ['puppet', 'facter'].include?(gem_name)
&&
ENV['PUPPET_AUTH_TOKEN']
[version, { require: false, source: 'https://rubygems-puppetcore.puppet.com' }]
elsif place_or_version
&&
(git_url = place_or_version.match(git_url_regex))
[fake_version, { git: git_url[:url], branch: git_url[:branch], require: false }].compact
[fake_version, { git: git_url[:url], branch: git_url[:branch], require: false }].compact
elsif place_or_version
&&
(file_url = place_or_version.match(file_url_regex))
elsif place_or_version
&&
(file_url = place_or_version.match(file_url_regex))
['>= 0', { path: File.expand_path(file_url[:path]), require: false }]
['>= 0', { path: File.expand_path(file_url[:path]), require: false }]
else
else
[
place_or_
version, { require: false }]
[version, { require: false }]
end
end
end
end
...
@@ -110,13 +114,11 @@ hiera_version = ENV['HIERA_GEM_VERSION']
...
@@ -110,13 +114,11 @@ hiera_version = ENV['HIERA_GEM_VERSION']
gems = {}
gems = {}
gems['puppet'] = location_for(puppet_version)
gems['puppet'] = location_for(puppet_version, nil, 'puppet')
# If facter or hiera versions have been specified via the environment
# variables
gems['facter'] = location_for(facter_version) if facter_version
# If facter or hiera versions have been specified via the environment variables
gems['hiera'] = location_for(hiera_version) if hiera_version
gems['facter'] = location_for(facter_version, nil, 'facter') if facter_version
gems['hiera'] = location_for(hiera_version, nil, 'hiera') if hiera_version
gems.each do |gem_name, gem_params|
gems.each do |gem_name, gem_params|
gem gem_name, *gem_params
gem gem_name, *gem_params
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment