r10k 2.6.4 → 2.6.9

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (40) hide show
  1. checksums.yaml +5 -5
  2. data/.github/pull_request_template.md +4 -0
  3. data/.github/workflows/release.yml +36 -0
  4. data/.gitignore +0 -1
  5. data/.travis.yml +16 -9
  6. data/CHANGELOG.mkd +51 -1
  7. data/CODEOWNERS +1 -0
  8. data/doc/dynamic-environments/usage.mkd +12 -0
  9. data/integration/Gemfile +2 -2
  10. data/integration/Rakefile +2 -3
  11. data/integration/pre-suite/00_pe_install.rb +2 -0
  12. data/integration/tests/basic_functionality/install_pe_only_module_with_puppetfile.rb +2 -2
  13. data/integration/tests/basic_functionality/proxy_with_pe_only_module.rb +2 -2
  14. data/integration/tests/user_scenario/basic_workflow/negative/neg_disk_full.rb +2 -12
  15. data/integration/tests/user_scenario/basic_workflow/single_env_10000_files.rb +2 -11
  16. data/integration/tests/user_scenario/basic_workflow/single_env_large_files.rb +2 -12
  17. data/lib/r10k/action/deploy/environment.rb +15 -2
  18. data/lib/r10k/cli/deploy.rb +1 -0
  19. data/lib/r10k/module/git.rb +5 -0
  20. data/lib/r10k/puppetfile.rb +17 -6
  21. data/lib/r10k/util/subprocess/runner/posix.rb +3 -3
  22. data/lib/r10k/version.rb +4 -1
  23. data/locales/r10k.pot +486 -0
  24. data/r10k.gemspec +7 -3
  25. data/spec/fixtures/unit/puppetfile/default-branch-override/Puppetfile +5 -0
  26. data/spec/unit/action/deploy/environment_spec.rb +63 -0
  27. data/spec/unit/puppetfile_spec.rb +39 -0
  28. metadata +48 -22
  29. data/MAINTAINERS +0 -18
  30. data/integration/pre-suite/30_test_utils.rb +0 -17
  31. data/integration/scripts/README.mkd +0 -86
  32. data/integration/scripts/setup_r10k_env_centos5.sh +0 -23
  33. data/integration/scripts/setup_r10k_env_centos6.sh +0 -23
  34. data/integration/scripts/setup_r10k_env_rhel7.sh +0 -23
  35. data/integration/scripts/setup_r10k_env_sles11.sh +0 -23
  36. data/integration/scripts/setup_r10k_env_sles12.sh +0 -23
  37. data/integration/scripts/setup_r10k_env_ubuntu1004.sh +0 -23
  38. data/integration/scripts/setup_r10k_env_ubuntu1204.sh +0 -23
  39. data/integration/scripts/setup_r10k_env_ubuntu1404.sh +0 -23
  40. data/integration/tests/basic_functionality/negative/attempt_to_install_peonly_module_without_license.rb +0 -71
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
- SHA1:
3
- metadata.gz: 57e5c32f14eddc3386bb26d91697fcce47f1a3bc
4
- data.tar.gz: 94d053fc19eb6cc38561571193e05a205613a444
2
+ SHA256:
3
+ metadata.gz: 58f78e7f2b417c01a90fda95cecea6f68038be0f6ce34647874b1f3710955a78
4
+ data.tar.gz: 61f99c6c4e43c855680abf8dae75a2b6077750d59ecb121f0e343207bb9efc37
5
5
  SHA512:
