r10k 2.6.9 → 3.0.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (83) hide show
  1. checksums.yaml +5 -5
  2. data/.gitignore +1 -0
  3. data/.travis.yml +9 -16
  4. data/CHANGELOG.mkd +23 -36
  5. data/Gemfile +2 -1
  6. data/MAINTAINERS +18 -0
  7. data/README.mkd +1 -5
  8. data/bin/r10k +2 -2
  9. data/doc/common-patterns.mkd +2 -2
  10. data/doc/dynamic-environments/configuration.mkd +1 -2
  11. data/doc/dynamic-environments/quickstart.mkd +3 -3
  12. data/doc/dynamic-environments/usage.mkd +0 -12
  13. data/doc/puppetfile.mkd +0 -18
  14. data/docker/Gemfile +13 -0
  15. data/docker/ci/build +72 -0
  16. data/docker/distelli-manifest.yml +4 -0
  17. data/docker/r10k/Dockerfile +41 -0
  18. data/docker/r10k/spec/dockerfile_spec.rb +16 -0
  19. data/integration/Gemfile +4 -2
  20. data/integration/Rakefile +3 -2
  21. data/integration/pre-suite/00_pe_install.rb +0 -1
  22. data/integration/pre-suite/30_test_utils.rb +17 -0
  23. data/integration/scripts/README.mkd +86 -0
  24. data/integration/scripts/setup_r10k_env_centos5.sh +23 -0
  25. data/integration/scripts/setup_r10k_env_centos6.sh +23 -0
  26. data/integration/scripts/setup_r10k_env_rhel7.sh +23 -0
  27. data/integration/scripts/setup_r10k_env_sles11.sh +23 -0
  28. data/integration/scripts/setup_r10k_env_sles12.sh +23 -0
  29. data/integration/scripts/setup_r10k_env_ubuntu1004.sh +23 -0
  30. data/integration/scripts/setup_r10k_env_ubuntu1204.sh +23 -0
  31. data/integration/scripts/setup_r10k_env_ubuntu1404.sh +23 -0
  32. data/integration/tests/basic_functionality/install_pe_only_module_with_puppetfile.rb +2 -2
  33. data/integration/tests/basic_functionality/negative/attempt_to_install_peonly_module_without_license.rb +71 -0
  34. data/integration/tests/basic_functionality/proxy_with_pe_only_module.rb +2 -2
  35. data/integration/tests/git_source/HTTP_proxy_and_git_source.rb +2 -2
  36. data/integration/tests/i18n/deploy_module_with_unicode_in_file_name.rb +64 -0
  37. data/integration/tests/purging/does_not_purge_files_on_white_list.rb +93 -0
  38. data/integration/tests/purging/invalid_whitelist_types.rb +63 -0
  39. data/integration/tests/user_scenario/basic_workflow/negative/neg_disk_full.rb +12 -2
  40. data/integration/tests/user_scenario/basic_workflow/negative/neg_duplicate_module_names.rb +1 -8
  41. data/integration/tests/user_scenario/basic_workflow/single_env_10000_files.rb +11 -2
  42. data/integration/tests/user_scenario/basic_workflow/single_env_large_files.rb +12 -2
  43. data/lib/r10k/action/deploy/environment.rb +2 -15
  44. data/lib/r10k/action/puppetfile/check.rb +1 -1
  45. data/lib/r10k/action/puppetfile/cri_runner.rb +1 -13
  46. data/lib/r10k/action/puppetfile/purge.rb +1 -1
  47. data/lib/r10k/cli/deploy.rb +0 -1
  48. data/lib/r10k/cli/puppetfile.rb +4 -0
  49. data/lib/r10k/environment/base.rb +7 -1
  50. data/lib/r10k/environment/svn.rb +1 -1
  51. data/lib/r10k/forge/module_release.rb +2 -2
  52. data/lib/r10k/git/rugged/base_repository.rb +6 -3
  53. data/lib/r10k/git/rugged/working_repository.rb +10 -1
  54. data/lib/r10k/git/shellgit/base_repository.rb +27 -8
  55. data/lib/r10k/git/shellgit/working_repository.rb +20 -6
  56. data/lib/r10k/git/stateful_repository.rb +0 -1
  57. data/lib/r10k/module/git.rb +0 -5
  58. data/lib/r10k/puppetfile.rb +22 -27
  59. data/lib/r10k/source/base.rb +6 -0
  60. data/lib/r10k/source/git.rb +2 -2
  61. data/lib/r10k/source/svn.rb +4 -2
  62. data/lib/r10k/util/purgeable.rb +4 -2
  63. data/lib/r10k/util/subprocess/runner/posix.rb +3 -3
  64. data/lib/r10k/version.rb +1 -4
  65. data/locales/r10k.pot +23 -19
  66. data/r10k.gemspec +4 -8
  67. data/r10k.yaml.example +6 -0
  68. data/spec/fixtures/unit/puppetfile/duplicate-module-error/Puppetfile +10 -0
  69. data/spec/fixtures/unit/puppetfile/name-error/Puppetfile +1 -0
  70. data/spec/shared-examples/git/working_repository.rb +46 -0
  71. data/spec/unit/action/deploy/environment_spec.rb +0 -63
  72. data/spec/unit/action/puppetfile/check_spec.rb +24 -9
  73. data/spec/unit/action/puppetfile/cri_runner_spec.rb +2 -20
  74. data/spec/unit/action/puppetfile/install_spec.rb +16 -16
  75. data/spec/unit/action/puppetfile/purge_spec.rb +29 -6
  76. data/spec/unit/forge/module_release_spec.rb +10 -6
  77. data/spec/unit/git/stateful_repository_spec.rb +1 -4
  78. data/spec/unit/puppetfile_spec.rb +43 -36
  79. metadata +33 -48
  80. data/.github/pull_request_template.md +0 -4
  81. data/.github/workflows/release.yml +0 -36
  82. data/CODEOWNERS +0 -1
  83. data/spec/fixtures/unit/puppetfile/default-branch-override/Puppetfile +0 -5
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
- SHA256:
3
- metadata.gz: 58f78e7f2b417c01a90fda95cecea6f68038be0f6ce34647874b1f3710955a78
4
- data.tar.gz: 61f99c6c4e43c855680abf8dae75a2b6077750d59ecb121f0e343207bb9efc37
2
+ SHA1:
3
+ metadata.gz: 423ef3150366d325b04675995eda19cb8a0f1481
4
+ data.tar.gz: b00ae84fb75504d6798adececce0198a4f3fd4fd
5
5
  SHA512:
