r10k 3.9.2 → 3.12.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 +33 -0
- data/README.mkd +6 -0
- data/doc/dynamic-environments/configuration.mkd +25 -0
- data/doc/dynamic-environments/usage.mkd +26 -0
- data/doc/puppetfile.mkd +18 -5
- data/integration/Rakefile +3 -1
- data/integration/tests/basic_functionality/basic_deployment.rb +176 -0
- 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/deploy/environment.rb +17 -2
- data/lib/r10k/action/deploy/module.rb +38 -7
- data/lib/r10k/action/puppetfile/check.rb +7 -5
- data/lib/r10k/action/puppetfile/install.rb +22 -16
- data/lib/r10k/action/puppetfile/purge.rb +12 -9
- data/lib/r10k/action/runner.rb +45 -10
- data/lib/r10k/cli/deploy.rb +5 -0
- data/lib/r10k/cli/puppetfile.rb +0 -1
- data/lib/r10k/content_synchronizer.rb +16 -4
- data/lib/r10k/environment/base.rb +64 -11
- data/lib/r10k/environment/with_modules.rb +6 -10
- data/lib/r10k/git/cache.rb +1 -1
- data/lib/r10k/git/rugged/credentials.rb +77 -0
- data/lib/r10k/git/stateful_repository.rb +8 -0
- data/lib/r10k/git.rb +3 -0
- data/lib/r10k/initializers.rb +4 -0
- data/lib/r10k/module/base.rb +42 -1
- data/lib/r10k/module/definition.rb +64 -0
- data/lib/r10k/module/forge.rb +17 -4
- data/lib/r10k/module/git.rb +24 -2
- data/lib/r10k/module/local.rb +2 -3
- data/lib/r10k/module/svn.rb +12 -1
- data/lib/r10k/module.rb +20 -2
- data/lib/r10k/module_loader/puppetfile/dsl.rb +42 -0
- data/lib/r10k/module_loader/puppetfile.rb +272 -0
- data/lib/r10k/puppetfile.rb +82 -160
- data/lib/r10k/settings/definition.rb +1 -1
- data/lib/r10k/settings.rb +58 -2
- 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 +165 -65
- 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/puppetfile/forge-override/Puppetfile +8 -0
- data/spec/fixtures/unit/puppetfile/various-modules/Puppetfile +9 -0
- data/spec/fixtures/unit/puppetfile/various-modules/Puppetfile.new +9 -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/r10k-mocks/mock_env.rb +3 -0
- data/spec/r10k-mocks/mock_source.rb +7 -3
- data/spec/unit/action/deploy/environment_spec.rb +105 -30
- data/spec/unit/action/deploy/module_spec.rb +232 -42
- data/spec/unit/action/puppetfile/check_spec.rb +17 -5
- data/spec/unit/action/puppetfile/install_spec.rb +42 -36
- data/spec/unit/action/puppetfile/purge_spec.rb +15 -17
- data/spec/unit/action/runner_spec.rb +122 -26
- data/spec/unit/environment/base_spec.rb +30 -17
- data/spec/unit/environment/git_spec.rb +2 -2
- data/spec/unit/environment/svn_spec.rb +4 -3
- data/spec/unit/environment/with_modules_spec.rb +2 -1
- 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 +54 -8
- data/spec/unit/module/forge_spec.rb +59 -5
- data/spec/unit/module/git_spec.rb +67 -17
- data/spec/unit/module/svn_spec.rb +35 -5
- data/spec/unit/module_loader/puppetfile_spec.rb +403 -0
- data/spec/unit/module_spec.rb +28 -0
- data/spec/unit/puppetfile_spec.rb +125 -189
- data/spec/unit/settings_spec.rb +47 -2
- data/spec/unit/util/purgeable_spec.rb +38 -6
- metadata +28 -2
@@ -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
|
@@ -41,11 +41,14 @@ module R10K
|
|
41
41
|
requested_environments: @argv.map { |arg| arg.gsub(/\W/,'_') },
|
42
42
|
default_branch_override: @default_branch_override,
|
43
43
|
generate_types: @generate_types || settings.dig(:deploy, :generate_types) || false,
|
44
|
-
preload_environments: true
|
44
|
+
preload_environments: true,
|
45
|
+
incremental: @incremental
|
45
46
|
},
|
46
47
|
modules: {
|
48
|
+
exclude_spec: settings.dig(:deploy, :exclude_spec),
|
47
49
|
requested_modules: [],
|
48
50
|
deploy_modules: @modules,
|
51
|
+
pool_size: @settings[:pool_size] || 4,
|
49
52
|
force: !@no_force, # force here is used to make it easier to reason about
|
50
53
|
},
|
51
54
|
purging: {
|
@@ -53,6 +56,9 @@ module R10K
|
|
53
56
|
purge_allowlist: read_purge_allowlist(settings.dig(:deploy, :purge_whitelist) || [],
|
54
57
|
settings.dig(:deploy, :purge_allowlist) || [])
|
55
58
|
},
|
59
|
+
forge: {
|
60
|
+
allow_puppetfile_override: settings.dig(:forge, :allow_puppetfile_override) || false
|
61
|
+
},
|
56
62
|
output: {}
|
57
63
|
}
|
58
64
|
})
|
@@ -116,6 +122,9 @@ module R10K
|
|
116
122
|
|
117
123
|
if @settings.dig(:overrides, :purging, :purge_levels).include?(:deployment)
|
118
124
|
logger.debug("Purging unmanaged environments for deployment...")
|
125
|
+
deployment.sources.each do |source|
|
126
|
+
source.reload!
|
127
|
+
end
|
119
128
|
deployment.purge!
|
120
129
|
end
|
121
130
|
ensure
|
@@ -126,6 +135,7 @@ module R10K
|
|
126
135
|
envs.reject! { |e| !requested_envs.include?(e) } if requested_envs.any?
|
127
136
|
postcmd = postcmd.map { |e| e.gsub('$modifiedenvs', envs.join(' ')) }
|
128
137
|
end
|
138
|
+
logger.debug _("Executing postrun command.")
|
129
139
|
subproc = R10K::Util::Subprocess.new(postcmd)
|
130
140
|
subproc.logger = logger
|
131
141
|
subproc.execute
|
@@ -233,13 +243,18 @@ module R10K
|
|
233
243
|
super.merge(puppetfile: :modules,
|
234
244
|
modules: :self,
|
235
245
|
cachedir: :self,
|
246
|
+
incremental: :self,
|
236
247
|
'no-force': :self,
|
248
|
+
'exclude-spec': :self,
|
237
249
|
'generate-types': :self,
|
238
250
|
'puppet-path': :self,
|
239
251
|
'puppet-conf': :self,
|
240
252
|
'private-key': :self,
|
241
253
|
'oauth-token': :self,
|
242
|
-
'default-branch-override': :self
|
254
|
+
'default-branch-override': :self,
|
255
|
+
'github-app-id': :self,
|
256
|
+
'github-app-key': :self,
|
257
|
+
'github-app-ttl': :self)
|
243
258
|
end
|
244
259
|
end
|
245
260
|
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,10 +38,15 @@ module R10K
|
|
37
38
|
generate_types: @generate_types
|
38
39
|
},
|
39
40
|
modules: {
|
41
|
+
exclude_spec: settings.dig(:deploy, :exclude_spec),
|
42
|
+
pool_size: @settings[:pool_size] || 4,
|
40
43
|
requested_modules: @argv.map.to_a,
|
41
44
|
# force here is used to make it easier to reason about
|
42
45
|
force: !@no_force
|
43
46
|
},
|
47
|
+
forge: {
|
48
|
+
allow_puppetfile_override: settings.dig(:forge, :allow_puppetfile_override) || false
|
49
|
+
},
|
44
50
|
purging: {},
|
45
51
|
output: {}
|
46
52
|
}
|
@@ -69,6 +75,23 @@ module R10K
|
|
69
75
|
|
70
76
|
def visit_deployment(deployment)
|
71
77
|
yield
|
78
|
+
ensure
|
79
|
+
if (postcmd = @settings[:postrun])
|
80
|
+
if @modified_envs.any?
|
81
|
+
envs_to_run = @modified_envs.join(' ')
|
82
|
+
logger.debug _("Running postrun command for environments: %{envs_to_run}.") % { envs_to_run: envs_to_run }
|
83
|
+
|
84
|
+
if postcmd.grep('$modifiedenvs').any?
|
85
|
+
postcmd = postcmd.map { |e| e.gsub('$modifiedenvs', envs_to_run) }
|
86
|
+
end
|
87
|
+
|
88
|
+
subproc = R10K::Util::Subprocess.new(postcmd)
|
89
|
+
subproc.logger = logger
|
90
|
+
subproc.execute
|
91
|
+
else
|
92
|
+
logger.debug _("No environments were modified, not executing postrun command.")
|
93
|
+
end
|
94
|
+
end
|
72
95
|
end
|
73
96
|
|
74
97
|
def visit_source(source)
|
@@ -82,13 +105,17 @@ module R10K
|
|
82
105
|
else
|
83
106
|
logger.debug1(_("Updating modules %{modules} in environment %{env_path}") % {modules: @settings.dig(:overrides, :modules, :requested_modules).inspect, env_path: environment.path})
|
84
107
|
|
85
|
-
environment.deploy
|
108
|
+
updated_modules = environment.deploy
|
109
|
+
|
110
|
+
# We actually synced a module in this env
|
111
|
+
if !updated_modules.nil? && !updated_modules.empty?
|
112
|
+
# Record modified environment for postrun command
|
113
|
+
@modified_envs << environment.dirname
|
86
114
|
|
87
|
-
|
88
|
-
|
89
|
-
|
90
|
-
|
91
|
-
environment.generate_types!
|
115
|
+
if generate_types = @settings.dig(:overrides, :environments, :generate_types)
|
116
|
+
logger.debug("Generating puppet types for environment '#{environment.dirname}'...")
|
117
|
+
environment.generate_types!
|
118
|
+
end
|
92
119
|
end
|
93
120
|
end
|
94
121
|
end
|
@@ -96,12 +123,16 @@ module R10K
|
|
96
123
|
def allowed_initialize_opts
|
97
124
|
super.merge(environment: true,
|
98
125
|
cachedir: :self,
|
126
|
+
'exclude-spec': :self,
|
99
127
|
'no-force': :self,
|
100
128
|
'generate-types': :self,
|
101
129
|
'puppet-path': :self,
|
102
130
|
'puppet-conf': :self,
|
103
131
|
'private-key': :self,
|
104
|
-
'oauth-token': :self
|
132
|
+
'oauth-token': :self,
|
133
|
+
'github-app-id': :self,
|
134
|
+
'github-app-key': :self,
|
135
|
+
'github-app-ttl': :self)
|
105
136
|
end
|
106
137
|
end
|
107
138
|
end
|
@@ -1,6 +1,6 @@
|
|
1
|
-
require 'r10k/puppetfile'
|
2
1
|
require 'r10k/action/base'
|
3
2
|
require 'r10k/errors/formatting'
|
3
|
+
require 'r10k/module_loader/puppetfile'
|
4
4
|
|
5
5
|
module R10K
|
6
6
|
module Action
|
@@ -8,11 +8,13 @@ module R10K
|
|
8
8
|
class Check < R10K::Action::Base
|
9
9
|
|
10
10
|
def call
|
11
|
-
|
12
|
-
|
13
|
-
|
11
|
+
options = { basedir: @root }
|
12
|
+
options[:moduledir] = @moduledir if @moduledir
|
13
|
+
options[:puppetfile] = @puppetfile if @puppetfile
|
14
|
+
|
15
|
+
loader = R10K::ModuleLoader::Puppetfile.new(**options)
|
14
16
|
begin
|
15
|
-
|
17
|
+
loader.load!
|
16
18
|
$stderr.puts _("Syntax OK")
|
17
19
|
true
|
18
20
|
rescue => e
|
@@ -1,7 +1,7 @@
|
|
1
|
-
require 'r10k/puppetfile'
|
2
|
-
require 'r10k/errors/formatting'
|
3
|
-
require 'r10k/action/visitor'
|
4
1
|
require 'r10k/action/base'
|
2
|
+
require 'r10k/content_synchronizer'
|
3
|
+
require 'r10k/errors/formatting'
|
4
|
+
require 'r10k/module_loader/puppetfile'
|
5
5
|
require 'r10k/util/cleaner'
|
6
6
|
|
7
7
|
module R10K
|
@@ -10,25 +10,31 @@ module R10K
|
|
10
10
|
class Install < R10K::Action::Base
|
11
11
|
|
12
12
|
def call
|
13
|
-
@ok = true
|
14
13
|
begin
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
14
|
+
options = { basedir: @root, overrides: { force: @force || false } }
|
15
|
+
options[:moduledir] = @moduledir if @moduledir
|
16
|
+
options[:puppetfile] = @puppetfile if @puppetfile
|
17
|
+
|
18
|
+
loader = R10K::ModuleLoader::Puppetfile.new(**options)
|
19
|
+
loaded_content = loader.load!
|
21
20
|
|
22
|
-
|
23
|
-
|
24
|
-
|
21
|
+
pool_size = @settings[:pool_size] || 4
|
22
|
+
modules = loaded_content[:modules]
|
23
|
+
if pool_size > 1
|
24
|
+
R10K::ContentSynchronizer.concurrent_sync(modules, pool_size, logger)
|
25
|
+
else
|
26
|
+
R10K::ContentSynchronizer.serial_sync(modules, logger)
|
27
|
+
end
|
25
28
|
|
29
|
+
R10K::Util::Cleaner.new(loaded_content[:managed_directories],
|
30
|
+
loaded_content[:desired_contents],
|
31
|
+
loaded_content[:purge_exclusions]).purge!
|
32
|
+
|
33
|
+
true
|
26
34
|
rescue => e
|
27
|
-
@ok = false
|
28
35
|
logger.error R10K::Errors::Formatting.format_exception(e, @trace)
|
36
|
+
false
|
29
37
|
end
|
30
|
-
|
31
|
-
@ok
|
32
38
|
end
|
33
39
|
|
34
40
|
private
|
@@ -1,7 +1,7 @@
|
|
1
|
-
require 'r10k/puppetfile'
|
2
|
-
require 'r10k/util/cleaner'
|
3
1
|
require 'r10k/action/base'
|
4
2
|
require 'r10k/errors/formatting'
|
3
|
+
require 'r10k/module_loader/puppetfile'
|
4
|
+
require 'r10k/util/cleaner'
|
5
5
|
|
6
6
|
module R10K
|
7
7
|
module Action
|
@@ -9,13 +9,16 @@ module R10K
|
|
9
9
|
class Purge < R10K::Action::Base
|
10
10
|
|
11
11
|
def call
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
12
|
+
options = { basedir: @root }
|
13
|
+
|
14
|
+
options[:moduledir] = @moduledir if @moduledir
|
15
|
+
options[:puppetfile] = @puppetfile if @puppetfile
|
16
|
+
|
17
|
+
loader = R10K::ModuleLoader::Puppetfile.new(**options)
|
18
|
+
loaded_content = loader.load!
|
19
|
+
R10K::Util::Cleaner.new(loaded_content[:managed_directories],
|
20
|
+
loaded_content[:desired_contents],
|
21
|
+
loaded_content[:purge_exclusions]).purge!
|
19
22
|
|
20
23
|
true
|
21
24
|
rescue => e
|
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
|
@@ -67,15 +70,20 @@ module R10K
|
|
67
70
|
exit(8)
|
68
71
|
end
|
69
72
|
|
73
|
+
# Set up authorization from license file if it wasn't
|
74
|
+
# already set via the config
|
70
75
|
def setup_authorization
|
71
|
-
|
72
|
-
|
76
|
+
if PuppetForge::Connection.authorization.nil?
|
77
|
+
begin
|
78
|
+
license = R10K::Util::License.load
|
73
79
|
|
74
|
-
|
75
|
-
|
80
|
+
if license.respond_to?(:authorization_token)
|
81
|
+
logger.debug "Using token from license to connect to the Forge."
|
82
|
+
PuppetForge::Connection.authorization = license.authorization_token
|
83
|
+
end
|
84
|
+
rescue R10K::Error => e
|
85
|
+
logger.warn e.message
|
76
86
|
end
|
77
|
-
rescue R10K::Error => e
|
78
|
-
logger.warn e.message
|
79
87
|
end
|
80
88
|
end
|
81
89
|
|
@@ -100,11 +108,26 @@ module R10K
|
|
100
108
|
def add_credential_overrides(overrides)
|
101
109
|
sshkey_path = @opts[:'private-key']
|
102
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']
|
103
114
|
|
104
115
|
if sshkey_path && token_path
|
105
116
|
raise R10K::Error, "Cannot specify both an SSH key and a token to use with this deploy."
|
106
117
|
end
|
107
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
|
+
|
108
131
|
if sshkey_path
|
109
132
|
overrides[:git] ||= {}
|
110
133
|
overrides[:git][:private_key] = sshkey_path
|
@@ -121,6 +144,18 @@ module R10K
|
|
121
144
|
repo[:oauth_token] = token_path
|
122
145
|
end
|
123
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
|
124
159
|
end
|
125
160
|
|
126
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])
|
@@ -65,6 +69,7 @@ scheduled. On subsequent deployments, Puppetfile deployment will default to off.
|
|
65
69
|
|
66
70
|
flag :p, :puppetfile, 'Deploy modules (deprecated, use -m)'
|
67
71
|
flag :m, :modules, 'Deploy modules'
|
72
|
+
flag nil, :incremental, 'Used with the --modules flag, only update those modules whose definition has changed or whose definition allows the version to float'
|
68
73
|
option nil, :'default-branch-override', 'Specify a branchname to override the default branch in the puppetfile',
|
69
74
|
argument: :required
|
70
75
|
|