6
- metadata.gz: abb8f5c18eff9074b2b66c2121cd3b74d5205536a78e9bfe8e50afd0c3fd02e34cbcee16e03a30e601bfa05af63b40163373a5970712accda38d43cee542a527
7
- data.tar.gz: 4b4238d221dd262c5b86c939b228221e01989fbfc8bbe88bd1eda0afd0d7792e9de1548729730fa90031bc68498dc827e7cbd9b75af52cb8d1c2c37088a5a9a8
6
+ metadata.gz: 2c10471595015b12c3f5af303ea35e81baf43fa4d3ad483a3f47b5efa495a427d70a7706ba3c7ea5ec526d6a086138234017e6bc6a03cbb9aeb98c7beaad27a2
7
+ data.tar.gz: b4f5f724e5bd480d0ba52fc32d0c5d5584ea6e2724c616de1d3a60fd3c639ddbae2643990b9694999f3d497ce3197c5db241e9105c0dd9d843f696f4fcb5af83
@@ -0,0 +1,4 @@
1
+ Please add all notable changes to the "Unreleased" section of the CHANGELOG in the format:
2
+ ```
3
+ - (JIRA ticket) Summary of changes. [Issue or PR #](link to issue or PR)
4
+ ```
@@ -0,0 +1,36 @@
1
+ name: Tag and release
2
+
3
+ on:
4
+ push:
5
+ branches:
6
+ - master
7
+ paths:
8
+ - 'lib/r10k/version.rb'
9
+
10
+ jobs:
11
+ release:
12
+ runs-on: ubuntu-latest
13
+ steps:
14
+ - uses: actions/checkout@v2
15
+ with:
16
+ fetch-depth: '0'
17
+ - name: Bump version and push tag
18
+ uses: anothrNick/github-tag-action@1.17.2
19
+ env:
20
+ GITHUB_TOKEN: ${{ secrets.PUPPET_RELEASE_GH_TOKEN }}
21
+ DEFAULT_BUMP: patch
22
+ WITH_V: false
23
+ # Uncomment this if the tag and version file become out-of-sync and
24
+ # you need to tag at a specific version.
25
+ # CUSTOM_TAG:
26
+ - name: Build gem
27
+ uses: scarhand/actions-ruby@master
28
+ with:
29
+ args: build *.gemspec
30
+ - name: Publish gem
31
+ uses: scarhand/actions-ruby@master
32
+ env:
33
+ RUBYGEMS_AUTH_TOKEN: ${{ secrets.RUBYGEMS_AUTH_TOKEN }}
34
+ with:
35
+ args: push *.gem
36
+
data/.gitignore CHANGED
@@ -4,7 +4,6 @@ Gemfile.lock
4
4
  .bundle
5
5
  bundle
6
6
  coverage
7
- locales/r10k.pot
8
7
  integration/log
9
8
  integration/junit
10
9
  integration/configs
@@ -5,13 +5,20 @@ 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.3.0"
11
- - "2.2.0"
12
- - "2.1.0"
13
- - "2.0.0"
14
- - "1.9.3"
15
- - "jruby-19mode"
16
8
  jdk:
17
- - oraclejdk8
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
@@ -1,13 +1,63 @@
1
1
  CHANGELOG
2
2
  =========
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
21
+ ----
22
+
23
+ ### Changes
24
+
25
+ (CDPE-1813) Add module deploy info to .r10k-deploy.json.
26
+ (RK-351) Update minitar to ~> 0.9.0.
27
+
28
+ 2.6.6
29
+ ----
30
+
31
+ ### Changes
32
+
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
+ ----
39
+
40
+ ### Bug Fix
41
+
42
+ (RK-324) Fix Ruby pipe bug affecting Ubuntu
43
+
44
+ 2.6.4
45
+ ----
46
+
47
+ ### Changes
48
+
49
+ Numerous test fixes.
50
+
3
51
  2.6.3
4
52
  ----
5
- ## Changes
53
+
54
+ ### Changes
6
55
 
7
56
  Update specs with new error string.
8
57
 
9
58
  2.6.2
10
59
  -----
60
+
11
61
  ### Changes
12
62
 
13
63
  (RK-311) Yard dependency updated for security fix.
@@ -0,0 +1 @@
1
+ * @puppetlabs/puppetserver-maintainers @adrienthebo @dhollinger
@@ -60,6 +60,18 @@ 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
+
63
75
  ### Deploying modules
64
76
 
65
77
  Update a single module across all environments:
@@ -10,8 +10,8 @@ def location_for(place, fake_version = nil)
10
10
  end
11
11
  end
12
12
 
13
- gem 'beaker', *location_for(ENV['BEAKER_VERSION'] || '~> 3.33')
14
- gem 'beaker-pe', '~> 1.22'
13
+ gem 'beaker', *location_for(ENV['BEAKER_VERSION'] || '~> 4.5')
14
+ gem 'beaker-pe', '~> 2.0'
15
15
  gem 'beaker-hostgenerator', *location_for(ENV['BEAKER_HOSTGENERATOR_VERSION'] || '~> 1.1')
16
16
  gem 'beaker-abs', *location_for(ENV['BEAKER_ABS_VERSION'] || '~> 0.4')
17
17
  gem 'rototiller', '= 0.1.0'
@@ -24,7 +24,6 @@ pre-suite/00_pe_install.rb,
24
24
  component/pre-suite/05_install_dev_r10k.rb,
25
25
  pre-suite/10_git_config.rb,