6
- metadata.gz: 2c10471595015b12c3f5af303ea35e81baf43fa4d3ad483a3f47b5efa495a427d70a7706ba3c7ea5ec526d6a086138234017e6bc6a03cbb9aeb98c7beaad27a2
7
- data.tar.gz: b4f5f724e5bd480d0ba52fc32d0c5d5584ea6e2724c616de1d3a60fd3c639ddbae2643990b9694999f3d497ce3197c5db241e9105c0dd9d843f696f4fcb5af83
6
+ metadata.gz: d8d32b5153c4400666355bda3ad4740170206a5200759caecbfecb780fca78068bab70d0eb834d434a3b463c04eb62289890d6cdf050519da861f00280b8a834
7
+ data.tar.gz: 4c4c83e653177423f9c4f1bb1acdfc7c7f5d4891669cd30eba9bcebc710c8fe2ee59a8775974a6425d337f67b89abbad48326a8e6c7b36a3a9df233d9b2dd258
data/.gitignore CHANGED
@@ -4,6 +4,7 @@ Gemfile.lock
4
4
  .bundle
5
5
  bundle
6
6
  coverage
7
+ locales/r10k.pot
7
8
  integration/log
8
9
  integration/junit
9
10
  integration/configs
@@ -5,20 +5,13 @@ script: "bundle exec rspec --color --format documentation spec/unit"
5
5
  notifications:
6
6
  email: false
7
7
  sudo: false
8
+ before_install: gem update bundler
9
+ rvm:
10
+ - "2.4.0"
11
+ - "2.3.0"
12
+ - "2.2.4"
13
+ - "2.1.8"
14
+ - "2.0.0"
15
+ - "jruby-19mode"
8
16
  jdk:
