r10k 3.9.1 → 3.11.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.github/workflows/rspec_tests.yml +1 -1
- data/.travis.yml +0 -10
- data/CHANGELOG.mkd +28 -0
- data/README.mkd +6 -0
- data/doc/dynamic-environments/configuration.mkd +21 -0
- data/doc/puppetfile.mkd +15 -1
- data/integration/Rakefile +3 -1
- data/integration/tests/user_scenario/basic_workflow/negative/neg_specify_deleted_forge_module.rb +3 -9
- data/integration/tests/user_scenario/basic_workflow/single_env_purge_unmanaged_modules.rb +21 -25
- data/integration/tests/user_scenario/complex_workflow/multi_env_add_change_remove.rb +3 -3
- data/integration/tests/user_scenario/complex_workflow/multi_env_remove_re-add.rb +3 -3
- data/integration/tests/user_scenario/complex_workflow/multi_env_unamanaged.rb +3 -3
- data/lib/r10k/action/base.rb +6 -3
- data/lib/r10k/action/deploy/display.rb +6 -3
- data/lib/r10k/action/deploy/environment.rb +15 -4
- data/lib/r10k/action/deploy/module.rb +37 -8
- data/lib/r10k/action/runner.rb +45 -10
- data/lib/r10k/cli/deploy.rb +4 -0
- data/lib/r10k/git.rb +3 -0
- data/lib/r10k/git/cache.rb +1 -1
- data/lib/r10k/git/rugged/credentials.rb +77 -0
- data/lib/r10k/git/stateful_repository.rb +1 -0
- data/lib/r10k/initializers.rb +10 -0
- data/lib/r10k/module/base.rb +37 -0
- data/lib/r10k/module/forge.rb +7 -2
- data/lib/r10k/module/git.rb +2 -1
- data/lib/r10k/module/svn.rb +2 -1
- data/lib/r10k/module_loader/puppetfile.rb +206 -0
- data/lib/r10k/module_loader/puppetfile/dsl.rb +37 -0
- data/lib/r10k/puppetfile.rb +83 -160
- data/lib/r10k/settings.rb +47 -2
- data/lib/r10k/settings/definition.rb +1 -1
- data/lib/r10k/source/base.rb +10 -0
- data/lib/r10k/source/git.rb +5 -0
- data/lib/r10k/source/svn.rb +4 -0
- data/lib/r10k/util/purgeable.rb +70 -8
- data/lib/r10k/version.rb +1 -1
- data/locales/r10k.pot +129 -57
- data/r10k.gemspec +2 -0
- data/spec/fixtures/unit/action/r10k_forge_auth.yaml +4 -0
- data/spec/fixtures/unit/action/r10k_forge_auth_no_url.yaml +3 -0
- data/spec/fixtures/unit/util/purgeable/managed_one/managed_subdir_1/managed_subdir_2/ignored_1 +0 -0
- data/spec/fixtures/unit/util/purgeable/managed_two/.hidden/unmanaged_3 +0 -0
- data/spec/unit/action/deploy/environment_spec.rb +25 -0
- data/spec/unit/action/deploy/module_spec.rb +216 -14
- data/spec/unit/action/runner_spec.rb +129 -25
- data/spec/unit/git/cache_spec.rb +14 -0
- data/spec/unit/git/rugged/credentials_spec.rb +29 -0
- data/spec/unit/git/stateful_repository_spec.rb +5 -0
- data/spec/unit/module/base_spec.rb +46 -0
- data/spec/unit/module/forge_spec.rb +27 -1
- data/spec/unit/module/git_spec.rb +17 -8
- data/spec/unit/module/svn_spec.rb +18 -0
- data/spec/unit/module_loader/puppetfile_spec.rb +343 -0
- data/spec/unit/module_spec.rb +28 -0
- data/spec/unit/puppetfile_spec.rb +127 -191
- data/spec/unit/settings_spec.rb +24 -2
- data/spec/unit/util/purgeable_spec.rb +38 -6
- metadata +23 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 34dc5753178d4777a6d36e6806515345b8b0e133807d46b21a9468de0325a1ed
|
4
|
+
data.tar.gz: 830085cca185bb00292af40f5cc13e8a46d00645a7bdc7f16e0d48b98ca4df23
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 26e01c3ae5cdd4b4c873aa04d233dbe8fbe1f1f9fa193add5fe03aba50d1db09604fc117fd26190b7a1c350a7a64df9bdeba1b33ee0697d90420813075fe7811
|
7
|
+
data.tar.gz: 84c8c37b4daa9f11a864c54df12834d7bc920207f5f1219516d49583ff88537b7a13772a0c812d2bc9ebb4ebd636da4124dd35fbc105681e36db1aee4f540961
|
@@ -15,7 +15,7 @@ jobs:
|
|
15
15
|
- {os: ubuntu-18.04, ruby: 2.5}
|
16
16
|
- {os: ubuntu-18.04, ruby: 2.6}
|
17
17
|
- {os: ubuntu-18.04, ruby: 2.7}
|
18
|
-
- {os: ubuntu-18.04, ruby: jruby-9.2.
|
18
|
+
- {os: ubuntu-18.04, ruby: jruby-9.2.10.0}
|
19
19
|
- {os: windows-2016, ruby: 2.5}
|
20
20
|
- {os: windows-2016, ruby: 2.6}
|
21
21
|
- {os: windows-2016, ruby: 2.7}
|
data/.travis.yml
CHANGED
@@ -10,18 +10,8 @@ jdk:
|
|
10
10
|
before_install: gem install bundler -v '< 2' --no-document
|
11
11
|
matrix:
|
12
12
|
include:
|
13
|
-
- stage: r10k tests
|
14
|
-
rvm: 2.7.0
|
15
|
-
- stage: r10k tests
|
16
|
-
rvm: 2.6.5
|
17
|
-
- stage: r10k tests
|
18
|
-
rvm: 2.5.0
|
19
|
-
- stage: r10k tests
|
20
|
-
rvm: 2.4.0
|
21
13
|
- stage: r10k tests
|
22
14
|
rvm: 2.3.0
|
23
|
-
- stage: r10k tests
|
24
|
-
rvm: jruby
|
25
15
|
- stage: r10k container tests
|
26
16
|
dist: focal
|
27
17
|
language: ruby
|
data/CHANGELOG.mkd
CHANGED
@@ -4,6 +4,34 @@ CHANGELOG
|
|
4
4
|
Unreleased
|
5
5
|
----------
|
6
6
|
|
7
|
+
3.11.0
|
8
|
+
------
|
9
|
+
|
10
|
+
- Always sync git cache on `ref: 'HEAD'` [#1182](https://github.com/puppetlabs/r10k/pull/1182)
|
11
|
+
- (CODEMGMT-1421, CODEMGMT-1422, CODEMGMT-1457) Add setting `exclude_spec` to remove the spec dir from module deployment[#1189](https://github.com/puppetlabs/r10k/pull/1189)[#1198](https://github.com/puppetlabs/r10k/pull/1198)[#1204](https://github.com/puppetlabs/r10k/pull/1204)
|
12
|
+
- (RK-369) Make module deploys run the postrun command if any environments were updated. [#982](https://github.com/puppetlabs/r10k/issues/982)
|
13
|
+
- Add support for Github App auth token. This allows r10k to authenticate under strict SSO/2FA guidelines that cannot utilize machine users for code deployment. [#1180](https://github.com/puppetlabs/r10k/pull/1180)
|
14
|
+
- Restore the ability to load a Puppetfile from a relative `basedir`. [#1202](https://github.com/puppetlabs/r10k/pull/1202), [#1203](https://github.com/puppetlabs/r10k/pull/1203)
|
15
|
+
|
16
|
+
3.10.0
|
17
|
+
------
|
18
|
+
|
19
|
+
- Add `authorization_token` setting to allow authentication to a custom Forge server. [#1181](https://github.com/puppetlabs/r10k/pull/1181)
|
20
|
+
- (RK-135) Attempting to download the latest version for a module that has no Forge releases will now issue a meaningful error. [#1177](https://github.com/puppetlabs/r10k/pull/1177)
|
21
|
+
- Added an interface to R10K::Source::Base named `reload!` for updating the environments list for a given deployment; `reload!` is called before deployment purges to make r10k deploy pools more threadsafe. [#1172](https://github.com/puppetlabs/r10k/pull/1172)
|
22
|
+
- Remove username and password from remote url in cache directory name [#1186](https://github.com/puppetlabs/r10k/pull/1186)
|
23
|
+
- Purging efficiency is greatly improved. R10K will no longer recurse into directories that match recursive purge exclusions. This should significantly improve the deploy times for those users who enable the "environment" purge level. [#1178](https://github.com/puppetlabs/r10k/pull/1178)
|
24
|
+
|
25
|
+
3.9.3
|
26
|
+
-----
|
27
|
+
|
28
|
+
- Fixes a regression when using `--default_branch_override` with Puppetfiles containing Forge modules. [#1173](https://github.com/puppetlabs/r10k/issues/1173)
|
29
|
+
|
30
|
+
3.9.2
|
31
|
+
-----
|
32
|
+
|
33
|
+
- Makes the third parameter to R10K::Actions optional, restoring backwards compatability broken in 3.9.1.
|
34
|
+
|
7
35
|
3.9.1
|
8
36
|
-----
|
9
37
|
|
data/README.mkd
CHANGED
@@ -66,6 +66,12 @@ a git repository using Bundler for dependencies:
|
|
66
66
|
bundle install
|
67
67
|
bundle exec r10k help
|
68
68
|
|
69
|
+
### Arch Linux
|
70
|
+
|
71
|
+
Arch Linux provides a [system package](https://archlinux.org/packages/community/any/r10k/) for r10k.
|
72
|
+
This is built against the [system Ruby](https://archlinux.org/packages/extra/x86_64/ruby/) (which is Ruby 3.0.2 as of 2021-08-03).
|
73
|
+
This package is maintained by [Tim Meusel](https://github.com/bastelfreak).
|
74
|
+
|
69
75
|
Usage
|
70
76
|
-----
|
71
77
|
|
@@ -165,9 +165,16 @@ interactions. See the global proxy setting documentation for more information an
|
|
165
165
|
The 'baseurl' setting indicates where Forge modules should be installed from.
|
166
166
|
This defaults to 'https://forgeapi.puppetlabs.com'
|
167
167
|
|
168
|
+
#### authorization_token
|
169
|
+
|
170
|
+
The 'authorization_token' setting allows you to provide a token for authenticating to a
|
171
|
+
custom Forge server. When set, 'baseurl' must also be set.
|
172
|
+
You will need to prepend your token with 'Bearer ' if using Artifactory as your Forge server.
|
173
|
+
|
168
174
|
```yaml
|
169
175
|
forge:
|
170
176
|
baseurl: 'https://private-forge.mysite'
|
177
|
+
authorization_token: 'Bearer mysupersecretauthtoken'
|
171
178
|
```
|
172
179
|
|
173
180
|
Deployment options
|
@@ -336,6 +343,20 @@ deploy:
|
|
336
343
|
puppet_conf: '/opt/puppet/conf/puppet.conf'
|
337
344
|
```
|
338
345
|
|
346
|
+
#### exclude_spec
|
347
|
+
|
348
|
+
During module deployment, r10k's default behavior is to deploy the spec directory.
|
349
|
+
This behavior can be configured for all modules using the `exclude_spec` setting in the r10k config.
|
350
|
+
This config setting can be overridden in each module definition in the Puppetfile
|
351
|
+
or more globally via the CLI for deploys. The following example sets all modules to
|
352
|
+
not deploy the spec dir.
|
353
|
+
|
354
|
+
|
355
|
+
```yaml
|
356
|
+
deploy:
|
357
|
+
exclude_spec: true
|
358
|
+
```
|
359
|
+
|
339
360
|
Source options
|
340
361
|
--------------
|
341
362
|
|
data/doc/puppetfile.mkd
CHANGED
@@ -130,7 +130,8 @@ with a git commit, branch reference, or a tag.
|
|
130
130
|
When a module is installed using `:tag` or `:commit`, r10k assumes that the
|
131
131
|
given object is a tag or commit and can do some optimizations around fetching
|
132
132
|
the object. If the tag or commit is already available r10k will skip network
|
133
|
-
operations when updating the repo, which can speed up install times.
|
133
|
+
operations when updating the repo, which can speed up install times. When
|
134
|
+
`:ref` is set to track `HEAD`, it will synchronize the module on each run.
|
134
135
|
|
135
136
|
Module versions can also be specified using `:branch` to track a specific
|
136
137
|
branch reference.
|
@@ -312,6 +313,19 @@ module.
|
|
312
313
|
For more information see the [FAQ entry](faq.mkd#how-do-i-prevent-r10k-from-removing-modules-in-the-modules-directory-of-my-git-repository)
|
313
314
|
on managing internal and external modules in the same directory.
|
314
315
|
|
316
|
+
### Per-Item spec dir deployment
|
317
|
+
|
318
|
+
During deployment, r10k's default behavior is to deploy the spec directory. The
|
319
|
+
Puppetfile can modify this per module, overriding settings from the default
|
320
|
+
r10k config. The following example sets the module to not deploy the spec
|
321
|
+
directory.
|
322
|
+
|
323
|
+
```
|
324
|
+
mod 'apache',
|
325
|
+
:git => 'git@github.com:puppetlabs/puppetlabs-apache.git',
|
326
|
+
:exclude_spec => true
|
327
|
+
```
|
328
|
+
|
315
329
|
### Per-Item Install Path
|
316
330
|
|
317
331
|
Git and SVN content types support installing into an alternate path without changing
|
data/integration/Rakefile
CHANGED
@@ -1,4 +1,5 @@
|
|
1
1
|
require 'rototiller'
|
2
|
+
require 'fileutils'
|
2
3
|
|
3
4
|
namespace :ci do
|
4
5
|
namespace :test do
|
@@ -59,13 +60,14 @@ end
|
|
59
60
|
desc 'Generate a host configuration used by Beaker'
|
60
61
|
rototiller_task :beaker_hostgenerator do |t|
|
61
62
|
if ENV['BEAKER_HOST'].nil?
|
63
|
+
FileUtils.mkdir_p 'configs'
|
62
64
|
t.add_command do |c|
|
63
65
|
c.name = 'beaker-hostgenerator'
|
64
66
|
c.argument = '> configs/generated'
|
65
67
|
end
|
66
68
|
|
67
69
|
# This is a hack :(
|
68
|
-
t.add_flag(:name => '', :default => '
|
70
|
+
t.add_flag(:name => '', :default => 'centos7-64mdca-64.fa', :override_env => 'TEST_TARGET')
|
69
71
|
|
70
72
|
t.add_flag(:name => '--global-config', :default => '{forge_host=forge-aio01-petest.puppetlabs.com}', :override_env => 'BHG_GLOBAL_CONFIG')
|
71
73
|
end
|
data/integration/tests/user_scenario/basic_workflow/negative/neg_specify_deleted_forge_module.rb
CHANGED
@@ -10,7 +10,7 @@ last_commit = git_last_commit(master, git_environments_path)
|
|
10
10
|
r10k_fqp = get_r10k_fqp(master)
|
11
11
|
|
12
12
|
#Verification
|
13
|
-
error_notification_regex = /
|
13
|
+
error_notification_regex = /The module puppetlabs-regret does not appear to have any published releases/
|
14
14
|
|
15
15
|
#File
|
16
16
|
puppet_file = <<-PUPPETFILE
|
@@ -40,12 +40,6 @@ git_add_commit_push(master, 'production', 'Add module.', git_environments_path)
|
|
40
40
|
|
41
41
|
#Tests
|
42
42
|
step "Deploy production environment via r10k with specified module deleted"
|
43
|
-
on(master, "#{r10k_fqp} deploy environment -p -v", :acceptable_exit_codes => 1) do |result|
|
44
|
-
|
45
|
-
assert_match(error_notification_regex, result.stderr, 'Unexpected error was detected!')
|
46
|
-
else
|
47
|
-
expect_failure('expected to fail due to RK-135') do
|
48
|
-
assert_match(error_notification_regex, result.stderr, 'Unexpected error was detected!')
|
49
|
-
end
|
50
|
-
end
|
43
|
+
on(master, "#{r10k_fqp} deploy environment -p -v --trace", :acceptable_exit_codes => 1) do |result|
|
44
|
+
assert_match(error_notification_regex, result.stderr, 'Unexpected error was detected!')
|
51
45
|
end
|
@@ -1,12 +1,15 @@
|
|
1
1
|
require 'git_utils'
|
2
2
|
require 'r10k_utils'
|
3
3
|
require 'master_manipulator'
|
4
|
-
test_name 'CODEMGMT-
|
4
|
+
test_name 'CODEMGMT-78 - Puppetfile Purge --puppetfile & --moduledir flag usage'
|
5
5
|
|
6
6
|
#Init
|
7
7
|
master_certname = on(master, puppet('config', 'print', 'certname')).stdout.rstrip
|
8
|
-
|
9
|
-
|
8
|
+
environments_path = on(master, puppet('config', 'print', 'environmentpath')).stdout.strip
|
9
|
+
moduledir = File.join(environments_path, 'production', 'modules')
|
10
|
+
puppetfile_path = File.join(environments_path, 'production', 'Puppetfile')
|
11
|
+
git_remote_environments_path = '/root/environments'
|
12
|
+
last_commit = git_last_commit(master, git_remote_environments_path)
|
10
13
|
r10k_fqp = get_r10k_fqp(master)
|
11
14
|
|
12
15
|
#Verification
|
@@ -14,14 +17,12 @@ motd_path = '/etc/motd'
|
|
14
17
|
motd_contents = 'Hello!'
|
15
18
|
motd_contents_regex = /\A#{motd_contents}\z/
|
16
19
|
|
17
|
-
error_message_regex = /Blah/
|
18
|
-
|
19
20
|
#File
|
20
|
-
|
21
|
+
puppetfile = <<-PUPPETFILE
|
21
22
|
mod "puppetlabs/xinetd"
|
22
23
|
PUPPETFILE
|
23
24
|
|
24
|
-
|
25
|
+
remote_puppetfile_path = File.join(git_remote_environments_path, 'Puppetfile')
|
25
26
|
|
26
27
|
#Manifest
|
27
28
|
manifest = <<-MANIFEST
|
@@ -30,12 +31,12 @@ manifest = <<-MANIFEST
|
|
30
31
|
}
|
31
32
|
MANIFEST
|
32
33
|
|
33
|
-
|
34
|
+
remote_site_pp_path = File.join(git_remote_environments_path, 'manifests', 'site.pp')
|
34
35
|
site_pp = create_site_pp(master_certname, manifest)
|
35
36
|
|
36
37
|
#Teardown
|
37
38
|
teardown do
|
38
|
-
clean_up_r10k(master, last_commit,
|
39
|
+
clean_up_r10k(master, last_commit, git_remote_environments_path)
|
39
40
|
|
40
41
|
step 'Remove "/etc/motd" File'
|
41
42
|
on(agents, "rm -rf #{motd_path}")
|
@@ -46,27 +47,24 @@ step 'Stub Forge on Master'
|
|
46
47
|
stub_forge_on(master)
|
47
48
|
|
48
49
|
step 'Checkout "production" Branch'
|
49
|
-
git_on(master, 'checkout production',
|
50
|
-
|
51
|
-
step 'Manually Install the "motd" Module from the Forge'
|
52
|
-
on(master, puppet('module install puppetlabs-motd'))
|
50
|
+
git_on(master, 'checkout production', git_remote_environments_path)
|
53
51
|
|
54
52
|
step 'Create "Puppetfile" for the "production" Environment'
|
55
|
-
create_remote_file(master,
|
53
|
+
create_remote_file(master, remote_puppetfile_path, puppetfile)
|
56
54
|
|
57
55
|
step 'Inject New "site.pp" to the "production" Environment'
|
58
|
-
inject_site_pp(master,
|
56
|
+
inject_site_pp(master, remote_site_pp_path, site_pp)
|
59
57
|
|
60
58
|
step 'Push Changes'
|
61
|
-
git_add_commit_push(master, 'production', 'Update site.pp and add module.',
|
59
|
+
git_add_commit_push(master, 'production', 'Update site.pp and add module.', git_remote_environments_path)
|
62
60
|
|
63
|
-
#Tests
|
64
61
|
step 'Deploy Environments via r10k'
|
65
|
-
on(master, "#{r10k_fqp} deploy environment
|
62
|
+
on(master, "#{r10k_fqp} deploy environment --modules --verbose debug --trace")
|
66
63
|
|
67
|
-
step '
|
68
|
-
on(
|
64
|
+
step 'Manually Install the "motd" Module from the Forge'
|
65
|
+
on(master, puppet("module install puppetlabs-motd --modulepath #{moduledir}"))
|
69
66
|
|
67
|
+
#Tests
|
70
68
|
agents.each do |agent|
|
71
69
|
step 'Run Puppet Agent Against "production" Environment'
|
72
70
|
on(agent, puppet('agent', '--test', '--environment production'), :acceptable_exit_codes => 2) do |result|
|
@@ -80,14 +78,12 @@ agents.each do |agent|
|
|
80
78
|
end
|
81
79
|
|
82
80
|
step 'Use r10k to Purge Unmanaged Modules'
|
83
|
-
on(master, "#{r10k_fqp} puppetfile purge
|
81
|
+
on(master, "#{r10k_fqp} puppetfile purge --puppetfile #{puppetfile_path} --moduledir #{moduledir} --verbose debug --trace")
|
84
82
|
|
85
83
|
#Agent will fail because r10k will purge the "motd" module
|
86
84
|
agents.each do |agent|
|
87
85
|
step 'Attempt to Run Puppet Agent'
|
88
|
-
on(agent, puppet('agent', '--test', '--environment production'), :acceptable_exit_codes =>
|
89
|
-
|
90
|
-
assert_match(error_message_regex, result.stderr, 'Expected error was not detected!')
|
91
|
-
end
|
86
|
+
on(agent, puppet('agent', '--test', '--environment production'), :acceptable_exit_codes => 1) do |result|
|
87
|
+
assert_match(/Could not find declared class motd/, result.stderr, 'Module was not purged')
|
92
88
|
end
|
93
89
|
end
|
@@ -24,7 +24,7 @@ stage_env_notify_message = 'This is a different message'
|
|
24
24
|
stage_env_notify_message_regex = /#{stage_env_notify_message}/
|
25
25
|
|
26
26
|
#Verification for "test" Environment
|
27
|
-
|
27
|
+
test_env_message_regex = /Environment 'test' not found on server/
|
28
28
|
|
29
29
|
#Verification for "temp" Environment
|
30
30
|
test_env_notify_message_regex = /I am in the temp environment/
|
@@ -157,7 +157,7 @@ agents.each do |agent|
|
|
157
157
|
end
|
158
158
|
|
159
159
|
step 'Attempt to Run Puppet Agent Against "test" Environment'
|
160
|
-
on(agent, puppet('agent', '--test', '--environment test'), :acceptable_exit_codes =>
|
161
|
-
assert_match(
|
160
|
+
on(agent, puppet('agent', '--test', '--environment test'), :acceptable_exit_codes => 2) do |result|
|
161
|
+
assert_match(test_env_message_regex, result.stdout, 'Expected message not found!')
|
162
162
|
end
|
163
163
|
end
|
@@ -15,7 +15,7 @@ initial_env_names = ['production', 'stage']
|
|
15
15
|
|
16
16
|
#Verification
|
17
17
|
notify_message_regex = /I am in the production environment/
|
18
|
-
|
18
|
+
stage_env_message_regex = /Environment 'stage' not found on server/
|
19
19
|
|
20
20
|
#Manifest
|
21
21
|
site_pp_path = File.join(git_environments_path, 'manifests', 'site.pp')
|
@@ -83,8 +83,8 @@ agents.each do |agent|
|
|
83
83
|
end
|
84
84
|
|
85
85
|
step 'Attempt to Run Puppet Agent Against "stage" Environment'
|
86
|
-
on(agent, puppet('agent', '--test', '--environment stage'), :acceptable_exit_codes =>
|
87
|
-
assert_match(
|
86
|
+
on(agent, puppet('agent', '--test', '--environment stage'), :acceptable_exit_codes => 2) do |result|
|
87
|
+
assert_match(stage_env_message_regex, result.stdout, 'Expected message not found!')
|
88
88
|
end
|
89
89
|
end
|
90
90
|
|
@@ -22,7 +22,7 @@ site_pp = create_site_pp(master_certname, ' include helloworld')
|
|
22
22
|
notify_message_prod_env_regex = /I am in the production environment/
|
23
23
|
notify_message_test_env_regex = /I am in the test environment/
|
24
24
|
removal_message_test_env_regex = /Removing unmanaged path.*test/
|
25
|
-
|
25
|
+
missing_message_regex = /Environment 'test' not found on server/
|
26
26
|
|
27
27
|
#Teardown
|
28
28
|
teardown do
|
@@ -72,7 +72,7 @@ end
|
|
72
72
|
|
73
73
|
agents.each do |agent|
|
74
74
|
step 'Run Puppet Agent Against "test" Environment'
|
75
|
-
on(agent, puppet('agent', '--test', '--environment test'), :acceptable_exit_codes =>
|
76
|
-
assert_match(
|
75
|
+
on(agent, puppet('agent', '--test', '--environment test'), :acceptable_exit_codes => 2) do |result|
|
76
|
+
assert_match(missing_message_regex, result.stdout, 'Expected message not found!')
|
77
77
|
end
|
78
78
|
end
|
data/lib/r10k/action/base.rb
CHANGED
@@ -13,11 +13,14 @@ module R10K
|
|
13
13
|
# @param opts [Hash] A hash of options defined in #allowed_initialized_opts
|
14
14
|
# and managed by the SetOps mixin within the Action::Base class.
|
15
15
|
# Corresponds to the CLI flags and options.
|
16
|
-
# @param argv [CRI::ArgumentList
|
17
|
-
# arguments to the CLI invocation (after
|
16
|
+
# @param argv [Enumerable] Typically CRI::ArgumentList or Array. A list-like
|
17
|
+
# collection of the remaining arguments to the CLI invocation (after
|
18
|
+
# removing flags and options).
|
18
19
|
# @param settings [Hash] A hash of configuration loaded from the relevant
|
19
20
|
# config (r10k.yaml).
|
20
|
-
|
21
|
+
#
|
22
|
+
# @note All arguments will be required in the next major version
|
23
|
+
def initialize(opts, argv, settings = {})
|
21
24
|
@opts = opts
|
22
25
|
@argv = argv
|
23
26
|
@settings = settings
|
@@ -12,11 +12,14 @@ module R10K
|
|
12
12
|
# @param opts [Hash] A hash of options defined in #allowed_initialized_opts
|
13
13
|
# and managed by the SetOps mixin within the Action::Base class.
|
14
14
|
# Corresponds to the CLI flags and options.
|
15
|
-
# @param argv [CRI::ArgumentList
|
16
|
-
# arguments to the CLI invocation (after
|
15
|
+
# @param argv [Enumerable] Typically CRI::ArgumentList or Array. A list-like
|
16
|
+
# collection of the remaining arguments to the CLI invocation (after
|
17
|
+
# removing flags and options).
|
17
18
|
# @param settings [Hash] A hash of configuration loaded from the relevant
|
18
19
|
# config (r10k.yaml).
|
19
|
-
|
20
|
+
#
|
21
|
+
# @note All arguments will be required in the next major version
|
22
|
+
def initialize(opts, argv, settings = {})
|
20
23
|
super
|
21
24
|
|
22
25
|
@settings = @settings.merge({
|
@@ -22,11 +22,14 @@ module R10K
|
|
22
22
|
# @param opts [Hash] A hash of options defined in #allowed_initialized_opts
|
23
23
|
# and managed by the SetOps mixin within the Action::Base class.
|
24
24
|
# Corresponds to the CLI flags and options.
|
25
|
-
# @param argv [CRI::ArgumentList
|
26
|
-
# arguments to the CLI invocation (after
|
25
|
+
# @param argv [Enumerable] Typically CRI::ArgumentList or Array. A list-like
|
26
|
+
# collection of the remaining arguments to the CLI invocation (after
|
27
|
+
# removing flags and options).
|
27
28
|
# @param settings [Hash] A hash of configuration loaded from the relevant
|
28
29
|
# config (r10k.yaml).
|
29
|
-
|
30
|
+
#
|
31
|
+
# @note All arguments will be required in the next major version
|
32
|
+
def initialize(opts, argv, settings = {})
|
30
33
|
super
|
31
34
|
|
32
35
|
# instance variables below are set by the super class based on the
|
@@ -41,6 +44,7 @@ module R10K
|
|
41
44
|
preload_environments: true
|
42
45
|
},
|
43
46
|
modules: {
|
47
|
+
exclude_spec: settings.dig(:deploy, :exclude_spec),
|
44
48
|
requested_modules: [],
|
45
49
|
deploy_modules: @modules,
|
46
50
|
force: !@no_force, # force here is used to make it easier to reason about
|
@@ -113,6 +117,9 @@ module R10K
|
|
113
117
|
|
114
118
|
if @settings.dig(:overrides, :purging, :purge_levels).include?(:deployment)
|
115
119
|
logger.debug("Purging unmanaged environments for deployment...")
|
120
|
+
deployment.sources.each do |source|
|
121
|
+
source.reload!
|
122
|
+
end
|
116
123
|
deployment.purge!
|
117
124
|
end
|
118
125
|
ensure
|
@@ -231,12 +238,16 @@ module R10K
|
|
231
238
|
modules: :self,
|
232
239
|
cachedir: :self,
|
233
240
|
'no-force': :self,
|
241
|
+
'exclude-spec': :self,
|
234
242
|
'generate-types': :self,
|
235
243
|
'puppet-path': :self,
|
236
244
|
'puppet-conf': :self,
|
237
245
|
'private-key': :self,
|
238
246
|
'oauth-token': :self,
|
239
|
-
'default-branch-override': :self
|
247
|
+
'default-branch-override': :self,
|
248
|
+
'github-app-id': :self,
|
249
|
+
'github-app-key': :self,
|
250
|
+
'github-app-ttl': :self)
|
240
251
|
end
|
241
252
|
end
|
242
253
|
end
|