-
Notifications
You must be signed in to change notification settings - Fork 306
(CAT-2353) Puppetcore update #826
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
Show all changes
5 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1,9 @@ | ||
--fail-on-warnings | ||
--relative | ||
--no-80chars-check | ||
--no-140chars-check | ||
--no-class_inherits_from_params_class-check | ||
--no-autoloader_layout-check | ||
--no-documentation-check | ||
--no-single_quote_string_with_variables-check | ||
--ignore-paths=.vendor/**/*.pp,.bundle/**/*.pp,pkg/**/*.pp,spec/**/*.pp,tests/**/*.pp,types/**/*.pp,vendor/**/*.pp |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,78 +1,101 @@ | ||
source ENV['GEM_SOURCE'] || 'https://rubygems.org' | ||
# frozen_string_literal: true | ||
|
||
def location_for(place_or_version, fake_version = nil) | ||
git_url_regex = %r{\A(?<url>(https?|git)[:@][^#]*)(#(?<branch>.*))?} | ||
file_url_regex = %r{\Afile:\/\/(?<path>.*)} | ||
# For puppetcore, set GEM_SOURCE_PUPPETCORE = 'https://rubygems-puppetcore.puppet.com' | ||
gemsource_default = ENV['GEM_SOURCE'] || 'https://rubygems.org' | ||
gemsource_puppetcore = if ENV['PUPPET_FORGE_TOKEN'] | ||
'https://rubygems-puppetcore.puppet.com' | ||
else | ||
ENV['GEM_SOURCE_PUPPETCORE'] || gemsource_default | ||
end | ||
source gemsource_default | ||
|
||
def location_for(place_or_constraint, fake_constraint = nil, opts = {}) | ||
git_url_regex = /\A(?<url>(?:https?|git)[:@][^#]*)(?:#(?<branch>.*))?/ | ||
file_url_regex = %r{\Afile://(?<path>.*)} | ||
|
||
if place_or_constraint && (git_url = place_or_constraint.match(git_url_regex)) | ||
# Git source → ignore :source, keep fake_constraint | ||
[fake_constraint, { git: git_url[:url], branch: git_url[:branch], require: false }].compact | ||
|
||
elsif place_or_constraint && (file_url = place_or_constraint.match(file_url_regex)) | ||
# File source → ignore :source, keep fake_constraint or default >= 0 | ||
[fake_constraint || '>= 0', { path: File.expand_path(file_url[:path]), require: false }] | ||
|
||
if 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 | ||
elsif place_or_version && (file_url = place_or_version.match(file_url_regex)) | ||
['>= 0', { path: File.expand_path(file_url[:path]), require: false }] | ||
else | ||
[place_or_version, { require: false }] | ||
# Plain version constraint → merge opts (including :source if provided) | ||
[place_or_constraint, { require: false }.merge(opts)] | ||
end | ||
end | ||
|
||
# Print debug information if DEBUG_GEMS or VERBOSE is set | ||
def print_gem_statement_for(gems) | ||
puts 'DEBUG: Gem definitions that will be generated:' | ||
gems.each do |gem_name, gem_params| | ||
puts "DEBUG: gem #{([gem_name.inspect] + gem_params.map(&:inspect)).join(', ')}" | ||
end | ||
end | ||
|
||
group :development do | ||
gem "json", '= 2.1.0', require: false if Gem::Requirement.create(['>= 2.5.0', '< 2.7.0']).satisfied_by?(Gem::Version.new(RUBY_VERSION.dup)) | ||
gem "json", '= 2.3.0', require: false if Gem::Requirement.create(['>= 2.7.0', '< 3.0.0']).satisfied_by?(Gem::Version.new(RUBY_VERSION.dup)) | ||
gem "json", '= 2.5.1', require: false if Gem::Requirement.create(['>= 3.0.0', '< 3.0.5']).satisfied_by?(Gem::Version.new(RUBY_VERSION.dup)) | ||
gem "json", '= 2.6.1', require: false if Gem::Requirement.create(['>= 3.1.0', '< 3.1.3']).satisfied_by?(Gem::Version.new(RUBY_VERSION.dup)) | ||
gem "json", '= 2.6.3', require: false if Gem::Requirement.create(['>= 3.2.0', '< 4.0.0']).satisfied_by?(Gem::Version.new(RUBY_VERSION.dup)) | ||
gem "racc", '~> 1.4.0', require: false if Gem::Requirement.create(['>= 2.7.0', '< 3.0.0']).satisfied_by?(Gem::Version.new(RUBY_VERSION.dup)) | ||
gem "deep_merge", '~> 1.2.2', require: false | ||
gem "voxpupuli-puppet-lint-plugins", '~> 5.0', require: false | ||
gem "facterdb", '~> 2.1', require: false | ||
gem "facterdb", '~> 2.1', require: false if Gem::Requirement.create(['< 3.0.0']).satisfied_by?(Gem::Version.new(RUBY_VERSION.dup)) | ||
gem "facterdb", '~> 3.0', require: false if Gem::Requirement.create(['>= 3.0.0']).satisfied_by?(Gem::Version.new(RUBY_VERSION.dup)) | ||
gem "metadata-json-lint", '~> 4.0', require: false | ||
gem "rspec-puppet-facts", '~> 4.0', require: false | ||
gem "json-schema", '< 5.1.1', require: false | ||
gem "rspec-puppet-facts", '~> 4.0', require: false if Gem::Requirement.create(['< 3.0.0']).satisfied_by?(Gem::Version.new(RUBY_VERSION.dup)) | ||
gem "rspec-puppet-facts", '~> 5.0', require: false if Gem::Requirement.create(['>= 3.0.0']).satisfied_by?(Gem::Version.new(RUBY_VERSION.dup)) | ||
gem "dependency_checker", '~> 1.0.0', require: false | ||
gem "parallel_tests", '= 3.12.1', require: false | ||
gem "pry", '~> 0.10', require: false | ||
gem "simplecov-console", '~> 0.9', require: false | ||
gem "puppet-debugger", '~> 1.0', require: false | ||
gem "puppet-debugger", '~> 1.6', require: false | ||
gem "rubocop", '~> 1.50.0', require: false | ||
gem "rubocop-performance", '= 1.16.0', require: false | ||
gem "rubocop-rspec", '= 2.19.0', require: false | ||
gem "rb-readline", '= 0.5.5', require: false, platforms: [:mswin, :mingw, :x64_mingw] | ||
gem "rexml", '>= 3.3.9', require: false | ||
gem "bigdecimal", '< 3.2.2', require: false, platforms: [:mswin, :mingw, :x64_mingw] | ||
end | ||
group :development, :release_prep do | ||
gem "puppet-strings", '~> 4.0', require: false | ||
gem "puppetlabs_spec_helper", '~> 7.0', require: false | ||
gem "puppetlabs_spec_helper", '~> 8.0', require: false | ||
gem "puppet-blacksmith", '~> 7.0', require: false | ||
end | ||
group :system_tests do | ||
gem "puppet_litmus", '~> 1.0', require: false, platforms: [:ruby, :x64_mingw] | ||
gem "puppet_litmus", '~> 2.0', require: false, platforms: [:ruby, :x64_mingw] if !ENV['PUPPET_FORGE_TOKEN'].to_s.empty? | ||
gem "puppet_litmus", '~> 1.0', require: false, platforms: [:ruby, :x64_mingw] if ENV['PUPPET_FORGE_TOKEN'].to_s.empty? | ||
gem "CFPropertyList", '< 3.0.7', require: false, platforms: [:mswin, :mingw, :x64_mingw] | ||
gem "serverspec", '~> 2.41', require: false | ||
end | ||
|
||
puppet_version = ENV['PUPPET_GEM_VERSION'] | ||
facter_version = ENV['FACTER_GEM_VERSION'] | ||
hiera_version = ENV['HIERA_GEM_VERSION'] | ||
|
||
gems = {} | ||
puppet_version = ENV.fetch('PUPPET_GEM_VERSION', nil) | ||
facter_version = ENV.fetch('FACTER_GEM_VERSION', nil) | ||
hiera_version = ENV.fetch('HIERA_GEM_VERSION', nil) | ||
|
||
gems['puppet'] = location_for(puppet_version) | ||
|
||
# If facter or hiera versions have been specified via the environment | ||
# variables | ||
|
||
gems['facter'] = location_for(facter_version) if facter_version | ||
gems['hiera'] = location_for(hiera_version) if hiera_version | ||
gems['puppet'] = location_for(puppet_version, nil, { source: gemsource_puppetcore }) | ||
gems['facter'] = location_for(facter_version, nil, { source: gemsource_puppetcore }) | ||
gems['hiera'] = location_for(hiera_version, nil, {}) if hiera_version | ||
|
||
# Generate the gem definitions | ||
print_gem_statement_for(gems) if ENV['DEBUG'] | ||
gems.each do |gem_name, gem_params| | ||
gem gem_name, *gem_params | ||
end | ||
|
||
# Evaluate Gemfile.local and ~/.gemfile if they exist | ||
extra_gemfiles = [ | ||
"#{__FILE__}.local", | ||
File.join(Dir.home, '.gemfile'), | ||
File.join(Dir.home, '.gemfile') | ||
] | ||
|
||
extra_gemfiles.each do |gemfile| | ||
if File.file?(gemfile) && File.readable?(gemfile) | ||
eval(File.read(gemfile), binding) | ||
end | ||
next unless File.file?(gemfile) && File.readable?(gemfile) | ||
|
||
# rubocop:disable Security/Eval | ||
eval(File.read(gemfile), binding) | ||
# rubocop:enable Security/Eval | ||
end | ||
# vim: syntax=ruby |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why did you pin to 5.1.0 or older? Did I introduce bugs in 5.1.1?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That was part of the
pdk update
command run. It was not a manual adjustment. We can look into updating the templates if the 5.1.1 has significantly important updates.