9
- - openjdk8
10
- before_install: gem install bundler -v '< 2' --no-document
11
- matrix:
12
- include:
13
- - stage: r10k tests
14
- rvm: 2.3.0
15
- - stage: r10k tests
16
- rvm: 2.2.0
17
- - stage: r10k tests
18
- rvm: 2.1.0
19
- - stage: r10k tests
20
- rvm: 2.0.0
21
- - stage: r10k tests
22
- rvm: 1.9.3
23
- - stage: r10k tests
24
- rvm: jruby-19mode
17
+ - oraclejdk8
@@ -1,63 +1,50 @@
1
1
  CHANGELOG
2
2
  =========
3
3
 
4
- Unreleased
5
- ----------
6
-
7
- 2.6.9
8
- ----
9
-
10
- - Don't purge root when using `puppetfile install`. [#1084](https://github.com/puppetlabs/r10k/issues/1084)
11
-
12
- 2.6.8
13
- ----
14
-
15
- ### Changes
16
-
17
- (RK-357) Restrict gettext and fast_gettext versions for compatibility with Ruby 2.4.
18
- (RK-358) Update puppet_forge to ~> 2.3.0.
19
-
20
- 2.6.7
4
+ 3.0.0
21
5
  ----
22
6
 
23
- ### Changes
24
-
25
- (CDPE-1813) Add module deploy info to .r10k-deploy.json.
26
- (RK-351) Update minitar to ~> 0.9.0.
7
+ ## Changes
27
8
 
