diff --git a/.github/workflows/docker.yml b/.github/workflows/docker.yml index 91c6c6276..64979ffe5 100644 --- a/.github/workflows/docker.yml +++ b/.github/workflows/docker.yml @@ -29,9 +29,9 @@ jobs: - run: gem install bundler - uses: actions/checkout@v3 - name: Set up QEMU - uses: docker/setup-qemu-action@v1 + uses: docker/setup-qemu-action@v2 - name: Set up Docker Buildx - uses: docker/setup-buildx-action@v1 + uses: docker/setup-buildx-action@v2 - name: Build container working-directory: docker run: | diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 79cd0cd9f..62c21d51c 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -15,7 +15,7 @@ jobs: with: fetch-depth: '0' - name: Bump version and push tag - uses: anothrNick/github-tag-action@1.35.0 + uses: anothrNick/github-tag-action@1.67.0 env: GITHUB_TOKEN: ${{ secrets.PUPPET_RELEASE_GH_TOKEN }} DEFAULT_BUMP: patch diff --git a/.github/workflows/stale.yml b/.github/workflows/stale.yml index 7340e092f..15ba9ed6a 100644 --- a/.github/workflows/stale.yml +++ b/.github/workflows/stale.yml @@ -8,7 +8,7 @@ jobs: stale: runs-on: ubuntu-latest steps: - - uses: actions/stale@v3 + - uses: actions/stale@v8 with: repo-token: ${{ secrets.GITHUB_TOKEN }} days-before-stale: 60 diff --git a/CHANGELOG.mkd b/CHANGELOG.mkd index b1a9cfa2a..3ff630955 100644 --- a/CHANGELOG.mkd +++ b/CHANGELOG.mkd @@ -7,6 +7,14 @@ Unreleased - Drop Ruby 2.3/2.4/2.5 support; puppet_forge: Use 4.1 and newer [#1336](https://github.com/puppetlabs/r10k/pull/1336) + +3.16.0 +------ +- Emit more debug output when modules fail to sync [#1347](https://github.com/puppetlabs/r10k/pull/1347) +- Update GitHub Actions & introduce dependabot [#1337](https://github.com/puppetlabs/r10k/pull/1337) +- Update R10K proxy usage to follow newer rugged best practices [PE-35980](https://tickets.puppet.com/browse/PE-35980) +- Update Acceptance tests to be compatible with Puppet 8 [#1349](https://github.com/puppetlabs/r10k/pull/1349) + 3.15.4 ------ - Pin dependencies to maintain support for old Ruby versions [#1329](https://github.com/puppetlabs/r10k/pull/1329) diff --git a/Gemfile b/Gemfile index 8214b854e..0ea5437a3 100644 --- a/Gemfile +++ b/Gemfile @@ -6,7 +6,7 @@ group :extra do end group :development do - gem 'simplecov', '~> 0.9.1' + gem 'simplecov', '~> 0.17.1' gem 'ruby-prof', :platforms => :ruby end diff --git a/integration/files/pre-suite/git_config.pp.erb b/integration/files/pre-suite/git_config.pp.erb index 87bf5e94c..ba9046ad0 100755 --- a/integration/files/pre-suite/git_config.pp.erb +++ b/integration/files/pre-suite/git_config.pp.erb @@ -1,4 +1,4 @@ -$git_package = $osfamily ? { +$git_package = $facts['os']['family'] ? { 'Debian' => 'git-core', default => 'git' } diff --git a/integration/pre-suite/10_git_config.rb b/integration/pre-suite/10_git_config.rb index 1c4e65b0c..609dc926b 100755 --- a/integration/pre-suite/10_git_config.rb +++ b/integration/pre-suite/10_git_config.rb @@ -23,9 +23,6 @@ fail_test('This pre-suite requires PE 3.7 or above!') if pe_version < 3.7 #Setup -step 'Stub Forge on Master' -stub_forge_on(master) - step 'Read module path' on(master, puppet('config print basemodulepath')) do |result| (result.stdout.include? ':') ? separator = ':' : separator = ';' diff --git a/integration/tests/Puppetfile/HTTP_PROXY_affects_git_source.rb b/integration/tests/Puppetfile/HTTP_PROXY_affects_git_source.rb index 27d89f118..f58725202 100644 --- a/integration/tests/Puppetfile/HTTP_PROXY_affects_git_source.rb +++ b/integration/tests/Puppetfile/HTTP_PROXY_affects_git_source.rb @@ -19,7 +19,7 @@ puppetfile =<<-EOS mod 'motd', - :git => 'https://github.com/puppetlabs/puppetlabs-motd' + :git => 'https://github.com/puppetlabs/puppetlabs-motd', :branch => 'main' EOS proxy_env_value = 'http://ferritsarebest.net:3219' @@ -36,7 +36,7 @@ CONF teardown do - master.clear_env_var('HTTP_PROXY') + master.clear_env_var('HTTPS_PROXY') step 'Restore Original "r10k" Config' on(master, "mv #{r10k_config_bak_path} #{r10k_config_path}") @@ -45,7 +45,7 @@ clean_up_r10k(master, last_commit, git_environments_path) end -master.add_env_var('HTTP_PROXY', proxy_env_value) +master.add_env_var('HTTPS_PROXY', proxy_env_value) step 'Backup Current "r10k" Config' on(master, "mv #{r10k_config_path} #{r10k_config_bak_path}") @@ -64,7 +64,8 @@ #test on(master, "#{r10k_fqp} deploy environment -p", :accept_all_exit_codes => true) do |r| - regex = /(Couldn't|Could not) resolve proxy.*ferritsarebest\.net/i + # Rugged as of 0.28 has a different error message than shellgit + regex = /((failed to resolve address for)|(Could not resolve proxy:)) ferritsarebest\.net/ assert(r.exit_code == 1, 'expected error code was not observed') assert_match(regex, r.stderr, 'The expected error message was not observed' ) end diff --git a/integration/tests/basic_functionality/install_pe_only_module_with_puppetfile.rb b/integration/tests/basic_functionality/install_pe_only_module_with_puppetfile.rb deleted file mode 100644 index 933b2ae1e..000000000 --- a/integration/tests/basic_functionality/install_pe_only_module_with_puppetfile.rb +++ /dev/null @@ -1,83 +0,0 @@ -require 'git_utils' -require 'r10k_utils' -require 'master_manipulator' -test_name 'RK-158 - C92362 - Install a PE-only module from forge' - -#Init -env_path = on(master, puppet('config print environmentpath')).stdout.rstrip -r10k_fqp = get_r10k_fqp(master) -master_certname = on(master, puppet('config', 'print', 'certname')).stdout.rstrip - -git_repo_path = '/git_repos' -git_repo_name = 'environments' -git_control_remote = File.join(git_repo_path, "#{git_repo_name}.git") -git_environments_path = '/root/environments' -last_commit = git_last_commit(master, git_environments_path) -git_provider = ENV['GIT_PROVIDER'] || 'shellgit' - -r10k_config_path = get_r10k_config_file_path(master) -r10k_config_bak_path = "#{r10k_config_path}.bak" - -#In-line files -r10k_conf = <<-CONF -cachedir: '/var/cache/r10k' -git: - provider: '#{git_provider}' -sources: - control: - basedir: "#{env_path}" - remote: "#{git_control_remote}" -CONF - -#Manifest -site_pp_path = File.join(git_environments_path, 'manifests', 'site.pp') -site_pp = create_site_pp(master_certname, ' include peonly') - -# Verification -notify_message_regex = /I am in the production environment, this is a PE only module/ - -#Teardown -teardown do - step 'remove license file' - on(master, 'rm -f /etc/puppetlabs/license.key') - - step 'Restore Original "r10k" Config' - on(master, "mv #{r10k_config_bak_path} #{r10k_config_path}") - - step 'cleanup r10k' - clean_up_r10k(master, last_commit, git_environments_path) -end - -#Setup -step 'Stub the forge' -stub_forge_on(master) - -step 'Backup a Valid "r10k" Config' -on(master, "mv #{r10k_config_path} #{r10k_config_bak_path}") - -step 'Update the "r10k" Config' -create_remote_file(master, r10k_config_path, r10k_conf) - -step 'Download license file from artifactory' -curl_on(master, 'https://artifactory.delivery.puppetlabs.net/artifactory/generic/r10k_test_license.key -o /etc/puppetlabs/license.key') - -step 'Inject New "site.pp" to the "production" Environment' -inject_site_pp(master, site_pp_path, site_pp) - -step 'Copy Puppetfile to "production" Environment Git Repo' -create_remote_file(master, "#{git_environments_path}/Puppetfile", 'mod "ztr-peonly"') - -step 'Push Changes' -git_add_commit_push(master, 'production', 'add Puppetfile', git_environments_path) - -#Tests -step 'Deploy "production" Environment via r10k' -on(master, "#{r10k_fqp} deploy environment -p") - -agents.each do |agent| - step "Run Puppet Agent" - on(agent, puppet('agent', '--test', '--environment production'), :acceptable_exit_codes => 2) do |result| - assert_no_match(/Error:/, result.stderr, 'Unexpected error was detected!') - assert_match(notify_message_regex, result.stdout, 'Expected message not found!') - end -end diff --git a/integration/tests/basic_functionality/proxy_specified_in_configuration.rb b/integration/tests/basic_functionality/proxy_specified_in_configuration.rb index 70fb6f837..25ec5b9b4 100644 --- a/integration/tests/basic_functionality/proxy_specified_in_configuration.rb +++ b/integration/tests/basic_functionality/proxy_specified_in_configuration.rb @@ -50,7 +50,7 @@ CONF #Verification -squid_log_regex = /CONNECT forgeapi.puppetlabs.com:443/ +squid_log_regex = /CONNECT forgeapi.puppet(labs)?.com:443/ #Teardown teardown do diff --git a/integration/tests/basic_functionality/proxy_with_pe_only_module.rb b/integration/tests/basic_functionality/proxy_with_pe_only_module.rb deleted file mode 100644 index 542d4748c..000000000 --- a/integration/tests/basic_functionality/proxy_with_pe_only_module.rb +++ /dev/null @@ -1,128 +0,0 @@ -require 'git_utils' -require 'r10k_utils' -require 'master_manipulator' -test_name 'RK-242 '#'- C87652 - Specify the proxy in the r10k.yaml' - -confine(:to, :platform => ['el', 'sles']) - -#Init -master_platform = fact_on(master, 'osfamily') -master_certname = on(master, puppet('config', 'print', 'certname')).stdout.rstrip -env_path = on(master, puppet('config print environmentpath')).stdout.rstrip -r10k_fqp = get_r10k_fqp(master) - -git_repo_path = '/git_repos' -git_repo_name = 'environments' -git_control_remote = File.join(git_repo_path, "#{git_repo_name}.git") -git_environments_path = '/root/environments' -last_commit = git_last_commit(master, git_environments_path) -git_provider = ENV['GIT_PROVIDER'] - -local_files_root_path = ENV['FILES'] || 'files' - -git_manifest_template_path = File.join(local_files_root_path, 'pre-suite', 'git_config.pp.erb') -git_manifest = ERB.new(File.read(git_manifest_template_path)).result(binding) - -r10k_config_path = get_r10k_config_file_path(master) -r10k_config_bak_path = "#{r10k_config_path}.bak" - -case master_platform - when 'RedHat' - pkg_manager = 'yum' - when 'Suse' - pkg_manager = 'zypper' -end - -install_squid = "#{pkg_manager} install -y squid" -remove_squid = "#{pkg_manager} remove -y squid" -squid_log = "/var/log/squid/access.log" - -#In-line files -r10k_conf = <<-CONF -cachedir: '/var/cache/r10k' -git: - provider: '#{git_provider}' -sources: - control: - basedir: "#{env_path}" - remote: "#{git_control_remote}" -forge: - proxy: "http://#{master.hostname}:3128" -CONF - -#Manifest -site_pp_path = File.join(git_environments_path, 'manifests', 'site.pp') -site_pp = create_site_pp(master_certname, ' include peonly') - -#Verification -squid_log_regex = /CONNECT forgeapi.puppetlabs.com:443/ -notify_message_regex = /I am in the production environment, this is a PE only module/ - -#Teardown -teardown do - step 'remove license file' - on(master, 'rm -f /etc/puppetlabs/license.key') - - step 'Restore "git" Package' - on(master, puppet('apply'), :stdin => git_manifest, :acceptable_exit_codes => [0,2]) - - step 'Restore Original "r10k" Config' - on(master, "mv #{r10k_config_bak_path} #{r10k_config_path}") - - clean_up_r10k(master, last_commit, git_environments_path) - - step 'Remove Squid' - on(master, puppet("apply -e 'service {'squid' : ensure => stopped}'")) - on(master, remove_squid) -end - -#Setup -step 'Stub the forge' -stub_forge_on(master) - -step 'Backup Current "r10k" Config' -on(master, "mv #{r10k_config_path} #{r10k_config_bak_path}") - -step 'Update the "r10k" Config' -create_remote_file(master, r10k_config_path, r10k_conf) - -step 'Download license file from artifactory' -curl_on(master, 'https://artifactory.delivery.puppetlabs.net/artifactory/generic/r10k_test_license.key -o /etc/puppetlabs/license.key') - -step 'Checkout "production" Branch' -git_on(master, 'checkout production', git_environments_path) - -step 'Inject New "site.pp" to the "production" Environment' -inject_site_pp(master, site_pp_path, site_pp) - -step 'Copy Puppetfile to "production" Environment with PE only module' -create_remote_file(master, "#{git_environments_path}/Puppetfile", 'mod "ztr-peonly"') - -step 'Push Changes' -git_add_commit_push(master, 'production', 'add Puppetfile', git_environments_path) - -step 'Install and configure squid proxy' -on(master, install_squid) - -step 'turn off the firewall' -on(master, puppet("apply -e 'service {'iptables' : ensure => stopped}'")) - -step 'start squid proxy' -on(master, puppet("apply -e 'service {'squid' : ensure => running}'")) - -#Tests -step 'Deploy "production" Environment via r10k' -on(master, "#{r10k_fqp} deploy environment -p") - -step 'Read the squid logs' -on(master, "cat #{squid_log}") do |result| - assert_match(squid_log_regex, result.stdout, 'Proxy logs did not indicate use of the proxy.') -end - -agents.each do |agent| - step "Run Puppet Agent" - on(agent, puppet('agent', '--test', '--environment production'), :acceptable_exit_codes => [0,2]) do |result| - assert_no_match(/Error:/, result.stderr, 'Unexpected error was detected!') - assert_match(notify_message_regex, result.stdout, 'Expected message not found!') - end -end diff --git a/integration/tests/basic_functionality/proxy_with_puppetfile.rb b/integration/tests/basic_functionality/proxy_with_puppetfile.rb index c62a95968..01386afe8 100644 --- a/integration/tests/basic_functionality/proxy_with_puppetfile.rb +++ b/integration/tests/basic_functionality/proxy_with_puppetfile.rb @@ -21,7 +21,7 @@ squid_log = "/var/log/squid/access.log" #Verification -squid_log_regex = /CONNECT forgeapi.puppetlabs.com:443/ +squid_log_regex = /CONNECT forgeapi.puppet(labs)?.com:443/ #Teardown teardown do diff --git a/integration/tests/command_line/deploy_env_without_mod_update.rb b/integration/tests/command_line/deploy_env_without_mod_update.rb index 3c5648703..81336fb23 100755 --- a/integration/tests/command_line/deploy_env_without_mod_update.rb +++ b/integration/tests/command_line/deploy_env_without_mod_update.rb @@ -46,9 +46,6 @@ class { 'motd': end #Setup -step 'Stub Forge on Master' -stub_forge_on(master) - step 'Inject New "site.pp" to the "production" Environment' inject_site_pp(master, site_pp_path, site_pp) diff --git a/integration/tests/command_line/negative/neg_deploy_env_with_module_update.rb b/integration/tests/command_line/negative/neg_deploy_env_with_module_update.rb index 76c894894..1260e3192 100755 --- a/integration/tests/command_line/negative/neg_deploy_env_with_module_update.rb +++ b/integration/tests/command_line/negative/neg_deploy_env_with_module_update.rb @@ -47,9 +47,6 @@ class { 'motd': end #Setup -step 'Stub Forge on Master' -stub_forge_on(master) - step 'Inject New "site.pp" to the "production" Environment' inject_site_pp(master, site_pp_path, site_pp) diff --git a/integration/tests/git_source/HTTP_proxy_and_git_source.rb b/integration/tests/git_source/HTTP_proxy_and_git_source.rb index bcee1949c..28287a55b 100644 --- a/integration/tests/git_source/HTTP_proxy_and_git_source.rb +++ b/integration/tests/git_source/HTTP_proxy_and_git_source.rb @@ -16,28 +16,24 @@ puppetfile =<<-EOS mod 'motd', - :git => 'https://github.com/puppetlabs/puppetlabs-motd' + :git => 'https://github.com/puppetlabs/puppetlabs-motd', :branch => 'main' EOS -proxy_env_value = 'http://cattastic.net:3219' - #In-line files r10k_conf = <<-CONF cachedir: '/var/cache/r10k' git: provider: '#{git_provider}' repositories: - - remote: 'http://example.com/fake_git_source.git' + - remote: 'https://something.else/repo' proxy: 'http://foooooooo.unresolvable:3128' sources: control: basedir: "#{env_path}" - remote: "http://example.com/fake_git_source.git" + remote: 'https://something.else/repo' CONF teardown do - master.clear_env_var('HTTP_PROXY') - step 'Restore Original "r10k" Config' on(master, "mv #{r10k_config_bak_path} #{r10k_config_path}") @@ -45,8 +41,6 @@ clean_up_r10k(master, last_commit, git_environments_path) end -master.add_env_var('HTTP_PROXY', proxy_env_value) - step 'Backup Current "r10k" Config' on(master, "mv #{r10k_config_path} #{r10k_config_bak_path}") @@ -64,7 +58,8 @@ #test on(master, "#{r10k_fqp} deploy environment -p", :accept_all_exit_codes => true) do |r| - regex = /proxy.*foooooooo\.unresolvable/ + # Rugged as of 0.28 has a different error message than shellgit + regex = /((failed to resolve address for)|(Could not resolve proxy:)) foooooooo\.unresolvable/ assert(r.exit_code == 1, 'expected error code was not observed') assert_match(regex, r.stderr, 'The expected error message was not observed' ) end diff --git a/integration/tests/git_source/git_source_git.rb b/integration/tests/git_source/git_source_git.rb index 9c750fd53..1f9b01a2a 100755 --- a/integration/tests/git_source/git_source_git.rb +++ b/integration/tests/git_source/git_source_git.rb @@ -84,9 +84,6 @@ end #Setup -step 'Stub Forge on Master' -stub_forge_on(master) - step 'Backup Current "r10k" Config' on(master, "mv #{r10k_config_path} #{r10k_config_bak_path}") diff --git a/integration/tests/git_source/git_source_repeated_remote.rb b/integration/tests/git_source/git_source_repeated_remote.rb index fb68d988f..bdc3047b0 100644 --- a/integration/tests/git_source/git_source_repeated_remote.rb +++ b/integration/tests/git_source/git_source_repeated_remote.rb @@ -44,9 +44,6 @@ clean_up_r10k(master, last_commit, git_environments_path) end -step 'Stub the forge' -stub_forge_on(master) - step 'Backup Current "r10k" Config' on(master, "mv #{r10k_config_path} #{r10k_config_bak_path}") diff --git a/integration/tests/git_source/negative/neg_git_unauthorized_ssh.rb b/integration/tests/git_source/negative/neg_git_unauthorized_ssh.rb index dac325a0d..ad6958763 100755 --- a/integration/tests/git_source/negative/neg_git_unauthorized_ssh.rb +++ b/integration/tests/git_source/negative/neg_git_unauthorized_ssh.rb @@ -68,6 +68,6 @@ #Tests step 'Attempt to Deploy via r10k' -on(master, "#{r10k_fqp} deploy environment -v", :acceptable_exit_codes => 1) do |result| +on(master, "SSH_AUTH_SOCK= SSH_CONNECTION= SSH_CLIENT= #{r10k_fqp} deploy environment -v", :acceptable_exit_codes => 1) do |result| assert_match(error_message_regex, result.stderr, 'Expected message not found!') end diff --git a/integration/tests/purging/content_not_purged_at_root.rb b/integration/tests/purging/content_not_purged_at_root.rb index a3b719165..092fc7181 100644 --- a/integration/tests/purging/content_not_purged_at_root.rb +++ b/integration/tests/purging/content_not_purged_at_root.rb @@ -50,9 +50,6 @@ clean_up_r10k(master, last_commit, git_environments_path) end -step 'Stub the forge' -stub_forge_on(master) - step 'Backup Current "r10k" Config' on(master, "mv #{r10k_config_path} #{r10k_config_bak_path}") diff --git a/integration/tests/purging/default_purging.rb b/integration/tests/purging/default_purging.rb index 37addb6a8..73e114734 100644 --- a/integration/tests/purging/default_purging.rb +++ b/integration/tests/purging/default_purging.rb @@ -51,9 +51,6 @@ fake_file_c_to_be_purged = "#{fake_environment_path_c}/fakefile3.txt" # initalize file content -step 'Stub the forge' -stub_forge_on(master) - step 'Backup Current "r10k" Config' on(master, "mv #{r10k_config_path} #{r10k_config_bak_path}") diff --git a/integration/tests/purging/does_not_purge_files_on_allowlist.rb b/integration/tests/purging/does_not_purge_files_on_allowlist.rb index bdd05e4a3..7103e691a 100644 --- a/integration/tests/purging/does_not_purge_files_on_allowlist.rb +++ b/integration/tests/purging/does_not_purge_files_on_allowlist.rb @@ -26,9 +26,6 @@ end # initalize file content -step 'Stub the forge' -stub_forge_on(master) - step 'Backup Current "r10k" Config' on(master, "mv #{r10k_config_path} #{r10k_config_bak_path}") diff --git a/integration/tests/purging/invalid_allowlist_types.rb b/integration/tests/purging/invalid_allowlist_types.rb deleted file mode 100644 index f9dd00f3d..000000000 --- a/integration/tests/purging/invalid_allowlist_types.rb +++ /dev/null @@ -1,63 +0,0 @@ -require 'git_utils' -require 'r10k_utils' -require 'master_manipulator' -test_name 'RK-257 - C98043 - verify default allowlist only accepts strings or array of strings' - -#Init -env_path = on(master, puppet('config print environmentpath')).stdout.rstrip -r10k_fqp = get_r10k_fqp(master) -git_environments_path = '/root/environments' - -git_repo_path = '/git_repos' -git_repo_name = 'environments' -git_control_remote = File.join(git_repo_path, "#{git_repo_name}.git") - -last_commit = git_last_commit(master, git_environments_path) -git_provider = ENV['GIT_PROVIDER'] - -r10k_config_path = get_r10k_config_file_path(master) -r10k_config_bak_path = "#{r10k_config_path}.bak" - -#invalid content to test -hash_allowlist = '{:cats => \'cats.txt\'}' -invalid_array_content_allowlist = '[\'cats.txt\', [:broken]]' - -teardown do - step 'Restore Original "r10k" Config' - on(master, "mv #{r10k_config_bak_path} #{r10k_config_path}") - - clean_up_r10k(master, last_commit, git_environments_path) -end - -# initalize file content -step 'Stub the forge' -stub_forge_on(master) - -step 'Backup Current "r10k" Config' -on(master, "mv #{r10k_config_path} #{r10k_config_bak_path}") - -[hash_allowlist, invalid_array_content_allowlist].each do |allowlist_content| - r10k_conf = <<-CONF -cachedir: '/var/cache/r10k' -git: - provider: '#{git_provider}' -sources: - control: - basedir: "#{env_path}" - remote: "#{git_control_remote}" -deploy: - purge_allowlist: #{allowlist_content} - CONF - - step 'Update the "r10k" Config' - create_remote_file(master, r10k_config_path, r10k_conf) - - step 'Deploy r10k, and verify that invalid allowlist content causes error' - on(master, "#{r10k_fqp} deploy environment -p", :accept_all_exit_codes => true) do |result| - error = /did not find expected node content while parsing a flow node/ - error_message = 'allowlist content did not generate expected error' - expect_failure('RK-263') do - assert_no_match(result.stdout, error, error_message) - end - end -end diff --git a/integration/tests/user_scenario/basic_workflow/multi_env_custom_forge_git_module.rb b/integration/tests/user_scenario/basic_workflow/multi_env_custom_forge_git_module.rb index aba257080..52a41e0c3 100755 --- a/integration/tests/user_scenario/basic_workflow/multi_env_custom_forge_git_module.rb +++ b/integration/tests/user_scenario/basic_workflow/multi_env_custom_forge_git_module.rb @@ -62,9 +62,6 @@ class { 'motd': end #Setup -step 'Stub Forge on Master' -stub_forge_on(master) - env_names.each do |env| if env == 'production' step "Checkout \"#{env}\" Branch" diff --git a/integration/tests/user_scenario/basic_workflow/multi_env_custom_forge_git_module_static.rb b/integration/tests/user_scenario/basic_workflow/multi_env_custom_forge_git_module_static.rb index 965421fb0..2e8275feb 100755 --- a/integration/tests/user_scenario/basic_workflow/multi_env_custom_forge_git_module_static.rb +++ b/integration/tests/user_scenario/basic_workflow/multi_env_custom_forge_git_module_static.rb @@ -66,9 +66,6 @@ class { 'motd': end #Setup -step 'Stub Forge on Master' -stub_forge_on(master) - env_names.each do |env| if env == 'production' step "Checkout \"#{env}\" Branch" diff --git a/integration/tests/user_scenario/basic_workflow/multi_source_custom_forge_git_module.rb b/integration/tests/user_scenario/basic_workflow/multi_source_custom_forge_git_module.rb index 71da6e0db..5c3a23f43 100755 --- a/integration/tests/user_scenario/basic_workflow/multi_source_custom_forge_git_module.rb +++ b/integration/tests/user_scenario/basic_workflow/multi_source_custom_forge_git_module.rb @@ -102,9 +102,6 @@ class { 'helloworld': } end #Setup -step 'Stub Forge on Master' -stub_forge_on(master) - step 'Backup Current "r10k" Config' on(master, "mv #{r10k_config_path} #{r10k_config_bak_path}") diff --git a/integration/tests/user_scenario/basic_workflow/negative/neg_bad_forge_module.rb b/integration/tests/user_scenario/basic_workflow/negative/neg_bad_forge_module.rb index cf48c7553..6a240f3a6 100755 --- a/integration/tests/user_scenario/basic_workflow/negative/neg_bad_forge_module.rb +++ b/integration/tests/user_scenario/basic_workflow/negative/neg_bad_forge_module.rb @@ -29,9 +29,6 @@ end #Setup -step 'Stub Forge on Master' -stub_forge_on(master) - step 'Checkout "production" Branch' git_on(master, 'checkout production', git_environments_path) diff --git a/integration/tests/user_scenario/basic_workflow/negative/neg_duplicate_module_names.rb b/integration/tests/user_scenario/basic_workflow/negative/neg_duplicate_module_names.rb index 112853238..e7bc8c839 100755 --- a/integration/tests/user_scenario/basic_workflow/negative/neg_duplicate_module_names.rb +++ b/integration/tests/user_scenario/basic_workflow/negative/neg_duplicate_module_names.rb @@ -25,9 +25,6 @@ end #Setup -step 'Stub Forge on Master' -stub_forge_on(master) - step 'Checkout "production" Branch' git_on(master, 'checkout production', git_environments_path) diff --git a/integration/tests/user_scenario/basic_workflow/negative/neg_inaccessible_forge.rb b/integration/tests/user_scenario/basic_workflow/negative/neg_inaccessible_forge.rb index 404d1276c..3822de64c 100755 --- a/integration/tests/user_scenario/basic_workflow/negative/neg_inaccessible_forge.rb +++ b/integration/tests/user_scenario/basic_workflow/negative/neg_inaccessible_forge.rb @@ -19,7 +19,7 @@ puppet_file_path = File.join(git_environments_path, 'Puppetfile') #Verification -error_message_regex = /Error: Could not connect via HTTPS to https:\/\/forgeapi.puppetlabs.com/ +error_message_regex = /Error: Could not connect via HTTPS to https:\/\/forgeapi.puppet(labs)?.com/ #Teardown teardown do @@ -34,7 +34,8 @@ on(master, "mv #{hosts_file_path} #{hosts_file_path}.bak") step 'Point Forge Hostname to Localhost' -on(master, "echo '127.0.0.1 forgeapi.puppetlabs.com' > #{hosts_file_path}") +on(master, "echo '127.0.0.1 forgeapi.puppet.com' > #{hosts_file_path}") +on(master, "echo '127.0.0.1 forgeapi.puppetlabs.com' >> #{hosts_file_path}") step 'Checkout "production" Branch' git_on(master, 'checkout production', git_environments_path) diff --git a/integration/tests/user_scenario/basic_workflow/negative/neg_module_specified_at_deleted_release.rb b/integration/tests/user_scenario/basic_workflow/negative/neg_module_specified_at_deleted_release.rb deleted file mode 100644 index da0c8b196..000000000 --- a/integration/tests/user_scenario/basic_workflow/negative/neg_module_specified_at_deleted_release.rb +++ /dev/null @@ -1,49 +0,0 @@ -require 'git_utils' -require 'r10k_utils' -test_name 'CODEMGMT-127 - C64121 - Attempt to Deploy Environment with Forge Module Specified at Deleted Release' - -#This test uses the spotty module at https://forge-aio01-petest.puppetlabs.com//puppetlabs/spotty, with valid released 0.1.0 and 0.3.0 versions, and deleted 0.2.0 and 0.4.0 versions. - -#Init -git_environments_path = '/root/environments' -last_commit = git_last_commit(master, git_environments_path) -r10k_fqp = get_r10k_fqp(master) - -#Verification -if get_puppet_version(master) < 4.0 - error_notification_regex = /No releases matching '0.2.0'/ -else - error_notification_regex = /error.* -> The module release puppetlabs-spotty-0.2.0 does not exist on/i -end - -#File -puppet_file = <<-PUPPETFILE -mod "puppetlabs/spotty", '0.2.0' -PUPPETFILE - -puppet_file_path = File.join(git_environments_path, 'Puppetfile') - -#Teardown -teardown do - clean_up_r10k(master, last_commit, git_environments_path) -end - -#Setup -step 'Stub Forge on Master' -stub_forge_on(master) - -#Tests -step 'Checkout "production" Branch' -git_on(master, 'checkout production', git_environments_path) - -step 'Create "Puppetfile" for the "production" Environment' -create_remote_file(master, puppet_file_path, puppet_file) - -step 'Push Changes' -git_add_commit_push(master, 'production', 'Add module.', git_environments_path) - -#Tests -step "Deploy production environment via r10k with module specified at deleted version" -on(master, "#{r10k_fqp} deploy environment -p -v", :acceptable_exit_codes => 1) do |result| - assert_match(error_notification_regex, result.stderr, 'Unexpected error was detected!') -end diff --git a/integration/tests/user_scenario/basic_workflow/negative/neg_specify_deleted_forge_module.rb b/integration/tests/user_scenario/basic_workflow/negative/neg_specify_deleted_forge_module.rb index 0211c86ef..5c9bbdfd9 100644 --- a/integration/tests/user_scenario/basic_workflow/negative/neg_specify_deleted_forge_module.rb +++ b/integration/tests/user_scenario/basic_workflow/negative/neg_specify_deleted_forge_module.rb @@ -10,7 +10,7 @@ r10k_fqp = get_r10k_fqp(master) #Verification -error_notification_regex = /The module puppetlabs-regret does not appear to have any published releases/ +error_notification_regex = /(The module puppetlabs-regret does not appear to have any published releases)|(module puppetlabs-regret does not exist on)/ #File puppet_file = <<-PUPPETFILE @@ -24,10 +24,6 @@ clean_up_r10k(master, last_commit, git_environments_path) end -#Setup -step 'Stub Forge on Master' -stub_forge_on(master) - #Tests step 'Checkout "production" Branch' git_on(master, 'checkout production', git_environments_path) diff --git a/integration/tests/user_scenario/basic_workflow/single_env_custom_forge_git_module.rb b/integration/tests/user_scenario/basic_workflow/single_env_custom_forge_git_module.rb index 85a2faaa3..08507baa1 100755 --- a/integration/tests/user_scenario/basic_workflow/single_env_custom_forge_git_module.rb +++ b/integration/tests/user_scenario/basic_workflow/single_env_custom_forge_git_module.rb @@ -64,9 +64,6 @@ class { 'motd': end #Setup -step 'Stub Forge on Master' -stub_forge_on(master) - step 'Checkout "production" Branch' git_on(master, 'checkout production', git_environments_path) diff --git a/integration/tests/user_scenario/basic_workflow/single_env_custom_forge_module.rb b/integration/tests/user_scenario/basic_workflow/single_env_custom_forge_module.rb index 87157a37b..26310bf45 100755 --- a/integration/tests/user_scenario/basic_workflow/single_env_custom_forge_module.rb +++ b/integration/tests/user_scenario/basic_workflow/single_env_custom_forge_module.rb @@ -45,9 +45,6 @@ class { 'motd': end #Setup -step 'Stub Forge on Master' -stub_forge_on(master) - step 'Checkout "production" Branch' git_on(master, 'checkout production', git_environments_path) diff --git a/integration/tests/user_scenario/basic_workflow/single_env_module_already_installed.rb b/integration/tests/user_scenario/basic_workflow/single_env_module_already_installed.rb index e7989e38d..6d69add0b 100755 --- a/integration/tests/user_scenario/basic_workflow/single_env_module_already_installed.rb +++ b/integration/tests/user_scenario/basic_workflow/single_env_module_already_installed.rb @@ -44,9 +44,6 @@ class { 'motd': end #Setup -step 'Stub Forge on Master' -stub_forge_on(master) - step 'Add motd module from the forge using the PMT' on(master, puppet('module', 'install', 'puppetlabs-motd', '--modulepath', forge_module_path)) diff --git a/integration/tests/user_scenario/basic_workflow/single_env_module_last_release_deleted.rb b/integration/tests/user_scenario/basic_workflow/single_env_module_last_release_deleted.rb deleted file mode 100644 index a8dc6d42e..000000000 --- a/integration/tests/user_scenario/basic_workflow/single_env_module_last_release_deleted.rb +++ /dev/null @@ -1,68 +0,0 @@ -require 'git_utils' -require 'r10k_utils' -test_name 'CODEMGMT-127 - C64120 - Single Environment with Forge Module where Latest Release has been Deleted' - -#This test uses the spotty module at https://forge-aio01-petest.puppetlabs.com//puppetlabs/spotty, which has valid 0.1.0 and 0.3.0 versions, and deleted 0.2.0 and 0.4.0 versions. - -#Init -env_path = on(master, puppet('config print environmentpath')).stdout.rstrip -prod_env_modules_path = File.join(env_path, 'production', 'modules') -r10k_fqp = get_r10k_fqp(master) - -git_environments_path = '/root/environments' -last_commit = git_last_commit(master, git_environments_path) - -#Verification -module_contents = 'Version 3' -module_contents_regex = /\A#{module_contents}\n\z/ - -module_contents_path = File.join(prod_env_modules_path, 'spotty', 'manifests', 'init.pp') -module_version_filepath = File.join(prod_env_modules_path, 'spotty', 'metadata.json') -module_version_3_regex = /"0.3.0"/ - -#File -puppet_file = <<-PUPPETFILE -mod "puppetlabs/spotty" -PUPPETFILE - -puppet_file_path = File.join(git_environments_path, 'Puppetfile') - -#Teardown -teardown do - clean_up_r10k(master, last_commit, git_environments_path) -end - -#Setup -step 'Stub Forge on Master' -stub_forge_on(master) - -#Tests -step 'Checkout "production" Branch' -git_on(master, 'checkout production', git_environments_path) - -step 'Create "Puppetfile" for the "production" Environment' -create_remote_file(master, puppet_file_path, puppet_file) - -step 'Push Changes' -git_add_commit_push(master, 'production', 'Add module.', git_environments_path) - -#Tests -step 'Deploy "production" Environment via r10k with modules' -on(master, "#{r10k_fqp} deploy environment -p -v") - -agents.each do |agent| - step "Run Puppet Agent" - on(agent, puppet('agent', '--test', '--environment production'), :acceptable_exit_codes => [0,2]) do |result| - assert_no_match(/Error:/, result.stderr, 'Unexpected error was detected!') - end - - step 'Verify Contents' - on(master, "cat #{module_contents_path}") do |result| - assert_match(module_contents, result.stdout, 'File Content is Invalid') - end - - step 'Verify Version' - on(master, "grep version #{module_version_filepath}") do |result| - assert_match(module_version_3_regex, result.stdout, 'File Content is Invalid') - end -end diff --git a/integration/tests/user_scenario/basic_workflow/single_env_purge_unmanaged_modules.rb b/integration/tests/user_scenario/basic_workflow/single_env_purge_unmanaged_modules.rb index a1412dab2..94b0ed235 100755 --- a/integration/tests/user_scenario/basic_workflow/single_env_purge_unmanaged_modules.rb +++ b/integration/tests/user_scenario/basic_workflow/single_env_purge_unmanaged_modules.rb @@ -43,9 +43,6 @@ class { 'motd': end #Setup -step 'Stub Forge on Master' -stub_forge_on(master) - step 'Checkout "production" Branch' git_on(master, 'checkout production', git_remote_environments_path) diff --git a/integration/tests/user_scenario/basic_workflow/single_env_switch_forge_git_module.rb b/integration/tests/user_scenario/basic_workflow/single_env_switch_forge_git_module.rb index f3e47fcf5..d4540bab2 100755 --- a/integration/tests/user_scenario/basic_workflow/single_env_switch_forge_git_module.rb +++ b/integration/tests/user_scenario/basic_workflow/single_env_switch_forge_git_module.rb @@ -57,9 +57,6 @@ class { 'motd': end #Setup -step 'Stub Forge on Master' -stub_forge_on(master) - step 'Checkout "production" Branch' git_on(master, 'checkout production', git_environments_path) diff --git a/integration/tests/user_scenario/basic_workflow/single_env_upgrade_forge_mod_revert_change.rb b/integration/tests/user_scenario/basic_workflow/single_env_upgrade_forge_mod_revert_change.rb index 6b6a37db8..e413657b4 100644 --- a/integration/tests/user_scenario/basic_workflow/single_env_upgrade_forge_mod_revert_change.rb +++ b/integration/tests/user_scenario/basic_workflow/single_env_upgrade_forge_mod_revert_change.rb @@ -60,9 +60,6 @@ class { 'motd': end #Setup -step 'Stub Forge on Master' -stub_forge_on(master) - step 'Checkout "production" Branch' git_on(master, 'checkout production', git_environments_path) diff --git a/integration/tests/user_scenario/complex_workflow/multi_env_add_change_remove.rb b/integration/tests/user_scenario/complex_workflow/multi_env_add_change_remove.rb index 4657b0356..098527301 100755 --- a/integration/tests/user_scenario/complex_workflow/multi_env_add_change_remove.rb +++ b/integration/tests/user_scenario/complex_workflow/multi_env_add_change_remove.rb @@ -65,9 +65,6 @@ class helloworld { end #Setup -step 'Stub Forge on Master' -stub_forge_on(master) - initial_env_names.each do |env| if env == 'production' step "Checkout \"#{env}\" Branch" diff --git a/lib/r10k/content_synchronizer.rb b/lib/r10k/content_synchronizer.rb index c75f1e7f0..56dd37d23 100644 --- a/lib/r10k/content_synchronizer.rb +++ b/lib/r10k/content_synchronizer.rb @@ -79,8 +79,13 @@ def self.sync_thread(mods_queue, logger, updated_modules) begin while mods = mods_queue.pop(true) do mods.each do |mod| - updated = mod.sync - updated_modules << mod.name if updated + begin + updated = mod.sync + updated_modules << mod.name if updated + rescue Exception => e + logger.error _("Module %{mod_name} failed to synchronize due to %{message}") % {mod_name: mod.name, message: e.message} + raise e + end end end rescue ThreadError => e diff --git a/lib/r10k/git/rugged/bare_repository.rb b/lib/r10k/git/rugged/bare_repository.rb index b712be102..cb1a91e8a 100644 --- a/lib/r10k/git/rugged/bare_repository.rb +++ b/lib/r10k/git/rugged/bare_repository.rb @@ -56,11 +56,12 @@ def fetch(remote_name='origin') logger.warn { _("Rugged versions prior to 0.24.0 do not support pruning stale branches during fetch, please upgrade your \'rugged\' gem. (Current version is: %{version})") % {version: Rugged::Version} } end - options = {:credentials => credentials, :prune => true} - refspecs = ['+refs/*:refs/*'] - remote = remotes[remote_name] proxy = R10K::Git.get_proxy_for_remote(remote) + + options = {:credentials => credentials, :prune => true, :proxy_url => proxy} + refspecs = ['+refs/*:refs/*'] + results = nil R10K::Git.with_proxy(proxy) do diff --git a/lib/r10k/git/rugged/working_repository.rb b/lib/r10k/git/rugged/working_repository.rb index 918097a6d..a5bc44b38 100644 --- a/lib/r10k/git/rugged/working_repository.rb +++ b/lib/r10k/git/rugged/working_repository.rb @@ -27,6 +27,7 @@ def initialize(basedir, dirname) def clone(remote, opts = {}) logger.debug1 { _("Cloning '%{remote}' into %{path}") % {remote: remote, path: @path } } + proxy = R10K::Git.get_proxy_for_remote(remote) # libgit2/rugged doesn't support cloning a repository and providing an # alternate object database, making the handling of :alternates a noop. # Unfortunately this means that this method can't really use alternates @@ -34,10 +35,9 @@ def clone(remote, opts = {}) # repository. However alternate databases can be handled when an existing # repository is loaded, so loading a cloned repo will correctly use # alternate object database. - options = {:credentials => credentials} + options = {:credentials => credentials, :proxy_url => proxy} options.merge!(:alternates => [File.join(opts[:reference], 'objects')]) if opts[:reference] - proxy = R10K::Git.get_proxy_for_remote(remote) R10K::Git.with_proxy(proxy) do @_rugged_repo = ::Rugged::Repository.clone_at(remote, @path.to_s, options) @@ -85,11 +85,13 @@ def checkout(ref, opts = {}) def fetch(remote_name = 'origin') logger.debug1 { _("Fetching remote '%{remote}' at %{path}") % {remote: remote_name, path: @path} } - options = {:credentials => credentials} - refspecs = ["+refs/heads/*:refs/remotes/#{remote_name}/*"] remote = remotes[remote_name] proxy = R10K::Git.get_proxy_for_remote(remote) + + options = {:credentials => credentials, :proxy_url => proxy} + refspecs = ["+refs/heads/*:refs/remotes/#{remote_name}/*"] + results = nil R10K::Git.with_proxy(proxy) do diff --git a/lib/r10k/puppetfile.rb b/lib/r10k/puppetfile.rb index d4cfd895b..5a26c4e09 100644 --- a/lib/r10k/puppetfile.rb +++ b/lib/r10k/puppetfile.rb @@ -72,7 +72,7 @@ def initialize(basedir, options_or_moduledir = nil, deprecated_path_arg = nil, d @overrides = options.delete(:overrides) || {} @default_branch_override = @overrides.dig(:environments, :default_branch_override) - @forge = 'forgeapi.puppetlabs.com' + @forge = 'forgeapi.puppet.com' @loader = ::R10K::ModuleLoader::Puppetfile.new( basedir: @basedir, diff --git a/locales/r10k.pot b/locales/r10k.pot index 6312efd79..dbca9d360 100644 --- a/locales/r10k.pot +++ b/locales/r10k.pot @@ -1,16 +1,16 @@ # SOME DESCRIPTIVE TITLE. -# Copyright (C) 2022 Puppet, Inc. +# Copyright (C) 2023 Puppet, Inc. # This file is distributed under the same license as the r10k package. -# FIRST AUTHOR , 2022. +# FIRST AUTHOR , 2023. # #, fuzzy msgid "" msgstr "" -"Project-Id-Version: r10k 3.9.3-265-gcb0a3463\n" +"Project-Id-Version: r10k 3.9.3-289-g2f5deb72\n" "\n" "Report-Msgid-Bugs-To: docs@puppetlabs.com\n" -"POT-Creation-Date: 2022-12-08 22:58+0000\n" -"PO-Revision-Date: 2022-12-08 22:58+0000\n" +"POT-Creation-Date: 2023-06-27 17:39+0000\n" +"PO-Revision-Date: 2023-06-27 17:39+0000\n" "Last-Translator: FULL NAME \n" "Language-Team: LANGUAGE \n" "Language: \n" @@ -95,7 +95,11 @@ msgstr "" msgid "Error during concurrent deploy of a module: %{message}" msgstr "" -#: ../lib/r10k/content_synchronizer.rb:87 +#: ../lib/r10k/content_synchronizer.rb:86 +msgid "Module %{mod_name} failed to synchronize due to %{message}" +msgstr "" + +#: ../lib/r10k/content_synchronizer.rb:92 msgid "Module thread %{id} exiting: %{message}" msgstr "" diff --git a/r10k.gemspec b/r10k.gemspec index e8f053301..a6333f198 100644 --- a/r10k.gemspec +++ b/r10k.gemspec @@ -32,7 +32,7 @@ Gem::Specification.new do |s| s.add_dependency 'gettext-setup', '~>0.24' - s.add_dependency 'jwt', '~> 2.2.3' + s.add_dependency 'jwt', '>= 2.2.3', '< 2.8.0' s.add_dependency 'minitar', '~> 0.9' s.add_development_dependency 'rspec', '~> 3.1'