r10k 3.10.0 → 3.11.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.
- checksums.yaml +4 -4
- data/.travis.yml +0 -10
- data/CHANGELOG.mkd +9 -0
- data/README.mkd +6 -0
- data/doc/dynamic-environments/configuration.mkd +14 -0
- data/doc/puppetfile.mkd +15 -1
- data/integration/Rakefile +2 -0
- data/integration/tests/user_scenario/basic_workflow/single_env_purge_unmanaged_modules.rb +15 -13
- 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/deploy/environment.rb +6 -1
- data/lib/r10k/action/deploy/module.rb +31 -5
- data/lib/r10k/action/runner.rb +34 -4
- data/lib/r10k/cli/deploy.rb +4 -0
- data/lib/r10k/git.rb +3 -0
- data/lib/r10k/git/rugged/credentials.rb +77 -0
- data/lib/r10k/git/stateful_repository.rb +1 -0
- data/lib/r10k/initializers.rb +3 -0
- data/lib/r10k/module/base.rb +37 -0
- data/lib/r10k/module/forge.rb +1 -0
- data/lib/r10k/module/git.rb +1 -0
- data/lib/r10k/module/svn.rb +1 -0
- data/lib/r10k/module_loader/puppetfile.rb +15 -4
- data/lib/r10k/puppetfile.rb +10 -11
- data/lib/r10k/settings.rb +44 -2
- data/lib/r10k/settings/definition.rb +1 -1
- data/lib/r10k/version.rb +1 -1
- data/locales/r10k.pot +106 -38
- data/r10k.gemspec +2 -0
- data/spec/unit/action/deploy/environment_spec.rb +16 -0
- data/spec/unit/action/deploy/module_spec.rb +178 -0
- data/spec/unit/action/runner_spec.rb +80 -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 +19 -0
- data/spec/unit/module/git_spec.rb +17 -0
- data/spec/unit/module/svn_spec.rb +18 -0
- data/spec/unit/module_loader/puppetfile_spec.rb +16 -3
- data/spec/unit/module_spec.rb +12 -1
- data/spec/unit/puppetfile_spec.rb +31 -1
- data/spec/unit/settings_spec.rb +18 -0
- metadata +16 -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
|
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,15 @@ 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
|
+
|
7
16
|
3.10.0
|
8
17
|
------
|
9
18
|
|
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
|
|
@@ -343,6 +343,20 @@ deploy:
|
|
343
343
|
puppet_conf: '/opt/puppet/conf/puppet.conf'
|
344
344
|
```
|
345
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
|
+
|
346
360
|
Source options
|
347
361
|
--------------
|
348
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,6 +60,7 @@ 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'
|
@@ -5,9 +5,11 @@ 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
|
-
|
10
|
-
|
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)
|
11
13
|
r10k_fqp = get_r10k_fqp(master)
|
12
14
|
|
13
15
|
#Verification
|
@@ -16,11 +18,11 @@ motd_contents = 'Hello!'
|
|
16
18
|
motd_contents_regex = /\A#{motd_contents}\z/
|
17
19
|
|
18
20
|
#File
|
19
|
-
|
21
|
+
puppetfile = <<-PUPPETFILE
|
20
22
|
mod "puppetlabs/xinetd"
|
21
23
|
PUPPETFILE
|
22
24
|
|
23
|
-
|
25
|
+
remote_puppetfile_path = File.join(git_remote_environments_path, 'Puppetfile')
|
24
26
|
|
25
27
|
#Manifest
|
26
28
|
manifest = <<-MANIFEST
|
@@ -29,12 +31,12 @@ manifest = <<-MANIFEST
|
|
29
31
|
}
|
30
32
|
MANIFEST
|
31
33
|
|
32
|
-
|
34
|
+
remote_site_pp_path = File.join(git_remote_environments_path, 'manifests', 'site.pp')
|
33
35
|
site_pp = create_site_pp(master_certname, manifest)
|
34
36
|
|
35
37
|
#Teardown
|
36
38
|
teardown do
|
37
|
-
clean_up_r10k(master, last_commit,
|
39
|
+
clean_up_r10k(master, last_commit, git_remote_environments_path)
|
38
40
|
|
39
41
|
step 'Remove "/etc/motd" File'
|
40
42
|
on(agents, "rm -rf #{motd_path}")
|
@@ -45,19 +47,19 @@ step 'Stub Forge on Master'
|
|
45
47
|
stub_forge_on(master)
|
46
48
|
|
47
49
|
step 'Checkout "production" Branch'
|
48
|
-
git_on(master, 'checkout production',
|
50
|
+
git_on(master, 'checkout production', git_remote_environments_path)
|
49
51
|
|
50
52
|
step 'Create "Puppetfile" for the "production" Environment'
|
51
|
-
create_remote_file(master,
|
53
|
+
create_remote_file(master, remote_puppetfile_path, puppetfile)
|
52
54
|
|
53
55
|
step 'Inject New "site.pp" to the "production" Environment'
|
54
|
-
inject_site_pp(master,
|
56
|
+
inject_site_pp(master, remote_site_pp_path, site_pp)
|
55
57
|
|
56
58
|
step 'Push Changes'
|
57
|
-
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)
|
58
60
|
|
59
61
|
step 'Deploy Environments via r10k'
|
60
|
-
on(master, "#{r10k_fqp} deploy environment
|
62
|
+
on(master, "#{r10k_fqp} deploy environment --modules --verbose debug --trace")
|
61
63
|
|
62
64
|
step 'Manually Install the "motd" Module from the Forge'
|
63
65
|
on(master, puppet("module install puppetlabs-motd --modulepath #{moduledir}"))
|
@@ -76,7 +78,7 @@ agents.each do |agent|
|
|
76
78
|
end
|
77
79
|
|
78
80
|
step 'Use r10k to Purge Unmanaged Modules'
|
79
|
-
on(master, "#{r10k_fqp} puppetfile purge
|
81
|
+
on(master, "#{r10k_fqp} puppetfile purge --puppetfile #{puppetfile_path} --moduledir #{moduledir} --verbose debug --trace")
|
80
82
|
|
81
83
|
#Agent will fail because r10k will purge the "motd" module
|
82
84
|
agents.each do |agent|
|
@@ -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
|
@@ -44,6 +44,7 @@ module R10K
|
|
44
44
|
preload_environments: true
|
45
45
|
},
|
46
46
|
modules: {
|
47
|
+
exclude_spec: settings.dig(:deploy, :exclude_spec),
|
47
48
|
requested_modules: [],
|
48
49
|
deploy_modules: @modules,
|
49
50
|
force: !@no_force, # force here is used to make it easier to reason about
|
@@ -237,12 +238,16 @@ module R10K
|
|
237
238
|
modules: :self,
|
238
239
|
cachedir: :self,
|
239
240
|
'no-force': :self,
|
241
|
+
'exclude-spec': :self,
|
240
242
|
'generate-types': :self,
|
241
243
|
'puppet-path': :self,
|
242
244
|
'puppet-conf': :self,
|
243
245
|
'private-key': :self,
|
244
246
|
'oauth-token': :self,
|
245
|
-
'default-branch-override': :self
|
247
|
+
'default-branch-override': :self,
|
248
|
+
'github-app-id': :self,
|
249
|
+
'github-app-key': :self,
|
250
|
+
'github-app-ttl': :self)
|
246
251
|
end
|
247
252
|
end
|
248
253
|
end
|
@@ -29,6 +29,7 @@ module R10K
|
|
29
29
|
super
|
30
30
|
|
31
31
|
requested_env = @opts[:environment] ? [@opts[:environment].gsub(/\W/, '_')] : []
|
32
|
+
@modified_envs = []
|
32
33
|
|
33
34
|
@settings = @settings.merge({
|
34
35
|
overrides: {
|
@@ -37,6 +38,7 @@ module R10K
|
|
37
38
|
generate_types: @generate_types
|
38
39
|
},
|
39
40
|
modules: {
|
41
|
+
exclude_spec: settings.dig(:deploy, :exclude_spec),
|
40
42
|
requested_modules: @argv.map.to_a,
|
41
43
|
# force here is used to make it easier to reason about
|
42
44
|
force: !@no_force
|
@@ -69,6 +71,21 @@ module R10K
|
|
69
71
|
|
70
72
|
def visit_deployment(deployment)
|
71
73
|
yield
|
74
|
+
ensure
|
75
|
+
if (postcmd = @settings[:postrun])
|
76
|
+
if @modified_envs.any?
|
77
|
+
if postcmd.grep('$modifiedenvs').any?
|
78
|
+
envs_to_run = @modified_envs.join(' ')
|
79
|
+
logger.debug "Running postrun command for environments #{envs_to_run}."
|
80
|
+
postcmd = postcmd.map { |e| e.gsub('$modifiedenvs', envs_to_run) }
|
81
|
+
end
|
82
|
+
subproc = R10K::Util::Subprocess.new(postcmd)
|
83
|
+
subproc.logger = logger
|
84
|
+
subproc.execute
|
85
|
+
else
|
86
|
+
logger.debug "No environments were modified, not executing postrun command."
|
87
|
+
end
|
88
|
+
end
|
72
89
|
end
|
73
90
|
|
74
91
|
def visit_source(source)
|
@@ -85,10 +102,15 @@ module R10K
|
|
85
102
|
environment.deploy
|
86
103
|
|
87
104
|
requested_mods = @settings.dig(:overrides, :modules, :requested_modules) || []
|
88
|
-
|
89
|
-
if
|
90
|
-
|
91
|
-
environment.
|
105
|
+
# We actually synced a module in this env
|
106
|
+
if !((environment.modules.map(&:name) & requested_mods).empty?)
|
107
|
+
# Record modified environment for postrun command
|
108
|
+
@modified_envs << environment.dirname
|
109
|
+
|
110
|
+
if generate_types = @settings.dig(:overrides, :environments, :generate_types)
|
111
|
+
logger.debug("Generating puppet types for environment '#{environment.dirname}'...")
|
112
|
+
environment.generate_types!
|
113
|
+
end
|
92
114
|
end
|
93
115
|
end
|
94
116
|
end
|
@@ -96,12 +118,16 @@ module R10K
|
|
96
118
|
def allowed_initialize_opts
|
97
119
|
super.merge(environment: true,
|
98
120
|
cachedir: :self,
|
121
|
+
'exclude-spec': :self,
|
99
122
|
'no-force': :self,
|
100
123
|
'generate-types': :self,
|
101
124
|
'puppet-path': :self,
|
102
125
|
'puppet-conf': :self,
|
103
126
|
'private-key': :self,
|
104
|
-
'oauth-token': :self
|
127
|
+
'oauth-token': :self,
|
128
|
+
'github-app-id': :self,
|
129
|
+
'github-app-key': :self,
|
130
|
+
'github-app-ttl': :self)
|
105
131
|
end
|
106
132
|
end
|
107
133
|
end
|
data/lib/r10k/action/runner.rb
CHANGED
@@ -44,10 +44,13 @@ module R10K
|
|
44
44
|
|
45
45
|
overrides = {}
|
46
46
|
overrides[:cachedir] = @opts[:cachedir] if @opts.key?(:cachedir)
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
|
47
|
+
if @opts.key?(:'puppet-path') || @opts.key?(:'generate-types') || @opts.key?(:'exclude-spec') || @opts.key?(:'puppet-conf')
|
48
|
+
overrides[:deploy] = {}
|
49
|
+
overrides[:deploy][:puppet_path] = @opts[:'puppet-path'] if @opts.key?(:'puppet-path')
|
50
|
+
overrides[:deploy][:puppet_conf] = @opts[:'puppet-conf'] if @opts.key?(:'puppet-conf')
|
51
|
+
overrides[:deploy][:generate_types] = @opts[:'generate-types'] if @opts.key?(:'generate-types')
|
52
|
+
overrides[:deploy][:exclude_spec] = @opts[:'exclude-spec'] if @opts.key?(:'exclude-spec')
|
53
|
+
end
|
51
54
|
|
52
55
|
with_overrides = config_settings.merge(overrides) do |key, oldval, newval|
|
53
56
|
newval = oldval.merge(newval) if oldval.is_a? Hash
|
@@ -105,11 +108,26 @@ module R10K
|
|
105
108
|
def add_credential_overrides(overrides)
|
106
109
|
sshkey_path = @opts[:'private-key']
|
107
110
|
token_path = @opts[:'oauth-token']
|
111
|
+
app_id = @opts[:'github-app-id']
|
112
|
+
app_private_key_path = @opts[:'github-app-key']
|
113
|
+
app_ttl = @opts[:'github-app-ttl']
|
108
114
|
|
109
115
|
if sshkey_path && token_path
|
110
116
|
raise R10K::Error, "Cannot specify both an SSH key and a token to use with this deploy."
|
111
117
|
end
|
112
118
|
|
119
|
+
if sshkey_path && (app_private_key_path || app_id)
|
120
|
+
raise R10K::Error, "Cannot specify both an SSH key and an SSL key or Github App id to use with this deploy."
|
121
|
+
end
|
122
|
+
|
123
|
+
if token_path && (app_private_key_path || app_id)
|
124
|
+
raise R10K::Error, "Cannot specify both an OAuth token and an SSL key or Github App id to use with this deploy."
|
125
|
+
end
|
126
|
+
|
127
|
+
if app_id && ! app_private_key_path || app_private_key_path && ! app_id
|
128
|
+
raise R10K::Error, "Must specify both id and SSL private key to use Github App for this deploy."
|
129
|
+
end
|
130
|
+
|
113
131
|
if sshkey_path
|
114
132
|
overrides[:git] ||= {}
|
115
133
|
overrides[:git][:private_key] = sshkey_path
|
@@ -126,6 +144,18 @@ module R10K
|
|
126
144
|
repo[:oauth_token] = token_path
|
127
145
|
end
|
128
146
|
end
|
147
|
+
elsif app_id
|
148
|
+
overrides[:git] ||= {}
|
149
|
+
overrides[:git][:github_app_id] = app_id
|
150
|
+
overrides[:git][:github_app_key] = app_private_key_path
|
151
|
+
overrides[:git][:github_app_ttl] = app_ttl
|
152
|
+
if repo_settings = overrides[:git][:repositories]
|
153
|
+
repo_settings.each do |repo|
|
154
|
+
repo[:github_app_id] = app_id
|
155
|
+
repo[:github_app_key] = app_private_key_path
|
156
|
+
repo[:github_app_ttl] = app_ttl
|
157
|
+
end
|
158
|
+
end
|
129
159
|
end
|
130
160
|
|
131
161
|
overrides
|
data/lib/r10k/cli/deploy.rb
CHANGED
@@ -24,6 +24,7 @@ module R10K::CLI
|
|
24
24
|
option nil, :cachedir, 'Specify a cachedir, overriding the value in config', argument: :required
|
25
25
|
flag nil, :'no-force', 'Prevent the overwriting of local module modifications'
|
26
26
|
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'
|
27
28
|
option nil, :'puppet-path', 'Path to puppet executable', argument: :required do |value, cmd|
|
28
29
|
unless File.executable? value
|
29
30
|
$stderr.puts "The specified puppet executable #{value} is not executable."
|
@@ -34,6 +35,9 @@ module R10K::CLI
|
|
34
35
|
option nil, :'puppet-conf', 'Path to puppet.conf', argument: :required
|
35
36
|
option nil, :'private-key', 'Path to SSH key to use when cloning. Only valid with rugged provider', argument: :required
|
36
37
|
option nil, :'oauth-token', 'Path to OAuth token to use when cloning. Only valid with rugged provider', argument: :required
|
38
|
+
option nil, :'github-app-id', 'Github App id. Only valid with rugged provider', argument: :required
|
39
|
+
option nil, :'github-app-key', 'Github App private key. Only valid with rugged provider', argument: :required
|
40
|
+
option nil, :'github-app-ttl', 'Github App token expiration, in seconds. Only valid with rugged provider', default: "120", argument: :optional
|
37
41
|
|
38
42
|
run do |opts, args, cmd|
|
39
43
|
puts cmd.help(:verbose => opts[:verbose])
|