26
26
  pre-suite/20_pe_r10k.rb,
27
- pre-suite/30_test_utils.rb,
28
27
  EOS
29
28
  common_setup.gsub!("\n", '')
30
29
 
@@ -45,8 +44,8 @@ EOS
45
44
 
46
45
  t.add_env do |env|
47
46
  env.name = 'pe_dist_dir'
48
- env.message = 'The location to download PE from example "http://enterprise.delivery.puppetlabs.net/20XX.X/ci-ready"'
49
- ENV['pe_dist_dir'] ||= "http://enterprise.delivery.puppetlabs.net/#{ENV['PE_FAMILY']}/ci-ready"
47
+ env.message = 'The location to download PE from, for example "https://artifactory.delivery.puppetlabs.net/artifactory/generic_enterprise__local/20XX.X/ci-ready"'
48
+ ENV['pe_dist_dir'] ||= "https://artifactory.delivery.puppetlabs.net/artifactory/generic_enterprise__local/#{ENV['PE_FAMILY']}/ci-ready"
50
49
  end
51
50
 
52
51
  t.add_env do |env|
@@ -1,3 +1,5 @@
1
+ require 'beaker-pe'
2
+
1
3
  test_name 'CODEMGMT-20 - C48 - Install Puppet Enterprise'
2
4
 
3
5
  step 'Install PE'
@@ -58,8 +58,8 @@ on(master, "mv #{r10k_config_path} #{r10k_config_bak_path}")
58
58
  step 'Update the "r10k" Config'
59
59
  create_remote_file(master, r10k_config_path, r10k_conf)
60
60
 
61
- step 'Download license file from int-resources'
62
- curl_on(master, 'http://int-resources.ops.puppetlabs.net/QA_resources/r10k/license.key -o /etc/puppetlabs/license.key')
61
+ step 'Download license file from artifactory'
62
+ curl_on(master, 'https://artifactory.delivery.puppetlabs.net/artifactory/generic/r10k_test_license.key -o /etc/puppetlabs/license.key')
63
63
 
64
64
  step 'Inject New "site.pp" to the "production" Environment'
65
65
  inject_site_pp(master, site_pp_path, site_pp)
@@ -86,8 +86,8 @@ on(master, "mv #{r10k_config_path} #{r10k_config_bak_path}")
86
86
  step 'Update the "r10k" Config'
87
87
  create_remote_file(master, r10k_config_path, r10k_conf)
88
88
 
89
- step 'Download license file from int-resources'
90
- curl_on(master, 'http://int-resources.ops.puppetlabs.net/QA_resources/r10k/license.key -o /etc/puppetlabs/license.key')
89
+ step 'Download license file from artifactory'
90
+ curl_on(master, 'https://artifactory.delivery.puppetlabs.net/artifactory/generic/r10k_test_license.key -o /etc/puppetlabs/license.key')
91
91
 
92
92
  step 'Checkout "production" Branch'
93
93
  git_on(master, 'checkout production', git_environments_path)
@@ -20,17 +20,6 @@ r10k_config_bak_path = "#{r10k_config_path}.bak"
20
20
 
21
21
  tmpfs_path = '/mnt/tmpfs'
22
22
 
23
- if on(master, 'which python', :acceptable_exit_codes => [0, 1]).exit_code == 1
24
- python_bin = 'python3'
25
- else
26
- python_bin = 'python'
27
- end
28
-
29
- file_bucket_path = '/opt/filebucket'
30
- file_bucket_command_path = File.join(file_bucket_path, 'filebucketapp.py')
31
- file_bucket_command = "#{python_bin} #{file_bucket_command_path}"
32
- pattern_file_path = File.join(file_bucket_path, 'psuedo_random_128k.pat')
33
-
34
23
  test_files_path = File.join(git_environments_path, 'test_files')
35
24
 
36
25
  #In-line files
@@ -73,7 +62,8 @@ on(master, "mount -osize=10m tmpfs #{tmpfs_path} -t tmpfs")
73
62
  step 'Create Large Binary File'
74
63
  create_remote_file(master, File.join(git_environments_path, '.gitattributes'), '*.file binary')
75
64
  on(master, "mkdir -p #{test_files_path}")
76
- on(master, "#{file_bucket_command} -s 11 -f #{test_files_path}/test.file -d #{pattern_file_path}")
65
+ # create a 11 mb file to fill the mount
66
+ on(master, "dd if=/dev/urandom of=#{test_files_path}.test.file bs=1048576 count=11")
77
67
 
