r10k 3.16.2 → 4.0.0

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 (35) hide show
  1. checksums.yaml +4 -4
  2. data/.github/workflows/release.yml +0 -1
  3. data/.github/workflows/rspec_tests.yml +6 -8
  4. data/CHANGELOG.mkd +9 -13
  5. data/Gemfile +1 -1
  6. data/README.mkd +3 -3
  7. data/doc/common-patterns.mkd +1 -2
  8. data/doc/dynamic-environments/configuration.mkd +13 -1
  9. data/doc/puppetfile.mkd +9 -3
  10. data/integration/Rakefile +1 -1
  11. data/integration/tests/basic_functionality/rugged_git_provider_with_ssh.rb +2 -2
  12. data/integration/tests/basic_functionality/rugged_git_provider_without_ssh.rb +2 -2
  13. data/integration/tests/git_source/git_source_git.rb +1 -1
  14. data/integration/tests/purging/{does_not_purge_files_on_white_list.rb → does_not_purge_files_on_allowlist.rb} +2 -2
  15. data/integration/tests/user_scenario/basic_workflow/negative/neg_disk_full.rb +1 -1
  16. data/integration/tests/user_scenario/basic_workflow/single_env_10000_files.rb +1 -1
  17. data/integration/tests/user_scenario/basic_workflow/single_env_large_files.rb +1 -1
  18. data/lib/r10k/action/deploy/environment.rb +2 -19
  19. data/lib/r10k/action/deploy/module.rb +1 -0
  20. data/lib/r10k/action/puppetfile/check.rb +7 -0
  21. data/lib/r10k/action/puppetfile/install.rb +1 -0
  22. data/lib/r10k/cli/deploy.rb +15 -1
  23. data/lib/r10k/environment.rb +0 -1
  24. data/lib/r10k/git/rugged/working_repository.rb +1 -1
  25. data/lib/r10k/git/shellgit/working_repository.rb +1 -1
  26. data/lib/r10k/git/stateful_repository.rb +2 -2
  27. data/lib/r10k/module/base.rb +3 -3
  28. data/lib/r10k/module/git.rb +13 -9
  29. data/lib/r10k/module_loader/puppetfile.rb +1 -11
  30. data/lib/r10k/settings.rb +6 -7
  31. data/lib/r10k/version.rb +1 -1
  32. data/locales/r10k.pot +19 -27
  33. data/r10k.gemspec +3 -5
  34. metadata +11 -52
  35. data/lib/r10k/environment/bare.rb +0 -13
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 4e049f760aad80be6b528604923d13227e763698f1a99aeea0b216e747aac75d
4
- data.tar.gz: 1e8eae627184409c3c9cc3a5ee903f480067bd780b2b7c935cce82e03cad8938
3
+ metadata.gz: e3243dd00fc7260b6cbbb51f070418886dfd76ad16befc18d0511185d17d4fae
4
+ data.tar.gz: dc8dcfe9644c9dabfd4532cc8b5a91064d57a5c8377fb38932aaf0aab1d0d6ef
5
5
  SHA512:
6
- metadata.gz: bfc734f0e05e6dda9d82bf28e0c203e65821a98258f75fc7caed5b5173aff78ac8a90234768ce43dfca6d41652a25a2f555bddd5da5d6d28074f4978a06b0599
7
- data.tar.gz: 9b17e3cc731a65e4a8cf0c612cfd037eb02d09b57ffeaa359076ce8081c3214b4509181c215e4e13613561b73c8e02e36e8507a5d34194abbcbd5bceec825e49
6
+ metadata.gz: 22a3158bc9c7c65caf1c437d9d855c4586c14ac836730121826d1eaaa326e4237e74675818fb6e71430523b416f318e9f757106fba9b8c3e83b6cfbe2a2144e3
7
+ data.tar.gz: 3d51941a78ec8e651c4657222a5f7f27b169b5b3811d472948c55f5b00e47244b2807aa6037182241a5c9b14a8df43748102d787e0218a2d8bacf2d17ae32fd9
@@ -4,7 +4,6 @@ on:
4
4
  push:
5
5
  branches:
6
6
  - main
7
- - 3.x
8
7
  paths:
9
8
  - 'lib/r10k/version.rb'
10
9
 
@@ -4,6 +4,7 @@ on:
4
4
  pull_request:
5
5
  branches:
6
6
  - main
7
+ - 3.x
7
8
 
8
9
  jobs:
9
10
  rspec_tests:
@@ -11,15 +12,14 @@ jobs:
11
12
  strategy:
12
13
  matrix:
13
14
  cfg:
14
- - {os: ubuntu-latest, ruby: 2.4}
15
- - {os: ubuntu-latest, ruby: 2.5}
16
15
  - {os: ubuntu-latest, ruby: 2.6}
17
16
  - {os: ubuntu-latest, ruby: 2.7}
17
+ - {os: ubuntu-latest, ruby: 3.1}
18
18
  - {os: ubuntu-latest, ruby: 3.2}
