r10k 3.16.2 → 4.0.0.pre
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.
- checksums.yaml +4 -4
- data/.github/workflows/release.yml +0 -1
- data/.github/workflows/rspec_tests.yml +3 -7
- data/CHANGELOG.mkd +10 -14
- data/README.mkd +3 -3
- data/doc/dynamic-environments/configuration.mkd +13 -1
- data/doc/puppetfile.mkd +9 -3
- data/integration/Rakefile +1 -1
- data/integration/tests/basic_functionality/rugged_git_provider_with_ssh.rb +2 -2
- data/integration/tests/basic_functionality/rugged_git_provider_without_ssh.rb +2 -2
- data/integration/tests/git_source/git_source_git.rb +1 -1
- data/integration/tests/purging/{does_not_purge_files_on_white_list.rb → does_not_purge_files_on_allowlist.rb} +2 -2
- data/integration/tests/user_scenario/basic_workflow/negative/neg_disk_full.rb +1 -1
- data/integration/tests/user_scenario/basic_workflow/single_env_10000_files.rb +1 -1
- data/integration/tests/user_scenario/basic_workflow/single_env_large_files.rb +1 -1
- data/lib/r10k/action/deploy/environment.rb +2 -19
- data/lib/r10k/action/deploy/module.rb +1 -0
- data/lib/r10k/action/puppetfile/check.rb +7 -0
- data/lib/r10k/action/puppetfile/install.rb +1 -0
- data/lib/r10k/cli/deploy.rb +15 -1
- data/lib/r10k/environment.rb +0 -1
- data/lib/r10k/git/rugged/working_repository.rb +1 -1
- data/lib/r10k/git/shellgit/working_repository.rb +1 -1
- data/lib/r10k/git/stateful_repository.rb +2 -2
- data/lib/r10k/module/base.rb +3 -3
- data/lib/r10k/module/git.rb +13 -9
- data/lib/r10k/module_loader/puppetfile.rb +1 -11
- data/lib/r10k/settings.rb +6 -7
- data/lib/r10k/version.rb +1 -1
- data/r10k.gemspec +3 -5
- metadata +13 -60
- data/lib/r10k/environment/bare.rb +0 -13
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 8209d4d067f8bfb87d3ea39cd66402d17b1b72a9c7ef6047f22ca9b7d2dd7114
|
|
4
|
+
data.tar.gz: b742aed73430365dec9d82a5007d1d1bef130b932307c2128d1cb08d789735cc
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 7c77bbce995d3f69fa1fa2c67bdb1db79c4bcda6f783a365ca7a06d6d3e873e661bdadb9cd4c5637fe8010b92c1081aab7fb93b5ee725aa74339dab70e110039
|
|
7
|
+
data.tar.gz: 3c694c48a648ca097662568efe27b228ca99610a0f7f6b5f3858459bbc41a0fd805b1a2d9bde707a724c9473327f35ea5c4409f0c71749ce4b26175ec5819f40
|
|
@@ -3,7 +3,7 @@ name: Rspec tests
|
|
|
3
3
|
on:
|
|
4
4
|
pull_request:
|
|
5
5
|
branches:
|
|
6
|
-
-
|
|
6
|
+
- 4.x
|
|
7
7
|
|
|
8
8
|
jobs:
|
|
9
9
|
rspec_tests:
|
|
@@ -11,13 +11,11 @@ jobs:
|
|
|
11
11
|
strategy:
|
|
12
12
|
matrix:
|
|
13
13
|
cfg:
|
|
14
|
-
- {os: ubuntu-latest, ruby: 2.4}
|
|
15
|
-
- {os: ubuntu-latest, ruby: 2.5}
|
|
16
14
|
- {os: ubuntu-latest, ruby: 2.6}
|
|
17
15
|
- {os: ubuntu-latest, ruby: 2.7}
|
|
16
|
+
- {os: ubuntu-latest, ruby: 3.1}
|
|
18
17
|
- {os: ubuntu-latest, ruby: 3.2}
|
|
19
|
-
- {os: ubuntu-latest, ruby: jruby-9.
|
|
20
|
-
- {os: windows-2019, ruby: 2.5}
|
|
18
|
+
- {os: ubuntu-latest, ruby: jruby-9.3}
|
|
21
19
|
- {os: windows-2019, ruby: 2.6}
|
|
22
20
|
- {os: windows-2019, ruby: 2.7}
|
|
23
21
|
|
|
@@ -33,8 +31,6 @@ jobs:
|
|
|
33
31
|
|
|
34
32
|
- name: Install bundler and gems
|
|
35
33
|
run: |
|
|
36
|
-
# Pin bundler to maintain support for Ruby 2.4 and 2.5
|
|
37
|
-
gem install bundler -v 2.3.26
|
|
38
34
|
bundle config set without packaging documentation
|
|
39
35
|
bundle install --jobs 4 --retry 3
|
|
40
36
|
|
data/CHANGELOG.mkd
CHANGED
|
@@ -3,21 +3,13 @@ CHANGELOG
|
|
|
3
3
|
|
|
4
4
|
Unreleased
|
|
5
5
|
----------
|
|
6
|
+
- Update GitHub Actions & introduce dependabot [#1337](https://github.com/puppetlabs/r10k/pull/1337)
|
|
6
7
|
|
|
7
|
-
3.
|
|
8
|
-
------
|
|
9
|
-
|
|
10
|
-
- r10k::module::git: expose remote as getter [#1379](https://github.com/puppetlabs/r10k/pull/1379)
|
|
11
|
-
|
|
12
|
-
3.16.1
|
|
13
|
-
------
|
|
8
|
+
- Drop Ruby 2.3/2.4/2.5 support; puppet_forge: Use 4.1 and newer [#1336](https://github.com/puppetlabs/r10k/pull/1336)
|
|
14
9
|
|
|
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
10
|
|
|
18
11
|
3.16.0
|
|
19
12
|
------
|
|
20
|
-
|
|
21
13
|
- Emit more debug output when modules fail to sync [#1347](https://github.com/puppetlabs/r10k/pull/1347)
|
|
22
14
|
- Update GitHub Actions & introduce dependabot [#1337](https://github.com/puppetlabs/r10k/pull/1337)
|
|
23
15
|
- Update R10K proxy usage to follow newer rugged best practices [PE-35980](https://tickets.puppet.com/browse/PE-35980)
|
|
@@ -25,26 +17,30 @@ Unreleased
|
|
|
25
17
|
|
|
26
18
|
3.15.4
|
|
27
19
|
------
|
|
28
|
-
|
|
29
20
|
- Pin dependencies to maintain support for old Ruby versions [#1329](https://github.com/puppetlabs/r10k/pull/1329)
|
|
30
21
|
|
|
31
22
|
3.15.3
|
|
32
23
|
------
|
|
33
|
-
|
|
34
24
|
- Fix dirty working copy debug logging [#1321](https://github.com/puppetlabs/r10k/pull/1321)
|
|
35
25
|
- Allow gettext-setup < 2 for compatibility with Ruby 3.2 and Puppet 8 [#1325](https://github.com/puppetlabs/r10k/pull/1325)
|
|
36
26
|
|
|
37
27
|
3.15.2
|
|
38
28
|
------
|
|
39
|
-
|
|
40
29
|
- Implement exclude regex for puppetfile install [#1248](https://github.com/puppetlabs/r10k/issues/1248)
|
|
41
30
|
|
|
42
31
|
3.15.1
|
|
43
32
|
------
|
|
44
|
-
|
|
45
33
|
- Add TOC to configuration docs [#1298](https://github.com/puppetlabs/r10k/issues/1298)
|
|
46
34
|
- Remove the spec folder from gemspec [#1316](https://github.com/puppetlabs/r10k/issues/1316)
|
|
47
35
|
|
|
36
|
+
- (RK-368) remove `purge_whitelist` setting [#1277](https://github.com/puppetlabs/r10k/pull/1277)
|
|
37
|
+
- (RK-390) Remove default ref for deploying git modules [#1275](http://github.com/puppetlabs/r10k/pull/1275)
|
|
38
|
+
- (RK-391) Change `exclude_spec` default to true for module spec dir deletion [#1264](https://github.com/puppetlabs/r10k/pull/1261)
|
|
39
|
+
- (maint) Add Ruby 3.0 to rspec CI matrix [#1261](https://github.com/puppetlabs/r10k/pull/1261)
|
|
40
|
+
- (RK-383) Remove deprecated `basedir` method from Puppetfile DSL. Users should use `environment_name` instead. [#1254](https://github.com/puppetlabs/r10k/pull/1254)
|
|
41
|
+
- (RK-386) Remove deprecated `bare` environment type. [#1235](https://github.com/puppetlabs/r10k/issues/1235)
|
|
42
|
+
- Drop EoL Ruby 2.3/2.4 support [#1280](https://github.com/puppetlabs/r10k/pull/1208)
|
|
43
|
+
|
|
48
44
|
3.15.0
|
|
49
45
|
------
|
|
50
46
|
|
data/README.mkd
CHANGED
|
@@ -27,14 +27,14 @@ based alternative.
|
|
|
27
27
|
Requirements
|
|
28
28
|
------------
|
|
29
29
|
|
|
30
|
-
R10k supports the Ruby versions `>= 2.
|
|
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
|
|
37
|
-
Puppet
|
|
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
|
|
|
@@ -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
|
|
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
|
|
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
|
|
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 =>
|
|
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=
|
|
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, "
|
|
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, "
|
|
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, "
|
|
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, "
|
|
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, "
|
|
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
|
|
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
|
-
|
|
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, "
|
|
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, "
|
|
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, "
|
|
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:
|
|
57
|
-
settings.dig(:deploy, :purge_allowlist) || [])
|
|
57
|
+
purge_allowlist: settings.dig(:deploy, :purge_allowlist) || []
|
|
58
58
|
},
|
|
59
59
|
forge: {
|
|
60
60
|
allow_puppetfile_override: settings.dig(:forge, :allow_puppetfile_override) || false
|
|
@@ -83,23 +83,6 @@ module R10K
|
|
|
83
83
|
|
|
84
84
|
private
|
|
85
85
|
|
|
86
|
-
def read_purge_allowlist (whitelist, allowlist)
|
|
87
|
-
whitelist_has_content = !whitelist.empty?
|
|
88
|
-
allowlist_has_content = !allowlist.empty?
|
|
89
|
-
case
|
|
90
|
-
when whitelist_has_content == false && allowlist_has_content == false
|
|
91
|
-
[]
|
|
92
|
-
when whitelist_has_content && allowlist_has_content
|
|
93
|
-
raise R10K::Error.new "Values found for both purge_whitelist and purge_allowlist. Setting " <<
|
|
94
|
-
"purge_whitelist is deprecated, please only use purge_allowlist."
|
|
95
|
-
when allowlist_has_content
|
|
96
|
-
allowlist
|
|
97
|
-
else
|
|
98
|
-
logger.warn "Setting purge_whitelist is deprecated; please use purge_allowlist instead."
|
|
99
|
-
whitelist
|
|
100
|
-
end
|
|
101
|
-
end
|
|
102
|
-
|
|
103
86
|
def visit_deployment(deployment)
|
|
104
87
|
# Ensure that everything can be preloaded. If we cannot preload all
|
|
105
88
|
# sources then we can't fully enumerate all environments which
|
|
@@ -9,12 +9,19 @@ module R10K
|
|
|
9
9
|
|
|
10
10
|
def call
|
|
11
11
|
options = { basedir: @root }
|
|
12
|
+
options[:overrides] = {}
|
|
13
|
+
options[:overrides][:modules] = { default_ref: @settings.dig(:git, :default_ref) }
|
|
12
14
|
options[:moduledir] = @moduledir if @moduledir
|
|
13
15
|
options[:puppetfile] = @puppetfile if @puppetfile
|
|
14
16
|
|
|
15
17
|
loader = R10K::ModuleLoader::Puppetfile.new(**options)
|
|
16
18
|
begin
|
|
17
19
|
loader.load!
|
|
20
|
+
loader.modules.each do |mod|
|
|
21
|
+
if mod.instance_of?(R10K::Module::Git)
|
|
22
|
+
mod.validate_ref_defined
|
|
23
|
+
end
|
|
24
|
+
end
|
|
18
25
|
$stderr.puts _("Syntax OK")
|
|
19
26
|
true
|
|
20
27
|
rescue => e
|
|
@@ -12,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
|
data/lib/r10k/cli/deploy.rb
CHANGED
|
@@ -10,6 +10,19 @@ require 'cri'
|
|
|
10
10
|
|
|
11
11
|
module R10K::CLI
|
|
12
12
|
module Deploy
|
|
13
|
+
|
|
14
|
+
class TransformExcludeSpec
|
|
15
|
+
def call(input)
|
|
16
|
+
# To be backward compatible with the 3.x flag version of this setting,
|
|
17
|
+
# r10k allows this flag to have an optional argument. When no argument
|
|
18
|
+
# is supplied, cri defaults to setting the class to true, so we check
|
|
19
|
+
# for TrueClass here as well as "true".
|
|
20
|
+
return true if input == true || input == 'true'
|
|
21
|
+
return false if input == 'false'
|
|
22
|
+
raise ArgumentError
|
|
23
|
+
end
|
|
24
|
+
end
|
|
25
|
+
|
|
13
26
|
def self.command
|
|
14
27
|
@cmd ||= Cri::Command.define do
|
|
15
28
|
name 'deploy'
|
|
@@ -24,7 +37,8 @@ module R10K::CLI
|
|
|
24
37
|
option nil, :cachedir, 'Specify a cachedir, overriding the value in config', argument: :required
|
|
25
38
|
flag nil, :'no-force', 'Prevent the overwriting of local module modifications'
|
|
26
39
|
flag nil, :'generate-types', 'Run `puppet generate types` after updating an environment'
|
|
27
|
-
|
|
40
|
+
option nil, :'exclude-spec', 'Exclude the module\'s spec dir for deployment', argument: :optional,
|
|
41
|
+
transform: TransformExcludeSpec.new
|
|
28
42
|
option nil, :'puppet-path', 'Path to puppet executable', argument: :required do |value, cmd|
|
|
29
43
|
unless File.executable? value
|
|
30
44
|
$stderr.puts "The specified puppet executable #{value} is not executable."
|
data/lib/r10k/environment.rb
CHANGED
|
@@ -31,7 +31,6 @@ module R10K
|
|
|
31
31
|
require 'r10k/environment/base'
|
|
32
32
|
require 'r10k/environment/with_modules'
|
|
33
33
|
require 'r10k/environment/plain'
|
|
34
|
-
require 'r10k/environment/bare'
|
|
35
34
|
require 'r10k/environment/git'
|
|
36
35
|
require 'r10k/environment/svn'
|
|
37
36
|
require 'r10k/environment/tarball'
|
|
@@ -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=
|
|
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=
|
|
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=
|
|
39
|
+
def sync(ref, force=true, exclude_spec=true)
|
|
40
40
|
@cache.sync if sync_cache?(ref)
|
|
41
41
|
|
|
42
42
|
sha = @cache.resolve(ref)
|
|
@@ -75,7 +75,7 @@ class R10K::Git::StatefulRepository
|
|
|
75
75
|
updated
|
|
76
76
|
end
|
|
77
77
|
|
|
78
|
-
def status(ref, exclude_spec=
|
|
78
|
+
def status(ref, exclude_spec=true)
|
|
79
79
|
if !@repo.exist?
|
|
80
80
|
:absent
|
|
81
81
|
elsif !@cache.exist?
|
data/lib/r10k/module/base.rb
CHANGED
|
@@ -60,8 +60,8 @@ class R10K::Module::Base
|
|
|
60
60
|
@environment = environment
|
|
61
61
|
@overrides = args.delete(:overrides) || {}
|
|
62
62
|
@spec_deletable = true
|
|
63
|
-
@exclude_spec =
|
|
64
|
-
@exclude_spec = @overrides.dig(:modules, :exclude_spec)
|
|
63
|
+
@exclude_spec = true
|
|
64
|
+
@exclude_spec = @overrides.dig(:modules, :exclude_spec) unless @overrides.dig(:modules, :exclude_spec).nil?
|
|
65
65
|
if args.has_key?(:exclude_spec)
|
|
66
66
|
logger.debug2 _("Overriding :exclude_spec setting with per module setting for #{@title}")
|
|
67
67
|
@exclude_spec = args.delete(:exclude_spec)
|
|
@@ -78,7 +78,7 @@ class R10K::Module::Base
|
|
|
78
78
|
path.to_s
|
|
79
79
|
end
|
|
80
80
|
|
|
81
|
-
# Delete the spec dir if @exclude_spec
|
|
81
|
+
# Delete the spec dir if @exclude_spec is true and @spec_deletable is also true
|
|
82
82
|
def maybe_delete_spec_dir
|
|
83
83
|
if @exclude_spec
|
|
84
84
|
if @spec_deletable
|
data/lib/r10k/module/git.rb
CHANGED
|
@@ -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 => :
|
|
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
|
|
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
|
|
211
|
-
:default =>
|
|
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 = '
|
|
5
|
+
VERSION = '4.0.0.pre'
|
|
6
6
|
end
|
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.
|
|
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',
|
|
31
|
+
s.add_dependency 'puppet_forge', '>= 4.1', '< 6'
|
|
32
32
|
|
|
33
|
-
s.add_dependency 'gettext-setup',
|
|
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'
|
|
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:
|
|
4
|
+
version: 4.0.0.pre
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Adrien Thebo
|
|
8
8
|
autorequire:
|
|
9
9
|
bindir: bin
|
|
10
10
|
cert_chain: []
|
|
11
|
-
date:
|
|
11
|
+
date: 2023-07-26 00:00:00.000000000 Z
|
|
12
12
|
dependencies:
|
|
13
13
|
- !ruby/object:Gem::Dependency
|
|
14
14
|
name: colored2
|
|
@@ -72,80 +72,34 @@ dependencies:
|
|
|
72
72
|
requirements:
|
|
73
73
|
- - ">="
|
|
74
74
|
- !ruby/object:Gem::Version
|
|
75
|
-
version:
|
|
75
|
+
version: '4.1'
|
|
76
76
|
- - "<"
|
|
77
77
|
- !ruby/object:Gem::Version
|
|
78
|
-
version:
|
|
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:
|
|
85
|
+
version: '4.1'
|
|
86
86
|
- - "<"
|
|
87
87
|
- !ruby/object:Gem::Version
|
|
88
|
-
version:
|
|
88
|
+
version: '6'
|
|
89
89
|
- !ruby/object:Gem::Dependency
|
|
90
90
|
name: gettext-setup
|
|
91
91
|
requirement: !ruby/object:Gem::Requirement
|
|
92
92
|
requirements:
|
|
93
|
-
- - "
|
|
93
|
+
- - "~>"
|
|
94
94
|
- !ruby/object:Gem::Version
|
|
95
95
|
version: '0.24'
|
|
96
|
-
- - "<"
|
|
97
|
-
- !ruby/object:Gem::Version
|
|
98
|
-
version: 2.0.0
|
|
99
96
|
type: :runtime
|
|
100
97
|
prerelease: false
|
|
101
98
|
version_requirements: !ruby/object:Gem::Requirement
|
|
102
99
|
requirements:
|
|
103
|
-
- - "
|
|
100
|
+
- - "~>"
|
|
104
101
|
- !ruby/object:Gem::Version
|
|
105
102
|
version: '0.24'
|
|
106
|
-
- - "<"
|
|
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
|
|
149
103
|
- !ruby/object:Gem::Dependency
|
|
150
104
|
name: jwt
|
|
151
105
|
requirement: !ruby/object:Gem::Requirement
|
|
@@ -312,7 +266,7 @@ files:
|
|
|
312
266
|
- integration/tests/i18n/deploy_module_with_unicode_in_file_name.rb
|
|
313
267
|
- integration/tests/purging/content_not_purged_at_root.rb
|
|
314
268
|
- integration/tests/purging/default_purging.rb
|
|
315
|
-
- integration/tests/purging/
|
|
269
|
+
- integration/tests/purging/does_not_purge_files_on_allowlist.rb
|
|
316
270
|
- integration/tests/user_scenario/basic_workflow/multi_env_1000_branches.rb
|
|
317
271
|
- integration/tests/user_scenario/basic_workflow/multi_env_custom_forge_git_module.rb
|
|
318
272
|
- integration/tests/user_scenario/basic_workflow/multi_env_custom_forge_git_module_static.rb
|
|
@@ -372,7 +326,6 @@ files:
|
|
|
372
326
|
- lib/r10k/deployment.rb
|
|
373
327
|
- lib/r10k/deployment/config.rb
|
|
374
328
|
- lib/r10k/environment.rb
|
|
375
|
-
- lib/r10k/environment/bare.rb
|
|
376
329
|
- lib/r10k/environment/base.rb
|
|
377
330
|
- lib/r10k/environment/git.rb
|
|
378
331
|
- lib/r10k/environment/name.rb
|
|
@@ -480,14 +433,14 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
|
480
433
|
requirements:
|
|
481
434
|
- - ">="
|
|
482
435
|
- !ruby/object:Gem::Version
|
|
483
|
-
version: 2.
|
|
436
|
+
version: 2.6.0
|
|
484
437
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
|
485
438
|
requirements:
|
|
486
|
-
- - "
|
|
439
|
+
- - ">"
|
|
487
440
|
- !ruby/object:Gem::Version
|
|
488
|
-
version:
|
|
441
|
+
version: 1.3.1
|
|
489
442
|
requirements: []
|
|
490
|
-
rubygems_version: 3.
|
|
443
|
+
rubygems_version: 3.0.3
|
|
491
444
|
signing_key:
|
|
492
445
|
specification_version: 4
|
|
493
446
|
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
|