r10k 3.15.4 → 3.16.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (62) hide show
  1. checksums.yaml +4 -4
  2. data/.github/dependabot.yml +17 -0
  3. data/.github/workflows/docker.yml +4 -4
  4. data/.github/workflows/release.yml +2 -2
  5. data/.github/workflows/rspec_tests.yml +7 -7
  6. data/.github/workflows/stale.yml +1 -1
  7. data/CHANGELOG.mkd +8 -0
  8. data/Gemfile +2 -2
  9. data/integration/files/pre-suite/git_config.pp.erb +1 -1
  10. data/integration/pre-suite/10_git_config.rb +0 -3
  11. data/integration/tests/Puppetfile/HTTP_PROXY_affects_git_source.rb +5 -4
  12. data/integration/tests/basic_functionality/proxy_specified_in_configuration.rb +1 -1
  13. data/integration/tests/basic_functionality/proxy_with_puppetfile.rb +1 -1
  14. data/integration/tests/command_line/deploy_env_without_mod_update.rb +0 -3
  15. data/integration/tests/command_line/negative/neg_deploy_env_with_module_update.rb +0 -3
  16. data/integration/tests/git_source/HTTP_proxy_and_git_source.rb +5 -10
  17. data/integration/tests/git_source/git_source_git.rb +0 -3
  18. data/integration/tests/git_source/git_source_repeated_remote.rb +0 -3
  19. data/integration/tests/git_source/negative/neg_git_unauthorized_ssh.rb +1 -1
  20. data/integration/tests/purging/content_not_purged_at_root.rb +0 -3
  21. data/integration/tests/purging/default_purging.rb +0 -3
  22. data/integration/tests/purging/does_not_purge_files_on_white_list.rb +0 -3
  23. data/integration/tests/user_scenario/basic_workflow/multi_env_custom_forge_git_module.rb +0 -3
  24. data/integration/tests/user_scenario/basic_workflow/multi_env_custom_forge_git_module_static.rb +0 -3
  25. data/integration/tests/user_scenario/basic_workflow/multi_source_custom_forge_git_module.rb +0 -3
  26. data/integration/tests/user_scenario/basic_workflow/negative/neg_bad_forge_module.rb +0 -3
  27. data/integration/tests/user_scenario/basic_workflow/negative/neg_duplicate_module_names.rb +0 -3
  28. data/integration/tests/user_scenario/basic_workflow/negative/neg_inaccessible_forge.rb +3 -2
  29. data/integration/tests/user_scenario/basic_workflow/negative/neg_specify_deleted_forge_module.rb +1 -5
  30. data/integration/tests/user_scenario/basic_workflow/single_env_custom_forge_git_module.rb +0 -3
  31. data/integration/tests/user_scenario/basic_workflow/single_env_custom_forge_module.rb +0 -3
  32. data/integration/tests/user_scenario/basic_workflow/single_env_module_already_installed.rb +0 -3
  33. data/integration/tests/user_scenario/basic_workflow/single_env_purge_unmanaged_modules.rb +0 -3
  34. data/integration/tests/user_scenario/basic_workflow/single_env_switch_forge_git_module.rb +0 -3
  35. data/integration/tests/user_scenario/basic_workflow/single_env_upgrade_forge_mod_revert_change.rb +0 -3
  36. data/integration/tests/user_scenario/complex_workflow/multi_env_add_change_remove.rb +0 -3
  37. data/lib/r10k/content_synchronizer.rb +7 -2
  38. data/lib/r10k/git/rugged/bare_repository.rb +4 -3
  39. data/lib/r10k/git/rugged/working_repository.rb +6 -4
  40. data/lib/r10k/puppetfile.rb +1 -1
  41. data/lib/r10k/version.rb +1 -1
  42. data/locales/r10k.pot +10 -6
  43. data/r10k.gemspec +1 -1
  44. metadata +11 -22
  45. data/docker/.gitignore +0 -1
  46. data/docker/.rspec +0 -4
  47. data/docker/Gemfile +0 -11
  48. data/docker/Makefile +0 -99
  49. data/docker/README.md +0 -28
  50. data/docker/docker-compose.yml +0 -18
  51. data/docker/r10k/Dockerfile +0 -68
  52. data/docker/r10k/adduser.sh +0 -13
  53. data/docker/r10k/docker-entrypoint.d/10-analytics.sh +0 -30
  54. data/docker/r10k/docker-entrypoint.sh +0 -10
  55. data/docker/r10k/release.Dockerfile +0 -55
  56. data/docker/spec/dockerfile_spec.rb +0 -37
  57. data/docker/spec/fixtures/Puppetfile +0 -2
  58. data/integration/tests/basic_functionality/install_pe_only_module_with_puppetfile.rb +0 -83
  59. data/integration/tests/basic_functionality/proxy_with_pe_only_module.rb +0 -128
  60. data/integration/tests/purging/invalid_whitelist_types.rb +0 -63
  61. data/integration/tests/user_scenario/basic_workflow/negative/neg_module_specified_at_deleted_release.rb +0 -49
  62. data/integration/tests/user_scenario/basic_workflow/single_env_module_last_release_deleted.rb +0 -68