28
- 2.6.6
29
- ----
9
+ ### Known issues
10
+ - Child processes may die unexpectedly when deploying many environments
11
+ on Ubuntu Bionic. See
12
+ [RK-324](https://tickets.puppetlabs.com/browse/RK-324).
30
13
 
31
- ### Changes
14
+ ### Backwards breaking changes
15
+ - Drop support for Ruby < 2.0
16
+ - Remove support for PUPPETFILE and PUPPETFILE_DIR environment variables
17
+ when running the `puppetfile` action, please use flags instead.
18
+ - Fail when duplicate module definitions in Puppetfile
32
19
 
33
- - Flag for overriding default branch configuration in Puppetfile
34
- - Plumbing for internationalization
35
- - Numerous test fixes and legacy docker work
36
-
37
- 2.6.5
38
- ----
20
+ ### Bug fixes
21
+ - More reliable pruning of refs on fetch
22
+ - Improved error messaging when:
23
+ - Unable to connect to a proxy
24
+ - r10k.yaml file is empty
25
+ - Unable to parse Puppetfile
26
+ - Various perfomance improvements
39
27
 
40
- ### Bug Fix
41
28
 
42
- (RK-324) Fix Ruby pipe bug affecting Ubuntu
43
29
 
44
30
  2.6.4
45
31
  ----
46
32
 
47
- ### Changes
33
+ ## Changes
48
34
 
49
35
  Numerous test fixes.
50
36
 
51
37
  2.6.3
52
38
  ----
53
-
54
- ### Changes
39
+ ## Changes
55
40
 
56
41
  Update specs with new error string.
57
42
 
43
+ **NOTE** - CHANGELOG is only assured to be up to date for a particular branch
44
+ when a release is made on that branch.
45
+
58
46
  2.6.2
59
47
  -----
60
-
61
48
  ### Changes
62
49
 
63
50
  (RK-311) Yard dependency updated for security fix.
data/Gemfile CHANGED
@@ -2,11 +2,12 @@ source ENV['GEM_SOURCE'] || 'https://rubygems.org'
2
2
  gemspec
3
3
 
4
4
  group :extra do
5
- gem 'rugged', '~> 0.24.0', :platforms => :ruby
5
+ gem 'rugged', '>= 0.24.0', '< 0.24.6', :platforms => :ruby
6
6
  end
7
7
 
8
8
  group :development do
9
9
  gem 'simplecov', '~> 0.9.1'
10
+ gem 'ruby-prof', :platforms => :ruby
10
11
  end
11
12
 
12
13
  if File.exists? "#{__FILE__}.local"
@@ -0,0 +1,18 @@
1
+ {
2
+ "version": 1,
3
+ "file_format": "This MAINTAINERS file format is described at https://github.com/puppetlabs/maintainers",
4
+ "issues": "https://tickets.puppet.com/browse/RK",
5
+ "internal_list": "https://groups.google.com/a/puppet.com/forum/?hl=en#!forum/discuss-code-manager-maintainers",
6
+ "people": [
7
+ {
8
+ "github": "andersonmills",
9
+ "email": "anderson@puppet.com",
10
+ "name": "Anderson Mills"
11
+ },
12
+ {
13
+ "github": "scotje",
14
+ "email": "jesse@puppet.com",
15
+ "name": "Jesse Scott"
16
+ }
17
+ ]
18
+ }
data/README.mkd CHANGED
@@ -17,11 +17,7 @@ implementation of Puppet [dynamic environments][workflow].
17
17
  Requirements
18
18
  ------------
19
19
 
20
- R10k supports the following Ruby versions:
21
-
22
- - 1.9.3
23
- - 2.0.0
24
- - 2.1.0
20
+ R10k supports the Ruby versions `>= 2.0.0`.
25
21
 
26
22
  R10k requires additional components, depending on how you plan on managing
27
23
  environments and modules.
data/bin/r10k CHANGED
@@ -6,12 +6,12 @@ require 'colored'
6
6
  begin
7
7
  R10K::CLI.command.run(ARGV)
8
8
  rescue Interrupt
9
- $stderr.puts "Aborted!".red
9
+ $stderr.puts "r10k: Aborted!".red
10
10
  exit(1)
11
11
  rescue SystemExit => e
12
12
  exit(e.status)
13
13
  rescue Exception => e
14
- $stderr.puts "\nError while running: #{e.inspect}".red
14
+ $stderr.puts "\nr10k: Runtime error: #{e.inspect}".red
15
15
  $stderr.puts e.backtrace.join("\n").red if ARGV.include? '--trace'
16
16
  exit(1)
17
17
  end
@@ -8,12 +8,12 @@ specific pattern before implementing it.
8
8
  Repository Setup
9
9
  ----------------
10
10
 
11
- Use a [Control Repo](http://www.jeffmalnick.com/blog/2014/05/16/r10k-control-repos/)
11
+ Use a [Control Repo](https://docs.puppet.com/pe/latest/cmgmt_control_repo.html)
12
12
  to store your `Puppetfile`.
13
13
 
14
14
  Hiera data should be in the Control repo OR as a separate source in
15
15
  `r10k.yaml`. Any `hiera.yaml` in the Control repo will be ignored on a per
16
- environment basis, locating it at `/etc/puppet/hiera.yaml` is prefered.
16
+ environment basis, locating it at `/etc/puppetlabs/puppet/hiera.yaml` is prefered.
17
17
 
18
18
  Each puppet module should be contained in its own independent forge module or
19
19
  repository.
@@ -46,10 +46,9 @@ For example:
46
46
  cachedir: '/var/cache/r10k'
47
47
  ```
48
48
 
49
- [prerun_command](http://docs.puppetlabs.com/references/latest/configuration.html#preruncommand)
50
49
 
51
50
  The cachedir setting defaults to `~/.r10k`. If the HOME environment variable is
52
- unset r10k will assume that r10k is being run with the Puppet [`prerun_command`][prerun_command]
51
+ unset r10k will assume that r10k is being run with the Puppet [`prerun_command`](http://docs.puppetlabs.com/references/latest/configuration.html#preruncommand)
53
52
  setting and will set the cachedir default to `/root/.r10k`.
54
53
 
55
54
  ### proxy
@@ -95,7 +95,7 @@ Configure r10k by creating the following directory structure and file `/etc/pupp
95
95
 
96
96
  ```
97
97
  # The location to use for storing cached Git repos
98
- :cachedir: '/opt/puppetlabs/r10k/cache'
98
+ :cachedir: '/var/cache/r10k'
99
99
 
100
100
  # A list of git repositories to create
101
101
  :sources:
@@ -166,8 +166,8 @@ class profile::base {
166
166
  ```
167
167
 
168
168
  Ensure that the user r10k runs as (typically root) can access the git
169
- repository. See the [git environment guide]
170
- (git-environments.mkd) for more detail. You can test
169
+ repository. See the [git environment guide](git-environments.mkd)
170
+ for more detail. You can test
171
171
  the access by using su/sudo to perform `git clone yourrepoURL` as the correct
172
172
  user.
173
173
 
@@ -60,18 +60,6 @@ Update a single environment and force an update of modules:
60
60
  This will update the given environment and update all contained modules. This is
61
61
  useful if you want to make sure that a given environment is fully up to date.
62
62
 
63
- - - -
64
-
65
- Update a single environment and specify a default branch override:
66
-
67
- r10k deploy environment my_working_environment --puppetfile --default-branch-override default_branch_override
68
-
69
- This will update the given environment and update all contained modules, overrideing
70
- the :default_branch entry in the Puppetfile of each module. This is used primarily to allow
71
- automated r10k solutions using the control_branch pattern with a temporary branch deployment to
72
- ensure the deployment is pushed to the correct module repository branch. Note that the :default_branch
73
- is only ever utilized if the desired ref cannot be located.
74
-
75
63
  ### Deploying modules
76
64
 
77
65
  Update a single module across all environments:
@@ -305,21 +305,3 @@ mod 'apache',
305
305
  The given 'install\_path' can be an absolute path or a path relative to the base of
306
306
  the environment. Note that r10k will exit with an error if you attempt to set the
307
307
  'path' option to a directory outside of the environment.
308
-
309
- ## Environment variables (**DEPRECATED** as of 2.5.6)
310
-
311
- It is possible to set an alternate name/location for your `Puppetfile` and
312
- `modules` directory. This is useful if you want to control multiple environments
313
- and have a single location for your `Puppetfile`.
314
-
315
- Example:
316
-
317
- PUPPETFILE=/etc/r10k.d/Puppetfile.production \
318
- PUPPETFILE_DIR=/etc/puppet/modules/production \
319
- /usr/bin/r10k puppetfile install
320
-
321
- NOTE: using these environment variables is not a suggested configuration, and
322
- have different semantics than librarian-puppet. Specifically, the PUPPETFILE_DIR
323
- is the environment that r10k will install modules into, and it will take full
324
- control over that directory and _remove any unmanaged content_. Use these
325
- variables with caution.
@@ -0,0 +1,13 @@
1
+ source ENV['GEM_SOURCE'] || "https://rubygems.org"
2
+
3
+ def location_for(place)
4
+ if place =~ /^((?:git|https?)[:@][^#]*)#(.*)/
5
+ [{ :git => $1, :branch => $2, :require => false }]
6
+ elsif place =~ /^file:\/\/(.*)/
7
+ ['>= 0', { :path => File.expand_path($1), :require => false }]
8
+ else
9
+ [place, { :require => false }]
10
+ end
11
+ end
12
+
13
+ gem 'puppet_docker_tools', *location_for(ENV['PUPPET_DOCKER_LOCATION'] || '~> 0.1.5')
@@ -0,0 +1,72 @@
1
+ #!/usr/bin/env bash
2
+
3
+ set -eux
4
+
5
+ PATH=$PATH:/usr/local/bin
6
+ BUNDLER_PATH=.bundle/gems
7
+
8
+ function build_and_test_image() {
9
+ container_name="$1"
10
+
11
+ : ===
12
+ : === run linter on the docker files
13
+ : ===
14
+ bundle exec puppet-docker local-lint "$container_name"
15
+
16
+ : ===
17
+ : === build and test $container_name
18
+ : ===
19
+ bundle exec puppet-docker build "$container_name" --no-cache --repository puppet --version "$version"
20
+ bundle exec puppet-docker spec "$container_name"
21
+ }
22
+
23
+ function push_image() {
24
+ container_name="$1"
25
+ container_version="$2"
26
+ : ===
27
+ : === push $container_name
28
+ : ===
29
+ bundle exec puppet-docker push "$container_name" --repository puppet --version "$container_version"
30
+ }
31
+
32
+ : ===
33
+ : === bundle install to get ready
34
+ : ===
35
+ bundle install --path "$BUNDLER_PATH"
36
+
37
+ : ===
38
+ : === If we do not git pull --unshallow we get really weird results with git describe
39
+ : ===
40
+ git pull --unshallow
41
+
42
+ : ===
43
+ : === make sure we fetch tags for versioning
44
+ : ===
45
+ git fetch origin 'refs/tags/*:refs/tags/*'
46
+ git_describe=`git describe`
47
+ version="${git_describe%%-*}"
48
+
49
+ : ===
50
+ : === pull updated base images
51
+ : ===
52
+ bundle exec puppet-docker update-base-images ubuntu:16.04
53
+
54
+ container_list=(r10k)
55
+
56
+ : ===
57
+ : === build and test all the images before we push anything
58
+ : ===
59
+ for container in "${container_list[@]}"; do
60
+ build_and_test_image "$container"
61
+ done
62
+
63
+ : ===
64
+ : === push all the images
65
+ : ===
66
+ for container in "${container_list[@]}"; do
67
+ push_image "$container" "$version"
68
+ done
69
+
70
+ : ===
71
+ : === SUCCESS
72
+ : ===
@@ -0,0 +1,4 @@
1
+ pe-and-platform/r10k:
2
+ Build:
3
+ - docker login -u "$DISTELLI_DOCKER_USERNAME" -p "$DISTELLI_DOCKER_PW" "$DISTELLI_DOCKER_ENDPOINT"
4
+ - /bin/bash -x ./ci/build
@@ -0,0 +1,41 @@
1
+ FROM ubuntu:16.04
2
+
3
+ ARG vcs_ref
4
+ ARG build_date
5
+ ARG version="2.6.4"
6
+ ENV R10K_VERSION="$version"
7
+ ENV UBUNTU_CODENAME="xenial"
8
+
9
+ LABEL org.label-schema.maintainer="Puppet Release Team <release@puppet.com>" \
10
+ org.label-schema.vendor="Puppet" \
11
+ org.label-schema.url="https://github.com/puppetlabs/r10k" \
12
+ org.label-schema.name="r10k" \
13
+ org.label-schema.license="Apache-2.0" \
14
+ org.label-schema.version="$R10K_VERSION" \
15
+ org.label-schema.vcs-url="https://github.com/puppetlabs/r10k" \
16
+ org.label-schema.vcs-ref="$vcs_ref" \
17
+ org.label-schema.build-date="$build_date" \
18
+ org.label-schema.schema-version="1.0" \
19
+ org.label-schema.dockerfile="/Dockerfile"
20
+
21
+ RUN apt-get update && \
22
+ apt-get install --no-install-recommends -y wget ca-certificates lsb-release && \
23
+ wget https://apt.puppetlabs.com/puppet5-release-"$UBUNTU_CODENAME".deb && \
24
+ dpkg -i puppet5-release-"$UBUNTU_CODENAME".deb && \
25
+ rm puppet5-release-"$UBUNTU_CODENAME".deb && \
26
+ apt-get update && \
27
+ apt-get install --no-install-recommends -y puppet-agent && \
28
+ apt-get install --no-install-recommends -y git openssh-client && \
29
+ apt-get remove --purge -y wget && \
30
+ apt-get autoremove -y && \
31
+ apt-get clean && \
32
+ rm -rf /var/lib/apt/lists/*
33
+
34
+ RUN /opt/puppetlabs/puppet/bin/gem install r10k:"$R10K_VERSION"
35
+
36
+ ENV PATH=/opt/puppetlabs/server/bin:/opt/puppetlabs/puppet/bin:/opt/puppetlabs/bin:$PATH
37
+
38
+ ENTRYPOINT ["/opt/puppetlabs/puppet/bin/r10k"]
39
+ CMD ["help"]
40
+
41
+ COPY Dockerfile /
@@ -0,0 +1,16 @@
1
+ require 'puppet_docker_tools/spec_helper'
2
+
3
+ CURRENT_DIRECTORY = File.dirname(File.dirname(__FILE__))
4
+
5
+ describe 'Dockerfile' do
6
+ include_context 'with a docker image'
7
+
8
+ describe package('puppet-agent') do
9
+ it { is_expected.to be_installed }
10
+ end
11
+
12
+ describe file('/opt/puppetlabs/puppet/bin/r10k') do
13
+ it { should exist }
14
+ it { should be_executable }
15
+ end
16
+ end