simplygenius-atmos 0.11.10 → 0.13.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +64 -0
- data/README.md +1 -1
- data/lib/simplygenius/atmos.rb +3 -0
- data/lib/simplygenius/atmos/cli.rb +99 -9
- data/lib/simplygenius/atmos/commands/account.rb +39 -3
- data/lib/simplygenius/atmos/commands/auth_exec.rb +1 -1
- data/lib/simplygenius/atmos/commands/bootstrap.rb +2 -1
- data/lib/simplygenius/atmos/commands/container.rb +44 -18
- data/lib/simplygenius/atmos/commands/generate.rb +2 -2
- data/lib/simplygenius/atmos/commands/init.rb +0 -2
- data/lib/simplygenius/atmos/commands/otp.rb +1 -1
- data/lib/simplygenius/atmos/commands/secret.rb +2 -2
- data/lib/simplygenius/atmos/commands/terraform.rb +9 -10
- data/lib/simplygenius/atmos/commands/tfutil.rb +7 -7
- data/lib/simplygenius/atmos/commands/user.rb +7 -7
- data/lib/simplygenius/atmos/config.rb +104 -39
- data/lib/simplygenius/atmos/provider_factory.rb +6 -5
- data/lib/simplygenius/atmos/providers/aws/account_manager.rb +71 -0
- data/lib/simplygenius/atmos/providers/aws/container_manager.rb +38 -5
- data/lib/simplygenius/atmos/providers/aws/provider.rb +3 -0
- data/lib/simplygenius/atmos/providers/none/auth_manager.rb +24 -0
- data/lib/simplygenius/atmos/providers/none/provider.rb +47 -0
- data/lib/simplygenius/atmos/providers/none/secret_manager.rb +40 -0
- data/lib/simplygenius/atmos/source_path.rb +1 -1
- data/lib/simplygenius/atmos/terraform_executor.rb +20 -3
- data/lib/simplygenius/atmos/version.rb +1 -1
- data/templates/new/config/atmos.yml +6 -1
- data/templates/new/config/atmos/runtime.yml +12 -6
- metadata +77 -46
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: e6e7037a18301c9dc8f8908d72b83d2390481145dcd1061d2c2d678e922bf658
|
4
|
+
data.tar.gz: '08858cc4a83f9af8cca448dc64c9a094ece7216c43b872c0c07bc9f8dcd32b0b'
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 75e6f5eac9061b38e12f162a31e721d74f97d532d576b142b5a4be5b39b952a91ffc013fc2cce175bd6b8fd0ee2fe8da34bbe73790a8686b930c2a6fb8368556
|
7
|
+
data.tar.gz: 9ebfb5234e13d3972c507c1366c1785ddebea03e23bd6dcc33b32c3057876f0dca2ec696c77bbfcd2ef7ba274aed95f56ac73809e142b52178a4c30902a73bb5
|
data/CHANGELOG.md
CHANGED
@@ -1,3 +1,67 @@
|
|
1
|
+
0.13.1 (05/04/2021)
|
2
|
+
-------------------
|
3
|
+
|
4
|
+
* fix console exception, extend console startup wait loop, and add better console logging and error reporting [2d44553](../../commit/2d44553)
|
5
|
+
* fix logging [3cc07b9](../../commit/3cc07b9)
|
6
|
+
* allow selection of specific items with cli config dump [675ebfe](../../commit/675ebfe)
|
7
|
+
* cli help line formatting [13b36a3](../../commit/13b36a3)
|
8
|
+
* add container pull helper [22518f3](../../commit/22518f3)
|
9
|
+
|
10
|
+
0.13.0 (01/20/2021)
|
11
|
+
-------------------
|
12
|
+
|
13
|
+
#### Notes on major changes
|
14
|
+
|
15
|
+
* Now testing the atmos runtime against terraform 0.14 (and 0.11, 0.13)
|
16
|
+
* The ability to link files into the terraform execution directory was enhanced, but still doesn't work for the .terraform.lock.hcl as it is overwritten by terraform and doesn't follow the link
|
17
|
+
|
18
|
+
#### Full changelog
|
19
|
+
|
20
|
+
* exclude some new taskdef attributes for creation of new taskdef during deploy [a01b997](https://github.com/simplygenius/atmos/commit/a01b997)
|
21
|
+
* add debug logging for aws sdk logger [55dd303](https://github.com/simplygenius/atmos/commit/55dd303)
|
22
|
+
* directory sorting made more consistent across platforms [13622ff](https://github.com/simplygenius/atmos/commit/13622ff)
|
23
|
+
* switch ci/cd from travis to github actions [13622ff](https://github.com/simplygenius/atmos/commit/13622ff)
|
24
|
+
* fix test for tf 0.14 [122f861](https://github.com/simplygenius/atmos/commit/122f861)
|
25
|
+
* replace plugin sharing with built in terraform variant [eb75266](https://github.com/simplygenius/atmos/commit/eb75266)
|
26
|
+
* allow more options for linking in non-tf files into working dir [9878336](https://github.com/simplygenius/atmos/commit/9878336)
|
27
|
+
* sort secret list [6b2dbfe](https://github.com/simplygenius/atmos/commit/6b2dbfe)
|
28
|
+
* Only run terraform init when needed [d77186b](https://github.com/simplygenius/atmos/commit/d77186b)
|
29
|
+
|
30
|
+
|
31
|
+
0.12.1 (10/14/2020)
|
32
|
+
-------------------
|
33
|
+
|
34
|
+
* fix bug with deeply nested overrides [60cb84a](https://github.com/simplygenius/atmos/commit/60cb84a)
|
35
|
+
|
36
|
+
0.12.0 (10/12/2020)
|
37
|
+
-------------------
|
38
|
+
|
39
|
+
#### Notes on major changes
|
40
|
+
|
41
|
+
* Now testing the atmos runtime against terraform 0.13 (and 0.11, 0.12), but no changes were necessary, so it should work if you upgrade aside from recipe changes
|
42
|
+
* The fix to to make overrides (keys like ^foo to replace foo rather than add to it) work no matter where they appear in the config load chain could break compatibility if you were depending on the old behavior, i.e. you have multiple overrides for the same key with only the last one winning, or you have an override earlier in the change that was previously not taking effect
|
43
|
+
|
44
|
+
#### Full changelog
|
45
|
+
|
46
|
+
* Make overrides work no matter where they appear in the config load chain [47d73ba](https://github.com/simplygenius/atmos/commit/47d73ba)
|
47
|
+
* allow interpolation in (remote_)config_source references, e.g. for supplying an access key from ~/.atmos.yml in the url [43f0c4d](https://github.com/simplygenius/atmos/commit/43f0c4d)
|
48
|
+
* fix docker build [f4b3e2e](https://github.com/simplygenius/atmos/commit/f4b3e2e)
|
49
|
+
* fix stdin test [5bd3f95](https://github.com/simplygenius/atmos/commit/5bd3f95)
|
50
|
+
* exit with code on terraform error [2d2af2a](https://github.com/simplygenius/atmos/commit/2d2af2a)
|
51
|
+
* test against tf 0.1[123] [1bbfb3b](https://github.com/simplygenius/atmos/commit/1bbfb3b)
|
52
|
+
* add 'none' provider for tests (or if one wants to only run against terraform without aws) [991cefe](https://github.com/simplygenius/atmos/commit/991cefe)
|
53
|
+
* fix activesupport cve [3d8b30c](https://github.com/simplygenius/atmos/commit/3d8b30c)
|
54
|
+
* Add the ability to fetch atmos config from remote sources [b4b97fb](https://github.com/simplygenius/atmos/commit/b4b97fb)
|
55
|
+
* Add convenience (`atmos account setup_credentials`)for populating aws local credential stores with the aws accounts managed by atmos [05466bd](https://github.com/simplygenius/atmos/commit/05466bd)
|
56
|
+
* Add error msg for when task definition does't exist [0f8291e](https://github.com/simplygenius/atmos/commit/0f8291e)
|
57
|
+
* Fix `jsonify` to convert the correct value to JSON. (#4) [1bda229](https://github.com/simplygenius/atmos/commit/1bda229)
|
58
|
+
* Use ruby 2.4 for legacy testing since 2.3 is eol [78d2862](https://github.com/simplygenius/atmos/commit/78d2862)
|
59
|
+
|
60
|
+
0.11.11 (02/20/2020)
|
61
|
+
--------------------
|
62
|
+
|
63
|
+
* Add the ability to setup a version requirement for forcing teams to use a consistent version of atmos [5c44ef3](https://github.com/simplygenius/atmos/commit/5c44ef3)
|
64
|
+
|
1
65
|
0.11.10 (02/19/2020)
|
2
66
|
--------------------
|
3
67
|
|
data/README.md
CHANGED
@@ -1,4 +1,4 @@
|
|
1
|
-
[![Build Status](https://
|
1
|
+
[![Build Status](https://github.com/simplygenius/atmos/workflows/CD/badge.svg)](https://github.com/simplygenius/atmos/actions)
|
2
2
|
[![Coverage Status](https://coveralls.io/repos/github/simplygenius/atmos/badge.svg?branch=master)](https://coveralls.io/github/simplygenius/atmos?branch=master)
|
3
3
|
[![Gitter](https://badges.gitter.im/simplygenius/atmos.svg)](https://gitter.im/simplygenius/atmos?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge)
|
4
4
|
|
data/lib/simplygenius/atmos.rb
CHANGED
@@ -2,6 +2,7 @@ require_relative '../atmos'
|
|
2
2
|
require_relative '../atmos/ui'
|
3
3
|
require 'clamp'
|
4
4
|
require 'sigdump/setup'
|
5
|
+
require 'open-uri'
|
5
6
|
|
6
7
|
Dir.glob(File.join(File.join(__dir__, 'commands'), '*.rb')) do |f|
|
7
8
|
require_relative "commands/#{File.basename(f).sub(/\.rb$/, "")}"
|
@@ -29,22 +30,22 @@ module SimplyGenius
|
|
29
30
|
end
|
30
31
|
|
31
32
|
option ["-d", "--debug"],
|
32
|
-
:flag, "debug output
|
33
|
+
:flag, "debug output",
|
33
34
|
default: false
|
34
35
|
|
35
36
|
option ["-q", "--quiet"],
|
36
|
-
:flag, "suppress output
|
37
|
+
:flag, "suppress output",
|
37
38
|
default: false
|
38
39
|
|
39
40
|
option ["-c", "--[no-]color"],
|
40
|
-
:flag, "colorize output (or not)
|
41
|
+
:flag, "colorize output (or not) (default: $stdout.tty?)"
|
41
42
|
|
42
43
|
option ["-e", "--atmos-env"],
|
43
|
-
'ENV', "The atmos environment
|
44
|
+
'ENV', "The atmos environment",
|
44
45
|
environment_variable: 'ATMOS_ENV', default: 'ops'
|
45
46
|
|
46
47
|
option ["-g", "--atmos-group"],
|
47
|
-
'GROUP', "The atmos working group
|
48
|
+
'GROUP', "The atmos working group for selecting recipe groups",
|
48
49
|
default: 'default'
|
49
50
|
|
50
51
|
option ["-p", "--load-path"],
|
@@ -52,7 +53,7 @@ module SimplyGenius
|
|
52
53
|
multivalued: true
|
53
54
|
|
54
55
|
option ["-o", "--override"],
|
55
|
-
"KEYVALUE", "overrides atmos configuration
|
56
|
+
"KEYVALUE", "overrides atmos configuration in the form 'some.config=value' where value can be expressed in yaml form for complex types e.g. foo=1 foo=abc, foo=[x, y], foo={x: y}",
|
56
57
|
multivalued: true
|
57
58
|
|
58
59
|
option ["-v", "--version"],
|
@@ -63,7 +64,7 @@ module SimplyGenius
|
|
63
64
|
end
|
64
65
|
|
65
66
|
option ["-l", "--[no-]log"],
|
66
|
-
:flag, "log to file in addition to terminal (or not)
|
67
|
+
:flag, "log to file in addition to terminal (or not)",
|
67
68
|
default: true
|
68
69
|
|
69
70
|
|
@@ -109,16 +110,69 @@ module SimplyGenius
|
|
109
110
|
option ["-j", "--json"],
|
110
111
|
:flag, "Dump config as json instead of yaml"
|
111
112
|
|
113
|
+
parameter "PATH",
|
114
|
+
"The dot notation path of a specific config item to get",
|
115
|
+
required: false
|
116
|
+
|
112
117
|
def execute
|
118
|
+
if path
|
119
|
+
result = Atmos.config[path]
|
120
|
+
result = case result
|
121
|
+
when Hash
|
122
|
+
result.to_h
|
123
|
+
when Array
|
124
|
+
result.to_a
|
125
|
+
else
|
126
|
+
result
|
127
|
+
end
|
128
|
+
else
|
129
|
+
result = Atmos.config.to_h
|
130
|
+
end
|
131
|
+
|
113
132
|
if json?
|
114
|
-
output = JSON.pretty_generate(
|
133
|
+
output = JSON.pretty_generate(result)
|
115
134
|
else
|
116
|
-
output = YAML.dump(
|
135
|
+
output = YAML.dump(result).sub(/^\s*---\s*/, '')
|
117
136
|
end
|
118
137
|
logger.info output
|
119
138
|
end
|
120
139
|
end
|
121
140
|
|
141
|
+
def fetch_latest_version
|
142
|
+
begin
|
143
|
+
latest_ver = JSON.parse(URI.open("https://rubygems.org/api/v1/versions/simplygenius-atmos/latest.json").read)['version']
|
144
|
+
rescue => e
|
145
|
+
latest_ver = "[Version Fetch Failed]"
|
146
|
+
logger.log_exception(e, "Couldn't check latest atmos gem version", level: :debug)
|
147
|
+
end
|
148
|
+
latest_ver
|
149
|
+
end
|
150
|
+
|
151
|
+
def version_check(atmos_version)
|
152
|
+
|
153
|
+
required_ver = Atmos.config["atmos.version_requirement"]
|
154
|
+
if required_ver.present?
|
155
|
+
case required_ver
|
156
|
+
|
157
|
+
when "latest"
|
158
|
+
latest_ver = fetch_latest_version
|
159
|
+
|
160
|
+
if latest_ver != atmos_version
|
161
|
+
raise "The atmos version (#{atmos_version}) does not match the given requirement (latest: #{latest_ver})"
|
162
|
+
end
|
163
|
+
|
164
|
+
when /[~<>=]*\s*[\d\.]*/
|
165
|
+
if ! Gem::Dependency.new('', required_ver).match?('', atmos_version)
|
166
|
+
raise "The atmos version (#{atmos_version}) does not match the given requirement (#{required_ver})"
|
167
|
+
end
|
168
|
+
|
169
|
+
else
|
170
|
+
raise "Invalid atmos.version_requirement, should be 'latest' or in a gem dependency form"
|
171
|
+
end
|
172
|
+
end
|
173
|
+
|
174
|
+
end
|
175
|
+
|
122
176
|
# hook into clamp lifecycle to force logging setup even when we are calling
|
123
177
|
# a subcommand
|
124
178
|
def parse(arguments)
|
@@ -149,6 +203,8 @@ module SimplyGenius
|
|
149
203
|
logger.info "Atmos Version #{VERSION}"
|
150
204
|
exit(0)
|
151
205
|
end
|
206
|
+
|
207
|
+
version_check(VERSION)
|
152
208
|
end
|
153
209
|
end
|
154
210
|
|
@@ -175,3 +231,37 @@ module SimplyGenius
|
|
175
231
|
|
176
232
|
end
|
177
233
|
end
|
234
|
+
|
235
|
+
# Hack to make clamp usage less of a pain to get long lines to fit within a
|
236
|
+
# standard terminal width
|
237
|
+
class Clamp::Help::Builder
|
238
|
+
|
239
|
+
def word_wrap(text, line_width:)
|
240
|
+
text.split("\n").collect do |line|
|
241
|
+
line.length > line_width ? line.gsub(/(.{1,#{line_width}})(\s+|$)/, "\\1\n").strip.split("\n") : line
|
242
|
+
end.flatten
|
243
|
+
end
|
244
|
+
|
245
|
+
def string
|
246
|
+
line_width = 79
|
247
|
+
indent_size = 4
|
248
|
+
indent = " " * indent_size
|
249
|
+
StringIO.new.tap do |out|
|
250
|
+
lines.each do |line|
|
251
|
+
case line
|
252
|
+
when Array
|
253
|
+
out << indent
|
254
|
+
out.puts(line[0])
|
255
|
+
formatted_line = line[1].gsub(/\((default|required)/, "\n\\0")
|
256
|
+
word_wrap(formatted_line, line_width: (line_width - indent_size * 2)).each do |l|
|
257
|
+
out << (indent * 2)
|
258
|
+
out.puts(l)
|
259
|
+
end
|
260
|
+
else
|
261
|
+
out.puts(line)
|
262
|
+
end
|
263
|
+
end
|
264
|
+
end.string
|
265
|
+
end
|
266
|
+
|
267
|
+
end
|
@@ -15,13 +15,13 @@ module SimplyGenius
|
|
15
15
|
subcommand "create", "Create a new account" do
|
16
16
|
|
17
17
|
option ["-s", "--source-env"],
|
18
|
-
"SOURCE_ENV", "Base the new env on a clone of the given one
|
18
|
+
"SOURCE_ENV", "Base the new env on a clone of the given one"
|
19
19
|
|
20
20
|
option ["-e", "--email"],
|
21
|
-
"EMAIL", "override default email used for new account
|
21
|
+
"EMAIL", "override default email used for new account"
|
22
22
|
|
23
23
|
option ["-n", "--name"],
|
24
|
-
"NAME", "override default name used for new account
|
24
|
+
"NAME", "override default name used for new account"
|
25
25
|
|
26
26
|
parameter "ENV",
|
27
27
|
"The name of the new env to create"
|
@@ -62,6 +62,42 @@ module SimplyGenius
|
|
62
62
|
end
|
63
63
|
end
|
64
64
|
|
65
|
+
subcommand "setup_credentials", "Convenience that adds accounts to the local aws credentials store" do
|
66
|
+
|
67
|
+
option ["-u", "--user"],
|
68
|
+
"USERNAME", "The username in the cloud provider", required: true
|
69
|
+
|
70
|
+
option ["-k", "--key"],
|
71
|
+
"KEY", "The access key in the cloud provider"
|
72
|
+
|
73
|
+
option ["-s", "--secret"],
|
74
|
+
"SECRET", "The access secret in the cloud provider"
|
75
|
+
|
76
|
+
option ["-d", "--default"],
|
77
|
+
:flag, "Sets as default credentials"
|
78
|
+
|
79
|
+
option ["-f", "--force"],
|
80
|
+
:flag, "Forces overwrites of existing"
|
81
|
+
|
82
|
+
option ["-n", "--nowrite"],
|
83
|
+
:flag, "Trial run without writing results to files"
|
84
|
+
|
85
|
+
def execute
|
86
|
+
|
87
|
+
if ! key.present?
|
88
|
+
key = ask("Input your access key: ") { |q| q.echo = "*" }
|
89
|
+
raise ArgumentError.new("An access key is required") if key.blank?
|
90
|
+
end
|
91
|
+
if ! secret.present?
|
92
|
+
secret = ask("Input your access secret: ") { |q| q.echo = "*" }
|
93
|
+
raise ArgumentError.new("An access secret is required") if secret.blank?
|
94
|
+
end
|
95
|
+
|
96
|
+
Atmos.config.provider.account_manager.setup_credentials(username: user, access_key: key, access_secret: secret,
|
97
|
+
become_default: default?, force: force?, nowrite: nowrite?)
|
98
|
+
end
|
99
|
+
end
|
100
|
+
|
65
101
|
end
|
66
102
|
|
67
103
|
end
|
@@ -11,7 +11,7 @@ module SimplyGenius
|
|
11
11
|
end
|
12
12
|
|
13
13
|
option ["-f", "--force"],
|
14
|
-
:flag, "forces bootstrap
|
14
|
+
:flag, "forces bootstrap"
|
15
15
|
|
16
16
|
def execute
|
17
17
|
orig_config = Atmos.config
|
@@ -68,6 +68,7 @@ module SimplyGenius
|
|
68
68
|
rescue TerraformExecutor::ProcessFailed => e
|
69
69
|
logger.error(e.message)
|
70
70
|
logger.error(rebootstrap_msg)
|
71
|
+
exit(1)
|
71
72
|
end
|
72
73
|
end
|
73
74
|
end
|
@@ -15,22 +15,44 @@ module SimplyGenius
|
|
15
15
|
end
|
16
16
|
|
17
17
|
option ["-c", "--cluster"],
|
18
|
-
"CLUSTER", "The cluster name
|
18
|
+
"CLUSTER", "The cluster name",
|
19
19
|
required: true
|
20
20
|
|
21
21
|
option ["-r", "--role"],
|
22
|
-
"ROLE", "The role to assume when deploying
|
22
|
+
"ROLE", "The role to assume when deploying"
|
23
|
+
|
24
|
+
subcommand "pull", "Pulls a container image from repository" do
|
25
|
+
|
26
|
+
option ["-v", "--revision"],
|
27
|
+
"REVISION", "Use as the remote image revision"
|
28
|
+
|
29
|
+
parameter "NAME",
|
30
|
+
"The name of the service (or task) to pull the image for"
|
31
|
+
|
32
|
+
def execute
|
33
|
+
Atmos.config.provider.auth_manager.authenticate(ENV, role: role) do |auth_env|
|
34
|
+
ClimateControl.modify(auth_env) do
|
35
|
+
mgr = Atmos.config.provider.container_manager
|
36
|
+
|
37
|
+
result = mgr.pull(name, revision: revision)
|
38
|
+
|
39
|
+
logger.info "Container pulled:\n #{display result}"
|
40
|
+
end
|
41
|
+
end
|
42
|
+
end
|
43
|
+
|
44
|
+
end
|
23
45
|
|
24
46
|
subcommand "push", "Only push a container image without activating it" do
|
25
47
|
|
26
48
|
option ["-i", "--image"],
|
27
|
-
"IMAGE", "The local container image to deploy
|
49
|
+
"IMAGE", "The local container image to deploy Defaults to service/task name"
|
28
50
|
|
29
51
|
option ["-v", "--revision"],
|
30
|
-
"REVISION", "Use as the remote image revision
|
52
|
+
"REVISION", "Use as the remote image revision"
|
31
53
|
|
32
54
|
parameter "NAME ...",
|
33
|
-
"The name of the service (or task) to deploy
|
55
|
+
"The name of the service (or task) to deploy. When multiple, the first is the primary, and the rest get deployed with its image"
|
34
56
|
|
35
57
|
def default_image
|
36
58
|
name_list.first
|
@@ -55,22 +77,22 @@ module SimplyGenius
|
|
55
77
|
subcommand "activate", "Activate a container that has already been pushed" do
|
56
78
|
|
57
79
|
option ["-v", "--revision"],
|
58
|
-
"REVISION", "Use the given revision of the pushed image
|
80
|
+
"REVISION", "Use the given revision of the pushed image to activate"
|
59
81
|
|
60
82
|
option ["-w", "--wait"],
|
61
|
-
:flag, "Wait for service to become stable after deploy
|
83
|
+
:flag, "Wait for service to become stable after deploy non-zero exit on fail"
|
62
84
|
|
63
85
|
option ["-l", "--list"],
|
64
|
-
:flag, "List the most recent pushed images
|
86
|
+
:flag, "List the most recent pushed images"
|
65
87
|
|
66
88
|
option ["-t", "--tagcount"],
|
67
|
-
"N", "Only show the last N items when listing
|
89
|
+
"N", "Only show the last N items when listing",
|
68
90
|
default: 10 do |s|
|
69
91
|
Integer(s)
|
70
92
|
end
|
71
93
|
|
72
94
|
parameter "NAME ...",
|
73
|
-
"The name of the service (or task) to activate
|
95
|
+
"The name of the service (or task) to activate. When multiple, the first is the primary, and the rest get activated with its image"
|
74
96
|
|
75
97
|
def execute
|
76
98
|
Atmos.config.provider.auth_manager.authenticate(ENV, role: role) do |auth_env|
|
@@ -125,16 +147,16 @@ module SimplyGenius
|
|
125
147
|
subcommand "deploy", "Push and activate a container" do
|
126
148
|
|
127
149
|
option ["-i", "--image"],
|
128
|
-
"IMAGE", "The local container image to deploy
|
150
|
+
"IMAGE", "The local container image to deploy. Defaults to service/task name"
|
129
151
|
|
130
152
|
option ["-w", "--wait"],
|
131
|
-
:flag, "Wait for service to become stable after deploy
|
153
|
+
:flag, "Wait for service to become stable after deploy non-zero exit on fail"
|
132
154
|
|
133
155
|
option ["-v", "--revision"],
|
134
|
-
"REVISION", "Use as the remote image revision
|
156
|
+
"REVISION", "Use as the remote image revision"
|
135
157
|
|
136
158
|
parameter "NAME ...",
|
137
|
-
"The name of the service (or task) to deploy
|
159
|
+
"The name of the service (or task) to deploy. When multiple, the first is the primary, and the rest get deployed with its image"
|
138
160
|
|
139
161
|
def default_image
|
140
162
|
name_list.first
|
@@ -171,10 +193,10 @@ module SimplyGenius
|
|
171
193
|
subcommand "console", "Spawn a console and attach to it" do
|
172
194
|
|
173
195
|
option ["-p", "--persist"],
|
174
|
-
:flag, "Leave the task running after disconnect
|
196
|
+
:flag, "Leave the task running after disconnect"
|
175
197
|
|
176
198
|
parameter "NAME",
|
177
|
-
"The name of the service (or task) to attach
|
199
|
+
"The name of the service (or task) to attach the console to"
|
178
200
|
|
179
201
|
def execute
|
180
202
|
Atmos.config.provider.auth_manager.authenticate(ENV, role: role) do |auth_env|
|
@@ -191,8 +213,12 @@ module SimplyGenius
|
|
191
213
|
logger.debug "Run task result: #{result}"
|
192
214
|
begin
|
193
215
|
match = result[:log_match]
|
194
|
-
|
195
|
-
|
216
|
+
if match.blank?
|
217
|
+
logger.error("Aborting, the console task failed to produce the expected output: #{log_pattern}")
|
218
|
+
else
|
219
|
+
local_command = local_command.collect {|c| match.names.each {|n| c = c.gsub("<#{n}>", match[n]) }; c }
|
220
|
+
system(*local_command)
|
221
|
+
end
|
196
222
|
ensure
|
197
223
|
if persist?
|
198
224
|
logger.info "Console disconnected, you can reconnect with: #{local_command.join(" ")}"
|