stack_master 2.18.0 → 2.19.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/lib/stack_master/cli.rb +2 -2
- data/lib/stack_master/commands/tidy.rb +1 -4
- data/lib/stack_master/parameter_loader.rb +32 -30
- data/lib/stack_master/parameter_resolvers/latest_ami_by_tags.rb +1 -1
- data/lib/stack_master/parameter_resolvers/latest_container.rb +2 -2
- data/lib/stack_master/sparkle_formation/template_file.rb +2 -2
- data/lib/stack_master/stack_differ.rb +1 -1
- data/lib/stack_master/template_compiler.rb +1 -1
- data/lib/stack_master/template_compilers/sparkle_formation.rb +59 -57
- data/lib/stack_master/test_driver/cloud_formation.rb +1 -1
- data/lib/stack_master/version.rb +1 -1
- metadata +6 -6
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 607ab539b978fab2e12639668d933f93f57e0313fadc0ba4bbca9e91acc2dd55
|
|
4
|
+
data.tar.gz: 46c1b5546ed2e64375ebd16ea3703361e173bd766b346b56f9b8bb1357c06737
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: f3141ebe8c68a84ea43a47822f697186a1c03466be28cf20c9c78ce3ec54cb631687d2b847dbe220ea960118a28768495c00699bb1d37bc3c4031c8eb06f0fb2
|
|
7
|
+
data.tar.gz: 698d19f1b98155df1e1441f372e58becf1af0d4d54d5281565ccd0f213adf1099eb42c2fed79e3690fdc8a5d184b4c36212aa345c61b3d47e73c964cdbe9c214
|
data/lib/stack_master/cli.rb
CHANGED
|
@@ -263,7 +263,7 @@ module StackMaster
|
|
|
263
263
|
def load_config(file)
|
|
264
264
|
stack_file = file || default_config_file
|
|
265
265
|
StackMaster::Config.load!(stack_file)
|
|
266
|
-
rescue Errno::ENOENT
|
|
266
|
+
rescue Errno::ENOENT
|
|
267
267
|
say "Failed to load config file #{stack_file}"
|
|
268
268
|
@kernel.exit false
|
|
269
269
|
end
|
|
@@ -301,7 +301,7 @@ module StackMaster
|
|
|
301
301
|
end
|
|
302
302
|
|
|
303
303
|
def show_other_region_candidates(config, stack_name)
|
|
304
|
-
candidates = config.filter(
|
|
304
|
+
candidates = config.filter('', stack_name = stack_name)
|
|
305
305
|
return if candidates.empty?
|
|
306
306
|
|
|
307
307
|
StackMaster.stdout.puts "Stack name #{stack_name} exists in regions: #{candidates.map(&:region).join(', ')}"
|
|
@@ -5,13 +5,10 @@ module StackMaster
|
|
|
5
5
|
include StackMaster::Commands::TerminalHelper
|
|
6
6
|
|
|
7
7
|
def perform
|
|
8
|
-
used_templates = []
|
|
9
|
-
used_parameter_files = []
|
|
10
|
-
|
|
11
8
|
templates = Set.new(find_templates)
|
|
12
9
|
parameter_files = Set.new(find_parameter_files)
|
|
13
10
|
|
|
14
|
-
|
|
11
|
+
@config.stacks.each do |stack_definition|
|
|
15
12
|
parameter_files.subtract(stack_definition.parameter_files_from_globs)
|
|
16
13
|
template = File.absolute_path(stack_definition.template_file_path)
|
|
17
14
|
|
|
@@ -1,46 +1,48 @@
|
|
|
1
1
|
require 'active_support/core_ext/object/deep_dup'
|
|
2
2
|
|
|
3
3
|
module StackMaster
|
|
4
|
-
|
|
4
|
+
module ParameterLoader
|
|
5
5
|
COMPILE_TIME_PARAMETERS_KEY = 'compile_time_parameters'
|
|
6
6
|
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
template_parameters
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
7
|
+
class << self
|
|
8
|
+
def load(parameter_files: [], parameters: {})
|
|
9
|
+
StackMaster.debug 'Searching for parameter files...'
|
|
10
|
+
all_parameters = parameter_files.map { |file_name| load_parameters(file_name) } + [parameters]
|
|
11
|
+
all_parameters.each_with_object({ template_parameters: {}, compile_time_parameters: {} }) do |parameters, hash|
|
|
12
|
+
template_parameters = create_template_parameters(parameters)
|
|
13
|
+
compile_time_parameters = create_compile_time_parameters(parameters)
|
|
14
|
+
|
|
15
|
+
merge_and_camelize(hash[:template_parameters], template_parameters)
|
|
16
|
+
merge_and_camelize(hash[:compile_time_parameters], compile_time_parameters)
|
|
17
|
+
end
|
|
16
18
|
end
|
|
17
|
-
end
|
|
18
19
|
|
|
19
|
-
|
|
20
|
+
private
|
|
20
21
|
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
22
|
+
def load_parameters(file_name)
|
|
23
|
+
file_exists = File.exist?(file_name)
|
|
24
|
+
StackMaster.debug file_exists ? " #{file_name} found" : " #{file_name} not found"
|
|
25
|
+
file_exists ? load_file(file_name) : {}
|
|
26
|
+
end
|
|
26
27
|
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
28
|
+
def load_file(file_name)
|
|
29
|
+
YAML.load(File.read(file_name)) || {}
|
|
30
|
+
end
|
|
30
31
|
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
32
|
+
def create_template_parameters(parameters)
|
|
33
|
+
parameters.deep_dup.tap do |parameters_clone|
|
|
34
|
+
parameters_clone.delete(COMPILE_TIME_PARAMETERS_KEY) ||
|
|
35
|
+
parameters_clone.delete(COMPILE_TIME_PARAMETERS_KEY.camelize)
|
|
36
|
+
end
|
|
35
37
|
end
|
|
36
|
-
end
|
|
37
38
|
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
39
|
+
def create_compile_time_parameters(parameters)
|
|
40
|
+
(parameters[COMPILE_TIME_PARAMETERS_KEY] || parameters[COMPILE_TIME_PARAMETERS_KEY.camelize] || {}).deep_dup
|
|
41
|
+
end
|
|
41
42
|
|
|
42
|
-
|
|
43
|
-
|
|
43
|
+
def merge_and_camelize(hash, parameters)
|
|
44
|
+
parameters.each { |key, value| hash[key.camelize] = value }
|
|
45
|
+
end
|
|
44
46
|
end
|
|
45
47
|
end
|
|
46
48
|
end
|
|
@@ -37,7 +37,7 @@ module StackMaster
|
|
|
37
37
|
def fetch_images(repository_name, registry_id, ecr)
|
|
38
38
|
images = []
|
|
39
39
|
next_token = nil
|
|
40
|
-
while resp = ecr.describe_images(
|
|
40
|
+
while (resp = ecr.describe_images(
|
|
41
41
|
{
|
|
42
42
|
repository_name: repository_name,
|
|
43
43
|
registry_id: registry_id,
|
|
@@ -46,7 +46,7 @@ module StackMaster
|
|
|
46
46
|
tag_status: 'TAGGED'
|
|
47
47
|
}
|
|
48
48
|
}
|
|
49
|
-
)
|
|
49
|
+
))
|
|
50
50
|
|
|
51
51
|
images += resp.image_details
|
|
52
52
|
next_token = resp.next_token
|
|
@@ -61,5 +61,5 @@ module StackMaster
|
|
|
61
61
|
end
|
|
62
62
|
end
|
|
63
63
|
|
|
64
|
-
SparkleFormation::SparkleAttribute::Aws.
|
|
65
|
-
SparkleFormation::SparkleAttribute::Aws.
|
|
64
|
+
SparkleFormation::SparkleAttribute::Aws.include StackMaster::SparkleFormation::UserDataFile
|
|
65
|
+
SparkleFormation::SparkleAttribute::Aws.include StackMaster::SparkleFormation::JoinedFile
|
|
@@ -10,7 +10,7 @@ module StackMaster
|
|
|
10
10
|
end
|
|
11
11
|
compiler.require_dependencies
|
|
12
12
|
compiler.compile(template_dir, template, compile_time_parameters, compiler_options)
|
|
13
|
-
rescue StandardError
|
|
13
|
+
rescue StandardError
|
|
14
14
|
raise TemplateCompilationFailed, "Failed to compile #{template}"
|
|
15
15
|
end
|
|
16
16
|
|
|
@@ -3,80 +3,82 @@ require 'stack_master/sparkle_formation/compile_time/definitions_validator'
|
|
|
3
3
|
require 'stack_master/sparkle_formation/compile_time/state_builder'
|
|
4
4
|
|
|
5
5
|
module StackMaster::TemplateCompilers
|
|
6
|
-
|
|
6
|
+
module SparkleFormation
|
|
7
7
|
CompileTime = StackMaster::SparkleFormation::CompileTime
|
|
8
8
|
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
9
|
+
class << self
|
|
10
|
+
def require_dependencies
|
|
11
|
+
require 'sparkle_formation'
|
|
12
|
+
require 'stack_master/sparkle_formation/template_file'
|
|
13
|
+
end
|
|
13
14
|
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
15
|
+
def compile(template_dir, template, compile_time_parameters, compiler_options = {})
|
|
16
|
+
sparkle_template = compile_sparkle_template(template_dir, template, compiler_options)
|
|
17
|
+
definitions = sparkle_template.parameters
|
|
18
|
+
validate_definitions(definitions)
|
|
19
|
+
validate_parameters(definitions, compile_time_parameters)
|
|
19
20
|
|
|
20
|
-
|
|
21
|
-
|
|
21
|
+
sparkle_template.compile_time_parameter_setter do
|
|
22
|
+
sparkle_template.compile_state = create_state(definitions, compile_time_parameters)
|
|
23
|
+
end
|
|
24
|
+
|
|
25
|
+
JSON.pretty_generate(sparkle_template.dump)
|
|
22
26
|
end
|
|
23
27
|
|
|
24
|
-
|
|
25
|
-
|
|
28
|
+
private
|
|
29
|
+
|
|
30
|
+
def compile_sparkle_template(template_dir, template, compiler_options)
|
|
31
|
+
sparkle_path =
|
|
32
|
+
if compiler_options['sparkle_path']
|
|
33
|
+
File.expand_path(compiler_options['sparkle_path'])
|
|
34
|
+
else
|
|
35
|
+
template_dir
|
|
36
|
+
end
|
|
37
|
+
|
|
38
|
+
collection = ::SparkleFormation::SparkleCollection.new
|
|
39
|
+
root_pack = ::SparkleFormation::Sparkle.new(
|
|
40
|
+
root: sparkle_path
|
|
41
|
+
)
|
|
42
|
+
collection.set_root(root_pack)
|
|
43
|
+
if compiler_options['sparkle_packs']
|
|
44
|
+
compiler_options['sparkle_packs'].each do |pack_name|
|
|
45
|
+
require pack_name
|
|
46
|
+
pack = ::SparkleFormation::SparklePack.new(name: pack_name)
|
|
47
|
+
collection.add_sparkle(pack)
|
|
48
|
+
end
|
|
49
|
+
end
|
|
26
50
|
|
|
27
|
-
|
|
51
|
+
if compiler_options['sparkle_pack_template']
|
|
52
|
+
unless collection.templates['aws'].include? template
|
|
53
|
+
raise ArgumentError.new("Template #{template.inspect} not found in any sparkle pack")
|
|
54
|
+
end
|
|
28
55
|
|
|
29
|
-
|
|
30
|
-
sparkle_path =
|
|
31
|
-
if compiler_options['sparkle_path']
|
|
32
|
-
File.expand_path(compiler_options['sparkle_path'])
|
|
56
|
+
template_file_path = collection.templates['aws'][template].top['path']
|
|
33
57
|
else
|
|
34
|
-
template_dir
|
|
58
|
+
template_file_path = File.join(template_dir, template)
|
|
35
59
|
end
|
|
36
60
|
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
)
|
|
41
|
-
collection.set_root(root_pack)
|
|
42
|
-
if compiler_options['sparkle_packs']
|
|
43
|
-
compiler_options['sparkle_packs'].each do |pack_name|
|
|
44
|
-
require pack_name
|
|
45
|
-
pack = ::SparkleFormation::SparklePack.new(name: pack_name)
|
|
46
|
-
collection.add_sparkle(pack)
|
|
47
|
-
end
|
|
61
|
+
sparkle_template = compile_template_with_sparkle_path(template_file_path, sparkle_path)
|
|
62
|
+
sparkle_template.sparkle.apply(collection)
|
|
63
|
+
sparkle_template
|
|
48
64
|
end
|
|
49
65
|
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
end
|
|
54
|
-
|
|
55
|
-
template_file_path = collection.templates['aws'][template].top['path']
|
|
56
|
-
else
|
|
57
|
-
template_file_path = File.join(template_dir, template)
|
|
66
|
+
def compile_template_with_sparkle_path(template_path, sparkle_path)
|
|
67
|
+
::SparkleFormation.sparkle_path = sparkle_path
|
|
68
|
+
::SparkleFormation.compile(template_path, :sparkle)
|
|
58
69
|
end
|
|
59
70
|
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
end
|
|
64
|
-
|
|
65
|
-
def self.compile_template_with_sparkle_path(template_path, sparkle_path)
|
|
66
|
-
::SparkleFormation.sparkle_path = sparkle_path
|
|
67
|
-
::SparkleFormation.compile(template_path, :sparkle)
|
|
68
|
-
end
|
|
69
|
-
|
|
70
|
-
def self.validate_definitions(definitions)
|
|
71
|
-
CompileTime::DefinitionsValidator.new(definitions).validate
|
|
72
|
-
end
|
|
71
|
+
def validate_definitions(definitions)
|
|
72
|
+
CompileTime::DefinitionsValidator.new(definitions).validate
|
|
73
|
+
end
|
|
73
74
|
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
75
|
+
def validate_parameters(definitions, compile_time_parameters)
|
|
76
|
+
CompileTime::ParametersValidator.new(definitions, compile_time_parameters).validate
|
|
77
|
+
end
|
|
77
78
|
|
|
78
|
-
|
|
79
|
-
|
|
79
|
+
def create_state(definitions, compile_time_parameters)
|
|
80
|
+
CompileTime::StateBuilder.new(definitions, compile_time_parameters).build
|
|
81
|
+
end
|
|
80
82
|
end
|
|
81
83
|
|
|
82
84
|
StackMaster::TemplateCompiler.register(:sparkle_formation, self)
|
data/lib/stack_master/version.rb
CHANGED
metadata
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: stack_master
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 2.
|
|
4
|
+
version: 2.19.0
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Steve Hodgkiss
|
|
@@ -173,7 +173,7 @@ dependencies:
|
|
|
173
173
|
version: 4.6.0
|
|
174
174
|
- - "<"
|
|
175
175
|
- !ruby/object:Gem::Version
|
|
176
|
-
version: '
|
|
176
|
+
version: '7'
|
|
177
177
|
type: :runtime
|
|
178
178
|
prerelease: false
|
|
179
179
|
version_requirements: !ruby/object:Gem::Requirement
|
|
@@ -183,7 +183,7 @@ dependencies:
|
|
|
183
183
|
version: 4.6.0
|
|
184
184
|
- - "<"
|
|
185
185
|
- !ruby/object:Gem::Version
|
|
186
|
-
version: '
|
|
186
|
+
version: '7'
|
|
187
187
|
- !ruby/object:Gem::Dependency
|
|
188
188
|
name: aws-sdk-acm
|
|
189
189
|
requirement: !ruby/object:Gem::Requirement
|
|
@@ -623,8 +623,8 @@ metadata:
|
|
|
623
623
|
allowed_push_host: https://rubygems.org
|
|
624
624
|
bug_tracker_uri: https://github.com/envato/stack_master/issues
|
|
625
625
|
changelog_uri: https://github.com/envato/stack_master/blob/master/CHANGELOG.md
|
|
626
|
-
documentation_uri: https://www.rubydoc.info/gems/stack_master/2.
|
|
627
|
-
source_code_uri: https://github.com/envato/stack_master/tree/v2.
|
|
626
|
+
documentation_uri: https://www.rubydoc.info/gems/stack_master/2.19.0
|
|
627
|
+
source_code_uri: https://github.com/envato/stack_master/tree/v2.19.0
|
|
628
628
|
rdoc_options: []
|
|
629
629
|
require_paths:
|
|
630
630
|
- lib
|
|
@@ -639,7 +639,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
|
639
639
|
- !ruby/object:Gem::Version
|
|
640
640
|
version: '0'
|
|
641
641
|
requirements: []
|
|
642
|
-
rubygems_version: 4.0.
|
|
642
|
+
rubygems_version: 4.0.16
|
|
643
643
|
specification_version: 4
|
|
644
644
|
summary: StackMaster is a sure-footed way of creating, updating and keeping track
|
|
645
645
|
of Amazon (AWS) CloudFormation stacks.
|