moonshot 2.0.0.beta7 → 3.0.4
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/moonshot/change_set.rb +11 -3
- data/lib/moonshot/commands/create.rb +2 -0
- data/lib/moonshot/commands/tag_arguments.rb +20 -0
- data/lib/moonshot/commands/update.rb +1 -0
- data/lib/moonshot/controller_config.rb +2 -1
- data/lib/moonshot/stack.rb +25 -11
- data/lib/moonshot/tools/asg_rollout/asg.rb +3 -0
- data/lib/moonshot/unicode_table.rb +4 -2
- data/lib/plugins/backup.rb +1 -1
- data/lib/plugins/encrypted_parameters/kms_key.rb +24 -5
- data/lib/plugins/encrypted_parameters.rb +3 -1
- metadata +80 -9
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: d87f616758ca8f4b32b4af436e73c565665b8753d38b3fd14d478f6a6d347ce4
|
4
|
+
data.tar.gz: 616b51d3d59341f58beb48efea6af2dba7a3821ef0dace26f4dd1eae395a34bf
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 8532967756fa789d68ce86fbdffc25bb053f5c483d784285b43ed1c934c40d72c03dc3ec73674bb6d06eb58bf2ec3b6f3641156ea6f7797e387e3d16ecf3ecc8
|
7
|
+
data.tar.gz: a4bcf9e2b1d6367670aa7cba505d4d561231d114dce658c2a92b10786f8eae24c25ba7052057966e5d6c8a5569633f4676eedda7d198483f7ef0c9446bd132da
|
data/lib/moonshot/change_set.rb
CHANGED
@@ -77,9 +77,17 @@ module Moonshot
|
|
77
77
|
end
|
78
78
|
|
79
79
|
def wait_for_change_set
|
80
|
-
|
81
|
-
|
82
|
-
|
80
|
+
begin
|
81
|
+
@cf_client.wait_until(:change_set_create_complete,
|
82
|
+
stack_name: @stack_name,
|
83
|
+
change_set_name: @name)
|
84
|
+
rescue Aws::Waiters::Errors::FailureStateError => e
|
85
|
+
if e.message != 'stopped waiting, encountered a failure state'
|
86
|
+
throw e
|
87
|
+
else
|
88
|
+
puts "The change set didn't contain any new changes."
|
89
|
+
end
|
90
|
+
end
|
83
91
|
|
84
92
|
@change_set = @cf_client.describe_change_set(stack_name: @stack_name,
|
85
93
|
change_set_name: @name)
|
@@ -1,6 +1,7 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
3
|
require_relative 'parameter_arguments'
|
4
|
+
require_relative 'tag_arguments'
|
4
5
|
require_relative 'show_all_events_option'
|
5
6
|
require_relative 'parent_stack_option'
|
6
7
|
|
@@ -8,6 +9,7 @@ module Moonshot
|
|
8
9
|
module Commands
|
9
10
|
class Create < Moonshot::Command
|
10
11
|
include ParameterArguments
|
12
|
+
include TagArguments
|
11
13
|
include ShowAllEventsOption
|
12
14
|
include ParentStackOption
|
13
15
|
|
@@ -0,0 +1,20 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module Moonshot
|
4
|
+
module Commands
|
5
|
+
module TagArguments
|
6
|
+
def parser
|
7
|
+
parser = super
|
8
|
+
|
9
|
+
parser.on('--tag KEY=VALUE', '-TKEY=VALUE', 'Specify Stack Tag on the command line') do |v|
|
10
|
+
data = v.split('=', 2)
|
11
|
+
unless data.size == 2
|
12
|
+
raise "Invalid tag format '#{v}', expected KEY=VALUE (e.g. MyStackTag=12)"
|
13
|
+
end
|
14
|
+
|
15
|
+
Moonshot.config.extra_tags << { key: data[0], value: data[1] }
|
16
|
+
end
|
17
|
+
end
|
18
|
+
end
|
19
|
+
end
|
20
|
+
end
|
@@ -10,7 +10,7 @@ module Moonshot
|
|
10
10
|
:interactive, :interactive_logger, :parameter_overrides, :parameters, :parent_stacks,
|
11
11
|
:default_parameter_source, :parameter_sources, :plugins, :project_root,
|
12
12
|
:show_all_stack_events, :ssh_auto_scaling_group_name, :ssh_command, :ssh_config,
|
13
|
-
:ssh_instance, :template_file, :template_s3_bucket
|
13
|
+
:ssh_instance, :template_file, :template_s3_bucket, :extra_tags
|
14
14
|
|
15
15
|
def initialize
|
16
16
|
@default_parameter_source = AskUserSource.new
|
@@ -26,6 +26,7 @@ module Moonshot
|
|
26
26
|
@project_root = Dir.pwd
|
27
27
|
@show_all_stack_events = false
|
28
28
|
@ssh_config = SSHConfig.new
|
29
|
+
@extra_tags = []
|
29
30
|
|
30
31
|
@dev_build_name_proc = lambda do |c|
|
31
32
|
['dev', c.app_name, c.environment_name, Time.now.to_i].join('/')
|
data/lib/moonshot/stack.rb
CHANGED
@@ -13,10 +13,30 @@ module Moonshot
|
|
13
13
|
|
14
14
|
attr_reader :app_name, :name
|
15
15
|
|
16
|
+
class << self
|
17
|
+
def generate_name(config)
|
18
|
+
[config.app_name, config.environment_name].join('-')
|
19
|
+
end
|
20
|
+
|
21
|
+
def make_tags(config)
|
22
|
+
default_tags = [
|
23
|
+
{ key: 'moonshot_application', value: config.app_name },
|
24
|
+
{ key: 'moonshot_environment', value: config.environment_name }
|
25
|
+
]
|
26
|
+
name = generate_name(config)
|
27
|
+
|
28
|
+
if config.additional_tag
|
29
|
+
default_tags << { key: config.additional_tag, value: name }
|
30
|
+
end
|
31
|
+
|
32
|
+
default_tags + config.extra_tags
|
33
|
+
end
|
34
|
+
end
|
35
|
+
|
16
36
|
def initialize(config)
|
17
37
|
@config = config
|
18
38
|
@ilog = config.interactive_logger
|
19
|
-
@name =
|
39
|
+
@name = self.class.generate_name(@config)
|
20
40
|
|
21
41
|
yield @config if block_given?
|
22
42
|
end
|
@@ -233,8 +253,9 @@ module Moonshot
|
|
233
253
|
change_set_name:,
|
234
254
|
description: "Moonshot update command for application '#{Moonshot.config.app_name}'",
|
235
255
|
stack_name: @name,
|
236
|
-
capabilities:
|
237
|
-
parameters: @config.parameters.values.map(&:to_cf)
|
256
|
+
capabilities: %w(CAPABILITY_IAM CAPABILITY_NAMED_IAM), # rubocop:disable Layout/HashAlignment,Style/PercentLiteralDelimiters
|
257
|
+
parameters: @config.parameters.values.map(&:to_cf),
|
258
|
+
tags: make_tags
|
238
259
|
}
|
239
260
|
if @config.template_s3_bucket
|
240
261
|
parameters[:template_url] = upload_template_to_s3
|
@@ -288,14 +309,7 @@ module Moonshot
|
|
288
309
|
end
|
289
310
|
|
290
311
|
def make_tags
|
291
|
-
|
292
|
-
{ key: 'moonshot_application', value: @config.app_name },
|
293
|
-
{ key: 'moonshot_environment', value: @config.environment_name }
|
294
|
-
]
|
295
|
-
|
296
|
-
default_tags << { key: @config.additional_tag, value: @name } if @config.additional_tag
|
297
|
-
|
298
|
-
default_tags
|
312
|
+
self.class.make_tags(@config)
|
299
313
|
end
|
300
314
|
|
301
315
|
def format_event(event)
|
@@ -37,12 +37,14 @@ module Moonshot
|
|
37
37
|
end
|
38
38
|
|
39
39
|
def draw(depth = 1, first = true)
|
40
|
+
space = ' '
|
41
|
+
pipe = '|'
|
40
42
|
print first ? '┌' : '├'
|
41
43
|
print '─' * depth
|
42
|
-
puts
|
44
|
+
puts "#{space}" << @name.light_black # rubocop:disable Style/RedundantInterpolation
|
43
45
|
@lines = [''] + @lines + ['']
|
44
46
|
@lines.each do |line|
|
45
|
-
puts
|
47
|
+
puts "#{pipe}" << (' ' * depth) << line # rubocop:disable Style/RedundantInterpolation
|
46
48
|
end
|
47
49
|
@children.each do |child|
|
48
50
|
child.draw(depth + 1, false)
|
data/lib/plugins/backup.rb
CHANGED
@@ -200,7 +200,7 @@ module Moonshot
|
|
200
200
|
# single bucket for all accounts
|
201
201
|
return @bucket if @bucket
|
202
202
|
# calculating bucket based on account name
|
203
|
-
return bucket_by_account(iam_account) if @buckets
|
203
|
+
return bucket_by_account(iam_account) if @buckets # rubocop:disable Style/RedundantReturn
|
204
204
|
end
|
205
205
|
|
206
206
|
def bucket_by_account(account)
|
@@ -1,5 +1,7 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
|
+
require_relative '../../moonshot/stack'
|
4
|
+
|
3
5
|
module Moonshot
|
4
6
|
module Plugins
|
5
7
|
class EncryptedParameters
|
@@ -7,16 +9,33 @@ module Moonshot
|
|
7
9
|
class KmsKey
|
8
10
|
attr_reader :arn
|
9
11
|
|
12
|
+
class << self
|
13
|
+
def create
|
14
|
+
standard_tags = stack_tags
|
15
|
+
resp = Aws::KMS::Client.new.create_key({
|
16
|
+
tags: standard_tags # An array of tags.
|
17
|
+
})
|
18
|
+
arn = resp.key_metadata.arn
|
19
|
+
new(arn)
|
20
|
+
end
|
21
|
+
|
22
|
+
def stack_tags
|
23
|
+
tags = Moonshot::Stack.make_tags(Moonshot.config)
|
24
|
+
tags.map { |tag| { tag_key: tag[:key], tag_value: tag[:value] } }
|
25
|
+
end
|
26
|
+
end
|
27
|
+
|
10
28
|
def initialize(arn)
|
11
29
|
@arn = arn
|
12
30
|
@kms_client = Aws::KMS::Client.new
|
13
31
|
end
|
14
32
|
|
15
|
-
def
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
33
|
+
def update
|
34
|
+
standard_tags = self.class.stack_tags
|
35
|
+
@kms_client.tag_resource({
|
36
|
+
key_id: @arn, # arn of the CMK being tagged
|
37
|
+
tags: standard_tags # An array of tags.
|
38
|
+
})
|
20
39
|
end
|
21
40
|
|
22
41
|
def delete
|
@@ -104,7 +104,9 @@ module Moonshot
|
|
104
104
|
Moonshot.config.parameters[@kms_key_parameter_name].set(key_arn)
|
105
105
|
s.success "Created a new KMS Key for #{@kms_key_parameter_name.blue}!"
|
106
106
|
else
|
107
|
-
|
107
|
+
kms=KmsKey.new(Moonshot.config.parameters[@kms_key_parameter_name].value) # rubocop:disable Style/SpaceAroundOperators
|
108
|
+
key_arn = kms.arn
|
109
|
+
kms.update
|
108
110
|
s.success "Using existing KMS Key for #{@kms_key_parameter_name.blue}!"
|
109
111
|
end
|
110
112
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: moonshot
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version:
|
4
|
+
version: 3.0.4
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Cloud Engineering <engineering@acquia.com>
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2024-12-12 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: aws-sdk-autoscaling
|
@@ -66,6 +66,20 @@ dependencies:
|
|
66
66
|
- - "~>"
|
67
67
|
- !ruby/object:Gem::Version
|
68
68
|
version: '1.34'
|
69
|
+
- !ruby/object:Gem::Dependency
|
70
|
+
name: aws-sdk-elasticloadbalancing
|
71
|
+
requirement: !ruby/object:Gem::Requirement
|
72
|
+
requirements:
|
73
|
+
- - "~>"
|
74
|
+
- !ruby/object:Gem::Version
|
75
|
+
version: '1.3'
|
76
|
+
type: :runtime
|
77
|
+
prerelease: false
|
78
|
+
version_requirements: !ruby/object:Gem::Requirement
|
79
|
+
requirements:
|
80
|
+
- - "~>"
|
81
|
+
- !ruby/object:Gem::Version
|
82
|
+
version: '1.3'
|
69
83
|
- !ruby/object:Gem::Dependency
|
70
84
|
name: aws-sdk-iam
|
71
85
|
requirement: !ruby/object:Gem::Requirement
|
@@ -122,6 +136,48 @@ dependencies:
|
|
122
136
|
- - ">="
|
123
137
|
- !ruby/object:Gem::Version
|
124
138
|
version: '0'
|
139
|
+
- !ruby/object:Gem::Dependency
|
140
|
+
name: faraday
|
141
|
+
requirement: !ruby/object:Gem::Requirement
|
142
|
+
requirements:
|
143
|
+
- - "~>"
|
144
|
+
- !ruby/object:Gem::Version
|
145
|
+
version: '1.0'
|
146
|
+
type: :runtime
|
147
|
+
prerelease: false
|
148
|
+
version_requirements: !ruby/object:Gem::Requirement
|
149
|
+
requirements:
|
150
|
+
- - "~>"
|
151
|
+
- !ruby/object:Gem::Version
|
152
|
+
version: '1.0'
|
153
|
+
- !ruby/object:Gem::Dependency
|
154
|
+
name: faraday-rack
|
155
|
+
requirement: !ruby/object:Gem::Requirement
|
156
|
+
requirements:
|
157
|
+
- - "~>"
|
158
|
+
- !ruby/object:Gem::Version
|
159
|
+
version: 1.0.0
|
160
|
+
type: :runtime
|
161
|
+
prerelease: false
|
162
|
+
version_requirements: !ruby/object:Gem::Requirement
|
163
|
+
requirements:
|
164
|
+
- - "~>"
|
165
|
+
- !ruby/object:Gem::Version
|
166
|
+
version: 1.0.0
|
167
|
+
- !ruby/object:Gem::Dependency
|
168
|
+
name: faraday-retry
|
169
|
+
requirement: !ruby/object:Gem::Requirement
|
170
|
+
requirements:
|
171
|
+
- - "~>"
|
172
|
+
- !ruby/object:Gem::Version
|
173
|
+
version: '1.0'
|
174
|
+
type: :runtime
|
175
|
+
prerelease: false
|
176
|
+
version_requirements: !ruby/object:Gem::Requirement
|
177
|
+
requirements:
|
178
|
+
- - "~>"
|
179
|
+
- !ruby/object:Gem::Version
|
180
|
+
version: '1.0'
|
125
181
|
- !ruby/object:Gem::Dependency
|
126
182
|
name: highline
|
127
183
|
requirement: !ruby/object:Gem::Requirement
|
@@ -192,6 +248,20 @@ dependencies:
|
|
192
248
|
- - ">="
|
193
249
|
- !ruby/object:Gem::Version
|
194
250
|
version: '0'
|
251
|
+
- !ruby/object:Gem::Dependency
|
252
|
+
name: rexml
|
253
|
+
requirement: !ruby/object:Gem::Requirement
|
254
|
+
requirements:
|
255
|
+
- - ">="
|
256
|
+
- !ruby/object:Gem::Version
|
257
|
+
version: '0'
|
258
|
+
type: :runtime
|
259
|
+
prerelease: false
|
260
|
+
version_requirements: !ruby/object:Gem::Requirement
|
261
|
+
requirements:
|
262
|
+
- - ">="
|
263
|
+
- !ruby/object:Gem::Version
|
264
|
+
version: '0'
|
195
265
|
- !ruby/object:Gem::Dependency
|
196
266
|
name: rotp
|
197
267
|
requirement: !ruby/object:Gem::Requirement
|
@@ -252,16 +322,16 @@ dependencies:
|
|
252
322
|
name: travis
|
253
323
|
requirement: !ruby/object:Gem::Requirement
|
254
324
|
requirements:
|
255
|
-
- - "
|
325
|
+
- - "~>"
|
256
326
|
- !ruby/object:Gem::Version
|
257
|
-
version:
|
327
|
+
version: 1.11.1
|
258
328
|
type: :runtime
|
259
329
|
prerelease: false
|
260
330
|
version_requirements: !ruby/object:Gem::Requirement
|
261
331
|
requirements:
|
262
|
-
- - "
|
332
|
+
- - "~>"
|
263
333
|
- !ruby/object:Gem::Version
|
264
|
-
version:
|
334
|
+
version: 1.11.1
|
265
335
|
- !ruby/object:Gem::Dependency
|
266
336
|
name: vandamme
|
267
337
|
requirement: !ruby/object:Gem::Requirement
|
@@ -360,6 +430,7 @@ files:
|
|
360
430
|
- lib/moonshot/commands/show_all_events_option.rb
|
361
431
|
- lib/moonshot/commands/ssh.rb
|
362
432
|
- lib/moonshot/commands/status.rb
|
433
|
+
- lib/moonshot/commands/tag_arguments.rb
|
363
434
|
- lib/moonshot/commands/update.rb
|
364
435
|
- lib/moonshot/commands/version.rb
|
365
436
|
- lib/moonshot/config.rb
|
@@ -418,12 +489,12 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
418
489
|
requirements:
|
419
490
|
- - ">="
|
420
491
|
- !ruby/object:Gem::Version
|
421
|
-
version: 3.
|
492
|
+
version: 3.3.4
|
422
493
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
423
494
|
requirements:
|
424
|
-
- - "
|
495
|
+
- - ">="
|
425
496
|
- !ruby/object:Gem::Version
|
426
|
-
version:
|
497
|
+
version: '0'
|
427
498
|
requirements: []
|
428
499
|
rubygems_version: 3.1.6
|
429
500
|
signing_key:
|