akerl-r10k 3.14.2.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/.gitattributes +1 -0
- data/.github/pull_request_template.md +4 -0
- data/.github/workflows/docker.yml +64 -0
- data/.github/workflows/release.yml +37 -0
- data/.github/workflows/rspec_tests.yml +81 -0
- data/.github/workflows/stale.yml +21 -0
- data/.gitignore +10 -0
- data/.travis.yml +42 -0
- data/CHANGELOG.mkd +1879 -0
- data/CODEOWNERS +2 -0
- data/CONTRIBUTING.mkd +105 -0
- data/Gemfile +15 -0
- data/LICENSE +14 -0
- data/README.mkd +139 -0
- data/Rakefile +3 -0
- data/bin/r10k +17 -0
- data/doc/common-patterns.mkd +45 -0
- data/doc/dynamic-environments/configuration.mkd +850 -0
- data/doc/dynamic-environments/git-environments.mkd +75 -0
- data/doc/dynamic-environments/introduction.mkd +69 -0
- data/doc/dynamic-environments/master-configuration.mkd +40 -0
- data/doc/dynamic-environments/quickstart.mkd +201 -0
- data/doc/dynamic-environments/svn-environments.mkd +45 -0
- data/doc/dynamic-environments/usage.mkd +163 -0
- data/doc/dynamic-environments/workflow-guide.mkd +247 -0
- data/doc/dynamic-environments.mkd +31 -0
- data/doc/faq.mkd +164 -0
- data/doc/git/cloning-and-mirroring.mkd +60 -0
- data/doc/git/providers.mkd +133 -0
- data/doc/puppetfile.mkd +355 -0
- data/doc/updating-your-puppetfile.mkd +38 -0
- data/docker/.gitignore +1 -0
- data/docker/.rspec +4 -0
- data/docker/Gemfile +11 -0
- data/docker/Makefile +99 -0
- data/docker/README.md +28 -0
- data/docker/docker-compose.yml +18 -0
- data/docker/r10k/Dockerfile +68 -0
- data/docker/r10k/adduser.sh +13 -0
- data/docker/r10k/docker-entrypoint.d/10-analytics.sh +30 -0
- data/docker/r10k/docker-entrypoint.sh +10 -0
- data/docker/r10k/release.Dockerfile +55 -0
- data/docker/spec/dockerfile_spec.rb +37 -0
- data/docker/spec/fixtures/Puppetfile +2 -0
- data/integration/Gemfile +19 -0
- data/integration/README.mkd +29 -0
- data/integration/Rakefile +79 -0
- data/integration/component/pre-suite/05_install_dev_r10k.rb +12 -0
- data/integration/files/README.mkd +4 -0
- data/integration/files/hiera.yaml +8 -0
- data/integration/files/modules/helloworld/manifests/init.pp +3 -0
- data/integration/files/modules/hieratest/manifests/init.pp +3 -0
- data/integration/files/modules/unicode/files/pretend_unicode +1 -0
- data/integration/files/modules/unicode/manifests/init.pp +6 -0
- data/integration/files/pre-suite/git_config.pp.erb +19 -0
- data/integration/files/pre-suite/prod_env.config +3 -0
- data/integration/files/r10k_conf.yaml.erb +9 -0
- data/integration/lib/README.mkd +4 -0
- data/integration/lib/git_utils.rb +205 -0
- data/integration/lib/master_manipulator.rb +205 -0
- data/integration/lib/r10k_utils.rb +222 -0
- data/integration/manifests/README.mkd +4 -0
- data/integration/pre-suite/00_pe_install.rb +6 -0
- data/integration/pre-suite/10_git_config.rb +48 -0
- data/integration/pre-suite/20_pe_r10k.rb +55 -0
- data/integration/pre-suite/README.mkd +5 -0
- data/integration/tests/Puppetfile/HTTP_PROXY_affects_forge_source.rb +72 -0
- data/integration/tests/Puppetfile/HTTP_PROXY_affects_git_source.rb +70 -0
- data/integration/tests/README.mkd +4 -0
- data/integration/tests/basic_functionality/basic_deployment.rb +176 -0
- data/integration/tests/basic_functionality/install_pe_only_module_with_puppetfile.rb +83 -0
- data/integration/tests/basic_functionality/negative/neg_deploy_with_invalid_r10k_yaml.rb +51 -0
- data/integration/tests/basic_functionality/negative/neg_deploy_with_missing_r10k_yaml.rb +28 -0
- data/integration/tests/basic_functionality/negative/neg_invalid_git_provider.rb +45 -0
- data/integration/tests/basic_functionality/negative/negative_bad_proxy.rb +34 -0
- data/integration/tests/basic_functionality/proxy_specified_in_configuration.rb +103 -0
- data/integration/tests/basic_functionality/proxy_with_pe_only_module.rb +128 -0
- data/integration/tests/basic_functionality/proxy_with_puppetfile.rb +61 -0
- data/integration/tests/basic_functionality/rugged_git_provider_with_ssh.rb +109 -0
- data/integration/tests/basic_functionality/rugged_git_provider_without_ssh.rb +108 -0
- data/integration/tests/command_line/deploy_env_without_mod_update.rb +76 -0
- data/integration/tests/command_line/negative/neg_deploy_env_with_module_update.rb +77 -0
- data/integration/tests/command_line/negative/neg_invalid_cmd_line_arg.rb +23 -0
- data/integration/tests/git_source/HTTP_proxy_and_git_source.rb +70 -0
- data/integration/tests/git_source/git_source_git.rb +128 -0
- data/integration/tests/git_source/git_source_repeated_remote.rb +68 -0
- data/integration/tests/git_source/git_source_ssh.rb +87 -0
- data/integration/tests/git_source/git_source_submodule.rb +70 -0
- data/integration/tests/git_source/negative/neg_git_broken_remote.rb +38 -0
- data/integration/tests/git_source/negative/neg_git_unauthorized_https.rb +46 -0
- data/integration/tests/git_source/negative/neg_git_unauthorized_ssh.rb +73 -0
- data/integration/tests/git_source/negative/neg_git_unicode_branch.rb +35 -0
- data/integration/tests/i18n/deploy_module_with_unicode_in_file_name.rb +64 -0
- data/integration/tests/purging/content_not_purged_at_root.rb +89 -0
- data/integration/tests/purging/default_purging.rb +125 -0
- data/integration/tests/purging/does_not_purge_files_on_white_list.rb +93 -0
- data/integration/tests/purging/invalid_whitelist_types.rb +63 -0
- data/integration/tests/user_scenario/basic_workflow/multi_env_1000_branches.rb +66 -0
- data/integration/tests/user_scenario/basic_workflow/multi_env_custom_forge_git_module.rb +112 -0
- data/integration/tests/user_scenario/basic_workflow/multi_env_custom_forge_git_module_static.rb +118 -0
- data/integration/tests/user_scenario/basic_workflow/multi_env_hiera.rb +100 -0
- data/integration/tests/user_scenario/basic_workflow/multi_env_multi_source.rb +133 -0
- data/integration/tests/user_scenario/basic_workflow/multi_source_custom_forge_git_module.rb +161 -0
- data/integration/tests/user_scenario/basic_workflow/negative/neg_bad_basedir.rb +46 -0
- data/integration/tests/user_scenario/basic_workflow/negative/neg_bad_forge_module.rb +48 -0
- data/integration/tests/user_scenario/basic_workflow/negative/neg_bad_git_module.rb +45 -0
- data/integration/tests/user_scenario/basic_workflow/negative/neg_bad_git_module_ref.rb +43 -0
- data/integration/tests/user_scenario/basic_workflow/negative/neg_bad_git_remote.rb +45 -0
- data/integration/tests/user_scenario/basic_workflow/negative/neg_branch_name_collision.rb +64 -0
- data/integration/tests/user_scenario/basic_workflow/negative/neg_disk_full.rb +75 -0
- data/integration/tests/user_scenario/basic_workflow/negative/neg_duplicate_module_names.rb +44 -0
- data/integration/tests/user_scenario/basic_workflow/negative/neg_inaccessible_forge.rb +58 -0
- data/integration/tests/user_scenario/basic_workflow/negative/neg_invalid_env_name.rb +34 -0
- data/integration/tests/user_scenario/basic_workflow/negative/neg_invalid_puppet_file.rb +36 -0
- data/integration/tests/user_scenario/basic_workflow/negative/neg_module_specified_at_deleted_release.rb +49 -0
- data/integration/tests/user_scenario/basic_workflow/negative/neg_read_only.rb +58 -0
- data/integration/tests/user_scenario/basic_workflow/negative/neg_specify_deleted_forge_module.rb +45 -0
- data/integration/tests/user_scenario/basic_workflow/single_env_10000_files.rb +75 -0
- data/integration/tests/user_scenario/basic_workflow/single_env_custom_forge_git_module.rb +105 -0
- data/integration/tests/user_scenario/basic_workflow/single_env_custom_forge_module.rb +81 -0
- data/integration/tests/user_scenario/basic_workflow/single_env_custom_module.rb +49 -0
- data/integration/tests/user_scenario/basic_workflow/single_env_large_files.rb +75 -0
- data/integration/tests/user_scenario/basic_workflow/single_env_module_already_installed.rb +82 -0
- data/integration/tests/user_scenario/basic_workflow/single_env_module_last_release_deleted.rb +68 -0
- data/integration/tests/user_scenario/basic_workflow/single_env_non-existent_base_dir.rb +94 -0
- data/integration/tests/user_scenario/basic_workflow/single_env_purge_unmanaged_modules.rb +89 -0
- data/integration/tests/user_scenario/basic_workflow/single_env_switch_forge_git_module.rb +117 -0
- data/integration/tests/user_scenario/basic_workflow/single_env_unicode_paths.rb +60 -0
- data/integration/tests/user_scenario/basic_workflow/single_env_upgrade_forge_mod_revert_change.rb +166 -0
- data/integration/tests/user_scenario/complex_workflow/multi_env_add_change_remove.rb +163 -0
- data/integration/tests/user_scenario/complex_workflow/multi_env_remove_re-add.rb +111 -0
- data/integration/tests/user_scenario/complex_workflow/multi_env_unamanaged.rb +78 -0
- data/integration/tests/user_scenario/complex_workflow/single_env_git_module_update.rb +100 -0
- data/lib/r10k/action/base.rb +41 -0
- data/lib/r10k/action/cri_runner.rb +72 -0
- data/lib/r10k/action/deploy/deploy_helpers.rb +38 -0
- data/lib/r10k/action/deploy/display.rb +128 -0
- data/lib/r10k/action/deploy/environment.rb +260 -0
- data/lib/r10k/action/deploy/module.rb +139 -0
- data/lib/r10k/action/deploy.rb +9 -0
- data/lib/r10k/action/puppetfile/check.rb +35 -0
- data/lib/r10k/action/puppetfile/cri_runner.rb +26 -0
- data/lib/r10k/action/puppetfile/install.rb +48 -0
- data/lib/r10k/action/puppetfile/purge.rb +37 -0
- data/lib/r10k/action/puppetfile.rb +10 -0
- data/lib/r10k/action/runner.rb +171 -0
- data/lib/r10k/action/visitor.rb +34 -0
- data/lib/r10k/cli/deploy.rb +126 -0
- data/lib/r10k/cli/ext/logging.rb +15 -0
- data/lib/r10k/cli/help.rb +7 -0
- data/lib/r10k/cli/puppetfile.rb +73 -0
- data/lib/r10k/cli/version.rb +31 -0
- data/lib/r10k/cli.rb +51 -0
- data/lib/r10k/content_synchronizer.rb +95 -0
- data/lib/r10k/deployment/config.rb +56 -0
- data/lib/r10k/deployment.rb +132 -0
- data/lib/r10k/environment/bare.rb +13 -0
- data/lib/r10k/environment/base.rb +230 -0
- data/lib/r10k/environment/git.rb +93 -0
- data/lib/r10k/environment/name.rb +109 -0
- data/lib/r10k/environment/plain.rb +16 -0
- data/lib/r10k/environment/svn.rb +98 -0
- data/lib/r10k/environment/tarball.rb +78 -0
- data/lib/r10k/environment/with_modules.rb +174 -0
- data/lib/r10k/environment.rb +39 -0
- data/lib/r10k/errors/formatting.rb +28 -0
- data/lib/r10k/errors.rb +66 -0
- data/lib/r10k/feature/collection.rb +23 -0
- data/lib/r10k/feature.rb +56 -0
- data/lib/r10k/features.rb +20 -0
- data/lib/r10k/forge/module_release.rb +229 -0
- data/lib/r10k/git/alternates.rb +63 -0
- data/lib/r10k/git/cache.rb +107 -0
- data/lib/r10k/git/errors.rb +34 -0
- data/lib/r10k/git/rugged/bare_repository.rb +85 -0
- data/lib/r10k/git/rugged/base_repository.rb +104 -0
- data/lib/r10k/git/rugged/cache.rb +19 -0
- data/lib/r10k/git/rugged/credentials.rb +205 -0
- data/lib/r10k/git/rugged/thin_repository.rb +96 -0
- data/lib/r10k/git/rugged/working_repository.rb +149 -0
- data/lib/r10k/git/rugged.rb +17 -0
- data/lib/r10k/git/shellgit/bare_repository.rb +43 -0
- data/lib/r10k/git/shellgit/base_repository.rb +137 -0
- data/lib/r10k/git/shellgit/cache.rb +11 -0
- data/lib/r10k/git/shellgit/thin_repository.rb +73 -0
- data/lib/r10k/git/shellgit/working_repository.rb +112 -0
- data/lib/r10k/git/shellgit.rb +9 -0
- data/lib/r10k/git/stateful_repository.rb +109 -0
- data/lib/r10k/git.rb +200 -0
- data/lib/r10k/initializers.rb +93 -0
- data/lib/r10k/instance_cache.rb +32 -0
- data/lib/r10k/keyed_factory.rb +39 -0
- data/lib/r10k/logging/terminaloutputter.rb +36 -0
- data/lib/r10k/logging.rb +186 -0
- data/lib/r10k/module/base.rb +182 -0
- data/lib/r10k/module/definition.rb +64 -0
- data/lib/r10k/module/forge.rb +208 -0
- data/lib/r10k/module/git.rb +156 -0
- data/lib/r10k/module/local.rb +40 -0
- data/lib/r10k/module/metadata_file.rb +31 -0
- data/lib/r10k/module/svn.rb +129 -0
- data/lib/r10k/module/tarball.rb +101 -0
- data/lib/r10k/module.rb +57 -0
- data/lib/r10k/module_loader/puppetfile/dsl.rb +42 -0
- data/lib/r10k/module_loader/puppetfile.rb +290 -0
- data/lib/r10k/puppetfile.rb +211 -0
- data/lib/r10k/settings/collection.rb +123 -0
- data/lib/r10k/settings/container.rb +97 -0
- data/lib/r10k/settings/definition.rb +124 -0
- data/lib/r10k/settings/enum_definition.rb +30 -0
- data/lib/r10k/settings/helpers.rb +38 -0
- data/lib/r10k/settings/list.rb +107 -0
- data/lib/r10k/settings/loader.rb +99 -0
- data/lib/r10k/settings/mixin.rb +54 -0
- data/lib/r10k/settings/uri_definition.rb +19 -0
- data/lib/r10k/settings.rb +312 -0
- data/lib/r10k/source/base.rb +93 -0
- data/lib/r10k/source/exec.rb +51 -0
- data/lib/r10k/source/git.rb +178 -0
- data/lib/r10k/source/hash.rb +182 -0
- data/lib/r10k/source/svn.rb +142 -0
- data/lib/r10k/source/yaml.rb +20 -0
- data/lib/r10k/source/yamldir.rb +32 -0
- data/lib/r10k/source.rb +42 -0
- data/lib/r10k/svn/remote.rb +68 -0
- data/lib/r10k/svn/working_dir.rb +125 -0
- data/lib/r10k/svn.rb +6 -0
- data/lib/r10k/tarball.rb +183 -0
- data/lib/r10k/util/attempt.rb +84 -0
- data/lib/r10k/util/basedir.rb +65 -0
- data/lib/r10k/util/cacheable.rb +31 -0
- data/lib/r10k/util/cleaner.rb +21 -0
- data/lib/r10k/util/commands.rb +31 -0
- data/lib/r10k/util/downloader.rb +134 -0
- data/lib/r10k/util/exec_env.rb +36 -0
- data/lib/r10k/util/license.rb +24 -0
- data/lib/r10k/util/platform.rb +42 -0
- data/lib/r10k/util/purgeable.rb +154 -0
- data/lib/r10k/util/setopts.rb +78 -0
- data/lib/r10k/util/subprocess/result.rb +56 -0
- data/lib/r10k/util/subprocess/runner/jruby.rb +23 -0
- data/lib/r10k/util/subprocess/runner/posix.rb +103 -0
- data/lib/r10k/util/subprocess/runner/pump.rb +59 -0
- data/lib/r10k/util/subprocess/runner/windows.rb +23 -0
- data/lib/r10k/util/subprocess/runner.rb +26 -0
- data/lib/r10k/util/subprocess/subprocess_error.rb +24 -0
- data/lib/r10k/util/subprocess.rb +85 -0
- data/lib/r10k/util/symbolize_keys.rb +35 -0
- data/lib/r10k/version.rb +6 -0
- data/lib/r10k.rb +11 -0
- data/locales/config.yaml +21 -0
- data/locales/r10k.pot +693 -0
- data/r10k.gemspec +52 -0
- data/r10k.yaml.example +140 -0
- 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 +1 -0
- data/spec/fixtures/module/forge/eight_hundred/Modulefile +8 -0
- data/spec/fixtures/module/forge/eight_hundred/metadata.json +19 -0
- data/spec/fixtures/tarball/tarball.tar.gz +0 -0
- data/spec/fixtures/unit/action/r10k.yaml +5 -0
- data/spec/fixtures/unit/action/r10k_cachedir.yaml +2 -0
- data/spec/fixtures/unit/action/r10k_creds.yaml +9 -0
- data/spec/fixtures/unit/action/r10k_forge_auth.yaml +4 -0
- data/spec/fixtures/unit/action/r10k_forge_auth_no_url.yaml +3 -0
- data/spec/fixtures/unit/action/r10k_generate_types.yaml +3 -0
- data/spec/fixtures/unit/action/r10k_logging.yaml +12 -0
- data/spec/fixtures/unit/action/r10k_puppet_path.yaml +3 -0
- data/spec/fixtures/unit/puppetfile/argument-error/Puppetfile +1 -0
- data/spec/fixtures/unit/puppetfile/default-branch-override/Puppetfile +5 -0
- data/spec/fixtures/unit/puppetfile/duplicate-module-error/Puppetfile +10 -0
- data/spec/fixtures/unit/puppetfile/forge-override/Puppetfile +8 -0
- data/spec/fixtures/unit/puppetfile/invalid-syntax/Puppetfile +1 -0
- data/spec/fixtures/unit/puppetfile/load-error/Puppetfile +1 -0
- data/spec/fixtures/unit/puppetfile/name-error/Puppetfile +1 -0
- data/spec/fixtures/unit/puppetfile/valid-forge-with-version/Puppetfile +1 -0
- data/spec/fixtures/unit/puppetfile/valid-forge-without-version/Puppetfile +1 -0
- data/spec/fixtures/unit/puppetfile/various-modules/Puppetfile +10 -0
- data/spec/fixtures/unit/puppetfile/various-modules/Puppetfile.new +10 -0
- data/spec/fixtures/unit/puppetfile/various-modules/modules/apt/.gitkeep +1 -0
- data/spec/fixtures/unit/puppetfile/various-modules/modules/baz/.gitkeep +1 -0
- data/spec/fixtures/unit/puppetfile/various-modules/modules/buzz/.gitkeep +1 -0
- data/spec/fixtures/unit/puppetfile/various-modules/modules/canary/.gitkeep +1 -0
- data/spec/fixtures/unit/puppetfile/various-modules/modules/fizz/.gitkeep +1 -0
- data/spec/fixtures/unit/puppetfile/various-modules/modules/rpm/.gitkeep +1 -0
- 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 +1 -0
- 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 +1 -0
- data/spec/fixtures/unit/util/purgeable/managed_one/managed_symlink_dir +1 -0
- data/spec/fixtures/unit/util/purgeable/managed_one/unmanaged_1 +0 -0
- data/spec/fixtures/unit/util/purgeable/managed_one/unmanaged_symlink_file +1 -0
- 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 +3 -0
- data/spec/integration/git/rugged/bare_repository_spec.rb +13 -0
- data/spec/integration/git/rugged/cache_spec.rb +33 -0
- data/spec/integration/git/rugged/thin_repository_spec.rb +14 -0
- data/spec/integration/git/rugged/working_repository_spec.rb +48 -0
- data/spec/integration/git/shellgit/bare_repository_spec.rb +13 -0
- data/spec/integration/git/shellgit/thin_repository_spec.rb +14 -0
- data/spec/integration/git/shellgit/working_repository_spec.rb +13 -0
- data/spec/integration/git/stateful_repository_spec.rb +175 -0
- data/spec/integration/util/purageable_spec.rb +41 -0
- data/spec/matchers/exit_with.rb +28 -0
- data/spec/matchers/match_realpath.rb +18 -0
- data/spec/r10k-mocks/mock_config.rb +33 -0
- data/spec/r10k-mocks/mock_env.rb +18 -0
- data/spec/r10k-mocks/mock_source.rb +17 -0
- data/spec/r10k-mocks.rb +3 -0
- data/spec/shared-contexts/git-fixtures.rb +55 -0
- data/spec/shared-contexts/tarball.rb +32 -0
- data/spec/shared-examples/deploy-actions.rb +69 -0
- data/spec/shared-examples/git/bare_repository.rb +132 -0
- data/spec/shared-examples/git/thin_repository.rb +26 -0
- data/spec/shared-examples/git/working_repository.rb +207 -0
- data/spec/shared-examples/git-repository.rb +38 -0
- data/spec/shared-examples/puppetfile-action.rb +39 -0
- data/spec/shared-examples/settings/ancestry.rb +44 -0
- data/spec/shared-examples/subprocess-runner.rb +89 -0
- data/spec/spec_helper.rb +41 -0
- data/spec/unit/action/cri_runner_spec.rb +72 -0
- data/spec/unit/action/deploy/deploy_helpers_spec.rb +38 -0
- data/spec/unit/action/deploy/display_spec.rb +61 -0
- data/spec/unit/action/deploy/environment_spec.rb +640 -0
- data/spec/unit/action/deploy/module_spec.rb +476 -0
- data/spec/unit/action/puppetfile/check_spec.rb +53 -0
- data/spec/unit/action/puppetfile/cri_runner_spec.rb +47 -0
- data/spec/unit/action/puppetfile/install_spec.rb +112 -0
- data/spec/unit/action/puppetfile/purge_spec.rb +60 -0
- data/spec/unit/action/runner_spec.rb +407 -0
- data/spec/unit/action/visitor_spec.rb +39 -0
- data/spec/unit/cli_spec.rb +9 -0
- data/spec/unit/deployment/config_spec.rb +33 -0
- data/spec/unit/deployment_spec.rb +162 -0
- data/spec/unit/environment/bare_spec.rb +13 -0
- data/spec/unit/environment/base_spec.rb +122 -0
- data/spec/unit/environment/git_spec.rb +114 -0
- data/spec/unit/environment/name_spec.rb +181 -0
- data/spec/unit/environment/plain_spec.rb +8 -0
- data/spec/unit/environment/svn_spec.rb +146 -0
- data/spec/unit/environment/tarball_spec.rb +45 -0
- data/spec/unit/environment/with_modules_spec.rb +122 -0
- data/spec/unit/errors/formatting_spec.rb +84 -0
- data/spec/unit/feature_spec.rb +50 -0
- data/spec/unit/forge/module_release_spec.rb +213 -0
- data/spec/unit/git/alternates_spec.rb +116 -0
- data/spec/unit/git/cache_spec.rb +66 -0
- data/spec/unit/git/rugged/cache_spec.rb +48 -0
- data/spec/unit/git/rugged/credentials_spec.rb +215 -0
- data/spec/unit/git/shellgit/cache_spec.rb +27 -0
- data/spec/unit/git/stateful_repository_spec.rb +45 -0
- data/spec/unit/git_spec.rb +102 -0
- data/spec/unit/initializers_spec.rb +68 -0
- data/spec/unit/instance_cache_spec.rb +78 -0
- data/spec/unit/keyed_factory_spec.rb +51 -0
- data/spec/unit/logging/terminaloutputter_spec.rb +53 -0
- data/spec/unit/logging_spec.rb +68 -0
- data/spec/unit/module/base_spec.rb +118 -0
- data/spec/unit/module/forge_spec.rb +271 -0
- data/spec/unit/module/git_spec.rb +387 -0
- data/spec/unit/module/metadata_file_spec.rb +68 -0
- data/spec/unit/module/svn_spec.rb +208 -0
- data/spec/unit/module/tarball_spec.rb +70 -0
- data/spec/unit/module_loader/puppetfile_spec.rb +421 -0
- data/spec/unit/module_spec.rb +114 -0
- data/spec/unit/puppetfile_spec.rb +304 -0
- data/spec/unit/settings/collection_spec.rb +123 -0
- data/spec/unit/settings/container_spec.rb +92 -0
- data/spec/unit/settings/definition_spec.rb +79 -0
- data/spec/unit/settings/enum_definition_spec.rb +20 -0
- data/spec/unit/settings/inheritance_spec.rb +38 -0
- data/spec/unit/settings/list_spec.rb +88 -0
- data/spec/unit/settings/loader_spec.rb +110 -0
- data/spec/unit/settings/uri_definition_spec.rb +23 -0
- data/spec/unit/settings_spec.rb +303 -0
- data/spec/unit/source/base_spec.rb +31 -0
- data/spec/unit/source/exec_spec.rb +81 -0
- data/spec/unit/source/git_spec.rb +233 -0
- data/spec/unit/source/hash_spec.rb +54 -0
- data/spec/unit/source/svn_spec.rb +196 -0
- data/spec/unit/source/yaml_spec.rb +42 -0
- data/spec/unit/source_spec.rb +10 -0
- data/spec/unit/svn/remote_spec.rb +21 -0
- data/spec/unit/svn/working_dir_spec.rb +56 -0
- data/spec/unit/tarball_spec.rb +57 -0
- data/spec/unit/util/attempt_spec.rb +82 -0
- data/spec/unit/util/cacheable_spec.rb +23 -0
- data/spec/unit/util/commands_spec.rb +61 -0
- data/spec/unit/util/downloader_spec.rb +98 -0
- data/spec/unit/util/exec_env_spec.rb +56 -0
- data/spec/unit/util/purgeable_spec.rb +267 -0
- data/spec/unit/util/setopts_spec.rb +83 -0
- data/spec/unit/util/subprocess/result_spec.rb +36 -0
- data/spec/unit/util/subprocess/runner/posix_spec.rb +7 -0
- data/spec/unit/util/subprocess/runner/pump_spec.rb +79 -0
- data/spec/unit/util/subprocess/runner/windows_spec.rb +7 -0
- data/spec/unit/util/subprocess/subprocess_error_spec.rb +26 -0
- data/spec/unit/util/subprocess_spec.rb +65 -0
- data/spec/unit/util/symbolize_keys_spec.rb +67 -0
- metadata +637 -0
data/doc/puppetfile.mkd
ADDED
@@ -0,0 +1,355 @@
|
|
1
|
+
Puppetfile
|
2
|
+
==========
|
3
|
+
|
4
|
+
Puppetfiles are a simple Ruby based DSL that specifies a list of modules to
|
5
|
+
install, what version to install, and where to fetch them from. r10k can use a
|
6
|
+
Puppetfile to install a set of Puppet modules for local development, or they can
|
7
|
+
be used with r10k environment deployments to install additional modules into a
|
8
|
+
given environment.
|
9
|
+
|
10
|
+
Unlike librarian-puppet, the r10k implementation of Puppetfiles does not include
|
11
|
+
dependency resolution, but it is on the roadmap.
|
12
|
+
|
13
|
+
When directly working with Puppetfiles, you can use the `r10k puppetfile`
|
14
|
+
subcommand to interact with a Puppetfile.
|
15
|
+
|
16
|
+
When using r10k's deploy functionality, interacting with Puppetfiles is handled
|
17
|
+
on a case by case basis.
|
18
|
+
|
19
|
+
Because the Puppetfile format is actually implemented using a Ruby DSL any valid
|
20
|
+
Ruby expression can be used. That being said, being a bit too creative in the
|
21
|
+
DSL can lead to surprising (read: bad) things happening, so consider keeping it
|
22
|
+
simple.
|
23
|
+
|
24
|
+
Commands
|
25
|
+
--------
|
26
|
+
|
27
|
+
Puppetfile subcommands assume that the Puppetfile to operate on is in the
|
28
|
+
current working directory and modules should be installed in the 'modules'
|
29
|
+
directory relative to the current working directory.
|
30
|
+
|
31
|
+
Install or update all modules in a given Puppetfile
|
32
|
+
into ./modules)
|
33
|
+
|
34
|
+
r10k puppetfile install
|
35
|
+
|
36
|
+
Verify the Puppetfile syntax
|
37
|
+
|
38
|
+
r10k puppetfile check
|
39
|
+
|
40
|
+
Remove any modules in the 'modules' directory that are not specified in the
|
41
|
+
Puppetfile:
|
42
|
+
|
43
|
+
r10k puppetfile purge
|
44
|
+
|
45
|
+
Global settings
|
46
|
+
---------------
|
47
|
+
|
48
|
+
The following settings can be used to control how the Puppetfile installs and
|
49
|
+
handles modules.
|
50
|
+
|
51
|
+
### forge
|
52
|
+
|
53
|
+
The `forge` setting specifies which server that Forge based modules are fetched
|
54
|
+
from. This declaration is only respected if [`forge.allow_puppetfile_override`](/dynamic-environments/configuration.mkd#allow_puppetfile_override)
|
55
|
+
is set to true in the main `r10k.yaml`. Otherwise, use [`forge.baseurl`](/doc/dynamic-environments/configuration.mkd#baseurl)
|
56
|
+
to globally configure where modules should be downloaded from.
|
57
|
+
|
58
|
+
### moduledir
|
59
|
+
|
60
|
+
The `moduledir` setting specifies where modules from the Puppetfile will be
|
61
|
+
installed. This defaults to the `modules` directory relative to the Puppetfile.
|
62
|
+
If the path is absolute then the modules will be installed to that absolute
|
63
|
+
path, otherwise it's assumed that the `moduledir` setting should be relative and
|
64
|
+
the modules will be installed in that directory relative to the Puppetfile.
|
65
|
+
|
66
|
+
The moduledir setting should be placed before any modules are declared.
|
67
|
+
|
68
|
+
Install modules to an absolute path:
|
69
|
+
|
70
|
+
```ruby
|
71
|
+
moduledir '/etc/puppet/modules'
|
72
|
+
|
73
|
+
mod 'branan/eight_hundred' # will be installed into '/etc/puppet/modules/eight_hundred'
|
74
|
+
```
|
75
|
+
|
76
|
+
Install modules to a relative path:
|
77
|
+
|
78
|
+
```ruby
|
79
|
+
moduledir 'thirdparty'
|
80
|
+
|
81
|
+
mod 'branan/eight_hundred' # will be installed into `dirname /path/to/Puppetfile`/thirdparty/eight_hundred
|
82
|
+
```
|
83
|
+
|
84
|
+
**Note**: support for a relative moduledir was added in r10k 1.4.0; the behavior
|
85
|
+
of a relative moduledir path is undefined on earlier versions of r10k.
|
86
|
+
|
87
|
+
Module types
|
88
|
+
------------
|
89
|
+
|
90
|
+
r10k can install Puppet modules from a number of different sources. Right now
|
91
|
+
modules can be installed from the Puppet Forge, Git, or SVN.
|
92
|
+
|
93
|
+
### Puppet Forge
|
94
|
+
|
95
|
+
Modules can be installed from the Puppet Forge.
|
96
|
+
|
97
|
+
If no version is specified the latest version available at the time will be
|
98
|
+
installed, and will be kept at that version.
|
99
|
+
|
100
|
+
mod 'puppetlabs/apache'
|
101
|
+
|
102
|
+
If a version is specified then that version will be installed.
|
103
|
+
|
104
|
+
mod 'puppetlabs/apache', '0.10.0'
|
105
|
+
|
106
|
+
If the version is set to :latest then the module will be always updated to the
|
107
|
+
latest version available.
|
108
|
+
|
109
|
+
mod 'puppetlabs/apache', :latest
|
110
|
+
|
111
|
+
An explicit type and/or version can be specified using the standard interface,
|
112
|
+
`:type` and `:version`. The `:source` parameter is not supported for individual
|
113
|
+
forge modules and will be ignored.
|
114
|
+
|
115
|
+
mod 'puppetlabs/apache',
|
116
|
+
type: 'forge',
|
117
|
+
version: '6.0.0'
|
118
|
+
|
119
|
+
### Git
|
120
|
+
|
121
|
+
Git repositories that contain a Puppet module can be cloned and used as modules.
|
122
|
+
When Git is used, the module version can be specified by using `:ref`, `:tag`,
|
123
|
+
`:commit`, `:branch`, or the standard interface parameter `:version`.
|
124
|
+
|
125
|
+
When a module is installed using `:ref`, r10k uses some simple heuristics to
|
126
|
+
determine the type of Git object that should be checked out. This can be used
|
127
|
+
with a git commit, branch reference, or a tag.
|
128
|
+
|
129
|
+
When a module is installed using `:tag` or `:commit`, r10k assumes that the
|
130
|
+
given object is a tag or commit and can do some optimizations around fetching
|
131
|
+
the object. If the tag or commit is already available r10k will skip network
|
132
|
+
operations when updating the repo, which can speed up install times. When
|
133
|
+
`:ref` is set to track `HEAD`, it will synchronize the module on each run.
|
134
|
+
|
135
|
+
Module versions can also be specified using `:branch` to track a specific
|
136
|
+
branch reference.
|
137
|
+
|
138
|
+
#### Examples
|
139
|
+
|
140
|
+
```ruby
|
141
|
+
# Install puppetlabs/apache and keep it up to date with 'master'
|
142
|
+
mod 'apache',
|
143
|
+
:git => 'https://github.com/puppetlabs/puppetlabs-apache'
|
144
|
+
|
145
|
+
# Install puppetlabs/apache and track the 'docs_experiment' branch
|
146
|
+
mod 'apache',
|
147
|
+
:git => 'https://github.com/puppetlabs/puppetlabs-apache',
|
148
|
+
:ref => 'docs_experiment'
|
149
|
+
|
150
|
+
# Install puppetlabs/apache and pin to the '0.9.0' tag
|
151
|
+
mod 'apache',
|
152
|
+
:git => 'https://github.com/puppetlabs/puppetlabs-apache',
|
153
|
+
:tag => '0.9.0'
|
154
|
+
|
155
|
+
# Install puppetlabs/apache and pin to the '83401079' commit
|
156
|
+
mod 'apache',
|
157
|
+
:git => 'https://github.com/puppetlabs/puppetlabs-apache',
|
158
|
+
:commit => '83401079053dca11d61945bd9beef9ecf7576cbf'
|
159
|
+
|
160
|
+
# Install puppetlabs/apache and track the 'docs_experiment' branch
|
161
|
+
mod 'apache',
|
162
|
+
:git => 'https://github.com/puppetlabs/puppetlabs-apache',
|
163
|
+
:branch => 'docs_experiment'
|
164
|
+
|
165
|
+
# Install puppetlabs/apache and use standard interface parameters pinned to the
|
166
|
+
# '2098a17' commit.
|
167
|
+
mod 'puppetlabs-apache',
|
168
|
+
type: 'git',
|
169
|
+
source: 'https://github.com/puppetlabs/puppetlabs-apache',
|
170
|
+
version: '2098a17'
|
171
|
+
```
|
172
|
+
|
173
|
+
#### Control Repo Branch Tracking
|
174
|
+
|
175
|
+
Since r10k 2.4.0, the `:branch` option can be set to the special value
|
176
|
+
`:control_branch` to indicate that the content should track a branch
|
177
|
+
reference matching the containing control repo branch. For example, if a
|
178
|
+
Puppetfile containing a Git content declaration is in the "testing" branch
|
179
|
+
of a control repo, a setting of `:control_branch` will attempt to deploy that
|
180
|
+
content from a "testing" branch of the content repo.
|
181
|
+
|
182
|
+
Additionally, you can specify a `:default_branch` option which is the branch
|
183
|
+
reference that content will be deployed from if the the given `:ref`, `:tag`,
|
184
|
+
`:commit`, or `:branch` option cannot be resolved and deployed. If the desired
|
185
|
+
content cannot be resolved and no default branch is given, or if the default
|
186
|
+
branch can also not be resolved, an error will be logged and the content will
|
187
|
+
not be deployed or updated.
|
188
|
+
|
189
|
+
#### :control\_branch Examples
|
190
|
+
|
191
|
+
```ruby
|
192
|
+
# Deploy content from branch matching control repo branch.
|
193
|
+
mod 'hieradata',
|
194
|
+
:git => 'git@git.example.com:organization/hieradata.git',
|
195
|
+
:branch => :control_branch
|
196
|
+
|
197
|
+
# Track control branch and fall-back to master if no matching branch.
|
198
|
+
mod 'hieradata',
|
199
|
+
:git => 'git@git.example.com:organization/hieradata.git',
|
200
|
+
:branch => :control_branch,
|
201
|
+
:default_branch => 'master'
|
202
|
+
```
|
203
|
+
|
204
|
+
|
205
|
+
### SVN
|
206
|
+
|
207
|
+
Modules can be installed via SVN. If no version is given, the module will track
|
208
|
+
the latest version available in the main SVN repository.
|
209
|
+
|
210
|
+
mod 'apache',
|
211
|
+
:svn => 'https://github.com/puppetlabs/puppetlabs-apache/trunk'
|
212
|
+
|
213
|
+
If an SVN revision number is specified with `:rev`, `:revision`, or `:version`,
|
214
|
+
that SVN revision will be kept checked out.
|
215
|
+
|
216
|
+
mod 'apache',
|
217
|
+
:svn => 'https://github.com/puppetlabs/puppetlabs-apache/trunk',
|
218
|
+
:rev => '154'
|
219
|
+
|
220
|
+
mod 'apache',
|
221
|
+
:svn => 'https://github.com/puppetlabs/puppetlabs-apache/trunk',
|
222
|
+
:revision => '154'
|
223
|
+
|
224
|
+
mod 'apache',
|
225
|
+
type: 'svn',
|
226
|
+
source: 'https://github.com/puppetlabs/puppetlabs-apache/trunk',
|
227
|
+
version: '154'
|
228
|
+
|
229
|
+
If the SVN repository requires credentials, you can supply the `:username` and
|
230
|
+
`:password` options.
|
231
|
+
|
232
|
+
mod 'apache',
|
233
|
+
:svn => 'https://github.com/puppetlabs/puppetlabs-apache/trunk',
|
234
|
+
:username => 'azurediamond',
|
235
|
+
:password => 'hunter2'
|
236
|
+
|
237
|
+
**Note**: SVN credentials are passed as command line options, so the SVN
|
238
|
+
credentials may be visible in the process table when r10k is running. If you
|
239
|
+
choose to supply SVN credentials make sure that the system running r10k is
|
240
|
+
appropriately secured.
|
241
|
+
|
242
|
+
### Tarball
|
243
|
+
|
244
|
+
Modules can be installed from tarball archives. A tarball module must specify a source URL to retreive the tarball content from. A tarball module may optionally specify a sha256 checksum as the module version.
|
245
|
+
|
246
|
+
mod 'puppetlabs-apache',
|
247
|
+
type: 'tarball',
|
248
|
+
source: 'https://repo.example.com/puppet/modules/puppetlabs-apache-7.0.0.tar.gz',
|
249
|
+
version: 'aedd6dc1a5136c6a1a1ec2f285df2a70b0fe4c9effb254b5a1f58116e4c1659e' # sha256 digest
|
250
|
+
|
251
|
+
If no version is specified, a tarball will be downloaded from the given source and cached. The cache will not be invalidated until the source URL is changed, or a sha256 checksum version is provided.
|
252
|
+
|
253
|
+
Tarball module content will be unpacked directly into an appropriately named module directory. For example, the puppetlabs-apache-7.0.0.tar.gz archive in the example above will be unpacked into `<environment-dir>/modules/apache/`.
|
254
|
+
|
255
|
+
### Local
|
256
|
+
|
257
|
+
In the event you want to store locally written modules in your r10k-managed
|
258
|
+
repository in the Puppetfile managed path, you can use the `:local` type.
|
259
|
+
|
260
|
+
For instance, if you have a Git repository with the following structure:
|
261
|
+
|
262
|
+
```
|
263
|
+
# tree -L 2
|
264
|
+
.
|
265
|
+
├── environment.conf
|
266
|
+
├── modules
|
267
|
+
│ └── local_module
|
268
|
+
└── Puppetfile
|
269
|
+
|
270
|
+
4 directories, 2 files
|
271
|
+
```
|
272
|
+
|
273
|
+
And you want to prevent `local_module` from being removed, you can add a 'local'
|
274
|
+
module in your Puppetfile:
|
275
|
+
|
276
|
+
```
|
277
|
+
mod 'local_module', :local => true
|
278
|
+
|
279
|
+
# Include your other modules as normal
|
280
|
+
mod 'branan/eight_hundred'
|
281
|
+
mod 'puppetlabs/apache'
|
282
|
+
```
|
283
|
+
|
284
|
+
If you run r10k against this Git branch, you'll get the following:
|
285
|
+
|
286
|
+
```
|
287
|
+
# tree -L 2
|
288
|
+
.
|
289
|
+
├── environment.conf
|
290
|
+
├── modules
|
291
|
+
│ ├── apache
|
292
|
+
│ ├── eight_hundred
|
293
|
+
│ └── local_module
|
294
|
+
└── Puppetfile
|
295
|
+
|
296
|
+
4 directories, 2 files
|
297
|
+
```
|
298
|
+
|
299
|
+
#### Caveats
|
300
|
+
|
301
|
+
This is a workaround for r10k not being able to determine that modules
|
302
|
+
created via VCS should not be purged, but is not meant to be a long term
|
303
|
+
solution. The general practice around having local and remote modules in the
|
304
|
+
same Git repository is to move modules versioned into a separate directory, like
|
305
|
+
so:
|
306
|
+
|
307
|
+
```
|
308
|
+
# tree -L 2
|
309
|
+
.
|
310
|
+
├── environment.conf
|
311
|
+
├── site-modules
|
312
|
+
│ └── local_module
|
313
|
+
├── modules
|
314
|
+
│ ├── apache
|
315
|
+
│ └── eight_hundred
|
316
|
+
└── Puppetfile
|
317
|
+
|
318
|
+
4 directories, 2 files
|
319
|
+
```
|
320
|
+
|
321
|
+
Moving modules stored in the Git repository into a separate directory will
|
322
|
+
remove the need to have Puppetfile entries for every locally versioned Puppet
|
323
|
+
module.
|
324
|
+
|
325
|
+
For more information see the [FAQ entry](faq.mkd#how-do-i-prevent-r10k-from-removing-modules-in-the-modules-directory-of-my-git-repository)
|
326
|
+
on managing internal and external modules in the same directory.
|
327
|
+
|
328
|
+
### Per-Item spec dir deployment
|
329
|
+
|
330
|
+
During deployment, r10k's default behavior is to deploy the spec directory. The
|
331
|
+
Puppetfile can modify this per module, overriding settings from the default
|
332
|
+
r10k config. The following example sets the module to not deploy the spec
|
333
|
+
directory.
|
334
|
+
|
335
|
+
```
|
336
|
+
mod 'apache',
|
337
|
+
:git => 'git@github.com:puppetlabs/puppetlabs-apache.git',
|
338
|
+
:exclude_spec => true
|
339
|
+
```
|
340
|
+
|
341
|
+
### Per-Item Install Path
|
342
|
+
|
343
|
+
Git and SVN content types support installing into an alternate path without changing
|
344
|
+
the value of moduledir by specifying an 'install\_path' option:
|
345
|
+
|
346
|
+
```
|
347
|
+
# This will install the 'apache' module into 'external/apache'.
|
348
|
+
mod 'apache',
|
349
|
+
:git => 'git@github.com:puppetlabs/puppetlabs-apache.git',
|
350
|
+
:install_path => 'external'
|
351
|
+
```
|
352
|
+
|
353
|
+
The given 'install\_path' can be an absolute path or a path relative to the base of
|
354
|
+
the environment. Note that r10k will exit with an error if you attempt to set the
|
355
|
+
'path' option to a directory outside of the environment.
|
@@ -0,0 +1,38 @@
|
|
1
|
+
Updating Your Puppetfile
|
2
|
+
========================
|
3
|
+
|
4
|
+
Over time, your Puppetfile may become stale and reference older versions of modules or miss dependencies for the modules. Your Puppetfile will require maintenance to keep it up to date.
|
5
|
+
|
6
|
+
Manual Updates
|
7
|
+
--------------
|
8
|
+
|
9
|
+
You can manually update your Puppetfile very easily. By visiting the module's homepage on the [Puppet Forge](https://forge.puppetlabs.com/), you can determine the new version of a module and update it:
|
10
|
+
|
11
|
+
# Original
|
12
|
+
mod 'puppetlabs/apache', '0.10.0'
|
13
|
+
|
14
|
+
# New
|
15
|
+
mod 'puppetlabs/apache', '1.0.0'
|
16
|
+
|
17
|
+
When using a module directly from a git/svn repo, the `:tag` or `:ref` should be updated:
|
18
|
+
|
19
|
+
# Original
|
20
|
+
mod 'apache',
|
21
|
+
:git => 'https://github.com/puppetlabs/puppetlabs-apache',
|
22
|
+
:tag => '0.10.0'
|
23
|
+
|
24
|
+
# Original
|
25
|
+
mod 'apache',
|
26
|
+
:git => 'https://github.com/puppetlabs/puppetlabs-apache',
|
27
|
+
:tag => '1.0.0'
|
28
|
+
|
29
|
+
Dependency tracking can be done on the Puppet Forge as well by looking at the Dependency tab (Ex: [puppetlabs/apache](https://forge.puppetlabs.com/puppetlabs/apache/dependencies) and visiting each module in turn, or examining `metadata.json` in non-forge modules.
|
30
|
+
|
31
|
+
Automatic Updates
|
32
|
+
-----------------
|
33
|
+
|
34
|
+
The manual update process is sufficient when updating a small number of modules for a specific effort. Automatic tooling is helpful when updating a lengthier number of modules and for scheduled updates. A number of tools have been provided by the Puppet user community to assist with this. You are encouraged to review each tool before using them, and use of these tools is at your own risk.
|
35
|
+
|
36
|
+
* [ra10ke](https://rubygems.org/gems/ra10ke) ([project page](https://github.com/tampakrap/ra10ke/)) - A set of rake tasks to scan the Puppetfile for out of date modules
|
37
|
+
* [puppetfile-updater](https://rubygems.org/gems/puppetfile-updater/) ([project page](https://github.com/camptocamp/puppetfile-updater)) - A set of rake tasks to scan the Puppetfile, find newer versions, update the Puppetfile, and commit the changes.
|
38
|
+
* [generate-puppetfile](https://rubygems.org/gems/generate-puppetfile) ([project page](https://github.com/rnelson0/puppet-generate-puppetfile)) - A command line tool to generate raw Puppetfiles, update existing Puppetfiles, and optionally generate a `.fixtures.yml` file.
|
data/docker/.gitignore
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
TEST-rspec.xml
|
data/docker/.rspec
ADDED
data/docker/Gemfile
ADDED
data/docker/Makefile
ADDED
@@ -0,0 +1,99 @@
|
|
1
|
+
PUPPERWARE_ANALYTICS_STREAM ?= dev
|
2
|
+
NAMESPACE ?= puppet
|
3
|
+
git_describe = $(shell git describe --tags)
|
4
|
+
vcs_ref := $(shell git rev-parse HEAD)
|
5
|
+
build_date := $(shell date -u +%FT%T)
|
6
|
+
hadolint_available := $(shell hadolint --help > /dev/null 2>&1; echo $$?)
|
7
|
+
hadolint_command := hadolint
|
8
|
+
hadolint_container := ghcr.io/hadolint/hadolint:latest
|
9
|
+
alpine_version := 3.14
|
10
|
+
# --load (--output=type=docker) can only be used with a single arch / platform
|
11
|
+
# https://github.com/docker/buildx/issues/59
|
12
|
+
output_type := docker
|
13
|
+
platform := linux/amd64
|
14
|
+
export BUNDLE_PATH = $(PWD)/.bundle/gems
|
15
|
+
export BUNDLE_BIN = $(PWD)/.bundle/bin
|
16
|
+
export GEMFILE = $(PWD)/Gemfile
|
17
|
+
export DOCKER_BUILDKIT ?= 1
|
18
|
+
|
19
|
+
ifeq ($(IS_RELEASE),true)
|
20
|
+
VERSION ?= $(shell echo $(git_describe) | sed 's/-.*//')
|
21
|
+
PUBLISHED_VERSION ?= $(shell curl --silent 'https://rubygems.org/api/v1/gems/r10k.json' | jq '."version"' | tr -d '"')
|
22
|
+
CONTAINER_EXISTS = $(shell DOCKER_CLI_EXPERIMENTAL=enabled docker manifest inspect $(NAMESPACE)/r10k:$(VERSION) > /dev/null 2>&1; echo $$?)
|
23
|
+
ifeq ($(CONTAINER_EXISTS),0)
|
24
|
+
SKIP_BUILD ?= true
|
25
|
+
else ifneq ($(VERSION),$(PUBLISHED_VERSION))
|
26
|
+
SKIP_BUILD ?= true
|
27
|
+
endif
|
28
|
+
|
29
|
+
LATEST_VERSION ?= latest
|
30
|
+
dockerfile := release.Dockerfile
|
31
|
+
dockerfile_context := r10k
|
32
|
+
else
|
33
|
+
VERSION ?= edge
|
34
|
+
IS_LATEST := false
|
35
|
+
dockerfile := Dockerfile
|
36
|
+
dockerfile_context := $(PWD)/..
|
37
|
+
endif
|
38
|
+
|
39
|
+
ifeq ($(IS_LATEST),true)
|
40
|
+
latest_tag := --tag $(NAMESPACE)/r10k:$(LATEST_VERSION)
|
41
|
+
endif
|
42
|
+
|
43
|
+
prep:
|
44
|
+
@git fetch --unshallow 2> /dev/null ||:
|
45
|
+
@git fetch origin 'refs/tags/*:refs/tags/*'
|
46
|
+
ifeq ($(SKIP_BUILD),true)
|
47
|
+
@echo "SKIP_BUILD is true, exiting with 1"
|
48
|
+
@exit 1
|
49
|
+
endif
|
50
|
+
|
51
|
+
lint:
|
52
|
+
ifeq ($(hadolint_available),0)
|
53
|
+
@$(hadolint_command) r10k/$(dockerfile)
|
54
|
+
else
|
55
|
+
@docker pull $(hadolint_container)
|
56
|
+
@docker run --rm -v $(PWD)/r10k/$(dockerfile):/Dockerfile -i $(hadolint_container) $(hadolint_command) Dockerfile
|
57
|
+
endif
|
58
|
+
|
59
|
+
build: prep
|
60
|
+
docker pull alpine:$(alpine_version)
|
61
|
+
docker buildx build \
|
62
|
+
${DOCKER_BUILD_FLAGS} \
|
63
|
+
--output=type=$(output_type) \
|
64
|
+
--platform $(platform) \
|
65
|
+
--build-arg alpine_version=$(alpine_version) \
|
66
|
+
--build-arg vcs_ref=$(vcs_ref) \
|
67
|
+
--build-arg build_date=$(build_date) \
|
68
|
+
--build-arg version=$(VERSION) \
|
69
|
+
--build-arg pupperware_analytics_stream=$(PUPPERWARE_ANALYTICS_STREAM) \
|
70
|
+
--file r10k/$(dockerfile) \
|
71
|
+
--tag $(NAMESPACE)/r10k:$(VERSION) $(latest_tag) $(dockerfile_context)
|
72
|
+
|
73
|
+
test: prep
|
74
|
+
@bundle install --path $$BUNDLE_PATH --gemfile $$GEMFILE --with test
|
75
|
+
@bundle update
|
76
|
+
@PUPPET_TEST_DOCKER_IMAGE=$(NAMESPACE)/r10k:$(VERSION) \
|
77
|
+
bundle exec --gemfile $$GEMFILE \
|
78
|
+
rspec spec
|
79
|
+
|
80
|
+
# call build to produce multiple architectures
|
81
|
+
# uses cached output from amd64 build target if it exists
|
82
|
+
# registry output is equivalent to --push
|
83
|
+
push-image: platform=linux/amd64,linux/arm64
|
84
|
+
push-image: output_type=registry
|
85
|
+
push-image: prep build
|
86
|
+
|
87
|
+
push-readme:
|
88
|
+
@docker pull sheogorath/readme-to-dockerhub
|
89
|
+
@docker run --rm \
|
90
|
+
-v $(PWD)/README.md:/data/README.md \
|
91
|
+
-e DOCKERHUB_USERNAME="$(DOCKERHUB_USERNAME)" \
|
92
|
+
-e DOCKERHUB_PASSWORD="$(DOCKERHUB_PASSWORD)" \
|
93
|
+
-e DOCKERHUB_REPO_PREFIX=puppet \
|
94
|
+
-e DOCKERHUB_REPO_NAME=r10k \
|
95
|
+
sheogorath/readme-to-dockerhub
|
96
|
+
|
97
|
+
publish: push-image push-readme
|
98
|
+
|
99
|
+
.PHONY: lint build test prep publish push-image push-readme
|
data/docker/README.md
ADDED
@@ -0,0 +1,28 @@
|
|
1
|
+
# [puppetlabs/r10k](https://github.com/puppetlabs/r10k)
|
2
|
+
|
3
|
+
r10k on a Docker image. Based on Alpine 3.8.
|
4
|
+
|
5
|
+
## Configuration
|
6
|
+
|
7
|
+
The following environment variables are supported:
|
8
|
+
|
9
|
+
- `PUPPERWARE_ANALYTICS_ENABLED`
|
10
|
+
|
11
|
+
Set to 'true' to enable Google Analytics metrics. Defaults to 'false'.
|
12
|
+
|
13
|
+
## Analytics Data Collection
|
14
|
+
|
15
|
+
The r10k container collects usage data. This is disabled by default. You can enable it by passing `--env PUPPERWARE_ANALYTICS_ENABLED=true`
|
16
|
+
to your `docker run` command.
|
17
|
+
|
18
|
+
### What data is collected?
|
19
|
+
* Version of the r10k container.
|
20
|
+
* Anonymized IP address is used by Google Analytics for Geolocation data, but the IP address is not collected.
|
21
|
+
|
22
|
+
### Why does the r10k container collect data?
|
23
|
+
|
24
|
+
We collect data to help us understand how the containers are used and make decisions about upcoming changes.
|
25
|
+
|
26
|
+
### How can I opt out of r10k container data collection?
|
27
|
+
|
28
|
+
This is disabled by default.
|
@@ -0,0 +1,18 @@
|
|
1
|
+
version: '3.7'
|
2
|
+
|
3
|
+
services:
|
4
|
+
r10k_check:
|
5
|
+
image: ${R10K_IMAGE:-puppet/r10k}
|
6
|
+
environment:
|
7
|
+
- PUPPERWARE_ANALYTICS_ENABLED=${PUPPERWARE_ANALYTICS_ENABLED:-false}
|
8
|
+
command: 'puppetfile check --verbose --trace --puppetfile test/Puppetfile'
|
9
|
+
volumes:
|
10
|
+
- ${SPEC_DIRECTORY}/fixtures:/home/puppet/test
|
11
|
+
|
12
|
+
r10k_install:
|
13
|
+
image: ${R10K_IMAGE:-puppet/r10k}
|
14
|
+
environment:
|
15
|
+
- PUPPERWARE_ANALYTICS_ENABLED=${PUPPERWARE_ANALYTICS_ENABLED:-false}
|
16
|
+
command: 'puppetfile install --verbose --trace --puppetfile test/Puppetfile'
|
17
|
+
volumes:
|
18
|
+
- ${SPEC_DIRECTORY}/fixtures:/home/puppet/test
|
@@ -0,0 +1,68 @@
|
|
1
|
+
ARG alpine_version=3.14
|
2
|
+
FROM alpine:${alpine_version} as build
|
3
|
+
|
4
|
+
# hadolint ignore=DL3018
|
5
|
+
RUN apk add --no-cache ruby git && \
|
6
|
+
mkdir /workspace
|
7
|
+
WORKDIR /workspace
|
8
|
+
COPY . /workspace
|
9
|
+
RUN gem build r10k.gemspec && \
|
10
|
+
mv r10k*.gem r10k.gem
|
11
|
+
|
12
|
+
FROM alpine:${alpine_version}
|
13
|
+
|
14
|
+
ARG vcs_ref
|
15
|
+
ARG build_date
|
16
|
+
ARG version="3.1.0"
|
17
|
+
# Used by entrypoint to submit metrics to Google Analytics.
|
18
|
+
# Published images should use "production" for this build_arg.
|
19
|
+
ARG pupperware_analytics_stream="dev"
|
20
|
+
# required to schedule runs of "r10k" in K8s
|
21
|
+
ARG supercronic_version="0.1.9"
|
22
|
+
ARG supercronic_sha1sum="5ddf8ea26b56d4a7ff6faecdd8966610d5cb9d85"
|
23
|
+
ARG supercronic="supercronic-linux-amd64"
|
24
|
+
ARG supercronic_url="https://github.com/aptible/supercronic/releases/download/v$supercronic_version/$supercronic"
|
25
|
+
|
26
|
+
LABEL org.label-schema.maintainer="Puppet Release Team <release@puppet.com>" \
|
27
|
+
org.label-schema.vendor="Puppet" \
|
28
|
+
org.label-schema.url="https://github.com/puppetlabs/r10k" \
|
29
|
+
org.label-schema.name="r10k" \
|
30
|
+
org.label-schema.license="Apache-2.0" \
|
31
|
+
org.label-schema.vcs-url="https://github.com/puppetlabs/r10k" \
|
32
|
+
org.label-schema.schema-version="1.0" \
|
33
|
+
org.label-schema.dockerfile="/Dockerfile"
|
34
|
+
|
35
|
+
COPY docker/r10k/adduser.sh docker/r10k/docker-entrypoint.sh /
|
36
|
+
COPY docker/r10k/docker-entrypoint.d /docker-entrypoint.d
|
37
|
+
|
38
|
+
ENTRYPOINT ["/docker-entrypoint.sh"]
|
39
|
+
CMD ["help"]
|
40
|
+
|
41
|
+
# dynamic LABELs and ENV vars placed lower for the sake of Docker layer caching
|
42
|
+
ENV PUPPERWARE_ANALYTICS_STREAM="$pupperware_analytics_stream"
|
43
|
+
|
44
|
+
LABEL org.label-schema.version="$version" \
|
45
|
+
org.label-schema.vcs-ref="$vcs_ref" \
|
46
|
+
org.label-schema.build-date="$build_date"
|
47
|
+
|
48
|
+
COPY --from=build /workspace/r10k.gem /
|
49
|
+
SHELL ["/bin/ash", "-eo", "pipefail", "-c"]
|
50
|
+
# ignore apk and gem pinning
|
51
|
+
# hadolint ignore=DL3018,DL3028
|
52
|
+
RUN chmod a+x /adduser.sh /docker-entrypoint.sh /docker-entrypoint.d/*.sh && \
|
53
|
+
# Add a puppet user to run r10k as for consistency with puppetserver
|
54
|
+
/adduser.sh && \
|
55
|
+
chown -R puppet: /docker-entrypoint.d /docker-entrypoint.sh && \
|
56
|
+
apk add --no-cache ruby openssh-client git ruby-rugged curl ruby-json ruby-etc && \
|
57
|
+
gem install --no-doc /r10k.gem && \
|
58
|
+
rm -f /r10k.gem && \
|
59
|
+
curl --fail --silent --show-error --location --remote-name "$supercronic_url" && \
|
60
|
+
echo "${supercronic_sha1sum} ${supercronic}" | sha1sum -c - && \
|
61
|
+
chmod +x "$supercronic" && \
|
62
|
+
mv "$supercronic" "/usr/local/bin/${supercronic}" && \
|
63
|
+
ln -s "/usr/local/bin/${supercronic}" /usr/local/bin/supercronic
|
64
|
+
|
65
|
+
USER puppet
|
66
|
+
WORKDIR /home/puppet
|
67
|
+
|
68
|
+
COPY docker/r10k/Dockerfile /
|
@@ -0,0 +1,13 @@
|
|
1
|
+
#!/bin/sh
|
2
|
+
|
3
|
+
getent_string="$(getent group | grep -e ':999$')"
|
4
|
+
exit_code=$?
|
5
|
+
|
6
|
+
if [ "$exit_code" = '0' ]; then
|
7
|
+
group="$(echo $getent_string | cut -d ':' -f1)"
|
8
|
+
else
|
9
|
+
addgroup -g 999 puppet
|
10
|
+
group='puppet'
|
11
|
+
fi
|
12
|
+
|
13
|
+
adduser -G $group -D -u 999 puppet
|
@@ -0,0 +1,30 @@
|
|
1
|
+
#!/bin/sh
|
2
|
+
|
3
|
+
if [ "${PUPPERWARE_ANALYTICS_ENABLED}" != "true" ]; then
|
4
|
+
# Don't print out any messages here since this is a CLI container
|
5
|
+
exit 0
|
6
|
+
fi
|
7
|
+
|
8
|
+
# See: https://developers.google.com/analytics/devguides/collection/protocol/v1/parameters
|
9
|
+
# Tracking ID
|
10
|
+
tid=UA-132486246-5
|
11
|
+
# Application Name
|
12
|
+
an=r10k
|
13
|
+
# Application Version
|
14
|
+
av=$(r10k version | cut -d ' ' -f 2)
|
15
|
+
# Anonymous Client ID
|
16
|
+
_file=/var/tmp/pwclientid
|
17
|
+
cid=$(cat $_file 2>/dev/null || (cat /proc/sys/kernel/random/uuid | tee $_file))
|
18
|
+
# Event Category
|
19
|
+
ec=${PUPPERWARE_ANALYTICS_STREAM:-dev}
|
20
|
+
# Event Action
|
21
|
+
ea=start
|
22
|
+
# Anonymize ip
|
23
|
+
aip=1
|
24
|
+
|
25
|
+
_params="v=1&t=event&tid=${tid}&an=${an}&av=${av}&cid=${cid}&ec=${ec}&ea=${ea}&aip=${aip}"
|
26
|
+
_url="http://www.google-analytics.com/collect?${_params}"
|
27
|
+
|
28
|
+
# Don't print out any messages here since this is a CLI container
|
29
|
+
curl --fail --silent --show-error --output /dev/null \
|
30
|
+
-X POST -H "Content-Length: 0" $_url
|