From df8a06834b3c9ae93a7e53bb8a983bd06e6fb473 Mon Sep 17 00:00:00 2001 From: Tim Meusel Date: Fri, 29 Mar 2024 23:11:26 +0100 Subject: [PATCH 1/5] r10k::module::git: expose remote as getter This allows us to access the remote property to figure out the git URI for a module: ``` $ bundle exec irb Calling `DidYouMean::SPELL_CHECKERS.merge!(error_name => spell_checker)' has been deprecated. Please call `DidYouMean.correct_error(error_name, spell_checker)' instead. irb(main):001:0> require 'json' => true irb(main):002:0> require 'r10k/module_loader/puppetfile' => true irb(main):003:0> puppetfile = R10K::ModuleLoader::Puppetfile.new(basedir: '/home/bastelfreak/code/controlrepo/').load => {:modules=> ... irb(main):004:0> mod = puppetfile[:modules].map {|mod| mod if mod.class == R10K::Module::Git}.compact.first => ... irb(main):005:0> mod.remote => "https://github.com/voxpupuli/puppet-borg" irb(main):006:0> ``` cherry-picked 22da06bd1411bc9bed339ecc5a1b6262f6093a8b from https://github.com/puppetlabs/r10k/pull/1379 --- CHANGELOG.mkd | 1 + lib/r10k/module/git.rb | 5 +++++ 2 files changed, 6 insertions(+) diff --git a/CHANGELOG.mkd b/CHANGELOG.mkd index 5cf179a60..17a9375ba 100644 --- a/CHANGELOG.mkd +++ b/CHANGELOG.mkd @@ -4,6 +4,7 @@ CHANGELOG Unreleased ---------- +- r10k::module::git: expose remote as getter [#1379](https://github.com/puppetlabs/r10k/pull/1379) 3.16.1 ------ diff --git a/lib/r10k/module/git.rb b/lib/r10k/module/git.rb index 1cec41333..84fcb409f 100644 --- a/lib/r10k/module/git.rb +++ b/lib/r10k/module/git.rb @@ -46,6 +46,11 @@ def self.statically_defined_version(name, args) # @return [String] attr_reader :default_override_ref + # @!attribute[r] remote + # @api private + # @return [String] + attr_reader :remote + include R10K::Util::Setopts def initialize(title, dirname, opts, environment=nil) From 8aae06d384d527c1d30b97b616caa082bd70b836 Mon Sep 17 00:00:00 2001 From: Justin Stoller Date: Fri, 10 May 2024 08:42:27 -0700 Subject: [PATCH 2/5] (maint) Allow automation to release 3.x versions as well --- .github/workflows/release.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 62c21d51c..125101972 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -4,6 +4,7 @@ on: push: branches: - main + - 3.x paths: - 'lib/r10k/version.rb' From 289b87121bbcf6d23b55848b784145c3c0103b02 Mon Sep 17 00:00:00 2001 From: Justin Stoller Date: Mon, 20 May 2024 22:21:28 -0700 Subject: [PATCH 3/5] (maint) Prep for #patch release 3.16.2 --- CHANGELOG.mkd | 3 +++ lib/r10k/version.rb | 2 +- 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.mkd b/CHANGELOG.mkd index 17a9375ba..6d45ae346 100644 --- a/CHANGELOG.mkd +++ b/CHANGELOG.mkd @@ -4,6 +4,9 @@ CHANGELOG Unreleased ---------- +3.16.2 +------ + - r10k::module::git: expose remote as getter [#1379](https://github.com/puppetlabs/r10k/pull/1379) 3.16.1 diff --git a/lib/r10k/version.rb b/lib/r10k/version.rb index 67eca680b..384bd1e2f 100644 --- a/lib/r10k/version.rb +++ b/lib/r10k/version.rb @@ -2,5 +2,5 @@ module R10K # When updating to a new major (X) or minor (Y) version, include `#major` or # `#minor` (respectively) in your commit message to trigger the appropriate # release. Otherwise, a new patch (Z) version will be released. - VERSION = '3.16.1' + VERSION = '3.16.2' end From b0d4af5414e7e7fda4f524fc21375d0bffdf6b3b Mon Sep 17 00:00:00 2001 From: Justin Stoller Date: Tue, 30 Jul 2024 22:00:24 -0700 Subject: [PATCH 4/5] (maint) Update test deps to relatively recent releases This still doesn't update them to their most modern releases but does as much of a lift as I have time for. --- integration/Gemfile | 7 ++-- integration/Rakefile | 81 +++++++++++++++++++++++++++++++------------- 2 files changed, 61 insertions(+), 27 deletions(-) diff --git a/integration/Gemfile b/integration/Gemfile index 515e05649..0785e3d61 100644 --- a/integration/Gemfile +++ b/integration/Gemfile @@ -10,10 +10,9 @@ def location_for(place, fake_version = nil) end end -gem 'beaker', *location_for(ENV['BEAKER_VERSION'] || '~> 4.5') -gem 'beaker-pe', '~> 2.0' -gem 'beaker-answers' +gem 'beaker', *location_for(ENV['BEAKER_VERSION'] || '~> 4.40') +gem 'beaker-pe', '~> 3.0' gem 'beaker-hostgenerator', *location_for(ENV['BEAKER_HOSTGENERATOR_VERSION'] || '~> 1.1') gem 'beaker-abs', *location_for(ENV['BEAKER_ABS_VERSION'] || '~> 0.4') -gem 'rototiller', '= 0.1.0' +gem 'rototiller', '= 1.0' gem 'beaker-qa-i18n' diff --git a/integration/Rakefile b/integration/Rakefile index 88040dc8f..30ec695be 100644 --- a/integration/Rakefile +++ b/integration/Rakefile @@ -20,24 +20,6 @@ end desc 'The acceptance tests for r10k, run in the beaker framework' rototiller_task :beaker => [:beaker_hostgenerator] do |t| - common_setup = <<-EOS -pre-suite/00_pe_install.rb, -component/pre-suite/05_install_dev_r10k.rb, -pre-suite/10_git_config.rb, -pre-suite/20_pe_r10k.rb, -EOS - common_setup.gsub!("\n", '') - - flags = [ - {:name => '--hosts', :default => 'configs/generated', :override_env => 'BEAKER_HOST'}, - {:name => '--keyfile', :default => "#{ENV['HOME']}/.ssh/id_rsa-acceptance", :override_env => 'BEAKER_KEYFILE'}, - {:name => '--load-path', :default => 'lib'}, - {:name => '--pre-suite', :default => @acceptance_pre_suite || common_setup, :override_env => 'BEAKER_PRE_SUITE'}, - {:name => '--tests', :default => 'tests', :override_env => 'BEAKER_TESTS'}, - {:name => '--preserve-hosts', :default => 'onfail', :override_env => 'BEAKER_PRESERVE_HOSTS'}, - ] - t.add_flag(*flags) - t.add_env do |env| env.name = 'PE_FAMILY' env.message = 'The puppet enterprise major branch to install from' @@ -54,7 +36,62 @@ EOS env.message = 'The git provider that r10k should use on a SUT' end - t.add_command({:name => 'beaker --debug', :override_env => 'BEAKER_EXECUTABLE'}) + t.add_command do |cmd| + cmd.name = 'beaker --debug' + + common_setup = <<-EOS +pre-suite/00_pe_install.rb, +component/pre-suite/05_install_dev_r10k.rb, +pre-suite/10_git_config.rb, +pre-suite/20_pe_r10k.rb, +EOS + common_setup.gsub!("\n", '') + + cmd.add_option do |opt| + opt.name = '--hosts' + opt.add_argument do |arg| + arg.name = 'configs/generated' + arg.add_env({name: 'BEAKER_HOST'}) + end + end + + cmd.add_option do |opt| + opt.name = '--keyfile' + opt.add_argument do |arg| + arg.name = "#{ENV['HOME']}/.ssh/id_rsa-acceptance" + arg.add_env({name: 'BEAKER_KEYFILE'}) + end + end + + cmd.add_option do |opt| + opt.name = '--pre-suite' + opt.add_argument do |arg| + arg.name = @acceptance_pre_suite || common_setup + arg.add_env({name: 'BEAKER_PRE_SUITE'}) + end + end + + cmd.add_option do |opt| + opt.name = '--tests' + opt.add_argument do |arg| + arg.name = 'tests' + arg.add_env({name: 'BEAKER_TESTS'}) + end + end + + cmd.add_option do |opt| + opt.name = '--preserve-hosts' + opt.add_argument do |arg| + arg.name = 'onfail' + arg.add_env({name: 'BEAKER_PRESERVE_HOSTS'}) + end + end + + cmd.add_option do |opt| + opt.name = '--load-path' + opt.add_argument({name: 'lib'}) + end + end end desc 'Generate a host configuration used by Beaker' @@ -64,12 +101,10 @@ rototiller_task :beaker_hostgenerator do |t| t.add_command do |c| c.name = 'beaker-hostgenerator' c.argument = '> configs/generated' + c.add_option(:name => '', :default => 'centos7-64mdca-64.fa', :override_env => 'TEST_TARGET') + c.add_option(:name => '--global-config', :default => '{forge_host=forgeapi.puppet.com}', :override_env => 'BHG_GLOBAL_CONFIG') end - # This is a hack :( - t.add_flag(:name => '', :default => 'centos7-64mdca-64.fa', :override_env => 'TEST_TARGET') - - t.add_flag(:name => '--global-config', :default => '{forge_host=forgeapi.puppet.com}', :override_env => 'BHG_GLOBAL_CONFIG') end end From 3268f8289bbccbfa53220626ab0db220c932941e Mon Sep 17 00:00:00 2001 From: Justin Stoller Date: Tue, 30 Jul 2024 22:01:41 -0700 Subject: [PATCH 5/5] (maint) Allow git-daemon to trust local repos --- integration/pre-suite/10_git_config.rb | 1 + 1 file changed, 1 insertion(+) diff --git a/integration/pre-suite/10_git_config.rb b/integration/pre-suite/10_git_config.rb index 609dc926b..8428a8a0f 100755 --- a/integration/pre-suite/10_git_config.rb +++ b/integration/pre-suite/10_git_config.rb @@ -36,6 +36,7 @@ on(master, puppet('apply'), :stdin => git_manifest, :acceptable_exit_codes => [0,2]) do |result| assert_no_match(/Error:/, result.stderr, 'Unexpected error was detected!') end +on(master, 'git config --system --add safe.directory "*"') step 'Create "production" Environment on Git' init_r10k_source_from_prod(master, git_repo_path, git_repo_name, git_environments_path, 'production')