lono 8.0.0.pre.rc4 → 8.0.0.pre.rc6
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/.github/FUNDING.yml +1 -0
- data/CHANGELOG.md +13 -0
- data/README.md +2 -2
- data/lib/lono/builder/context.rb +1 -1
- data/lib/lono/builder/dsl/helpers/ec2.rb +16 -3
- data/lib/lono/builder/dsl/helpers/template_file.rb +20 -38
- data/lib/lono/builder/dsl/syntax/fn.rb +6 -0
- data/lib/lono/builder/param.rb +2 -0
- data/lib/lono/cfn/deploy/operable.rb +1 -1
- data/lib/lono/cfn/deploy.rb +0 -23
- data/lib/lono/cfn/plan.rb +25 -0
- data/lib/lono/ext/core/object.rb +3 -1
- data/lib/lono/layering/layer.rb +1 -2
- data/lib/lono/utils/call_line.rb +9 -0
- data/lib/lono/version.rb +1 -1
- data/lib/templates/project/Gemfile.tt +2 -7
- metadata +5 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 4174a1ff12f805e84ba1b591670dae875d71bf5c64db1eedbe3fb68828d660a9
|
4
|
+
data.tar.gz: bf622dc807debfa1c6705585b200bf9db62d70fb0fd6e03b7948bc24ec332b7f
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 94b6af96b63ac0e94a02ba51341a077225a89486f6f3150bfe3739f9bba578df33240b12a051acf47cf43eee7e279bbcdade90f15c84eeab6eaf3eccfb3c3329
|
7
|
+
data.tar.gz: 3e6ccd7c6678af23ae7e8f300f01923b49c509c43e0b6384fe17eb7336193a6c2fd50005d04d3167d8791c722f6f97126233ce0f451da2ce4d9a408032dcfdb5
|
data/.github/FUNDING.yml
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
github: boltops-tools
|
data/CHANGELOG.md
CHANGED
@@ -1,5 +1,18 @@
|
|
1
1
|
# Change Log
|
2
2
|
|
3
|
+
## [8.0.0.rc6] - 2024-04-22
|
4
|
+
|
5
|
+
* allow require files in helpers folder that are not helpers
|
6
|
+
* join with single item list that uses get_att
|
7
|
+
|
8
|
+
## [8.0.0.rc5] - 2022-04-29
|
9
|
+
|
10
|
+
* #76 fix plan: upload template to s3
|
11
|
+
* #75 user_data helper improvements
|
12
|
+
* Improve lono error reported to use with better call line backtrace
|
13
|
+
* load helpers before variables so they're available in vars files
|
14
|
+
* vpc helper returns object
|
15
|
+
|
3
16
|
## [8.0.0.rc4] - 2022-03-19
|
4
17
|
|
5
18
|
Notable:
|
data/README.md
CHANGED
@@ -66,9 +66,9 @@ output("Instance")
|
|
66
66
|
output("SecurityGroup", get_att("SecurityGroup.GroupId"))
|
67
67
|
```
|
68
68
|
|
69
|
-
### Lono
|
69
|
+
### Lono Up
|
70
70
|
|
71
|
-
|
71
|
+
The `lono up` command deploys the CloudFormation stack.
|
72
72
|
|
73
73
|
$ lono up demo
|
74
74
|
|
data/lib/lono/builder/context.rb
CHANGED
@@ -3,8 +3,8 @@ class Lono::Builder
|
|
3
3
|
include DslEvaluator
|
4
4
|
|
5
5
|
def load_context
|
6
|
+
load_helpers # load helpers before variable so user custom helpers are available in vars files
|
6
7
|
load_variables
|
7
|
-
load_helpers
|
8
8
|
end
|
9
9
|
|
10
10
|
# Variables in base.rb are overridden by their environment specific variables
|
@@ -2,12 +2,25 @@ module Lono::Builder::Dsl::Helpers
|
|
2
2
|
module Ec2
|
3
3
|
extend Memoist
|
4
4
|
|
5
|
+
# Returns vpc object
|
6
|
+
def vpc(name)
|
7
|
+
filters = name == "default" ?
|
8
|
+
[name: "isDefault", values: ["true"]] :
|
9
|
+
[name: "tag:Name", values: [name]]
|
10
|
+
resp = ec2.describe_vpcs(filters: filters)
|
11
|
+
resp.vpcs.first
|
12
|
+
end
|
13
|
+
memoize :vpc
|
14
|
+
|
5
15
|
def default_vpc
|
6
|
-
|
7
|
-
vpc = resp.vpcs.first
|
16
|
+
vpc = vpc("default")
|
8
17
|
vpc ? vpc.vpc_id : "no default vpc found"
|
9
18
|
end
|
10
|
-
|
19
|
+
|
20
|
+
def default_vpc_cidr
|
21
|
+
vpc = vpc("default")
|
22
|
+
vpc.cidr_block
|
23
|
+
end
|
11
24
|
|
12
25
|
def default_subnets
|
13
26
|
return "no default subnets because no default vpc found" if default_vpc == "no default vpc found"
|
@@ -1,66 +1,48 @@
|
|
1
1
|
module Lono::Builder::Dsl::Helpers
|
2
2
|
module TemplateFile
|
3
3
|
extend Memoist
|
4
|
+
include Lono::Utils::CallLine
|
4
5
|
include Lono::Utils::Pretty
|
5
6
|
|
7
|
+
# Do not memoize :template_file - it'll hide the template_file_missing error
|
6
8
|
def template_file(path)
|
7
|
-
path = "#{@blueprint.root}/#{path}"
|
9
|
+
path = "#{@blueprint.root}/#{path}" unless path.starts_with?('/')
|
8
10
|
if File.exist?(path)
|
9
|
-
|
11
|
+
RenderMePretty.result(path, context: self)
|
10
12
|
else
|
11
13
|
template_file_missing(path)
|
12
14
|
end
|
13
15
|
end
|
14
|
-
|
16
|
+
alias_method :render_file, :template_file
|
17
|
+
alias_method :render_path, :template_file
|
18
|
+
alias_method :user_data, :template_file
|
19
|
+
alias_method :content, :template_file
|
20
|
+
|
15
21
|
|
16
22
|
# Caller lines are different for OSes:
|
17
23
|
#
|
18
24
|
# windows: "C:/Ruby31-x64/lib/ruby/gems/3.1.0/gems/lono-1.1.1/lib/lono/builder.rb:34:in `build'"
|
19
25
|
# linux: "/home/ec2-user/.rvm/gems/ruby-3.0.3/gems/lono-1.1.1/lib/lono/compiler/dsl/syntax/mod.rb:4:in `<module:Mod>'"
|
20
26
|
#
|
21
|
-
class TempleFileNotFoundError < StandardError; end
|
22
27
|
def template_file_missing(path)
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
logger.error " #{pretty_path(caller_line)}"
|
28
|
-
# Raise an error so Dsl::Evaluator#template_evaluation_error provides user friendly info
|
29
|
-
raise TempleFileNotFoundError.new
|
30
|
-
end
|
31
|
-
|
32
|
-
def render_file(path)
|
33
|
-
if File.exist?(path)
|
34
|
-
RenderMePretty.result(path, context: self)
|
35
|
-
else
|
36
|
-
lines = caller.select { |l| l.include?(Lono.root.to_s) }
|
37
|
-
caller_line = pretty_path(lines.first)
|
38
|
-
message =<<~EOL
|
39
|
-
WARN: #{pretty_path(path)} does not exist
|
40
|
-
Called from: #{caller_line}
|
41
|
-
EOL
|
42
|
-
logger.info message.color(:yellow)
|
43
|
-
message
|
44
|
-
end
|
28
|
+
logger.warn "WARN: File path not found: #{pretty_path(path)}".color(:yellow)
|
29
|
+
call_line = lono_call_line
|
30
|
+
DslEvaluator.print_code(call_line) # returns true right now
|
31
|
+
""
|
45
32
|
end
|
46
|
-
alias_method :render_path, :render_file
|
47
33
|
|
48
34
|
def user_data_script
|
49
|
-
|
50
|
-
|
35
|
+
path = @user_data_script || @user_data_script_path
|
36
|
+
unless path
|
37
|
+
# script_example = pretty_path("#{@blueprint.root}/template/bootstrap.sh")
|
38
|
+
script_example = "bootstrap.sh"
|
51
39
|
return <<~EOL
|
52
|
-
# @
|
40
|
+
# @user_data_script_path variable not set. IE: @user_data_script_path = "#{script_example}"
|
53
41
|
# Also, make sure that "#{script_example}" exists.
|
54
42
|
EOL
|
55
43
|
end
|
56
|
-
|
57
|
-
if File.exist?(@user_data_script)
|
58
|
-
render_file(@user_data_script)
|
59
|
-
else
|
60
|
-
message = "WARN: #{@user_data_script} not found"
|
61
|
-
logger.info message.color(:yellow)
|
62
|
-
"# #{message}"
|
63
|
-
end
|
44
|
+
user_data(path)
|
64
45
|
end
|
46
|
+
alias_method :user_data_script_path, :user_data_script
|
65
47
|
end
|
66
48
|
end
|
@@ -108,6 +108,12 @@ module Lono::Builder::Dsl::Syntax
|
|
108
108
|
|
109
109
|
def join(delimiter, *list)
|
110
110
|
list = list.flatten
|
111
|
+
if list.size == 1 # IE: join(",", get_att("Vpc.Ipv6CidrBlocks"))
|
112
|
+
first = list.first
|
113
|
+
if first.is_a?(Hash) && first.keys.first == "Fn::GetAtt"
|
114
|
+
list = first
|
115
|
+
end
|
116
|
+
end
|
111
117
|
{ "Fn::Join" => [delimiter, list] }
|
112
118
|
end
|
113
119
|
|
data/lib/lono/builder/param.rb
CHANGED
@@ -2,10 +2,12 @@ class Lono::Builder
|
|
2
2
|
class Param < Lono::CLI::Base
|
3
3
|
attr_reader :env_path, :base_path # set when build is called
|
4
4
|
include Lono::Builder::Dsl::Syntax
|
5
|
+
include Lono::Builder::Context
|
5
6
|
# Overriding output resource DSL method
|
6
7
|
alias_method :output, :stack_output
|
7
8
|
|
8
9
|
def build
|
10
|
+
load_context
|
9
11
|
logger.info "Building parameters"
|
10
12
|
|
11
13
|
contents = []
|
@@ -3,7 +3,7 @@ class Lono::Cfn::Deploy
|
|
3
3
|
def check!
|
4
4
|
status = stack_status
|
5
5
|
unless status =~ /_COMPLETE$/ || status == "UPDATE_ROLLBACK_FAILED"
|
6
|
-
logger.info "Cannot
|
6
|
+
logger.info "Cannot run operation on stack #{@stack} is not in an updatable state. Stack status: #{status}".color(:red)
|
7
7
|
quit 1
|
8
8
|
end
|
9
9
|
end
|
data/lib/lono/cfn/deploy.rb
CHANGED
@@ -59,7 +59,6 @@ module Lono::Cfn
|
|
59
59
|
opts = Opts.new(@blueprint, "create_stack", iam, options)
|
60
60
|
opts.show
|
61
61
|
options = opts.values
|
62
|
-
upload_all
|
63
62
|
cfn.create_stack(options)
|
64
63
|
end
|
65
64
|
|
@@ -70,33 +69,11 @@ module Lono::Cfn
|
|
70
69
|
end
|
71
70
|
|
72
71
|
operable.check!
|
73
|
-
upload_all # important to call before plan.for_update.
|
74
|
-
# plan.for_update creates the changeset and requires the template to already be uploaded to s3
|
75
72
|
changeset = plan.for_update
|
76
73
|
!changeset.changed? || @sure || sure?("Are you sure you want to update the #{@stack} stack?")
|
77
74
|
changeset.execute_change_set
|
78
75
|
end
|
79
76
|
|
80
|
-
def upload_all
|
81
|
-
upload_templates
|
82
|
-
upload_files
|
83
|
-
end
|
84
|
-
|
85
|
-
def upload_templates
|
86
|
-
Lono::Builder::Template::Upload.new(@options).run
|
87
|
-
end
|
88
|
-
|
89
|
-
# Upload files right before create_stack or execute_change_set
|
90
|
-
# Its better to upload here as part of a deploy vs a build
|
91
|
-
# IE: lono build should try not to do a remote write to s3 if possible
|
92
|
-
def upload_files
|
93
|
-
# Files built and compressed in
|
94
|
-
# Lono::Builder::Dsl::Finalizer::Files::Build#build_files
|
95
|
-
Lono::Files.files.each do |file| # using singular file, but is like a "file_list"
|
96
|
-
file.upload
|
97
|
-
end
|
98
|
-
end
|
99
|
-
|
100
77
|
def create?
|
101
78
|
!stack_exists?(@stack)
|
102
79
|
end
|
data/lib/lono/cfn/plan.rb
CHANGED
@@ -10,6 +10,7 @@ module Lono::Cfn
|
|
10
10
|
end
|
11
11
|
|
12
12
|
def for_update
|
13
|
+
upload_all
|
13
14
|
# Allow passing down of the build object from Cfn::Deploy so build.all only runs once.
|
14
15
|
# Fallback to creating new build object but still pass one build object instance down.
|
15
16
|
@options[:build] ||= build
|
@@ -24,11 +25,35 @@ module Lono::Cfn
|
|
24
25
|
end
|
25
26
|
|
26
27
|
def for_create
|
28
|
+
upload_all
|
27
29
|
New.new(@options).run
|
28
30
|
end
|
29
31
|
|
30
32
|
def for_delete
|
31
33
|
Delete.new(@options).run
|
32
34
|
end
|
35
|
+
|
36
|
+
# important to call before for_update and for_create
|
37
|
+
# since changeset requires the template to already be uploaded to s3
|
38
|
+
def upload_all
|
39
|
+
upload_templates
|
40
|
+
upload_files
|
41
|
+
end
|
42
|
+
|
43
|
+
def upload_templates
|
44
|
+
Lono::Builder::Template::Upload.new(@options).run
|
45
|
+
end
|
46
|
+
|
47
|
+
# Upload files right before create_stack or execute_change_set
|
48
|
+
# Its better to upload here as part of a deploy vs a build
|
49
|
+
# IE: lono build should try not to do a remote write to s3 if possible
|
50
|
+
def upload_files
|
51
|
+
# Files built and compressed in
|
52
|
+
# Lono::Builder::Dsl::Finalizer::Files::Build#build_files
|
53
|
+
Lono::Files.files.each do |file| # using singular file, but is like a "file_list"
|
54
|
+
file.upload
|
55
|
+
end
|
56
|
+
end
|
57
|
+
|
33
58
|
end
|
34
59
|
end
|
data/lib/lono/ext/core/object.rb
CHANGED
@@ -26,7 +26,9 @@ class Object
|
|
26
26
|
# path: app/blueprints/demo/helpers/outputs.rb
|
27
27
|
# module_name: Outputs
|
28
28
|
require path
|
29
|
-
|
29
|
+
if path.include?("_helper.rb")
|
30
|
+
self.class.send :include, module_name.constantize
|
31
|
+
end
|
30
32
|
end
|
31
33
|
end
|
32
34
|
end
|
data/lib/lono/layering/layer.rb
CHANGED
@@ -77,7 +77,7 @@ module Lono::Layering
|
|
77
77
|
# Interface method: layers = pre_layers + main_layers + post_layers
|
78
78
|
# Simple layering is default. Can set with:
|
79
79
|
#
|
80
|
-
# config.layering.mode = "simple" # simple
|
80
|
+
# config.layering.mode = "simple" # simple or full
|
81
81
|
#
|
82
82
|
def main_layers
|
83
83
|
if Lono.config.layering.mode == "simple"
|
@@ -120,7 +120,6 @@ module Lono::Layering
|
|
120
120
|
logger.info " #{pretty_path(path)}" if File.exist?(path)
|
121
121
|
end
|
122
122
|
end
|
123
|
-
logger.debug ""
|
124
123
|
@@shown_layers[@type] = true
|
125
124
|
end
|
126
125
|
|
data/lib/lono/version.rb
CHANGED
@@ -2,10 +2,5 @@ source "https://rubygems.org"
|
|
2
2
|
|
3
3
|
# gem "lono", "~> <%= Lono::VERSION %>"
|
4
4
|
|
5
|
-
|
6
|
-
|
7
|
-
gem "rspec-lono", path: "~/boltops-tools/rspec-lono"
|
8
|
-
else
|
9
|
-
gem "lono", git: "https://github.com/boltops-tools/lono", branch: "v8"
|
10
|
-
gem "rspec-lono", git: "https://github.com/boltops-tools/rspec-lono", branch: "master"
|
11
|
-
end
|
5
|
+
gem "lono", git: "https://github.com/boltops-tools/lono", branch: "master"
|
6
|
+
gem "rspec-lono", git: "https://github.com/boltops-tools/rspec-lono", branch: "master"
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: lono
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 8.0.0.pre.
|
4
|
+
version: 8.0.0.pre.rc6
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Tung Nguyen
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2024-04-22 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: activesupport
|
@@ -487,6 +487,7 @@ files:
|
|
487
487
|
- ".cody/acceptance/role.rb"
|
488
488
|
- ".cody/shared/script/install.sh"
|
489
489
|
- ".cody/shared/script/install/lono.sh"
|
490
|
+
- ".github/FUNDING.yml"
|
490
491
|
- ".github/ISSUE_TEMPLATE.md"
|
491
492
|
- ".github/ISSUE_TEMPLATE/bug_report.md"
|
492
493
|
- ".github/ISSUE_TEMPLATE/documentation.md"
|
@@ -765,6 +766,7 @@ files:
|
|
765
766
|
- lib/lono/seeder.rb
|
766
767
|
- lib/lono/user_data.rb
|
767
768
|
- lib/lono/utils.rb
|
769
|
+
- lib/lono/utils/call_line.rb
|
768
770
|
- lib/lono/utils/logging.rb
|
769
771
|
- lib/lono/utils/pretty.rb
|
770
772
|
- lib/lono/utils/quit.rb
|
@@ -807,7 +809,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
807
809
|
- !ruby/object:Gem::Version
|
808
810
|
version: 1.3.1
|
809
811
|
requirements: []
|
810
|
-
rubygems_version: 3.
|
812
|
+
rubygems_version: 3.4.19
|
811
813
|
signing_key:
|
812
814
|
specification_version: 4
|
813
815
|
summary: 'Lono: The CloudFormation Framework'
|