78
68
  step 'Push Changes'
79
69
  git_add_commit_push(master, 'production', 'Add large file.', git_environments_path)
@@ -21,16 +21,6 @@ helloworld_module_path = File.join(local_files_root_path, 'modules', 'helloworld
21
21
  test_files = 'test_files'
22
22
  test_files_path = File.join(git_environments_path, test_files)
23
23
 
24
- if on(master, 'which python', :acceptable_exit_codes => [0, 1]).exit_code == 1
25
- python_bin = 'python3'
26
- else
27
- python_bin = 'python'
28
- end
29
-
30
- file_bucket_path = '/opt/filebucket'
31
- file_bucket_command_path = File.join(file_bucket_path, 'filebucketapp.py')
32
- file_bucket_command = "#{python_bin} #{file_bucket_command_path}"
33
-
34
24
  #Manifest
35
25
  site_pp_path = File.join(git_environments_path, 'manifests', 'site.pp')
36
26
  site_pp = create_site_pp(master_certname, ' include helloworld')
@@ -60,7 +50,8 @@ inject_site_pp(master, site_pp_path, site_pp)
60
50
  step 'Create 10,000 Files'
61
51
  create_remote_file(master, File.join(git_environments_path, '.gitattributes'), '*.file binary')
62
52
  on(master, "mkdir -p #{test_files_path}")
63
- on(master, "#{file_bucket_command} -k -c 10000 -p #{test_files_path}/test -u .file")
53
+ # create 10000 1k files with random text
54
+ on(master, "for n in {1..10000}; do dd if=/dev/urandom of=#{test_files_path}/test$( printf %03d \"$n\" ).file bs=1024 count=1; done")
64
55
 
65
56
  step 'Create MD5 Checksum of Files'
66
57
  on(master, "cd #{test_files_path};md5sum *.file > #{checksum_file_name}")
@@ -21,17 +21,6 @@ helloworld_module_path = File.join(local_files_root_path, 'modules', 'helloworld
21
21
  test_files = 'test_files'
22
22
  test_files_path = File.join(git_environments_path, 'test_files')
23
23
 
24
- if on(master, 'which python', :acceptable_exit_codes => [0, 1]).exit_code == 1
25
- python_bin = 'python3'
26
- else
27
- python_bin = 'python'
28
- end
29
-
30
- file_bucket_path = '/opt/filebucket'
31
- file_bucket_command_path = File.join(file_bucket_path, 'filebucketapp.py')
32
- pattern_file_path = File.join(file_bucket_path, 'psuedo_random_128k.pat')
33
- file_bucket_command = "#{python_bin} #{file_bucket_command_path}"
34
-
35
24
  #Manifest
36
25
  site_pp_path = File.join(git_environments_path, 'manifests', 'site.pp')
37
26
  site_pp = create_site_pp(master_certname, ' include helloworld')
@@ -61,7 +50,8 @@ inject_site_pp(master, site_pp_path, site_pp)
61
50
  step 'Create Large Binary Files'
62
51
  create_remote_file(master, File.join(git_environments_path, '.gitattributes'), '*.file binary')
63
52
  on(master, "mkdir -p #{test_files_path}")
64
- on(master, "#{file_bucket_command} -c 10 -s 25 -p #{test_files_path}/test -u .file -d #{pattern_file_path}")
53
+ # create 10 25 MB files with random characters
54
+ on(master, "for n in {1..10}; do dd if=/dev/urandom of=#{test_files_path}/test$( printf %03d \"$n\" ).file bs=1048576 count=25; done")
65
55
 
66
56
  step 'Create MD5 Checksum of Files'
67
57
  on(master, "cd #{test_files_path};md5sum *.file > #{checksum_file_name}")
@@ -109,7 +109,7 @@ module R10K
109
109
  end
110
110
 
111
111
  def visit_puppetfile(puppetfile)
112
- puppetfile.load
112
+ puppetfile.load(@opts[:'default-branch-override'])
113
113
 
114
114
  yield
115
115
 
@@ -125,11 +125,24 @@ module R10K
125
125
  end
126
126
 
127
127
  def write_environment_info!(environment, started_at, success)
128
+ module_deploys = []
129
+ begin
130
+ environment.puppetfile.modules.each do |mod|
131
+ name = mod.name
132
+ version = mod.version
133
+ sha = mod.repo.head rescue nil
134
+ module_deploys.push({:name => name, :version => version, :sha => sha})
135
+ end
136
+ rescue
137
+ logger.debug("Unable to get environment module deploy data for .r10k-deploy.json at #{environment.path}")
138
+ end
139
+
128
140
  File.open("#{environment.path}/.r10k-deploy.json", 'w') do |f|
129
141
  deploy_info = environment.info.merge({
130
142
  :started_at => started_at,
131
143
  :finished_at => Time.new,
132
144
  :deploy_success => success,
145
+ :module_deploys => module_deploys,
133
146
  })
134
147
 
135
148
  f.puts(JSON.pretty_generate(deploy_info))
@@ -146,7 +159,7 @@ module R10K
146
159
  end
147
160
 
148
161
  def allowed_initialize_opts
149
- super.merge(puppetfile: :self, cachedir: :self, :'no-force' => :self)
162
+ super.merge(puppetfile: :self, cachedir: :self, :'no-force' => :self, :'default-branch-override' => :self)
150
163
  end
151
164
  end
152
165
  end
@@ -53,6 +53,7 @@ scheduled. On subsequent deployments, Puppetfile deployment will default to off.
53
53
  DESCRIPTION
54
54
 
55
55
  flag :p, :puppetfile, 'Deploy modules from a puppetfile'
56
+ required nil, :'default-branch-override', 'Specify a branchname to override the default branch in the puppetfile'
56
57
 
57
58
  runner R10K::Action::CriRunner.wrap(R10K::Action::Deploy::Environment)
58
59
  end
@@ -23,6 +23,11 @@ class R10K::Module::Git < R10K::Module::Base
23
23
  # @return [String]
24
24
  attr_reader :desired_ref
25
25
 
26
+ # @!attribute [r] default_ref
27
+ # @api private
28
+ # @return [String]
29
+ attr_reader :default_ref
30
+
26
31
  def initialize(title, dirname, args, environment=nil)
27
32
  super
28
33
 
@@ -55,17 +55,20 @@ class Puppetfile
55
55
  @loaded = false
56
56
  end
57
57
 
58
- def load
58
+ def load(default_branch_override = nil)
59
59
  if File.readable? @puppetfile_path
60
- self.load!
60
+ self.load!(default_branch_override)
61
61
  else
62
62
  logger.debug _("Puppetfile %{path} missing or unreadable") % {path: @puppetfile_path.inspect}
63
63
  end
64
64
  end
65
65
 
66
- def load!
66
+ def load!(default_branch_override = nil)
67
+ @default_branch_override = default_branch_override
68
+
67
69
  dsl = R10K::Puppetfile::DSL.new(self)
68
70
  dsl.instance_eval(puppetfile_contents, @puppetfile_path)
71
+
69
72
  validate_no_duplicate_names(@modules)
70
73
  @loaded = true
71
74
  rescue SyntaxError, LoadError, ArgumentError => e
@@ -107,6 +110,10 @@ class Puppetfile
107
110
  install_path = @moduledir
108
111
  end
109
112
 
113
+ if args.is_a?(Hash) && @default_branch_override != nil
114
+ args[:default_branch] = @default_branch_override
115
+ end
116
+
110
117
  # Keep track of all the content this Puppetfile is managing to enable purging.
111
118
  @managed_content[install_path] = Array.new unless @managed_content.has_key?(install_path)
112
119
 
@@ -121,7 +128,9 @@ class Puppetfile
121
128
  def managed_directories
122
129
  self.load unless @loaded
123
130
 
124
- @managed_content.keys
131
+ dirs = @managed_content.keys
132
+ dirs.delete(real_basedir)
133
+ dirs
125
134
  end
126
135
 
127
136
  # Returns an array of the full paths to all the content being managed.
@@ -173,8 +182,6 @@ class Puppetfile
173
182
  end
174
183
 
175
184
  def validate_install_path(path, modname)
176
- real_basedir = Pathname.new(basedir).cleanpath.to_s
177
-
178
185
  unless /^#{Regexp.escape(real_basedir)}.*/ =~ path
179
186
  raise R10K::Error.new("Puppetfile cannot manage content '#{modname}' outside of containing environment: #{path} is not within #{real_basedir}")
180
187
  end
@@ -182,6 +189,10 @@ class Puppetfile
182
189
  true
183
190
  end
184
191
 
192
+ def real_basedir
193
+ Pathname.new(basedir).cleanpath.to_s
194
+ end
195
+
185
196
  class DSL
186
197
  # A barebones implementation of the Puppetfile DSL
187
198
  #