ufo 6.2.1 → 6.2.4
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.github/ISSUE_TEMPLATE/bug_report.md +84 -0
- data/.github/ISSUE_TEMPLATE/documentation.md +12 -0
- data/.github/ISSUE_TEMPLATE/feature_request.md +64 -0
- data/.github/ISSUE_TEMPLATE/question.md +14 -0
- data/.github/ISSUE_TEMPLATE.md +7 -0
- data/.github/PULL_REQUEST_TEMPLATE.md +50 -0
- data/CHANGELOG.md +10 -0
- data/lib/ufo/cfn/stack/builder.rb +2 -1
- data/lib/ufo/cfn/stack/params.rb +2 -1
- data/lib/ufo/command.rb +17 -7
- data/lib/ufo/config/parse.rb +39 -0
- data/lib/ufo/config.rb +37 -3
- data/lib/ufo/layering/layer.rb +27 -37
- data/lib/ufo/task_definition/erb.rb +2 -2
- data/lib/ufo/task_definition/helpers/vars/builder.rb +13 -3
- data/lib/ufo/upgrade/upgrade4.rb +0 -9
- data/lib/ufo/version.rb +1 -1
- metadata +9 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 33b084a105deead3af06b7ee38478fe56875aa2a3e9728b4a78720ae33b7b100
|
4
|
+
data.tar.gz: 9c84f76952079299b855ac987d7de849a352f978badc05daa4934de34b93f7be
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 5c2d0f3ce6c72e0db4841ed99aaf0eb5095e2f8e2eea156dce69ac936dcca1b76c9185c920a4f791ff71217bb27ada2a486a023c139ff2c12d156dee882ca217
|
7
|
+
data.tar.gz: 285f2db81b8e5f49c0c2c52da74a896cfddee6df44853a61e9fa69f67b463654dff63f405229981db017c0bb7fcd0fa11b8993566aebe3c509ab7dbb72ccccf4
|
@@ -0,0 +1,84 @@
|
|
1
|
+
---
|
2
|
+
name: Reproducible Bug Report
|
3
|
+
about: Is something not working as expected?
|
4
|
+
title: ''
|
5
|
+
labels: 'bug'
|
6
|
+
assignees: ''
|
7
|
+
|
8
|
+
---
|
9
|
+
|
10
|
+
<!--
|
11
|
+
Hi! Thanks for considering to file a bug with UFO. Please take the time to
|
12
|
+
answer the basic questions. Please try to be as detailed as possible.
|
13
|
+
To be sensitive to everyone's time, if not enough details are provided, the
|
14
|
+
issue may be closed without comment. If you repeatedly fail to provide enough
|
15
|
+
details, you may be blocked from ever submitting issues to UFO again.
|
16
|
+
Please use your best judgment. 👍
|
17
|
+
|
18
|
+
If you are unsure this is a bug in UFO, please consider asking your question at:
|
19
|
+
https://community.boltops.com
|
20
|
+
|
21
|
+
Thanks!
|
22
|
+
-->
|
23
|
+
|
24
|
+
## Checklist
|
25
|
+
|
26
|
+
<!--
|
27
|
+
Make sure that you've done all of these. To mark a checkbox done, replace [ ] with [x]. Or after you create the issue you can click the checkbox.
|
28
|
+
-->
|
29
|
+
|
30
|
+
- [ ] Upgrade UFO: Are you using the latest version of UFO? This allows UFO to fix issues fast. There's an Upgrading Guide: https://ufoships.com/docs/upgrading/
|
31
|
+
- [ ] Reproducibility: Are you reporting a bug others will be able to reproduce and not asking a question. If you're unsure or want to ask a question, do so on https://community.boltops.com
|
32
|
+
- [ ] Code sample: Have you put together a code sample to reproduce the issue and make it available? Code samples help speed up fixes dramatically. If it's an easily reproducible issue, then code samples are not needed. If you're unsure, please include a code sample.
|
33
|
+
|
34
|
+
## My Environment
|
35
|
+
|
36
|
+
<!-- Please fill out the table below with debugging info to help: -->
|
37
|
+
|
38
|
+
| Software | Version |
|
39
|
+
| ---------------- | ------- |
|
40
|
+
| Operating System | |
|
41
|
+
| UFO | |
|
42
|
+
| Ruby | |
|
43
|
+
|
44
|
+
---
|
45
|
+
|
46
|
+
## Expected Behaviour
|
47
|
+
|
48
|
+
<!--
|
49
|
+
What is it you expected to happen? This should be a description of how the functionality you tried to use is supposed to work. Try to keep this to one-paragraph.
|
50
|
+
-->
|
51
|
+
|
52
|
+
## Current Behavior
|
53
|
+
|
54
|
+
<!--
|
55
|
+
Describe the details of the bug. Try to keep this to one-paragraph.
|
56
|
+
-->
|
57
|
+
|
58
|
+
## Step-by-step reproduction instructions
|
59
|
+
|
60
|
+
<!--
|
61
|
+
Be sure to include any steps you took for the problem to exist. This is likely the longest part of the report.
|
62
|
+
|
63
|
+
Please include any logs you think relevant here. If the logs are long (more than 50 lines) please make a gist of the logs and link to it. https://gist.github.com
|
64
|
+
|
65
|
+
With long logs, you can also use the <details> tag to keep the report readable. Example:
|
66
|
+
|
67
|
+
<details>
|
68
|
+
<summary>Summary Goes Here</summary>
|
69
|
+
|
70
|
+
...this is hidden, collapsable content. start with a blank line to get terminal output to format right...
|
71
|
+
</details>
|
72
|
+
-->
|
73
|
+
|
74
|
+
## Code Sample
|
75
|
+
|
76
|
+
<!--
|
77
|
+
Please provide a code repository, gist, code snippet or sample files to reproduce the issue.
|
78
|
+
-->
|
79
|
+
|
80
|
+
## Solution Suggestion
|
81
|
+
|
82
|
+
<!--
|
83
|
+
Please provide possible solutions. If you can't think of anything, feel free to omit. Please be kind and add helpful possible solutions. For example, "Fix it!" is not a helpful solution suggestion. We are mere mortals. Please be constructive.
|
84
|
+
-->
|
@@ -0,0 +1,12 @@
|
|
1
|
+
---
|
2
|
+
name: Documentation
|
3
|
+
about: Found a typo or something that isn't crystal clear in the docs?
|
4
|
+
title: ''
|
5
|
+
labels: docs
|
6
|
+
assignees: ''
|
7
|
+
|
8
|
+
---
|
9
|
+
|
10
|
+
The UFO Docs are in the [ufo-docs repo](https://github.com/boltops-tools/ufo-docs). Please submit a PR there. Thanks!
|
11
|
+
|
12
|
+
For documentation changes to the ufo code base itself, like code comments. Please submit a PR here. Thanks!
|
@@ -0,0 +1,64 @@
|
|
1
|
+
---
|
2
|
+
name: New Feature Suggestion
|
3
|
+
about: Want to add a feature to UFO?
|
4
|
+
title: ''
|
5
|
+
labels: feature
|
6
|
+
assignees: ''
|
7
|
+
|
8
|
+
---
|
9
|
+
|
10
|
+
<!--
|
11
|
+
Hi! Thanks for considering to file a feature request with UFO. Please take the time to answer the basic questions. Please try to be as detailed as possible.
|
12
|
+
|
13
|
+
Thanks!
|
14
|
+
-->
|
15
|
+
|
16
|
+
## Summary
|
17
|
+
|
18
|
+
<!--
|
19
|
+
A one-paragraph explanation of the feature.
|
20
|
+
-->
|
21
|
+
|
22
|
+
## Motivation
|
23
|
+
|
24
|
+
<!--
|
25
|
+
Why do you want to see this feature in UFO? What use cases does it support?
|
26
|
+
|
27
|
+
How the feature would be relevant to 80% or more of UFO users.
|
28
|
+
-->
|
29
|
+
|
30
|
+
## Guide-level explanation
|
31
|
+
|
32
|
+
<!--
|
33
|
+
Explain the proposal as if it was already included in the project and you were teaching it to another programmer. That generally means:
|
34
|
+
|
35
|
+
- Introducing new named concepts.
|
36
|
+
- Explaining the feature largely in terms of examples.
|
37
|
+
- If applicable, provide sample error messages, deprecation warnings, or upgrade guidance.
|
38
|
+
|
39
|
+
If this is a small feature, you may omit this section.
|
40
|
+
-->
|
41
|
+
|
42
|
+
## Reference-level explanation
|
43
|
+
|
44
|
+
<!--
|
45
|
+
This is the technical portion of the feature request. Explain the design in sufficient detail that:
|
46
|
+
|
47
|
+
- Its interaction with other features is clear.
|
48
|
+
- It is reasonably clear how the feature would be implemented.
|
49
|
+
- Corner cases are dissected by example.
|
50
|
+
|
51
|
+
If you do not know how to answer this, you can omit it. No worries!
|
52
|
+
-->
|
53
|
+
|
54
|
+
## Drawbacks
|
55
|
+
|
56
|
+
<!--
|
57
|
+
Why should we *not* do this?
|
58
|
+
-->
|
59
|
+
|
60
|
+
## Unresolved Questions
|
61
|
+
|
62
|
+
<!--
|
63
|
+
What related issues do you consider out of scope for this feature that could be addressed in the future independently of the solution that comes out of this feature?
|
64
|
+
-->
|
@@ -0,0 +1,14 @@
|
|
1
|
+
---
|
2
|
+
name: Question
|
3
|
+
about: Have any questions about how UFO works?
|
4
|
+
title: ''
|
5
|
+
labels: 'question'
|
6
|
+
assignees: ''
|
7
|
+
|
8
|
+
---
|
9
|
+
|
10
|
+
The UFO issue tracker IS NOT for usage questions! Please post your question on our dedicated forum at https://community.boltops.com
|
11
|
+
|
12
|
+
To be sensitive to everyone's time, we may close issues asking questions without comment. If you repeatedly post questions in the issues tracker, you may be blocked from ever submitting issues to UFO again. Please use your best judgment. 👍
|
13
|
+
|
14
|
+
Posting your questions in the UFO community forum benefits others by grouping questions in a dedicated place. Here are some additional options also https://ufoships.com/support/ 😁
|
@@ -0,0 +1,7 @@
|
|
1
|
+
Please fill out one of the templates on https://github.com/boltops-tools/ufo/issues/new/choose
|
2
|
+
|
3
|
+
If you want to ask a question please do so in the UFO category in the BoltOps Community forum: https://community.boltops.com
|
4
|
+
|
5
|
+
To be sensitive to everyone's time, we may close issues asking questions without comment. Posting your questions in the UFO community forum is the best place. It also benefits others by making the questions easier to find. Here are some additional options also https://ufoships.com/support/ 👌
|
6
|
+
|
7
|
+
Thank you!
|
@@ -0,0 +1,50 @@
|
|
1
|
+
<!--
|
2
|
+
Thanks for creating a Pull Request! Before you submit, please make sure you've done the following:
|
3
|
+
|
4
|
+
- I read the contributing document at https://ufoships.com/docs/contributing/
|
5
|
+
-->
|
6
|
+
|
7
|
+
<!--
|
8
|
+
Make our lives easier! Choose one of the following by uncommenting it:
|
9
|
+
-->
|
10
|
+
|
11
|
+
<!-- This is a 🐞 bug fix. -->
|
12
|
+
<!-- This is a 🙋♂️ feature or enhancement. -->
|
13
|
+
<!-- This is a 🧐 documentation change. -->
|
14
|
+
|
15
|
+
<!--
|
16
|
+
Before you submit this pull request, make sure to have a look at the following checklist. To mark a checkbox done, replace [ ] with [x]. Or after you create the issue you can click the checkbox.
|
17
|
+
|
18
|
+
If you don't know how to do some of these, that's fine! Submit your pull request and we will help you out on the way.
|
19
|
+
-->
|
20
|
+
|
21
|
+
- [ ] I've added tests (if it's a bug, feature or enhancement)
|
22
|
+
- [ ] I've adjusted the documentation (if it's a feature or enhancement)
|
23
|
+
- [ ] The test suite passes (run `bundle exec rspec` to verify this)
|
24
|
+
|
25
|
+
## Summary
|
26
|
+
|
27
|
+
<!--
|
28
|
+
Provide a description of what your pull request changes.
|
29
|
+
-->
|
30
|
+
|
31
|
+
## Context
|
32
|
+
|
33
|
+
<!--
|
34
|
+
Is this related to any GitHub issue(s) or another relevant link?
|
35
|
+
-->
|
36
|
+
|
37
|
+
## How to Test
|
38
|
+
|
39
|
+
<!--
|
40
|
+
Please provide instructions on how to test the fix. This speeds up reviewing the PR. If testing requires a demo UFO project, please provide an example repo.
|
41
|
+
-->
|
42
|
+
|
43
|
+
|
44
|
+
## Version Changes
|
45
|
+
|
46
|
+
<!--
|
47
|
+
Which semantic version change would you recommend?
|
48
|
+
If you don't know, feel free to omit it.
|
49
|
+
-->
|
50
|
+
|
data/CHANGELOG.md
CHANGED
@@ -3,6 +3,16 @@
|
|
3
3
|
All notable changes to this project will be documented in this file.
|
4
4
|
This project *tries* to adhere to [Semantic Versioning](http://semver.org/), even before v1.0.
|
5
5
|
|
6
|
+
## [6.2.4] - 2022-03-20
|
7
|
+
- [#158](https://github.com/tongueroo/ufo/pull/158) warn on missing env and secrets file instead of error
|
8
|
+
|
9
|
+
## [6.2.3] - 2022-03-20
|
10
|
+
- [#157](https://github.com/tongueroo/ufo/pull/157) layering.show_for_commands option
|
11
|
+
|
12
|
+
## [6.2.2] - 2022-03-20
|
13
|
+
- [#155](https://github.com/tongueroo/ufo/pull/155) layering.show option ability to show layers
|
14
|
+
- [#156](https://github.com/tongueroo/ufo/pull/156) extra layering support
|
15
|
+
|
6
16
|
## [6.2.1] - 2022-03-16
|
7
17
|
- [#153](https://github.com/tongueroo/ufo/pull/153) dockerfile_port also consider Dockerfile.base
|
8
18
|
- [#154](https://github.com/tongueroo/ufo/pull/154) report wrong vpc config errors to user
|
@@ -9,6 +9,7 @@ class Ufo::Cfn::Stack
|
|
9
9
|
end
|
10
10
|
|
11
11
|
def build
|
12
|
+
logger.info "Building template"
|
12
13
|
@template[:Parameters] = Parameters.build(@options)
|
13
14
|
@template[:Conditions] = Conditions.build(@options)
|
14
15
|
@template[:Resources] = Resources.build(@options)
|
@@ -23,7 +24,7 @@ class Ufo::Cfn::Stack
|
|
23
24
|
text = YAML.dump(template)
|
24
25
|
path = ".ufo/output/template.yml"
|
25
26
|
IO.write("#{Ufo.root}/#{path}", text)
|
26
|
-
logger.info "
|
27
|
+
logger.info " #{path}"
|
27
28
|
# Only basic YAML validation. Doesnt check for everything CloudFormation checks.
|
28
29
|
# For CloudFormation checks handled with an exception handler in Cfn::Stack#print_code(exception)
|
29
30
|
Ufo::Yaml.validate!(path)
|
data/lib/ufo/cfn/stack/params.rb
CHANGED
@@ -1,6 +1,7 @@
|
|
1
1
|
class Ufo::Cfn::Stack
|
2
2
|
class Params < Ufo::Cfn::Stack::Builder::Base
|
3
3
|
def build
|
4
|
+
logger.info "Building params"
|
4
5
|
params = {
|
5
6
|
Vpc: vpc.id,
|
6
7
|
ElbSubnets: vpc.elb_subnets,
|
@@ -40,7 +41,7 @@ class Ufo::Cfn::Stack
|
|
40
41
|
path = "#{Ufo.root}/.ufo/output/params.json"
|
41
42
|
FileUtils.mkdir_p(File.dirname(path))
|
42
43
|
IO.write(path, JSON.pretty_generate(params))
|
43
|
-
logger.info "
|
44
|
+
logger.info " #{pretty_path(path)}"
|
44
45
|
end
|
45
46
|
|
46
47
|
def vpc
|
data/lib/ufo/command.rb
CHANGED
@@ -39,7 +39,7 @@ module Ufo
|
|
39
39
|
# This requires Ufo.role.
|
40
40
|
# So we set Ufo.role before triggering Ufo.config loading
|
41
41
|
check_project!(args)
|
42
|
-
|
42
|
+
check_version_structure!
|
43
43
|
# Special case for `ufo central` commands.
|
44
44
|
# Dont want to call configure_dsl_evaluator
|
45
45
|
# and trigger loading of config => .ufo/config.rb
|
@@ -99,23 +99,33 @@ module Ufo
|
|
99
99
|
return if subcommand?
|
100
100
|
return if command_name.nil?
|
101
101
|
return if help_flags.include?(args.last) # IE: -h help
|
102
|
-
return if
|
102
|
+
return if non_project_command?
|
103
103
|
return if File.exist?("#{Ufo.root}/.ufo")
|
104
104
|
|
105
105
|
logger.error "ERROR: It doesnt look like this is a ufo project. Are you sure you are in a ufo project?".color(:red)
|
106
106
|
ENV['UFO_TEST'] ? raise : exit(1)
|
107
107
|
end
|
108
108
|
|
109
|
-
|
110
|
-
|
111
|
-
|
109
|
+
# Also, using ARGV instead of args because args is called by thor in multiple passes
|
110
|
+
# For `ufo central update`:
|
111
|
+
# * 1st pass: "central"
|
112
|
+
# * 2nd pass: "update"
|
113
|
+
def non_project_command?
|
114
|
+
commands = %w[-h -v --version completion completion_script help central init version]
|
115
|
+
commands.include?(ARGV[0])
|
116
|
+
end
|
117
|
+
|
118
|
+
def check_version_structure!
|
119
|
+
return if non_project_command?
|
120
|
+
return if File.exist?('.ufo/config.rb')
|
121
|
+
puts "ERROR: Latest ufo structure not detected".color(:red)
|
112
122
|
puts <<~EOL
|
113
123
|
It looks like this project .ufo files for an older ufo version.
|
114
124
|
The old .ufo structure does not work with this version of ufo.
|
115
125
|
|
116
|
-
Current Installed UFO Version:
|
126
|
+
Current Installed UFO Version: #{Ufo::VERSION}
|
117
127
|
|
118
|
-
Please
|
128
|
+
Please update the .ufo structure.
|
119
129
|
|
120
130
|
See: https://ufoships.com/docs/upgrading/upgrade6/
|
121
131
|
EOL
|
@@ -0,0 +1,39 @@
|
|
1
|
+
# Some limitations:
|
2
|
+
#
|
3
|
+
# * Only parsing one file: .ufo/config.rb
|
4
|
+
# * If user is using Ruby code that cannot be parse will fallback to default
|
5
|
+
#
|
6
|
+
# Think it's worth it so user only has to configure
|
7
|
+
#
|
8
|
+
# config.layering.show = true
|
9
|
+
#
|
10
|
+
class Ufo::Config
|
11
|
+
class Parse
|
12
|
+
def for(config, type: :boolean)
|
13
|
+
lines = IO.readlines("#{Ufo.root}/.ufo/config.rb")
|
14
|
+
config_line = lines.find do |l|
|
15
|
+
# IE: Regexp.new("config\.layering.show.*=")
|
16
|
+
regexp = Regexp.new("config\.#{config}.*=")
|
17
|
+
l =~ regexp && l !~ /^\s+#/
|
18
|
+
end
|
19
|
+
return false unless config_line # default is false
|
20
|
+
config_value = config_line.gsub(/.*=/,'').strip.gsub(/["']/,'')
|
21
|
+
case type
|
22
|
+
when :boolean
|
23
|
+
config_value != "false" && config_value != "nil"
|
24
|
+
when :array
|
25
|
+
eval(config_value) # IE: '["a"]' => ["a"]
|
26
|
+
else
|
27
|
+
raise "Type #{type.inspect} not supported"
|
28
|
+
end
|
29
|
+
rescue Exception => e
|
30
|
+
# if ENV['UFO_DEBUG']
|
31
|
+
puts "#{e.class} #{e.message}".color(:yellow)
|
32
|
+
puts "WARN: Unable to parse for config.layering.show".color(:yellow)
|
33
|
+
puts "Using default: config.layering.show = false"
|
34
|
+
# end
|
35
|
+
false
|
36
|
+
end
|
37
|
+
end
|
38
|
+
end
|
39
|
+
|
data/lib/ufo/config.rb
CHANGED
@@ -85,6 +85,10 @@ module Ufo
|
|
85
85
|
config.exec.command = "/bin/bash" # aws ecs execute-command cli
|
86
86
|
config.exec.enabled = true # EcsService EnableExecuteCommand
|
87
87
|
|
88
|
+
config.layering = ActiveSupport::OrderedOptions.new
|
89
|
+
config.layering.show = parsed_layering_show
|
90
|
+
config.layering.show_for_commands = parsed_layering_show_for
|
91
|
+
|
88
92
|
config.log = ActiveSupport::OrderedOptions.new
|
89
93
|
config.log.root = Ufo.log_root
|
90
94
|
config.logger = ufo_logger
|
@@ -108,6 +112,7 @@ module Ufo
|
|
108
112
|
config.secrets.pattern.secretsmanager = ":APP-:ENV-:SECRET_NAME" # => demo-dev-DB_PASS
|
109
113
|
config.secrets.pattern.ssm = ":APP/:ENV/:SECRET_NAME" # => demo/dev/DB_PASS
|
110
114
|
config.secrets.provider = "ssm" # default provider for conventional expansion IE: ssm or secretsmanager
|
115
|
+
config.secrets.warning = true
|
111
116
|
|
112
117
|
config.ship = ActiveSupport::OrderedOptions.new
|
113
118
|
config.ship.docker = ActiveSupport::OrderedOptions.new
|
@@ -160,15 +165,43 @@ module Ufo
|
|
160
165
|
role = layer_levels(".ufo/config/#{Ufo.app}/#{Ufo.role}")
|
161
166
|
layers += root + env + role
|
162
167
|
end
|
163
|
-
# load_project_config gets called so early that logger is not yet configured.
|
164
|
-
|
168
|
+
# load_project_config gets called so early that logger is not yet configured.
|
169
|
+
# Cannot use Ufo.config yet and cannot use logger which relies on Ufo.config
|
170
|
+
# Use puts and use parsed_layering_show
|
171
|
+
show = show_layers?
|
172
|
+
puts "Config Layers" if show
|
165
173
|
layers.each do |layer|
|
166
174
|
path = "#{Ufo.root}/#{layer}"
|
167
|
-
|
175
|
+
if ENV['UFO_LAYERS_ALL']
|
176
|
+
puts " #{pretty_path(path)}"
|
177
|
+
elsif show
|
178
|
+
puts " #{pretty_path(path)}" if File.exist?(path)
|
179
|
+
end
|
168
180
|
evaluate_file(path)
|
169
181
|
end
|
170
182
|
end
|
171
183
|
|
184
|
+
def show_layers?
|
185
|
+
show_for = parsed_layering_show_for
|
186
|
+
command = ARGV[0]
|
187
|
+
parsed_layering_show && show_for.include?(command)
|
188
|
+
end
|
189
|
+
|
190
|
+
def parsed_layering_show_for
|
191
|
+
parse.for("layering.show_for_commands", type: :array) || %w[build ship] # IE: ps exec logs are not shown
|
192
|
+
end
|
193
|
+
memoize :parsed_layering_show_for
|
194
|
+
|
195
|
+
def parsed_layering_show
|
196
|
+
ENV['UFO_LAYERS'] || parse.for("layering.show", type: :boolean)
|
197
|
+
end
|
198
|
+
private :parsed_layering_show
|
199
|
+
|
200
|
+
def parse
|
201
|
+
Parse.new
|
202
|
+
end
|
203
|
+
memoize :parse
|
204
|
+
|
172
205
|
# Works similiar to Layering::Layer. Consider combining the logic and usin Layering::Layer
|
173
206
|
#
|
174
207
|
# Examples:
|
@@ -183,6 +216,7 @@ module Ufo
|
|
183
216
|
#
|
184
217
|
def layer_levels(prefix=nil)
|
185
218
|
levels = ["", "base", Ufo.env]
|
219
|
+
levels << "#{Ufo.env}-#{Ufo.extra}" if Ufo.extra
|
186
220
|
paths = levels.map do |i|
|
187
221
|
# base layer has prefix of '', reject with blank so it doesnt produce '//'
|
188
222
|
[prefix, i].join('/')
|
data/lib/ufo/layering/layer.rb
CHANGED
@@ -23,46 +23,44 @@ module Ufo::Layering
|
|
23
23
|
end
|
24
24
|
|
25
25
|
def paths
|
26
|
-
core = full_layers(".ufo/vars")
|
27
|
-
app = full_layers(".ufo/vars/#{Ufo.app}")
|
28
|
-
|
26
|
+
# core = full_layers(".ufo/vars")
|
27
|
+
# app = full_layers(".ufo/vars/#{Ufo.app}")
|
28
|
+
|
29
|
+
core = layer_levels(".ufo/vars")
|
30
|
+
role = layer_levels(".ufo/vars/#{@task_definition.role}")
|
31
|
+
app = layer_levels(".ufo/vars/#{Ufo.app}")
|
32
|
+
app_role = layer_levels(".ufo/vars/#{Ufo.app}/#{@task_definition.role}")
|
33
|
+
|
34
|
+
paths = core + role + app + app_role
|
29
35
|
add_ext!(paths)
|
30
36
|
paths.map! { |p| "#{Ufo.root}/#{p}" }
|
31
37
|
show_layers(paths)
|
32
38
|
paths
|
33
39
|
end
|
34
40
|
|
35
|
-
def full_layering
|
36
|
-
# layers defined in Lono::Layering module
|
37
|
-
all = layers.map { |layer| layer.sub(/\/$/,'') } # strip trailing slash
|
38
|
-
all.inject([]) do |sum, layer|
|
39
|
-
sum += layer_levels(layer) unless layer.nil?
|
40
|
-
sum
|
41
|
-
end
|
42
|
-
end
|
43
|
-
|
44
|
-
# interface method
|
45
|
-
def main_layers
|
46
|
-
['']
|
47
|
-
end
|
48
|
-
|
49
41
|
# adds prefix and to each layer pair that has base and Ufo.env. IE:
|
50
42
|
#
|
51
43
|
# "#{prefix}/base"
|
52
44
|
# "#{prefix}/#{Ufo.env}"
|
53
45
|
#
|
54
46
|
def layer_levels(prefix=nil)
|
55
|
-
levels = ["base", Ufo.env]
|
47
|
+
levels = ["", "base", Ufo.env]
|
48
|
+
levels << "#{Ufo.env}-#{Ufo.extra}" if Ufo.extra
|
56
49
|
levels.map! do |i|
|
57
50
|
# base layer has prefix of '', reject with blank so it doesnt produce '//'
|
58
51
|
[prefix, i].reject(&:blank?).join('/')
|
59
52
|
end
|
60
|
-
levels.
|
53
|
+
levels.map! { |level| level.sub(/\/$/,'') } # strip trailing slash
|
54
|
+
# levels.unshift(prefix) # unless prefix.blank? # IE: params/us-west-2.txt
|
61
55
|
levels
|
62
56
|
end
|
63
57
|
|
58
|
+
# interface method
|
59
|
+
def main_layers
|
60
|
+
['']
|
61
|
+
end
|
62
|
+
|
64
63
|
def add_ext!(paths)
|
65
|
-
ext = "rb"
|
66
64
|
paths.map! do |path|
|
67
65
|
path = path.sub(/\/$/,'') if path.ends_with?('/')
|
68
66
|
"#{path}.rb"
|
@@ -70,26 +68,18 @@ module Ufo::Layering
|
|
70
68
|
paths
|
71
69
|
end
|
72
70
|
|
73
|
-
|
74
|
-
layers = full_layering.map do |layer|
|
75
|
-
"#{dir}/#{layer}"
|
76
|
-
end
|
77
|
-
role_layers = full_layering.map do |layer|
|
78
|
-
"#{dir}/#{@task_definition.role}/#{layer}" # Note: layer can be '' will clean up
|
79
|
-
end
|
80
|
-
layers += role_layers
|
81
|
-
layers.map { |l| l.gsub('//','/') } # cleanup // if layer is ''
|
82
|
-
end
|
83
|
-
|
84
|
-
@@shown_layers = false
|
71
|
+
@@shown = false
|
85
72
|
def show_layers(paths)
|
86
|
-
return if @@
|
87
|
-
logger.
|
73
|
+
return if @@shown
|
74
|
+
logger.debug "Layers:"
|
88
75
|
paths.each do |path|
|
89
|
-
|
90
|
-
|
76
|
+
if ENV['UFO_LAYERS_ALL']
|
77
|
+
logger.info " #{pretty_path(path)}"
|
78
|
+
elsif Ufo.config.show_layers?
|
79
|
+
logger.info " #{pretty_path(path)}" if File.exist?(path)
|
80
|
+
end
|
91
81
|
end
|
92
|
-
@@
|
82
|
+
@@shown = true
|
93
83
|
end
|
94
84
|
end
|
95
85
|
end
|
@@ -10,14 +10,14 @@ class Ufo::TaskDefinition
|
|
10
10
|
alias_method :family, :name
|
11
11
|
|
12
12
|
def run
|
13
|
-
logger.
|
13
|
+
logger.info "Building Task Definition"
|
14
14
|
clean
|
15
15
|
load_context
|
16
16
|
data = evaluate_code
|
17
17
|
check_empty!(data)
|
18
18
|
data = squeeze(data)
|
19
19
|
write(data)
|
20
|
-
logger.info "
|
20
|
+
logger.info " #{output_path}"
|
21
21
|
end
|
22
22
|
|
23
23
|
def check_empty!(data)
|
@@ -5,8 +5,10 @@ module Ufo::TaskDefinition::Helpers::Vars
|
|
5
5
|
extend Memoist
|
6
6
|
include AwsHelper
|
7
7
|
include Ufo::Concerns::Names
|
8
|
-
include Ufo::Utils::Pretty
|
9
8
|
include Ufo::Config::CallableOption::Concern
|
9
|
+
include Ufo::Utils::CallLine
|
10
|
+
include Ufo::Utils::Logging
|
11
|
+
include Ufo::Utils::Pretty
|
10
12
|
|
11
13
|
def initialize(options={})
|
12
14
|
# use either file or text. text takes higher precedence
|
@@ -21,8 +23,16 @@ module Ufo::TaskDefinition::Helpers::Vars
|
|
21
23
|
def read(path)
|
22
24
|
full_path = "#{Ufo.root}/#{path}"
|
23
25
|
unless File.exist?(full_path)
|
24
|
-
|
25
|
-
|
26
|
+
logger.warn "WARN: The #{pretty_path(full_path)} env file could not be found. Are you sure it exists?".color(:yellow)
|
27
|
+
logger.warn <<~EOL
|
28
|
+
You can disable this warning with: secrets.warning = false
|
29
|
+
|
30
|
+
See: https://ufoships.com/docs/helpers/builtin/secrets/
|
31
|
+
|
32
|
+
EOL
|
33
|
+
call_line = ufo_config_call_line
|
34
|
+
DslEvaluator.print_code(call_line)
|
35
|
+
return ''
|
26
36
|
end
|
27
37
|
IO.read(full_path)
|
28
38
|
end
|
data/lib/ufo/upgrade/upgrade4.rb
CHANGED
@@ -24,7 +24,6 @@ class Ufo::Upgrade
|
|
24
24
|
upsert_dockerignore
|
25
25
|
upsert_gitignore
|
26
26
|
update_params_yaml
|
27
|
-
update_task_definitions
|
28
27
|
new_files
|
29
28
|
end
|
30
29
|
|
@@ -34,14 +33,6 @@ class Ufo::Upgrade
|
|
34
33
|
end
|
35
34
|
|
36
35
|
private
|
37
|
-
def update_task_definitions
|
38
|
-
text = <<-EOL
|
39
|
-
# HINT: shows how Ufo.extra can to create different log groups
|
40
|
-
# awslogs_group: ["ecs/TASK_DEFINITION_NAME", Ufo.extra].compact.join('-'),
|
41
|
-
EOL
|
42
|
-
insert_into_file ".ufo/task_definitions.rb", text, :before => / awslogs_group:/
|
43
|
-
end
|
44
|
-
|
45
36
|
def new_files
|
46
37
|
configure_network_settings
|
47
38
|
template(".ufo/settings/network/default.yml")
|
data/lib/ufo/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: ufo
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 6.2.
|
4
|
+
version: 6.2.4
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Tung Nguyen
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2022-03-
|
11
|
+
date: 2022-03-20 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: aws-logs
|
@@ -459,6 +459,12 @@ files:
|
|
459
459
|
- ".cody/acceptance/role.rb"
|
460
460
|
- ".cody/shared/script/install.sh"
|
461
461
|
- ".cody/shared/script/install/ufo.sh"
|
462
|
+
- ".github/ISSUE_TEMPLATE.md"
|
463
|
+
- ".github/ISSUE_TEMPLATE/bug_report.md"
|
464
|
+
- ".github/ISSUE_TEMPLATE/documentation.md"
|
465
|
+
- ".github/ISSUE_TEMPLATE/feature_request.md"
|
466
|
+
- ".github/ISSUE_TEMPLATE/question.md"
|
467
|
+
- ".github/PULL_REQUEST_TEMPLATE.md"
|
462
468
|
- ".github/workflows/main.yml"
|
463
469
|
- ".gitignore"
|
464
470
|
- ".rspec"
|
@@ -588,6 +594,7 @@ files:
|
|
588
594
|
- lib/ufo/config/callable_option.rb
|
589
595
|
- lib/ufo/config/callable_option/concern.rb
|
590
596
|
- lib/ufo/config/inits.rb
|
597
|
+
- lib/ufo/config/parse.rb
|
591
598
|
- lib/ufo/core.rb
|
592
599
|
- lib/ufo/docker/builder.rb
|
593
600
|
- lib/ufo/docker/cleaner.rb
|