r10k 3.15.0 → 4.1.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.github/dependabot.yml +17 -0
- data/.github/workflows/docker.yml +4 -4
- data/.github/workflows/release.yml +2 -2
- data/.github/workflows/rspec_tests.yml +10 -11
- data/.github/workflows/stale.yml +1 -1
- data/CHANGELOG.mkd +66 -0
- data/CODEOWNERS +1 -2
- data/Gemfile +2 -2
- data/README.mkd +16 -17
- data/doc/common-patterns.mkd +1 -2
- data/doc/dynamic-environments/configuration.mkd +78 -2
- data/doc/puppetfile.mkd +9 -3
- data/integration/Gemfile +1 -1
- data/integration/Rakefile +1 -1
- data/integration/files/pre-suite/git_config.pp.erb +1 -1
- data/integration/pre-suite/00_pe_install.rb +3 -0
- data/integration/pre-suite/10_git_config.rb +0 -3
- data/integration/tests/Puppetfile/HTTP_PROXY_affects_git_source.rb +5 -4
- data/integration/tests/basic_functionality/negative/negative_bad_proxy.rb +1 -1
- data/integration/tests/basic_functionality/proxy_specified_in_configuration.rb +2 -2
- data/integration/tests/basic_functionality/proxy_with_puppetfile.rb +2 -2
- data/integration/tests/basic_functionality/rugged_git_provider_with_ssh.rb +3 -3
- data/integration/tests/basic_functionality/rugged_git_provider_without_ssh.rb +3 -3
- data/integration/tests/command_line/deploy_env_without_mod_update.rb +0 -3
- data/integration/tests/command_line/negative/neg_deploy_env_with_module_update.rb +0 -3
- data/integration/tests/git_source/HTTP_proxy_and_git_source.rb +5 -10
- data/integration/tests/git_source/git_source_git.rb +1 -4
- data/integration/tests/git_source/git_source_repeated_remote.rb +0 -3
- data/integration/tests/git_source/git_source_submodule.rb +1 -1
- data/integration/tests/git_source/negative/neg_git_unauthorized_ssh.rb +1 -1
- data/integration/tests/purging/content_not_purged_at_root.rb +0 -3
- data/integration/tests/purging/default_purging.rb +0 -3
- data/integration/tests/purging/{does_not_purge_files_on_white_list.rb → does_not_purge_files_on_allowlist.rb} +2 -5
- data/integration/tests/user_scenario/basic_workflow/multi_env_custom_forge_git_module.rb +0 -3
- data/integration/tests/user_scenario/basic_workflow/multi_env_custom_forge_git_module_static.rb +0 -3
- data/integration/tests/user_scenario/basic_workflow/multi_source_custom_forge_git_module.rb +0 -3
- data/integration/tests/user_scenario/basic_workflow/negative/neg_bad_forge_module.rb +0 -3
- data/integration/tests/user_scenario/basic_workflow/negative/neg_disk_full.rb +1 -1
- data/integration/tests/user_scenario/basic_workflow/negative/neg_duplicate_module_names.rb +0 -3
- data/integration/tests/user_scenario/basic_workflow/negative/neg_inaccessible_forge.rb +3 -2
- data/integration/tests/user_scenario/basic_workflow/negative/neg_specify_deleted_forge_module.rb +1 -5
- data/integration/tests/user_scenario/basic_workflow/single_env_10000_files.rb +1 -1
- data/integration/tests/user_scenario/basic_workflow/single_env_custom_forge_git_module.rb +0 -3
- data/integration/tests/user_scenario/basic_workflow/single_env_custom_forge_module.rb +0 -3
- data/integration/tests/user_scenario/basic_workflow/single_env_large_files.rb +1 -1
- data/integration/tests/user_scenario/basic_workflow/single_env_module_already_installed.rb +0 -3
- data/integration/tests/user_scenario/basic_workflow/single_env_purge_unmanaged_modules.rb +0 -3
- data/integration/tests/user_scenario/basic_workflow/single_env_switch_forge_git_module.rb +0 -3
- data/integration/tests/user_scenario/basic_workflow/single_env_upgrade_forge_mod_revert_change.rb +0 -3
- data/integration/tests/user_scenario/complex_workflow/multi_env_add_change_remove.rb +0 -3
- data/lib/r10k/action/deploy/environment.rb +2 -19
- data/lib/r10k/action/deploy/module.rb +1 -0
- data/lib/r10k/action/puppetfile/check.rb +7 -0
- data/lib/r10k/action/puppetfile/install.rb +3 -1
- data/lib/r10k/cli/deploy.rb +15 -1
- data/lib/r10k/cli/puppetfile.rb +1 -0
- data/lib/r10k/content_synchronizer.rb +7 -2
- data/lib/r10k/environment.rb +0 -1
- data/lib/r10k/git/rugged/bare_repository.rb +4 -3
- data/lib/r10k/git/rugged/working_repository.rb +7 -5
- data/lib/r10k/git/shellgit/working_repository.rb +3 -3
- data/lib/r10k/git/stateful_repository.rb +2 -2
- data/lib/r10k/module/base.rb +3 -3
- data/lib/r10k/module/git.rb +18 -4
- data/lib/r10k/module_loader/puppetfile.rb +14 -9
- data/lib/r10k/puppetfile.rb +1 -1
- data/lib/r10k/settings.rb +6 -7
- data/lib/r10k/version.rb +1 -1
- data/locales/r10k.pot +34 -82
- data/r10k.gemspec +5 -7
- metadata +22 -211
- data/docker/.gitignore +0 -1
- data/docker/.rspec +0 -4
- data/docker/Gemfile +0 -11
- data/docker/Makefile +0 -99
- data/docker/README.md +0 -28
- data/docker/docker-compose.yml +0 -18
- data/docker/r10k/Dockerfile +0 -68
- data/docker/r10k/adduser.sh +0 -13
- data/docker/r10k/docker-entrypoint.d/10-analytics.sh +0 -30
- data/docker/r10k/docker-entrypoint.sh +0 -10
- data/docker/r10k/release.Dockerfile +0 -55
- data/docker/spec/dockerfile_spec.rb +0 -37
- data/docker/spec/fixtures/Puppetfile +0 -2
- data/integration/tests/basic_functionality/install_pe_only_module_with_puppetfile.rb +0 -83
- data/integration/tests/basic_functionality/proxy_with_pe_only_module.rb +0 -128
- data/integration/tests/purging/invalid_whitelist_types.rb +0 -63
- data/integration/tests/user_scenario/basic_workflow/negative/neg_module_specified_at_deleted_release.rb +0 -49
- data/integration/tests/user_scenario/basic_workflow/single_env_module_last_release_deleted.rb +0 -68
- data/lib/r10k/environment/bare.rb +0 -13
- data/spec/fixtures/empty/.empty +0 -0
- data/spec/fixtures/integration/git/puppet-boolean-bare.tar +0 -0
- data/spec/fixtures/module/forge/bad_module/metadata.json +0 -1
- data/spec/fixtures/module/forge/eight_hundred/Modulefile +0 -8
- data/spec/fixtures/module/forge/eight_hundred/metadata.json +0 -19
- data/spec/fixtures/tarball/tarball.tar.gz +0 -0
- data/spec/fixtures/unit/action/r10k.yaml +0 -5
- data/spec/fixtures/unit/action/r10k_cachedir.yaml +0 -2
- data/spec/fixtures/unit/action/r10k_creds.yaml +0 -9
- data/spec/fixtures/unit/action/r10k_forge_auth.yaml +0 -4
- data/spec/fixtures/unit/action/r10k_forge_auth_no_url.yaml +0 -3
- data/spec/fixtures/unit/action/r10k_generate_types.yaml +0 -3
- data/spec/fixtures/unit/action/r10k_logging.yaml +0 -12
- data/spec/fixtures/unit/action/r10k_puppet_path.yaml +0 -3
- data/spec/fixtures/unit/puppetfile/argument-error/Puppetfile +0 -1
- data/spec/fixtures/unit/puppetfile/default-branch-override/Puppetfile +0 -5
- data/spec/fixtures/unit/puppetfile/duplicate-module-error/Puppetfile +0 -10
- data/spec/fixtures/unit/puppetfile/forge-override/Puppetfile +0 -8
- data/spec/fixtures/unit/puppetfile/invalid-syntax/Puppetfile +0 -1
- data/spec/fixtures/unit/puppetfile/load-error/Puppetfile +0 -1
- data/spec/fixtures/unit/puppetfile/name-error/Puppetfile +0 -1
- data/spec/fixtures/unit/puppetfile/valid-forge-with-version/Puppetfile +0 -1
- data/spec/fixtures/unit/puppetfile/valid-forge-without-version/Puppetfile +0 -1
- data/spec/fixtures/unit/puppetfile/various-modules/Puppetfile +0 -10
- data/spec/fixtures/unit/puppetfile/various-modules/Puppetfile.new +0 -10
- data/spec/fixtures/unit/puppetfile/various-modules/modules/apt/.gitkeep +0 -1
- data/spec/fixtures/unit/puppetfile/various-modules/modules/baz/.gitkeep +0 -1
- data/spec/fixtures/unit/puppetfile/various-modules/modules/buzz/.gitkeep +0 -1
- data/spec/fixtures/unit/puppetfile/various-modules/modules/canary/.gitkeep +0 -1
- data/spec/fixtures/unit/puppetfile/various-modules/modules/fizz/.gitkeep +0 -1
- data/spec/fixtures/unit/puppetfile/various-modules/modules/rpm/.gitkeep +0 -1
- data/spec/fixtures/unit/util/purgeable/managed_one/expected_1 +0 -0
- data/spec/fixtures/unit/util/purgeable/managed_one/managed_subdir_1/managed_symlink_file +0 -1
- data/spec/fixtures/unit/util/purgeable/managed_one/managed_subdir_1/subdir_allowlisted_2/ignored_1 +0 -0
- data/spec/fixtures/unit/util/purgeable/managed_one/managed_subdir_1/subdir_expected_1 +0 -0
- data/spec/fixtures/unit/util/purgeable/managed_one/managed_subdir_1/subdir_unmanaged_1 +0 -0
- data/spec/fixtures/unit/util/purgeable/managed_one/managed_subdir_1/unmanaged_symlink_dir +0 -1
- data/spec/fixtures/unit/util/purgeable/managed_one/managed_symlink_dir +0 -1
- data/spec/fixtures/unit/util/purgeable/managed_one/unmanaged_1 +0 -0
- data/spec/fixtures/unit/util/purgeable/managed_one/unmanaged_symlink_file +0 -1
- data/spec/fixtures/unit/util/purgeable/managed_two/.hidden/unmanaged_3 +0 -0
- data/spec/fixtures/unit/util/purgeable/managed_two/expected_2 +0 -0
- data/spec/fixtures/unit/util/purgeable/managed_two/unmanaged_2 +0 -0
- data/spec/fixtures/unit/util/subprocess/runner/no-execute.sh +0 -3
- data/spec/integration/git/rugged/bare_repository_spec.rb +0 -13
- data/spec/integration/git/rugged/cache_spec.rb +0 -33
- data/spec/integration/git/rugged/thin_repository_spec.rb +0 -14
- data/spec/integration/git/rugged/working_repository_spec.rb +0 -48
- data/spec/integration/git/shellgit/bare_repository_spec.rb +0 -13
- data/spec/integration/git/shellgit/thin_repository_spec.rb +0 -14
- data/spec/integration/git/shellgit/working_repository_spec.rb +0 -13
- data/spec/integration/git/stateful_repository_spec.rb +0 -175
- data/spec/integration/util/purageable_spec.rb +0 -41
- data/spec/matchers/exit_with.rb +0 -28
- data/spec/matchers/match_realpath.rb +0 -18
- data/spec/r10k-mocks/mock_config.rb +0 -33
- data/spec/r10k-mocks/mock_env.rb +0 -18
- data/spec/r10k-mocks/mock_source.rb +0 -17
- data/spec/r10k-mocks.rb +0 -3
- data/spec/shared-contexts/git-fixtures.rb +0 -55
- data/spec/shared-contexts/tarball.rb +0 -32
- data/spec/shared-examples/deploy-actions.rb +0 -69
- data/spec/shared-examples/git/bare_repository.rb +0 -132
- data/spec/shared-examples/git/thin_repository.rb +0 -26
- data/spec/shared-examples/git/working_repository.rb +0 -207
- data/spec/shared-examples/git-repository.rb +0 -38
- data/spec/shared-examples/puppetfile-action.rb +0 -39
- data/spec/shared-examples/settings/ancestry.rb +0 -44
- data/spec/shared-examples/subprocess-runner.rb +0 -89
- data/spec/spec_helper.rb +0 -41
- data/spec/unit/action/cri_runner_spec.rb +0 -72
- data/spec/unit/action/deploy/deploy_helpers_spec.rb +0 -38
- data/spec/unit/action/deploy/display_spec.rb +0 -61
- data/spec/unit/action/deploy/environment_spec.rb +0 -640
- data/spec/unit/action/deploy/module_spec.rb +0 -476
- data/spec/unit/action/puppetfile/check_spec.rb +0 -53
- data/spec/unit/action/puppetfile/cri_runner_spec.rb +0 -47
- data/spec/unit/action/puppetfile/install_spec.rb +0 -112
- data/spec/unit/action/puppetfile/purge_spec.rb +0 -60
- data/spec/unit/action/runner_spec.rb +0 -407
- data/spec/unit/action/visitor_spec.rb +0 -39
- data/spec/unit/cli_spec.rb +0 -9
- data/spec/unit/deployment/config_spec.rb +0 -33
- data/spec/unit/deployment_spec.rb +0 -162
- data/spec/unit/environment/bare_spec.rb +0 -13
- data/spec/unit/environment/base_spec.rb +0 -122
- data/spec/unit/environment/git_spec.rb +0 -114
- data/spec/unit/environment/name_spec.rb +0 -181
- data/spec/unit/environment/plain_spec.rb +0 -8
- data/spec/unit/environment/svn_spec.rb +0 -146
- data/spec/unit/environment/tarball_spec.rb +0 -45
- data/spec/unit/environment/with_modules_spec.rb +0 -122
- data/spec/unit/errors/formatting_spec.rb +0 -84
- data/spec/unit/feature_spec.rb +0 -50
- data/spec/unit/forge/module_release_spec.rb +0 -213
- data/spec/unit/git/alternates_spec.rb +0 -116
- data/spec/unit/git/cache_spec.rb +0 -66
- data/spec/unit/git/rugged/cache_spec.rb +0 -48
- data/spec/unit/git/rugged/credentials_spec.rb +0 -215
- data/spec/unit/git/shellgit/cache_spec.rb +0 -27
- data/spec/unit/git/stateful_repository_spec.rb +0 -45
- data/spec/unit/git_spec.rb +0 -102
- data/spec/unit/initializers_spec.rb +0 -68
- data/spec/unit/instance_cache_spec.rb +0 -78
- data/spec/unit/keyed_factory_spec.rb +0 -51
- data/spec/unit/logging/terminaloutputter_spec.rb +0 -53
- data/spec/unit/logging_spec.rb +0 -68
- data/spec/unit/module/base_spec.rb +0 -118
- data/spec/unit/module/forge_spec.rb +0 -271
- data/spec/unit/module/git_spec.rb +0 -387
- data/spec/unit/module/metadata_file_spec.rb +0 -68
- data/spec/unit/module/svn_spec.rb +0 -208
- data/spec/unit/module/tarball_spec.rb +0 -70
- data/spec/unit/module_loader/puppetfile_spec.rb +0 -421
- data/spec/unit/module_spec.rb +0 -114
- data/spec/unit/puppetfile_spec.rb +0 -304
- data/spec/unit/settings/collection_spec.rb +0 -123
- data/spec/unit/settings/container_spec.rb +0 -92
- data/spec/unit/settings/definition_spec.rb +0 -79
- data/spec/unit/settings/enum_definition_spec.rb +0 -20
- data/spec/unit/settings/inheritance_spec.rb +0 -38
- data/spec/unit/settings/list_spec.rb +0 -88
- data/spec/unit/settings/loader_spec.rb +0 -110
- data/spec/unit/settings/uri_definition_spec.rb +0 -23
- data/spec/unit/settings_spec.rb +0 -303
- data/spec/unit/source/base_spec.rb +0 -31
- data/spec/unit/source/exec_spec.rb +0 -81
- data/spec/unit/source/git_spec.rb +0 -233
- data/spec/unit/source/hash_spec.rb +0 -54
- data/spec/unit/source/svn_spec.rb +0 -196
- data/spec/unit/source/yaml_spec.rb +0 -42
- data/spec/unit/source_spec.rb +0 -10
- data/spec/unit/svn/remote_spec.rb +0 -21
- data/spec/unit/svn/working_dir_spec.rb +0 -56
- data/spec/unit/tarball_spec.rb +0 -57
- data/spec/unit/util/attempt_spec.rb +0 -82
- data/spec/unit/util/cacheable_spec.rb +0 -23
- data/spec/unit/util/commands_spec.rb +0 -61
- data/spec/unit/util/downloader_spec.rb +0 -98
- data/spec/unit/util/exec_env_spec.rb +0 -56
- data/spec/unit/util/purgeable_spec.rb +0 -267
- data/spec/unit/util/setopts_spec.rb +0 -83
- data/spec/unit/util/subprocess/result_spec.rb +0 -36
- data/spec/unit/util/subprocess/runner/posix_spec.rb +0 -7
- data/spec/unit/util/subprocess/runner/pump_spec.rb +0 -79
- data/spec/unit/util/subprocess/runner/windows_spec.rb +0 -7
- data/spec/unit/util/subprocess/subprocess_error_spec.rb +0 -26
- data/spec/unit/util/subprocess_spec.rb +0 -65
- data/spec/unit/util/symbolize_keys_spec.rb +0 -67
@@ -16,28 +16,24 @@ r10k_config_bak_path = "#{r10k_config_path}.bak"
|
|
16
16
|
|
17
17
|
puppetfile =<<-EOS
|
18
18
|
mod 'motd',
|
19
|
-
:git
|
19
|
+
:git => 'https://github.com/puppetlabs/puppetlabs-motd', :branch => 'main'
|
20
20
|
EOS
|
21
21
|
|
22
|
-
proxy_env_value = 'http://cattastic.net:3219'
|
23
|
-
|
24
22
|
#In-line files
|
25
23
|
r10k_conf = <<-CONF
|
26
24
|
cachedir: '/var/cache/r10k'
|
27
25
|
git:
|
28
26
|
provider: '#{git_provider}'
|
29
27
|
repositories:
|
30
|
-
- remote: '
|
28
|
+
- remote: 'https://something.else/repo'
|
31
29
|
proxy: 'http://foooooooo.unresolvable:3128'
|
32
30
|
sources:
|
33
31
|
control:
|
34
32
|
basedir: "#{env_path}"
|
35
|
-
remote:
|
33
|
+
remote: 'https://something.else/repo'
|
36
34
|
CONF
|
37
35
|
|
38
36
|
teardown do
|
39
|
-
master.clear_env_var('HTTP_PROXY')
|
40
|
-
|
41
37
|
step 'Restore Original "r10k" Config'
|
42
38
|
on(master, "mv #{r10k_config_bak_path} #{r10k_config_path}")
|
43
39
|
|
@@ -45,8 +41,6 @@ teardown do
|
|
45
41
|
clean_up_r10k(master, last_commit, git_environments_path)
|
46
42
|
end
|
47
43
|
|
48
|
-
master.add_env_var('HTTP_PROXY', proxy_env_value)
|
49
|
-
|
50
44
|
step 'Backup Current "r10k" Config'
|
51
45
|
on(master, "mv #{r10k_config_path} #{r10k_config_bak_path}")
|
52
46
|
|
@@ -64,7 +58,8 @@ git_add_commit_push(master, 'production', 'add Puppetfile', git_environments_pat
|
|
64
58
|
|
65
59
|
#test
|
66
60
|
on(master, "#{r10k_fqp} deploy environment -p", :accept_all_exit_codes => true) do |r|
|
67
|
-
|
61
|
+
# Rugged as of 0.28 has a different error message than shellgit
|
62
|
+
regex = /((failed to resolve address for)|(Could not resolve proxy:)) foooooooo\.unresolvable/
|
68
63
|
assert(r.exit_code == 1, 'expected error code was not observed')
|
69
64
|
assert_match(regex, r.stderr, 'The expected error message was not observed' )
|
70
65
|
end
|
@@ -5,7 +5,7 @@ test_name 'CODEMGMT-92 - C59235 - Single Git Source Using "GIT" Transport Protoc
|
|
5
5
|
|
6
6
|
confine(:to, :platform => 'el')
|
7
7
|
|
8
|
-
if fact_on(master, "
|
8
|
+
if fact_on(master, "os.release.major").to_i < 6 || fact_on(master, "os.release.major").to_i > 8
|
9
9
|
skip_test('This version of EL is not supported by this test case!')
|
10
10
|
end
|
11
11
|
|
@@ -84,9 +84,6 @@ teardown do
|
|
84
84
|
end
|
85
85
|
|
86
86
|
#Setup
|
87
|
-
step 'Stub Forge on Master'
|
88
|
-
stub_forge_on(master)
|
89
|
-
|
90
87
|
step 'Backup Current "r10k" Config'
|
91
88
|
on(master, "mv #{r10k_config_path} #{r10k_config_bak_path}")
|
92
89
|
|
@@ -44,7 +44,7 @@ scp_to(master, helloworld_module_path, File.join(git_clone_module_path, 'hellowo
|
|
44
44
|
git_add_commit_push(master, 'master', 'Add module.', git_clone_module_path)
|
45
45
|
|
46
46
|
step 'Add "helloworld" Module Git Repo as Submodule'
|
47
|
-
on(master, "cd #{git_environments_path};git submodule add file://#{git_repo_module_path} dist")
|
47
|
+
on(master, "cd #{git_environments_path};git -c protocol.file.allow=always submodule add file://#{git_repo_module_path} dist")
|
48
48
|
|
49
49
|
step 'Checkout "production" Branch'
|
50
50
|
git_on(master, 'checkout production', git_environments_path)
|
@@ -68,6 +68,6 @@ on(master, "chmod 600 #{ssh_private_key_path}")
|
|
68
68
|
|
69
69
|
#Tests
|
70
70
|
step 'Attempt to Deploy via r10k'
|
71
|
-
on(master, "#{r10k_fqp} deploy environment -v", :acceptable_exit_codes => 1) do |result|
|
71
|
+
on(master, "SSH_AUTH_SOCK= SSH_CONNECTION= SSH_CLIENT= #{r10k_fqp} deploy environment -v", :acceptable_exit_codes => 1) do |result|
|
72
72
|
assert_match(error_message_regex, result.stderr, 'Expected message not found!')
|
73
73
|
end
|
@@ -51,9 +51,6 @@ fake_file_b_to_be_left_alone = "#{fake_environment_path_b}/fakefile2.txt"
|
|
51
51
|
fake_file_c_to_be_purged = "#{fake_environment_path_c}/fakefile3.txt"
|
52
52
|
|
53
53
|
# initalize file content
|
54
|
-
step 'Stub the forge'
|
55
|
-
stub_forge_on(master)
|
56
|
-
|
57
54
|
step 'Backup Current "r10k" Config'
|
58
55
|
on(master, "mv #{r10k_config_path} #{r10k_config_bak_path}")
|
59
56
|
|
@@ -1,7 +1,7 @@
|
|
1
1
|
require 'git_utils'
|
2
2
|
require 'r10k_utils'
|
3
3
|
require 'master_manipulator'
|
4
|
-
test_name 'RK-257 - C98046 - r10k does not purge files on
|
4
|
+
test_name 'RK-257 - C98046 - r10k does not purge files on allowlist'
|
5
5
|
|
6
6
|
#Init
|
7
7
|
env_path = on(master, puppet('config print environmentpath')).stdout.rstrip
|
@@ -26,9 +26,6 @@ teardown do
|
|
26
26
|
end
|
27
27
|
|
28
28
|
# initalize file content
|
29
|
-
step 'Stub the forge'
|
30
|
-
stub_forge_on(master)
|
31
|
-
|
32
29
|
step 'Backup Current "r10k" Config'
|
33
30
|
on(master, "mv #{r10k_config_path} #{r10k_config_bak_path}")
|
34
31
|
|
@@ -42,7 +39,7 @@ sources:
|
|
42
39
|
remote: "#{git_control_remote}"
|
43
40
|
deploy:
|
44
41
|
purge_levels: ['deployment', 'environment', 'puppetfile']
|
45
|
-
|
42
|
+
purge_allowlist: ['**/*.pp']
|
46
43
|
CONF
|
47
44
|
|
48
45
|
step 'Update the "r10k" Config'
|
@@ -2,7 +2,7 @@ require 'git_utils'
|
|
2
2
|
require 'r10k_utils'
|
3
3
|
test_name 'CODEMGMT-86 - C59265 - Attempt to Deploy Environment to Disk with Insufficient Free Space'
|
4
4
|
|
5
|
-
if fact_on(master, '
|
5
|
+
if fact_on(master, 'os.family') == 'RedHat' and fact_on(master, "os.release.major").to_i < 6
|
6
6
|
skip_test('This version of EL is not supported by this test case!')
|
7
7
|
end
|
8
8
|
|
@@ -19,7 +19,7 @@ PUPPETFILE
|
|
19
19
|
puppet_file_path = File.join(git_environments_path, 'Puppetfile')
|
20
20
|
|
21
21
|
#Verification
|
22
|
-
error_message_regex = /Error: Could not connect via HTTPS to https:\/\/forgeapi.
|
22
|
+
error_message_regex = /Error: Could not connect via HTTPS to https:\/\/forgeapi.puppet(labs)?.com/
|
23
23
|
|
24
24
|
#Teardown
|
25
25
|
teardown do
|
@@ -34,7 +34,8 @@ step 'Backup "/etc/hosts" File on Master'
|
|
34
34
|
on(master, "mv #{hosts_file_path} #{hosts_file_path}.bak")
|
35
35
|
|
36
36
|
step 'Point Forge Hostname to Localhost'
|
37
|
-
on(master, "echo '127.0.0.1 forgeapi.
|
37
|
+
on(master, "echo '127.0.0.1 forgeapi.puppet.com' > #{hosts_file_path}")
|
38
|
+
on(master, "echo '127.0.0.1 forgeapi.puppetlabs.com' >> #{hosts_file_path}")
|
38
39
|
|
39
40
|
step 'Checkout "production" Branch'
|
40
41
|
git_on(master, 'checkout production', git_environments_path)
|
data/integration/tests/user_scenario/basic_workflow/negative/neg_specify_deleted_forge_module.rb
CHANGED
@@ -10,7 +10,7 @@ last_commit = git_last_commit(master, git_environments_path)
|
|
10
10
|
r10k_fqp = get_r10k_fqp(master)
|
11
11
|
|
12
12
|
#Verification
|
13
|
-
error_notification_regex = /The module puppetlabs-regret does not appear to have any published releases/
|
13
|
+
error_notification_regex = /(The module puppetlabs-regret does not appear to have any published releases)|(module puppetlabs-regret does not exist on)/
|
14
14
|
|
15
15
|
#File
|
16
16
|
puppet_file = <<-PUPPETFILE
|
@@ -24,10 +24,6 @@ teardown do
|
|
24
24
|
clean_up_r10k(master, last_commit, git_environments_path)
|
25
25
|
end
|
26
26
|
|
27
|
-
#Setup
|
28
|
-
step 'Stub Forge on Master'
|
29
|
-
stub_forge_on(master)
|
30
|
-
|
31
27
|
#Tests
|
32
28
|
step 'Checkout "production" Branch'
|
33
29
|
git_on(master, 'checkout production', git_environments_path)
|
@@ -3,7 +3,7 @@ require 'r10k_utils'
|
|
3
3
|
require 'master_manipulator'
|
4
4
|
test_name 'CODEMGMT-62 - C59239 - Single Environment with 10,000 Files'
|
5
5
|
|
6
|
-
if fact_on(master, '
|
6
|
+
if fact_on(master, 'os.family') == 'RedHat' and fact_on(master, "os.release.major").to_i < 6
|
7
7
|
skip_test('This version of EL is not supported by this test case!')
|
8
8
|
end
|
9
9
|
|
@@ -3,7 +3,7 @@ require 'r10k_utils'
|
|
3
3
|
require 'master_manipulator'
|
4
4
|
test_name 'CODEMGMT-62 - C59242 - Single Environment with Large Binary Files'
|
5
5
|
|
6
|
-
if fact_on(master, '
|
6
|
+
if fact_on(master, 'os.family') == 'RedHat' and fact_on(master, "os.release.major").to_i < 6
|
7
7
|
skip_test('This version of EL is not supported by this test case!')
|
8
8
|
end
|
9
9
|
|
@@ -45,6 +45,7 @@ module R10K
|
|
45
45
|
incremental: @incremental
|
46
46
|
},
|
47
47
|
modules: {
|
48
|
+
default_ref: settings.dig(:git, :default_ref),
|
48
49
|
exclude_spec: settings.dig(:deploy, :exclude_spec),
|
49
50
|
requested_modules: [],
|
50
51
|
deploy_modules: @modules,
|
@@ -53,8 +54,7 @@ module R10K
|
|
53
54
|
},
|
54
55
|
purging: {
|
55
56
|
purge_levels: settings.dig(:deploy, :purge_levels) || [],
|
56
|
-
purge_allowlist:
|
57
|
-
settings.dig(:deploy, :purge_allowlist) || [])
|
57
|
+
purge_allowlist: settings.dig(:deploy, :purge_allowlist) || []
|
58
58
|
},
|
59
59
|
forge: {
|
60
60
|
allow_puppetfile_override: settings.dig(:forge, :allow_puppetfile_override) || false
|
@@ -83,23 +83,6 @@ module R10K
|
|
83
83
|
|
84
84
|
private
|
85
85
|
|
86
|
-
def read_purge_allowlist (whitelist, allowlist)
|
87
|
-
whitelist_has_content = !whitelist.empty?
|
88
|
-
allowlist_has_content = !allowlist.empty?
|
89
|
-
case
|
90
|
-
when whitelist_has_content == false && allowlist_has_content == false
|
91
|
-
[]
|
92
|
-
when whitelist_has_content && allowlist_has_content
|
93
|
-
raise R10K::Error.new "Values found for both purge_whitelist and purge_allowlist. Setting " <<
|
94
|
-
"purge_whitelist is deprecated, please only use purge_allowlist."
|
95
|
-
when allowlist_has_content
|
96
|
-
allowlist
|
97
|
-
else
|
98
|
-
logger.warn "Setting purge_whitelist is deprecated; please use purge_allowlist instead."
|
99
|
-
whitelist
|
100
|
-
end
|
101
|
-
end
|
102
|
-
|
103
86
|
def visit_deployment(deployment)
|
104
87
|
# Ensure that everything can be preloaded. If we cannot preload all
|
105
88
|
# sources then we can't fully enumerate all environments which
|
@@ -9,12 +9,19 @@ module R10K
|
|
9
9
|
|
10
10
|
def call
|
11
11
|
options = { basedir: @root }
|
12
|
+
options[:overrides] = {}
|
13
|
+
options[:overrides][:modules] = { default_ref: @settings.dig(:git, :default_ref) }
|
12
14
|
options[:moduledir] = @moduledir if @moduledir
|
13
15
|
options[:puppetfile] = @puppetfile if @puppetfile
|
14
16
|
|
15
17
|
loader = R10K::ModuleLoader::Puppetfile.new(**options)
|
16
18
|
begin
|
17
19
|
loader.load!
|
20
|
+
loader.modules.each do |mod|
|
21
|
+
if mod.instance_of?(R10K::Module::Git)
|
22
|
+
mod.validate_ref_defined
|
23
|
+
end
|
24
|
+
end
|
18
25
|
$stderr.puts _("Syntax OK")
|
19
26
|
true
|
20
27
|
rescue => e
|
@@ -12,8 +12,10 @@ module R10K
|
|
12
12
|
def call
|
13
13
|
begin
|
14
14
|
options = { basedir: @root, overrides: { force: @force || false } }
|
15
|
+
options[:overrides][:modules] = { default_ref: @settings.dig(:git, :default_ref) }
|
15
16
|
options[:moduledir] = @moduledir if @moduledir
|
16
17
|
options[:puppetfile] = @puppetfile if @puppetfile
|
18
|
+
options[:module_exclude_regex] = @module_exclude_regex if @module_exclude_regex
|
17
19
|
|
18
20
|
loader = R10K::ModuleLoader::Puppetfile.new(**options)
|
19
21
|
loaded_content = loader.load!
|
@@ -40,7 +42,7 @@ module R10K
|
|
40
42
|
private
|
41
43
|
|
42
44
|
def allowed_initialize_opts
|
43
|
-
super.merge(root: :self, puppetfile: :self, moduledir: :self, force: :self )
|
45
|
+
super.merge(root: :self, puppetfile: :self, moduledir: :self, :'module-exclude-regex' => :self, force: :self )
|
44
46
|
end
|
45
47
|
end
|
46
48
|
end
|
data/lib/r10k/cli/deploy.rb
CHANGED
@@ -10,6 +10,19 @@ require 'cri'
|
|
10
10
|
|
11
11
|
module R10K::CLI
|
12
12
|
module Deploy
|
13
|
+
|
14
|
+
class TransformExcludeSpec
|
15
|
+
def call(input)
|
16
|
+
# To be backward compatible with the 3.x flag version of this setting,
|
17
|
+
# r10k allows this flag to have an optional argument. When no argument
|
18
|
+
# is supplied, cri defaults to setting the class to true, so we check
|
19
|
+
# for TrueClass here as well as "true".
|
20
|
+
return true if input == true || input == 'true'
|
21
|
+
return false if input == 'false'
|
22
|
+
raise ArgumentError
|
23
|
+
end
|
24
|
+
end
|
25
|
+
|
13
26
|
def self.command
|
14
27
|
@cmd ||= Cri::Command.define do
|
15
28
|
name 'deploy'
|
@@ -24,7 +37,8 @@ module R10K::CLI
|
|
24
37
|
option nil, :cachedir, 'Specify a cachedir, overriding the value in config', argument: :required
|
25
38
|
flag nil, :'no-force', 'Prevent the overwriting of local module modifications'
|
26
39
|
flag nil, :'generate-types', 'Run `puppet generate types` after updating an environment'
|
27
|
-
|
40
|
+
option nil, :'exclude-spec', 'Exclude the module\'s spec dir for deployment', argument: :optional,
|
41
|
+
transform: TransformExcludeSpec.new
|
28
42
|
option nil, :'puppet-path', 'Path to puppet executable', argument: :required do |value, cmd|
|
29
43
|
unless File.executable? value
|
30
44
|
$stderr.puts "The specified puppet executable #{value} is not executable."
|
data/lib/r10k/cli/puppetfile.rb
CHANGED
@@ -31,6 +31,7 @@ Puppetfile (http://bombasticmonkey.com/librarian-puppet/).
|
|
31
31
|
summary 'Install all modules from a Puppetfile'
|
32
32
|
option nil, :moduledir, 'Path to install modules to', argument: :required
|
33
33
|
option nil, :puppetfile, 'Path to puppetfile', argument: :required
|
34
|
+
option nil, :'module-exclude-regex', 'A regex to exclude modules from installation. Helpful in CI environments.', argument: :required
|
34
35
|
flag nil, :force, 'Force locally changed files to be overwritten'
|
35
36
|
runner R10K::Action::Puppetfile::CriRunner.wrap(R10K::Action::Puppetfile::Install)
|
36
37
|
end
|
@@ -79,8 +79,13 @@ module R10K
|
|
79
79
|
begin
|
80
80
|
while mods = mods_queue.pop(true) do
|
81
81
|
mods.each do |mod|
|
82
|
-
|
83
|
-
|
82
|
+
begin
|
83
|
+
updated = mod.sync
|
84
|
+
updated_modules << mod.name if updated
|
85
|
+
rescue Exception => e
|
86
|
+
logger.error _("Module %{mod_name} failed to synchronize due to %{message}") % {mod_name: mod.name, message: e.message}
|
87
|
+
raise e
|
88
|
+
end
|
84
89
|
end
|
85
90
|
end
|
86
91
|
rescue ThreadError => e
|
data/lib/r10k/environment.rb
CHANGED
@@ -31,7 +31,6 @@ module R10K
|
|
31
31
|
require 'r10k/environment/base'
|
32
32
|
require 'r10k/environment/with_modules'
|
33
33
|
require 'r10k/environment/plain'
|
34
|
-
require 'r10k/environment/bare'
|
35
34
|
require 'r10k/environment/git'
|
36
35
|
require 'r10k/environment/svn'
|
37
36
|
require 'r10k/environment/tarball'
|
@@ -56,11 +56,12 @@ class R10K::Git::Rugged::BareRepository < R10K::Git::Rugged::BaseRepository
|
|
56
56
|
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} }
|
57
57
|
end
|
58
58
|
|
59
|
-
options = {:credentials => credentials, :prune => true}
|
60
|
-
refspecs = ['+refs/*:refs/*']
|
61
|
-
|
62
59
|
remote = remotes[remote_name]
|
63
60
|
proxy = R10K::Git.get_proxy_for_remote(remote)
|
61
|
+
|
62
|
+
options = {:credentials => credentials, :prune => true, :proxy_url => proxy}
|
63
|
+
refspecs = ['+refs/*:refs/*']
|
64
|
+
|
64
65
|
results = nil
|
65
66
|
|
66
67
|
R10K::Git.with_proxy(proxy) do
|
@@ -27,6 +27,7 @@ class R10K::Git::Rugged::WorkingRepository < R10K::Git::Rugged::BaseRepository
|
|
27
27
|
def clone(remote, opts = {})
|
28
28
|
logger.debug1 { _("Cloning '%{remote}' into %{path}") % {remote: remote, path: @path } }
|
29
29
|
|
30
|
+
proxy = R10K::Git.get_proxy_for_remote(remote)
|
30
31
|
# libgit2/rugged doesn't support cloning a repository and providing an
|
31
32
|
# alternate object database, making the handling of :alternates a noop.
|
32
33
|
# Unfortunately this means that this method can't really use alternates
|
@@ -34,10 +35,9 @@ class R10K::Git::Rugged::WorkingRepository < R10K::Git::Rugged::BaseRepository
|
|
34
35
|
# repository. However alternate databases can be handled when an existing
|
35
36
|
# repository is loaded, so loading a cloned repo will correctly use
|
36
37
|
# alternate object database.
|
37
|
-
options = {:credentials => credentials}
|
38
|
+
options = {:credentials => credentials, :proxy_url => proxy}
|
38
39
|
options.merge!(:alternates => [File.join(opts[:reference], 'objects')]) if opts[:reference]
|
39
40
|
|
40
|
-
proxy = R10K::Git.get_proxy_for_remote(remote)
|
41
41
|
|
42
42
|
R10K::Git.with_proxy(proxy) do
|
43
43
|
@_rugged_repo = ::Rugged::Repository.clone_at(remote, @path.to_s, options)
|
@@ -85,11 +85,13 @@ class R10K::Git::Rugged::WorkingRepository < R10K::Git::Rugged::BaseRepository
|
|
85
85
|
|
86
86
|
def fetch(remote_name = 'origin')
|
87
87
|
logger.debug1 { _("Fetching remote '%{remote}' at %{path}") % {remote: remote_name, path: @path} }
|
88
|
-
options = {:credentials => credentials}
|
89
|
-
refspecs = ["+refs/heads/*:refs/remotes/#{remote_name}/*"]
|
90
88
|
|
91
89
|
remote = remotes[remote_name]
|
92
90
|
proxy = R10K::Git.get_proxy_for_remote(remote)
|
91
|
+
|
92
|
+
options = {:credentials => credentials, :proxy_url => proxy}
|
93
|
+
refspecs = ["+refs/heads/*:refs/remotes/#{remote_name}/*"]
|
94
|
+
|
93
95
|
results = nil
|
94
96
|
|
95
97
|
R10K::Git.with_proxy(proxy) do
|
@@ -117,7 +119,7 @@ class R10K::Git::Rugged::WorkingRepository < R10K::Git::Rugged::BaseRepository
|
|
117
119
|
with_repo { |repo| repo.config['remote.origin.url'] }
|
118
120
|
end
|
119
121
|
|
120
|
-
def dirty?(exclude_spec=
|
122
|
+
def dirty?(exclude_spec=true)
|
121
123
|
with_repo do |repo|
|
122
124
|
if exclude_spec
|
123
125
|
diff = repo.diff_workdir('HEAD').select { |d| ! d.delta.old_file[:path].start_with?('spec/') }
|
@@ -90,18 +90,18 @@ class R10K::Git::ShellGit::WorkingRepository < R10K::Git::ShellGit::BaseReposito
|
|
90
90
|
end
|
91
91
|
|
92
92
|
# does the working tree have local modifications to tracked files?
|
93
|
-
def dirty?(exclude_spec=
|
93
|
+
def dirty?(exclude_spec=true)
|
94
94
|
result = git(['diff-index', '--exit-code', '--name-only', 'HEAD'], :path => @path.to_s, :raise_on_fail => false)
|
95
95
|
|
96
96
|
if result.exit_code != 0
|
97
|
-
dirty_files = result.stdout.split(
|
97
|
+
dirty_files = result.stdout.split("\n")
|
98
98
|
dirty_files.delete_if { |f| f.start_with?('spec/') } if exclude_spec
|
99
99
|
|
100
100
|
dirty_files.each do |file|
|
101
101
|
logger.debug(_("Found local modifications in %{file_path}" % {file_path: File.join(@path, file)}))
|
102
102
|
|
103
103
|
# Do this in a block so that the extra subprocess only gets invoked when needed.
|
104
|
-
logger.debug1 { git(['diff-index', '-p', 'HEAD', file], :path => @path.to_s, :raise_on_fail => false).stdout }
|
104
|
+
logger.debug1 { git(['diff-index', '-p', 'HEAD', '--', file], :path => @path.to_s, :raise_on_fail => false).stdout }
|
105
105
|
end
|
106
106
|
|
107
107
|
return dirty_files.size > 0
|
@@ -36,7 +36,7 @@ class R10K::Git::StatefulRepository
|
|
36
36
|
end
|
37
37
|
|
38
38
|
# Returns true if the sync actually updated the repo, false otherwise
|
39
|
-
def sync(ref, force=true, exclude_spec=
|
39
|
+
def sync(ref, force=true, exclude_spec=true)
|
40
40
|
@cache.sync if sync_cache?(ref)
|
41
41
|
|
42
42
|
sha = @cache.resolve(ref)
|
@@ -75,7 +75,7 @@ class R10K::Git::StatefulRepository
|
|
75
75
|
updated
|
76
76
|
end
|
77
77
|
|
78
|
-
def status(ref, exclude_spec=
|
78
|
+
def status(ref, exclude_spec=true)
|
79
79
|
if !@repo.exist?
|
80
80
|
:absent
|
81
81
|
elsif !@cache.exist?
|
data/lib/r10k/module/base.rb
CHANGED
@@ -60,8 +60,8 @@ class R10K::Module::Base
|
|
60
60
|
@environment = environment
|
61
61
|
@overrides = args.delete(:overrides) || {}
|
62
62
|
@spec_deletable = true
|
63
|
-
@exclude_spec =
|
64
|
-
@exclude_spec = @overrides.dig(:modules, :exclude_spec)
|
63
|
+
@exclude_spec = true
|
64
|
+
@exclude_spec = @overrides.dig(:modules, :exclude_spec) unless @overrides.dig(:modules, :exclude_spec).nil?
|
65
65
|
if args.has_key?(:exclude_spec)
|
66
66
|
logger.debug2 _("Overriding :exclude_spec setting with per module setting for #{@title}")
|
67
67
|
@exclude_spec = args.delete(:exclude_spec)
|
@@ -78,7 +78,7 @@ class R10K::Module::Base
|
|
78
78
|
path.to_s
|
79
79
|
end
|
80
80
|
|
81
|
-
# Delete the spec dir if @exclude_spec
|
81
|
+
# Delete the spec dir if @exclude_spec is true and @spec_deletable is also true
|
82
82
|
def maybe_delete_spec_dir
|
83
83
|
if @exclude_spec
|
84
84
|
if @spec_deletable
|