19
- - {os: ubuntu-latest, ruby: jruby-9.2.10.0}
20
- - {os: windows-2019, ruby: 2.5}
21
- - {os: windows-2019, ruby: 2.6}
22
- - {os: windows-2019, ruby: 2.7}
19
+ - {os: ubuntu-latest, ruby: jruby-9.3}
20
+ - {os: ubuntu-latest, ruby: jruby-9.4}
21
+ - {os: windows-latest, ruby: 2.6}
22
+ - {os: windows-latest, ruby: 3.2}
23
23
 
24
24
  runs-on: ${{ matrix.cfg.os }}
25
25
  steps:
@@ -33,8 +33,6 @@ jobs:
33
33
 
34
34
  - name: Install bundler and gems
35
35
  run: |
36
- # Pin bundler to maintain support for Ruby 2.4 and 2.5
37
- gem install bundler -v 2.3.26
38
36
  bundle config set without packaging documentation
39
37
  bundle install --jobs 4 --retry 3
40
38
 
data/CHANGELOG.mkd CHANGED
@@ -4,20 +4,20 @@ CHANGELOG
4
4
  Unreleased
5
5
  ----------
6
6
 
7
- 3.16.2
8
- ------
9
-
10
- - r10k::module::git: expose remote as getter [#1379](https://github.com/puppetlabs/r10k/pull/1379)
11
7
 
12
- 3.16.1
13
- ------
8
+ 4.0.0
9
+ -----
10
+ - Drop Ruby 2.3/2.4/2.5 support; use puppet_forge 4.1 or newer [#1336](https://github.com/puppetlabs/r10k/pull/1336)
11
+ - (maint) Add Ruby 3.0 to rspec CI matrix [#1261](https://github.com/puppetlabs/r10k/pull/1261)
12
+ - (RK-368) remove `purge_whitelist` setting [#1277](https://github.com/puppetlabs/r10k/pull/1277)
13
+ - (RK-390) Remove default ref for deploying git modules [#1275](http://github.com/puppetlabs/r10k/pull/1275)
14
+ - (RK-391) Change `exclude_spec` default to true for module spec dir deletion [#1264](https://github.com/puppetlabs/r10k/pull/1261)
15
+ - (RK-383) Remove deprecated `basedir` method from Puppetfile DSL. Users should use `environment_name` instead. [#1254](https://github.com/puppetlabs/r10k/pull/1254)
16
+ - (RK-386) Remove deprecated `bare` environment type. [#1235](https://github.com/puppetlabs/r10k/issues/1235)
14
17
 
15
- - Make metadata loading during incremental deploys more robust [PE-34917](https://perforce.atlassian.net/browse/PE-34917)
16
- - Use the production forge for integration testing
17
18
 
18
19
  3.16.0
19
20
  ------
20
-
21
21
  - Emit more debug output when modules fail to sync [#1347](https://github.com/puppetlabs/r10k/pull/1347)
22
22
  - Update GitHub Actions & introduce dependabot [#1337](https://github.com/puppetlabs/r10k/pull/1337)
23
23
  - Update R10K proxy usage to follow newer rugged best practices [PE-35980](https://tickets.puppet.com/browse/PE-35980)
@@ -25,23 +25,19 @@ Unreleased
25
25
 
26
26
  3.15.4
27
27
  ------
28
-
29
28
  - Pin dependencies to maintain support for old Ruby versions [#1329](https://github.com/puppetlabs/r10k/pull/1329)
30
29
 
31
30
  3.15.3
32
31
  ------
33
-
34
32
  - Fix dirty working copy debug logging [#1321](https://github.com/puppetlabs/r10k/pull/1321)
35
33
  - Allow gettext-setup < 2 for compatibility with Ruby 3.2 and Puppet 8 [#1325](https://github.com/puppetlabs/r10k/pull/1325)
36
34
 
37
35
  3.15.2
38
36
  ------
39
-
40
37
  - Implement exclude regex for puppetfile install [#1248](https://github.com/puppetlabs/r10k/issues/1248)
41
38
 
42
39
  3.15.1
43
40
  ------
44
-
45
41
  - Add TOC to configuration docs [#1298](https://github.com/puppetlabs/r10k/issues/1298)
46
42
  - Remove the spec folder from gemspec [#1316](https://github.com/puppetlabs/r10k/issues/1316)
47
43
 
data/Gemfile CHANGED
@@ -6,7 +6,7 @@ group :extra do
6
6
  end
7
7
 
8
8
  group :development do
9
- gem 'simplecov', '~> 0.17.1'
9
+ gem 'simplecov', '~> 0.22.0'
10
10
  gem 'ruby-prof', :platforms => :ruby
11
11
  end
12
12
 
data/README.mkd CHANGED
@@ -27,14 +27,14 @@ based alternative.
27
27
  Requirements
28
28
  ------------
29
29
 
30
- R10k supports the Ruby versions `>= 2.4.0`. It's tested on Ruby 2.4.0 up to
30
+ R10k supports the Ruby versions `>= 2.6.0`. It's tested on Ruby 2.6.0 up to
31
31
  Ruby 3.1.0 + Jruby.
32
32
 
33
33
  R10k requires additional components, depending on how you plan on managing
34
34
  environments and modules.
35
35
 
36
- - Installing modules from the Puppet Forge requires Puppet 5.0.0+ or later.
37
- Puppet 3 or 4 may work, but is generally not recommended.
36
+ - Installing modules from the Puppet Forge requires Puppet 7.0.0+ or later.
37
+ Puppet 5 and 6 may work, but is generally not recommended.
38
38
  - Git is required for creating environments and modules from Git
39
39
  - SVN is required for creating environments and modules from SVN
40
40
 
@@ -12,8 +12,7 @@ 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
- `r10k.yaml`. Any `hiera.yaml` in the Control repo will be ignored on a per
16
- environment basis, locating it at `/etc/puppetlabs/puppet/hiera.yaml` is prefered.
15
+ `r10k.yaml`.
17
16
 
18
17
  Each puppet module should be contained in its own independent forge module or
19
18
  repository.
@@ -160,6 +160,18 @@ git:
160
160
  See the [git provider documentation](../git/providers.mkd) for more information
161
161
  regarding Git providers.
162
162
 
163
+ #### default_ref
164
+
165
+ r10k is unable to deploy a git module if no `ref` is specified. A `default_ref` can be
166
+ set in the r10k config that will become the ref a module uses if not otherwise specified. This
167
+ is the lowest priority setting for a module's `ref`. Read the [Puppetfile documentation](../puppetfile.mkd#git)
168
+ for higher priority settings to determine a module's ref.
169
+
170
+ ```yaml
171
+ git:
172
+ default_ref: main
173
+ ```
174
+
163
175
  #### proxy
164
176
 
165
177
  The 'proxy' setting allows you to set or override the global proxy setting specifically
@@ -437,7 +449,7 @@ deploy:
437
449
 
438
450
  #### exclude_spec
439
451
 
440
- During module deployment, r10k's default behavior is to deploy the spec directory. Setting
452
+ During module deployment, r10k's default behavior is to delete the spec directory. Setting
441
453
  `exclude_spec` to true will deploy modules without their spec directory. This behavior
442
454
  can be configured for all modules using the `exclude_spec` setting in the r10k config.
443
455
  It can also be passed as a CLI argument for `deploy environment/module`, overriding the
data/doc/puppetfile.mkd CHANGED
@@ -135,6 +135,12 @@ operations when updating the repo, which can speed up install times. When
135
135
  Module versions can also be specified using `:branch` to track a specific
136
136
  branch reference.
137
137
 
138
+ In r10k 3.x the default branch was hardcoded to `master`; in 4.x that was
139
+ removed. A `default_ref` can be specified in the r10k config to
140
+ to mimic that old behavior, but it is recommended to set the ref on a
141
+ per-module basis in the Puppetfile. Read [here](dynamic-environments/configuration.mkd#default_ref) for more info
142
+ on the `default_ref` setting.
143
+
138
144
  #### Examples
139
145
 
140
146
  ```ruby
@@ -327,15 +333,15 @@ on managing internal and external modules in the same directory.
327
333
 
328
334
  ### Per-Item spec dir deployment
329
335
 
330
- During deployment, r10k's default behavior is to deploy the spec directory. The
336
+ During deployment, r10k's default behavior is to delete the spec directory. The
331
337
  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
338
+ r10k config. The following example sets the module to deploy the spec
333
339
  directory.
334
340
 
335
341
  ```
336
342
  mod 'apache',
337
343
  :git => 'git@github.com:puppetlabs/puppetlabs-apache.git',
338
- :exclude_spec => true
344
+ :exclude_spec => false
339
345
  ```
340
346
 
341
347
  ### Per-Item Install Path
data/integration/Rakefile CHANGED
@@ -69,7 +69,7 @@ rototiller_task :beaker_hostgenerator do |t|
69
69
  # This is a hack :(
70
70
  t.add_flag(:name => '', :default => 'centos7-64mdca-64.fa', :override_env => 'TEST_TARGET')
71
71
 
72
- t.add_flag(:name => '--global-config', :default => '{forge_host=forgeapi.puppet.com}', :override_env => 'BHG_GLOBAL_CONFIG')
72
+ t.add_flag(:name => '--global-config', :default => '{forge_host=forge-aio01-petest.puppetlabs.com}', :override_env => 'BHG_GLOBAL_CONFIG')
73
73
  end
74
74
  end
75
75
 
@@ -10,7 +10,7 @@ confine(:to, :platform => ['el', 'ubuntu', 'sles'])
10
10
 
11
11
  if ENV['GIT_PROVIDER'] == 'shellgit'
12
12
  skip_test('Skipping test because removing Git from the system affects other "shellgit" tests.')
13
- elsif fact_on(master, 'osfamily') == 'RedHat' and fact_on(master, "os.release.major").to_i < 6
13
+ elsif fact_on(master, 'osfamily') == 'RedHat' and fact_on(master, "operatingsystemmajrelease").to_i < 6
14
14
  skip_test('This version of EL is not supported by this test case!')
15
15
  end
16
16
 
@@ -87,7 +87,7 @@ step 'Remove "git" Package from System'
87
87
  if master_platform == 'RedHat'
88
88
  on(master, 'yum remove -y git')
89
89
  elsif master_platform == 'Debian'
90
- if fact_on(master, "os.release.major") == '10.04'
90
+ if fact_on(master, "operatingsystemmajrelease") == '10.04'
91
91
  on(master, 'apt-get remove -y git-core')
92
92
  else
93
93
  on(master, 'apt-get remove -y git')
@@ -8,7 +8,7 @@ confine(:to, :platform => ['el', 'ubuntu', 'sles'])
8
8
 
9
9
  if ENV['GIT_PROVIDER'] == 'shellgit'
10
10
  skip_test('Skipping test because removing Git from the system affects other "shellgit" tests.')
11
- elsif fact_on(master, 'osfamily') == 'RedHat' and fact_on(master, "os.release.major").to_i < 6
11
+ elsif fact_on(master, 'osfamily') == 'RedHat' and fact_on(master, "operatingsystemmajrelease").to_i < 6
12
12
  skip_test('This version of EL is not supported by this test case!')
13
13
  end
14
14
 
@@ -86,7 +86,7 @@ step 'Remove "git" Package from System'
86
86
  if master_platform == 'RedHat'
87
87
  on(master, 'yum remove -y git')
88
88
  elsif master_platform == 'Debian'
89
- if fact_on(master, "os.release.major") == '10.04'
89
+ if fact_on(master, "operatingsystemmajrelease") == '10.04'
90
90
  on(master, 'apt-get remove -y git-core')
91
91
  else
92
92
  on(master, 'apt-get remove -y git')
@@ -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, "os.release.major").to_i < 6 || fact_on(master, "os.release.major").to_i > 8
8
+ if fact_on(master, "operatingsystemmajrelease").to_i < 6
9
9
  skip_test('This version of EL is not supported by this test case!')
10
10
  end
11
11
 
@@ -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 whitelist'
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
@@ -39,7 +39,7 @@ sources:
39
39
  remote: "#{git_control_remote}"
40
40
  deploy:
41
41
  purge_levels: ['deployment', 'environment', 'puppetfile']
42
- purge_whitelist: ['**/*.pp']
42
+ purge_allowlist: ['**/*.pp']
43
43
  CONF
44
44
 
45
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, 'osfamily') == 'RedHat' and fact_on(master, "os.release.major").to_i < 6
5
+ if fact_on(master, 'osfamily') == 'RedHat' and fact_on(master, "operatingsystemmajrelease").to_i < 6
6
6
  skip_test('This version of EL is not supported by this test case!')
7
7
  end
8
8
 
@@ -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, 'osfamily') == 'RedHat' and fact_on(master, "os.release.major").to_i < 6
6
+ if fact_on(master, 'osfamily') == 'RedHat' and fact_on(master, "operatingsystemmajrelease").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, 'osfamily') == 'RedHat' and fact_on(master, "os.release.major").to_i < 6
6
+ if fact_on(master, 'osfamily') == 'RedHat' and fact_on(master, "operatingsystemmajrelease").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: read_purge_allowlist(settings.dig(:deploy, :purge_whitelist) || [],
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
@@ -39,6 +39,7 @@ module R10K
39
39
  generate_types: @generate_types
40
40
  },
41
41
  modules: {
42
+ default_ref: settings.dig(:git, :default_ref),
42
43
  exclude_spec: settings.dig(:deploy, :exclude_spec),
43
44
  pool_size: @settings[:pool_size] || 4,
44
45
  requested_modules: @argv.map.to_a,
@@ -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,6 +12,7 @@ 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
17
18
  options[:module_exclude_regex] = @module_exclude_regex if @module_exclude_regex
@@ -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
- flag nil, :'exclude-spec', 'Exclude the module\'s spec dir from deployment'
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."
@@ -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'
@@ -119,7 +119,7 @@ class R10K::Git::Rugged::WorkingRepository < R10K::Git::Rugged::BaseRepository
119
119
  with_repo { |repo| repo.config['remote.origin.url'] }
120
120
  end
121
121
 
122
- def dirty?(exclude_spec=false)
122
+ def dirty?(exclude_spec=true)
123
123
  with_repo do |repo|
124
124
  if exclude_spec
125
125
  diff = repo.diff_workdir('HEAD').select { |d| ! d.delta.old_file[:path].start_with?('spec/') }
@@ -90,7 +90,7 @@ 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=false)
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
@@ -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=false)
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=false)
78
+ def status(ref, exclude_spec=true)
79
79
  if !@repo.exist?
80
80
  :absent
81
81
  elsif !@cache.exist?
@@ -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 = false
64
- @exclude_spec = @overrides.dig(:modules, :exclude_spec) if @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 has been set to true and @spec_deletable is also true
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
@@ -46,11 +46,6 @@ class R10K::Module::Git < R10K::Module::Base
46
46
  # @return [String]
47
47
  attr_reader :default_override_ref
48
48
 
49
- # @!attribute[r] remote
50
- # @api private
51
- # @return [String]
52
- attr_reader :remote
53
-
54
49
  include R10K::Util::Setopts
55
50
 
56
51
  def initialize(title, dirname, opts, environment=nil)
@@ -68,15 +63,14 @@ class R10K::Module::Git < R10K::Module::Base
68
63
  :commit => :desired_ref,
69
64
  :ref => :desired_ref,
70
65
  :git => :remote,
71
- :default_branch => :default_ref,
66
+ :default_branch => :default_branch,
72
67
  :default_branch_override => :default_override_ref,
73
68
  }, :raise_on_unhandled => false)
74
69
 
70
+ @default_ref = @default_branch.nil? ? @overrides.dig(:modules, :default_ref) : @default_branch
75
71
  force = @overrides[:force]
76
72
  @force = force == false ? false : true
77
73
 
78
- @desired_ref ||= 'master'
79
-
80
74
  if @desired_ref == :control_branch
81
75
  if @environment && @environment.respond_to?(:ref)
82
76
  @desired_ref = @environment.ref
@@ -121,6 +115,14 @@ class R10K::Module::Git < R10K::Module::Base
121
115
  @repo.cache.sanitized_dirname
122
116
  end
123
117
 
118
+ def validate_ref_defined
119
+ if @desired_ref.nil? && @default_ref.nil? && @default_override_ref.nil?
120
+ msg = "No ref defined for module #{@name}. Add a ref to the module definition "
121
+ msg << "or set git:default_ref in the r10k.yaml config to configure a global default ref."
122
+ raise ArgumentError, msg
123
+ end
124
+ end
125
+
124
126
  private
125
127
 
126
128
  def validate_ref(desired, default, default_override)
@@ -152,7 +154,9 @@ class R10K::Module::Git < R10K::Module::Base
152
154
  msg << "or resolve default ref '%{default}'"
153
155
  vars[:default] = default
154
156
  else
155
- msg << "and no default provided"
157
+ msg << "and no default provided. r10k no longer hardcodes 'master' as the default ref."
158
+ msg << "Consider setting a ref per module in the Puppetfile or setting git:default_ref"
159
+ msg << "in your r10k config."
156
160
  end
157
161
 
158
162
  raise ArgumentError, _(msg.join(' ')) % vars
@@ -104,11 +104,8 @@ module R10K
104
104
  @existing_module_versions_by_name = @existing_module_metadata.map {|mod| [ mod.name, mod.version ] }.to_h
105
105
  empty_load_output.merge(modules: @existing_module_metadata)
106
106
 
107
- rescue ScriptError, StandardError => e
107
+ rescue SyntaxError, LoadError, ArgumentError, NameError => e
108
108
  logger.warn _("Unable to preload Puppetfile because of %{msg}" % { msg: e.message })
109
-
110
- @existing_module_metadata = []
111
- @existing_module_versions_by_name = {}
112
109
  end
113
110
 
114
111
  def add_module_metadata(name, info)
@@ -178,13 +175,6 @@ module R10K
178
175
  @modules << mod
179
176
  end
180
177
 
181
- # @deprecated
182
- # @return [String] The base directory that contains the Puppetfile
183
- def basedir
184
- logger.warn _('"basedir" is deprecated. Please use "environment_name" instead. "basedir" will be removed in a future version.')
185
- @basedir
186
- end
187
-
188
178
  private
189
179
 
190
180
  def empty_load_output
data/lib/r10k/settings.rb CHANGED
@@ -19,6 +19,10 @@ module R10K
19
19
  def self.git_settings
20
20
  R10K::Settings::Collection.new(:git, [
21
21
 
22
+ Definition.new(:default_ref, {
23
+ :desc => "User-defined default ref from which to deploy modules when not otherwise specified; nil unless configured via the r10k.yaml config.",
24
+ :default => nil}),
25
+
22
26
  EnumDefinition.new(:provider, {
23
27
  :desc => "The Git provider to use. Valid values: 'shellgit', 'rugged'",
24
28
  :normalize => lambda { |input| input.to_sym },
@@ -175,11 +179,6 @@ module R10K
175
179
  :default => [],
176
180
  }),
177
181
 
178
- Definition.new(:purge_whitelist, {
179
- :desc => "Deprecated; please use purge_allowlist instead. This setting will be removed in a future version.",
180
- :default => [],
181
- }),
182
-
183
182
  Definition.new(:generate_types, {
184
183
  :desc => "Controls whether to generate puppet types after deploying an environment. Defaults to false.",
185
184
  :default => false,
@@ -207,8 +206,8 @@ module R10K
207
206
  end
208
207
  }),
209
208
  Definition.new(:exclude_spec, {
210
- :desc => "Whether or not to deploy the spec dir of a module. Defaults to false.",
211
- :default => false,
209
+ :desc => "Whether or not to deploy the spec dir of a module. Defaults to true.",
210
+ :default => true,
212
211
  :validate => lambda do |value|
213
212
  unless !!value == value
214
213
  raise ArgumentError, "`exclude_spec` can only be a boolean value, not '#{value}'"
data/lib/r10k/version.rb CHANGED
@@ -2,5 +2,5 @@ module R10K
2
2
  # When updating to a new major (X) or minor (Y) version, include `#major` or
3
3
  # `#minor` (respectively) in your commit message to trigger the appropriate
4
4
  # release. Otherwise, a new patch (Z) version will be released.
5
- VERSION = '3.16.2'
5
+ VERSION = '4.0.0'
6
6
  end
data/locales/r10k.pot CHANGED
@@ -6,11 +6,11 @@
6
6
  #, fuzzy
7
7
  msgid ""
8
8
  msgstr ""
9
- "Project-Id-Version: r10k 3.9.3-289-g2f5deb72\n"
9
+ "Project-Id-Version: r10k 3.9.3-373-g117587fb\n"
10
10
  "\n"
11
11
  "Report-Msgid-Bugs-To: docs@puppetlabs.com\n"
12
- "POT-Creation-Date: 2023-06-27 17:39+0000\n"
13
- "PO-Revision-Date: 2023-06-27 17:39+0000\n"
12
+ "POT-Creation-Date: 2023-07-26 22:34+0000\n"
13
+ "PO-Revision-Date: 2023-07-26 22:34+0000\n"
14
14
  "Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
15
15
  "Language-Team: LANGUAGE <LL@li.org>\n"
16
16
  "Language: \n"
@@ -31,47 +31,47 @@ msgstr ""
31
31
  msgid "Reason: %{write_lock}"
32
32
  msgstr ""
33
33
 
34
- #: ../lib/r10k/action/deploy/environment.rb:116
34
+ #: ../lib/r10k/action/deploy/environment.rb:99
35
35
  msgid "Environment(s) \\'%{environments}\\' cannot be found in any source and will not be deployed."
36
36
  msgstr ""
37
37
 
38
- #: ../lib/r10k/action/deploy/environment.rb:136
38
+ #: ../lib/r10k/action/deploy/environment.rb:119
39
39
  msgid "Executing postrun command."
40
40
  msgstr ""
41
41
 
42
- #: ../lib/r10k/action/deploy/environment.rb:150
42
+ #: ../lib/r10k/action/deploy/environment.rb:133
43
43
  msgid "Environment %{env_dir} does not match environment name filter, skipping"
44
44
  msgstr ""
45
45
 
46
- #: ../lib/r10k/action/deploy/environment.rb:158
46
+ #: ../lib/r10k/action/deploy/environment.rb:141
47
47
  msgid "Deploying environment %{env_path}"
48
48
  msgstr ""
49
49
 
50
- #: ../lib/r10k/action/deploy/environment.rb:161
50
+ #: ../lib/r10k/action/deploy/environment.rb:144
51
51
  msgid "Environment %{env_dir} is now at %{env_signature}"
52
52
  msgstr ""
53
53
 
54
- #: ../lib/r10k/action/deploy/environment.rb:165
54
+ #: ../lib/r10k/action/deploy/environment.rb:148
55
55
  msgid "Environment %{env_dir} is new, updating all modules"
56
56
  msgstr ""
57
57
 
58
- #: ../lib/r10k/action/deploy/module.rb:81
58
+ #: ../lib/r10k/action/deploy/module.rb:82
59
59
  msgid "Running postrun command for environments: %{envs_to_run}."
60
60
  msgstr ""
61
61
 
62
- #: ../lib/r10k/action/deploy/module.rb:91
62
+ #: ../lib/r10k/action/deploy/module.rb:92
63
63
  msgid "No environments were modified, not executing postrun command."
64
64
  msgstr ""
65
65
 
66
- #: ../lib/r10k/action/deploy/module.rb:103
66
+ #: ../lib/r10k/action/deploy/module.rb:104
67
67
  msgid "Only updating modules in environment(s) %{opt_env} skipping environment %{env_path}"
68
68
  msgstr ""
69
69
 
70
- #: ../lib/r10k/action/deploy/module.rb:105
70
+ #: ../lib/r10k/action/deploy/module.rb:106
71
71
  msgid "Updating modules %{modules} in environment %{env_path}"
72
72
  msgstr ""
73
73
 
74
- #: ../lib/r10k/action/puppetfile/check.rb:18
74
+ #: ../lib/r10k/action/puppetfile/check.rb:25
75
75
  msgid "Syntax OK"
76
76
  msgstr ""
77
77
 
@@ -111,10 +111,6 @@ msgstr ""
111
111
  msgid "Unable to load sources; the supplied configuration does not define the 'sources' key"
112
112
  msgstr ""
113
113
 
114
- #: ../lib/r10k/environment/bare.rb:6
115
- msgid "\"bare\" environment type is deprecated; please use \"plain\" instead (environment: %{name})"
116
- msgstr ""
117
-
118
114
  #: ../lib/r10k/environment/base.rb:89 ../lib/r10k/environment/base.rb:105 ../lib/r10k/environment/base.rb:114 ../lib/r10k/source/base.rb:83
119
115
  msgid "%{class} has not implemented method %{method}"
120
116
  msgstr ""
@@ -327,7 +323,7 @@ msgstr ""
327
323
  msgid "Fetching remote '%{remote}' at %{path}"
328
324
  msgstr ""
329
325
 
330
- #: ../lib/r10k/git/rugged/working_repository.rb:129 ../lib/r10k/git/shellgit/working_repository.rb:101
326
+ #: ../lib/r10k/git/rugged/working_repository.rb:131 ../lib/r10k/git/shellgit/working_repository.rb:101
331
327
  msgid "Found local modifications in %{file_path}"
332
328
  msgstr ""
333
329
 
@@ -407,7 +403,7 @@ msgstr ""
407
403
  msgid "The module %{title} does not exist on %{url}."
408
404
  msgstr ""
409
405
 
410
- #: ../lib/r10k/module/git.rb:79
406
+ #: ../lib/r10k/module/git.rb:78
411
407
  msgid "Cannot track control repo branch for content '%{name}' when not part of a git-backed environment, will use default if available."
412
408
  msgstr ""
413
409
 
@@ -443,19 +439,15 @@ msgstr ""
443
439
  msgid "Ignoring Forge declaration in Puppetfile, using value from settings: %{forge}."
444
440
  msgstr ""
445
441
 
446
- #: ../lib/r10k/module_loader/puppetfile.rb:181
447
- msgid "\"basedir\" is deprecated. Please use \"environment_name\" instead. \"basedir\" will be removed in a future version."
448
- msgstr ""
449
-
450
- #: ../lib/r10k/module_loader/puppetfile.rb:200 ../lib/r10k/puppetfile.rb:104
442
+ #: ../lib/r10k/module_loader/puppetfile.rb:193 ../lib/r10k/puppetfile.rb:104
451
443
  msgid "Puppetfile %{path} missing or unreadable"
452
444
  msgstr ""
453
445
 
454
- #: ../lib/r10k/module_loader/puppetfile.rb:242
446
+ #: ../lib/r10k/module_loader/puppetfile.rb:235
455
447
  msgid "Puppetfiles cannot contain duplicate module names."
456
448
  msgstr ""
457
449
 
458
- #: ../lib/r10k/module_loader/puppetfile.rb:244
450
+ #: ../lib/r10k/module_loader/puppetfile.rb:237
459
451
  msgid "Remove the duplicates of the following modules: %{dupes}"
460
452
  msgstr ""
461
453
 
data/r10k.gemspec CHANGED
@@ -18,7 +18,7 @@ Gem::Specification.new do |s|
18
18
  dynamic environments.
19
19
  DESCRIPTION
20
20
 
21
- s.required_ruby_version = '>= 2.3.0'
21
+ s.required_ruby_version = '>= 2.6.0'
22
22
 
23
23
  s.license = 'Apache-2.0'
24
24
 
@@ -28,11 +28,9 @@ Gem::Specification.new do |s|
28
28
  s.add_dependency 'log4r', '1.1.10'
29
29
  s.add_dependency 'multi_json', '~> 1.10'
30
30
 
31
- s.add_dependency 'puppet_forge', ['>= 2.3.0', '< 4.0.0']
31
+ s.add_dependency 'puppet_forge', '>= 4.1', '< 6'
32
32
 
33
- s.add_dependency 'gettext-setup', ['>=0.24', '< 2.0.0']
34
- s.add_dependency 'fast_gettext', ['>= 1.1.0', '< 3.0.0']
35
- s.add_dependency 'gettext', ['>= 3.0.2', '< 4.0.0']
33
+ s.add_dependency 'gettext-setup', '>=0.24', '<2.0'
36
34
 
37
35
  s.add_dependency 'jwt', '>= 2.2.3', '< 2.8.0'
38
36
  s.add_dependency 'minitar', '~> 0.9'
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: r10k
3
3
  version: !ruby/object:Gem::Version
4
- version: 3.16.2
4
+ version: 4.0.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Adrien Thebo
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2024-05-21 00:00:00.000000000 Z
11
+ date: 2023-08-01 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: colored2
@@ -72,20 +72,20 @@ dependencies:
72
72
  requirements:
73
73
  - - ">="
74
74
  - !ruby/object:Gem::Version
75
- version: 2.3.0
75
+ version: '4.1'
76
76
  - - "<"
77
77
  - !ruby/object:Gem::Version
78
- version: 4.0.0
78
+ version: '6'
79
79
  type: :runtime
80
80
  prerelease: false
81
81
  version_requirements: !ruby/object:Gem::Requirement
82
82
  requirements:
83
83
  - - ">="
84
84
  - !ruby/object:Gem::Version
85
- version: 2.3.0
85
+ version: '4.1'
86
86
  - - "<"
87
87
  - !ruby/object:Gem::Version
88
- version: 4.0.0
88
+ version: '6'
89
89
  - !ruby/object:Gem::Dependency
90
90
  name: gettext-setup
91
91
  requirement: !ruby/object:Gem::Requirement
@@ -95,7 +95,7 @@ dependencies:
95
95
  version: '0.24'
96
96
  - - "<"
97
97
  - !ruby/object:Gem::Version
98
- version: 2.0.0
98
+ version: '2.0'
99
99
  type: :runtime
100
100
  prerelease: false
101
101
  version_requirements: !ruby/object:Gem::Requirement
@@ -105,47 +105,7 @@ dependencies:
105
105
  version: '0.24'
106
106
  - - "<"
107
107
  - !ruby/object:Gem::Version
108
- version: 2.0.0
109
- - !ruby/object:Gem::Dependency
110
- name: fast_gettext
111
- requirement: !ruby/object:Gem::Requirement
112
- requirements:
113
- - - ">="
114
- - !ruby/object:Gem::Version
115
- version: 1.1.0
116
- - - "<"
117
- - !ruby/object:Gem::Version
118
- version: 3.0.0
119
- type: :runtime
120
- prerelease: false
121
- version_requirements: !ruby/object:Gem::Requirement
122
- requirements:
123
- - - ">="
124
- - !ruby/object:Gem::Version
125
- version: 1.1.0
126
- - - "<"
127
- - !ruby/object:Gem::Version
128
- version: 3.0.0
129
- - !ruby/object:Gem::Dependency
130
- name: gettext
131
- requirement: !ruby/object:Gem::Requirement
132
- requirements:
133
- - - ">="
134
- - !ruby/object:Gem::Version
135
- version: 3.0.2
136
- - - "<"
137
- - !ruby/object:Gem::Version
138
- version: 4.0.0
139
- type: :runtime
140
- prerelease: false
141
- version_requirements: !ruby/object:Gem::Requirement
142
- requirements:
143
- - - ">="
144
- - !ruby/object:Gem::Version
145
- version: 3.0.2
146
- - - "<"
147
- - !ruby/object:Gem::Version
148
- version: 4.0.0
108
+ version: '2.0'
149
109
  - !ruby/object:Gem::Dependency
150
110
  name: jwt
151
111
  requirement: !ruby/object:Gem::Requirement
@@ -312,7 +272,7 @@ files:
312
272
  - integration/tests/i18n/deploy_module_with_unicode_in_file_name.rb
313
273
  - integration/tests/purging/content_not_purged_at_root.rb
314
274
  - integration/tests/purging/default_purging.rb
315
- - integration/tests/purging/does_not_purge_files_on_white_list.rb
275
+ - integration/tests/purging/does_not_purge_files_on_allowlist.rb
316
276
  - integration/tests/user_scenario/basic_workflow/multi_env_1000_branches.rb
317
277
  - integration/tests/user_scenario/basic_workflow/multi_env_custom_forge_git_module.rb
318
278
  - integration/tests/user_scenario/basic_workflow/multi_env_custom_forge_git_module_static.rb
@@ -372,7 +332,6 @@ files:
372
332
  - lib/r10k/deployment.rb
373
333
  - lib/r10k/deployment/config.rb
374
334
  - lib/r10k/environment.rb
375
- - lib/r10k/environment/bare.rb
376
335
  - lib/r10k/environment/base.rb
377
336
  - lib/r10k/environment/git.rb
378
337
  - lib/r10k/environment/name.rb
@@ -480,14 +439,14 @@ required_ruby_version: !ruby/object:Gem::Requirement
480
439
  requirements:
481
440
  - - ">="
482
441
  - !ruby/object:Gem::Version
483
- version: 2.3.0
442
+ version: 2.6.0
484
443
  required_rubygems_version: !ruby/object:Gem::Requirement
485
444
  requirements:
486
445
  - - ">="
487
446
  - !ruby/object:Gem::Version
488
447
  version: '0'
489
448
  requirements: []
490
- rubygems_version: 3.4.20
449
+ rubygems_version: 3.0.3
491
450
  signing_key:
492
451
  specification_version: 4
493
452
  summary: Puppet environment and module deployment
@@ -1,13 +0,0 @@
1
- class R10K::Environment::Bare < R10K::Environment::Plain
2
-
3
- R10K::Environment.register(:bare, self)
4
-
5
- def initialize(name, basedir, dirname, options = {})
6
- logger.warn _('"bare" environment type is deprecated; please use "plain" instead (environment: %{name})') % {name: name}
7
- super
8
- end
9
-
10
- def signature
11
- 'bare-default'
12
- end
13
- end