@@ -1,128 +0,0 @@
1
- require 'git_utils'
2
- require 'r10k_utils'
3
- require 'master_manipulator'
4
- test_name 'RK-242 '#'- C87652 - Specify the proxy in the r10k.yaml'
5
-
6
- confine(:to, :platform => ['el', 'sles'])
7
-
8
- #Init
9
- master_platform = fact_on(master, 'osfamily')
10
- master_certname = on(master, puppet('config', 'print', 'certname')).stdout.rstrip
11
- env_path = on(master, puppet('config print environmentpath')).stdout.rstrip
12
- r10k_fqp = get_r10k_fqp(master)
13
-
14
- git_repo_path = '/git_repos'
15
- git_repo_name = 'environments'
16
- git_control_remote = File.join(git_repo_path, "#{git_repo_name}.git")
17
- git_environments_path = '/root/environments'
18
- last_commit = git_last_commit(master, git_environments_path)
19
- git_provider = ENV['GIT_PROVIDER']
20
-
21
- local_files_root_path = ENV['FILES'] || 'files'
22
-
23
- git_manifest_template_path = File.join(local_files_root_path, 'pre-suite', 'git_config.pp.erb')
24
- git_manifest = ERB.new(File.read(git_manifest_template_path)).result(binding)
25
-
26
- r10k_config_path = get_r10k_config_file_path(master)
27
- r10k_config_bak_path = "#{r10k_config_path}.bak"
28
-
29
- case master_platform
30
- when 'RedHat'
31
- pkg_manager = 'yum'
32
- when 'Suse'
33
- pkg_manager = 'zypper'
34
- end
35
-
36
- install_squid = "#{pkg_manager} install -y squid"
37
- remove_squid = "#{pkg_manager} remove -y squid"
38
- squid_log = "/var/log/squid/access.log"
39
-
40
- #In-line files
41
- r10k_conf = <<-CONF
42
- cachedir: '/var/cache/r10k'
43
- git:
44
- provider: '#{git_provider}'
45
- sources:
46
- control:
47
- basedir: "#{env_path}"
48
- remote: "#{git_control_remote}"
49
- forge:
50
- proxy: "http://#{master.hostname}:3128"
51
- CONF
52
-
53
- #Manifest
54
- site_pp_path = File.join(git_environments_path, 'manifests', 'site.pp')
55
- site_pp = create_site_pp(master_certname, ' include peonly')
56
-
57
- #Verification
58
- squid_log_regex = /CONNECT forgeapi.puppetlabs.com:443/
59
- notify_message_regex = /I am in the production environment, this is a PE only module/
60
-
61
- #Teardown
62
- teardown do
63
- step 'remove license file'
64
- on(master, 'rm -f /etc/puppetlabs/license.key')
65
-
66
- step 'Restore "git" Package'
67
- on(master, puppet('apply'), :stdin => git_manifest, :acceptable_exit_codes => [0,2])
68
-
69
- step 'Restore Original "r10k" Config'
70
- on(master, "mv #{r10k_config_bak_path} #{r10k_config_path}")
71
-
72
- clean_up_r10k(master, last_commit, git_environments_path)
73
-
74
- step 'Remove Squid'
75
- on(master, puppet("apply -e 'service {'squid' : ensure => stopped}'"))
76
- on(master, remove_squid)
77
- end
78
-
79
- #Setup
80
- step 'Stub the forge'
81
- stub_forge_on(master)
82
-
83
- step 'Backup Current "r10k" Config'
84
- on(master, "mv #{r10k_config_path} #{r10k_config_bak_path}")
85
-
86
- step 'Update the "r10k" Config'
87
- create_remote_file(master, r10k_config_path, r10k_conf)
88
-
89
- step 'Download license file from artifactory'
90
- curl_on(master, 'https://artifactory.delivery.puppetlabs.net/artifactory/generic/r10k_test_license.key -o /etc/puppetlabs/license.key')
91
-
92
- step 'Checkout "production" Branch'
93
- git_on(master, 'checkout production', git_environments_path)
94
-
95
- step 'Inject New "site.pp" to the "production" Environment'
96
- inject_site_pp(master, site_pp_path, site_pp)
97
-
98
- step 'Copy Puppetfile to "production" Environment with PE only module'
99
- create_remote_file(master, "#{git_environments_path}/Puppetfile", 'mod "ztr-peonly"')
100
-
101
- step 'Push Changes'
102
- git_add_commit_push(master, 'production', 'add Puppetfile', git_environments_path)
103
-
104
- step 'Install and configure squid proxy'
105
- on(master, install_squid)
106
-
107
- step 'turn off the firewall'
108
- on(master, puppet("apply -e 'service {'iptables' : ensure => stopped}'"))
109
-
110
- step 'start squid proxy'
111
- on(master, puppet("apply -e 'service {'squid' : ensure => running}'"))
112
-
113
- #Tests
114
- step 'Deploy "production" Environment via r10k'
115
- on(master, "#{r10k_fqp} deploy environment -p")
116
-
117
- step 'Read the squid logs'
118
- on(master, "cat #{squid_log}") do |result|
119
- assert_match(squid_log_regex, result.stdout, 'Proxy logs did not indicate use of the proxy.')
120
- end
121
-
122
- agents.each do |agent|
123
- step "Run Puppet Agent"
124
- on(agent, puppet('agent', '--test', '--environment production'), :acceptable_exit_codes => [0,2]) do |result|
125
- assert_no_match(/Error:/, result.stderr, 'Unexpected error was detected!')
126
- assert_match(notify_message_regex, result.stdout, 'Expected message not found!')
127
- end
128
- end
@@ -1,63 +0,0 @@
1
- require 'git_utils'
2
- require 'r10k_utils'
3
- require 'master_manipulator'
4
- test_name 'RK-257 - C98043 - verify default whitelist only accepts strings or array of strings'
5
-
6
- #Init
7
- env_path = on(master, puppet('config print environmentpath')).stdout.rstrip
8
- r10k_fqp = get_r10k_fqp(master)
9
- git_environments_path = '/root/environments'
10
-
11
- git_repo_path = '/git_repos'
12
- git_repo_name = 'environments'
13
- git_control_remote = File.join(git_repo_path, "#{git_repo_name}.git")
14
-
15
- last_commit = git_last_commit(master, git_environments_path)
16
- git_provider = ENV['GIT_PROVIDER']
17
-
18
- r10k_config_path = get_r10k_config_file_path(master)
19
- r10k_config_bak_path = "#{r10k_config_path}.bak"
20
-
21
- #invalid content to test
22
- hash_whitelist = '{:cats => \'cats.txt\'}'
23
- invalid_array_content_whitelist = '[\'cats.txt\', [:broken]]'
24
-
25
- teardown do
26
- step 'Restore Original "r10k" Config'
27
- on(master, "mv #{r10k_config_bak_path} #{r10k_config_path}")
28
-
29
- clean_up_r10k(master, last_commit, git_environments_path)
30
- end
31
-
32
- # initalize file content
33
- step 'Stub the forge'
34
- stub_forge_on(master)
35
-
36
- step 'Backup Current "r10k" Config'
37
- on(master, "mv #{r10k_config_path} #{r10k_config_bak_path}")
38
-
39
- [hash_whitelist, invalid_array_content_whitelist].each do |whitelist_content|
40
- r10k_conf = <<-CONF
41
- cachedir: '/var/cache/r10k'
42
- git:
43
- provider: '#{git_provider}'
44
- sources:
45
- control:
46
- basedir: "#{env_path}"
47
- remote: "#{git_control_remote}"
48
- deploy:
49
- purge_whitelist: #{whitelist_content}
50
- CONF
51
-
52
- step 'Update the "r10k" Config'
53
- create_remote_file(master, r10k_config_path, r10k_conf)
54
-
55
- step 'Deploy r10k, and verify that invalid whitelist content causes error'
56
- on(master, "#{r10k_fqp} deploy environment -p", :accept_all_exit_codes => true) do |result|
57
- error = /did not find expected node content while parsing a flow node/
58
- error_message = 'whitelist content did not generate expected error'
59
- expect_failure('RK-263') do
60
- assert_no_match(result.stdout, error, error_message)
61
- end
62
- end
63
- end
@@ -1,49 +0,0 @@
1
- require 'git_utils'
2
- require 'r10k_utils'
3
- test_name 'CODEMGMT-127 - C64121 - Attempt to Deploy Environment with Forge Module Specified at Deleted Release'
4
-
5
- #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.
6
-
7
- #Init
8
- git_environments_path = '/root/environments'
9
- last_commit = git_last_commit(master, git_environments_path)
10
- r10k_fqp = get_r10k_fqp(master)
11
-
12
- #Verification
13
- if get_puppet_version(master) < 4.0
14
- error_notification_regex = /No releases matching '0.2.0'/
15
- else
16
- error_notification_regex = /error.* -> The module release puppetlabs-spotty-0.2.0 does not exist on/i
17
- end
18
-
19
- #File
20
- puppet_file = <<-PUPPETFILE
21
- mod "puppetlabs/spotty", '0.2.0'
22
- PUPPETFILE
23
-
24
- puppet_file_path = File.join(git_environments_path, 'Puppetfile')
25
-
26
- #Teardown
27
- teardown do
28
- clean_up_r10k(master, last_commit, git_environments_path)
29
- end
30
-
31
- #Setup
32
- step 'Stub Forge on Master'
33
- stub_forge_on(master)
34
-
35
- #Tests
36
- step 'Checkout "production" Branch'
37
- git_on(master, 'checkout production', git_environments_path)
38
-
39
- step 'Create "Puppetfile" for the "production" Environment'
40
- create_remote_file(master, puppet_file_path, puppet_file)
41
-
42
- step 'Push Changes'
43
- git_add_commit_push(master, 'production', 'Add module.', git_environments_path)
44
-
45
- #Tests
46
- step "Deploy production environment via r10k with module specified at deleted version"
47
- on(master, "#{r10k_fqp} deploy environment -p -v", :acceptable_exit_codes => 1) do |result|
48
- assert_match(error_notification_regex, result.stderr, 'Unexpected error was detected!')
49
- end
@@ -1,68 +0,0 @@
1
- require 'git_utils'
2
- require 'r10k_utils'
3
- test_name 'CODEMGMT-127 - C64120 - Single Environment with Forge Module where Latest Release has been Deleted'
4
-
5
- #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.
6
-
7
- #Init
8
- env_path = on(master, puppet('config print environmentpath')).stdout.rstrip
9
- prod_env_modules_path = File.join(env_path, 'production', 'modules')
10
- r10k_fqp = get_r10k_fqp(master)
11
-
12
- git_environments_path = '/root/environments'
13
- last_commit = git_last_commit(master, git_environments_path)
14
-
15
- #Verification
16
- module_contents = 'Version 3'
17
- module_contents_regex = /\A#{module_contents}\n\z/
18
-
19
- module_contents_path = File.join(prod_env_modules_path, 'spotty', 'manifests', 'init.pp')
20
- module_version_filepath = File.join(prod_env_modules_path, 'spotty', 'metadata.json')
21
- module_version_3_regex = /"0.3.0"/
22
-
23
- #File
24
- puppet_file = <<-PUPPETFILE
25
- mod "puppetlabs/spotty"
26
- PUPPETFILE
27
-
28
- puppet_file_path = File.join(git_environments_path, 'Puppetfile')
29
-
30
- #Teardown
31
- teardown do
32
- clean_up_r10k(master, last_commit, git_environments_path)
33
- end
34
-
35
- #Setup
36
- step 'Stub Forge on Master'
37
- stub_forge_on(master)
38
-
39
- #Tests
40
- step 'Checkout "production" Branch'
41
- git_on(master, 'checkout production', git_environments_path)
42
-
43
- step 'Create "Puppetfile" for the "production" Environment'
44
- create_remote_file(master, puppet_file_path, puppet_file)
45
-
46
- step 'Push Changes'
47
- git_add_commit_push(master, 'production', 'Add module.', git_environments_path)
48
-
49
- #Tests
50
- step 'Deploy "production" Environment via r10k with modules'
51
- on(master, "#{r10k_fqp} deploy environment -p -v")
52
-
53
- agents.each do |agent|
54
- step "Run Puppet Agent"
55
- on(agent, puppet('agent', '--test', '--environment production'), :acceptable_exit_codes => [0,2]) do |result|
56
- assert_no_match(/Error:/, result.stderr, 'Unexpected error was detected!')
57
- end
58
-
59
- step 'Verify Contents'
60
- on(master, "cat #{module_contents_path}") do |result|
61
- assert_match(module_contents, result.stdout, 'File Content is Invalid')
62
- end
63
-
64
- step 'Verify Version'
65
- on(master, "grep version #{module_version_filepath}") do |result|
66
- assert_match(module_version_3_regex, result.stdout, 'File Content is Invalid')
67
- end
68
- end