hako 0.8.2 → 0.8.3
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/hako/cli.rb +6 -1
- data/lib/hako/commander.rb +2 -2
- data/lib/hako/schedulers/ecs.rb +5 -3
- data/lib/hako/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: f2f958e89ebfe3cdc0f02e19fef088050b9ed312
|
4
|
+
data.tar.gz: 6b4c9624e6365ae512687e5da44714d45f19f666
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: dadafbc0ed40f7e9b76c862606d4c409f9b612aac2cc28ac28f7aefd0fc1bbb35c60e0b258c9b22c5120952b7780cd661dc62598e2855b13fb8a73c52ab79b33
|
7
|
+
data.tar.gz: b884b5dfd9ff2eee4bb19a4c6f71687a098d87a1df51f6ad587e874fa020f1699f3a1cb4a6cde83299d2e20421cae58ad813feddb855020b380838b449ce7ec8
|
data/lib/hako/cli.rb
CHANGED
@@ -101,12 +101,13 @@ module Hako
|
|
101
101
|
Hako.logger.level = Logger::DEBUG
|
102
102
|
end
|
103
103
|
|
104
|
-
Commander.new(Application.new(@yaml_path)).oneshot(@argv, tag: @tag, containers: @containers)
|
104
|
+
Commander.new(Application.new(@yaml_path)).oneshot(@argv, tag: @tag, containers: @containers, env: @env)
|
105
105
|
end
|
106
106
|
|
107
107
|
def parse!(argv)
|
108
108
|
@tag = 'latest'
|
109
109
|
@containers = []
|
110
|
+
@env = {}
|
110
111
|
@verbose = false
|
111
112
|
parser.parse!(argv)
|
112
113
|
@yaml_path = argv.shift
|
@@ -125,6 +126,10 @@ module Hako
|
|
125
126
|
opts.on('-t', '--tag=TAG', 'Specify tag (default: latest)') { |v| @tag = v }
|
126
127
|
opts.on('-c', '--container=NAME', 'Additional container name to start with the app container') { |v| @containers << v }
|
127
128
|
opts.on('-v', '--verbose', 'Enable verbose logging') { @verbose = true }
|
129
|
+
opts.on('-e', '--env=NAME=VAL', 'Add environment variable') do |arg|
|
130
|
+
k, v = arg.split('=', 2)
|
131
|
+
@env[k] = v
|
132
|
+
end
|
128
133
|
end
|
129
134
|
end
|
130
135
|
end
|
data/lib/hako/commander.rb
CHANGED
@@ -24,10 +24,10 @@ module Hako
|
|
24
24
|
scripts.each { |script| script.after_deploy(containers) }
|
25
25
|
end
|
26
26
|
|
27
|
-
def oneshot(commands, tag:, containers:)
|
27
|
+
def oneshot(commands, tag:, containers:, env: {})
|
28
28
|
containers = load_containers(tag, dry_run: false, with: containers)
|
29
29
|
scheduler = load_scheduler(@app.yaml['scheduler'])
|
30
|
-
exit scheduler.oneshot(containers, commands)
|
30
|
+
exit scheduler.oneshot(containers, commands, env)
|
31
31
|
end
|
32
32
|
|
33
33
|
def status
|
data/lib/hako/schedulers/ecs.rb
CHANGED
@@ -55,7 +55,7 @@ module Hako
|
|
55
55
|
end
|
56
56
|
end
|
57
57
|
|
58
|
-
def oneshot(containers, commands)
|
58
|
+
def oneshot(containers, commands, env)
|
59
59
|
definitions = create_definitions(containers, -1)
|
60
60
|
definitions.each do |definition|
|
61
61
|
definition.delete(:essential)
|
@@ -67,7 +67,7 @@ module Hako
|
|
67
67
|
else
|
68
68
|
Hako.logger.info "Registered task definition: #{task_definition.task_definition_arn}"
|
69
69
|
end
|
70
|
-
task = run_task(task_definition, commands)
|
70
|
+
task = run_task(task_definition, commands, env)
|
71
71
|
Hako.logger.info "Started task: #{task.task_arn}"
|
72
72
|
containers = wait_for_task(task)
|
73
73
|
Hako.logger.info 'Oneshot task finished'
|
@@ -294,7 +294,8 @@ module Hako
|
|
294
294
|
}
|
295
295
|
end
|
296
296
|
|
297
|
-
def run_task(task_definition, commands)
|
297
|
+
def run_task(task_definition, commands, env)
|
298
|
+
environment = env.map { |k, v| { name: k, value: v } }
|
298
299
|
@ecs.run_task(
|
299
300
|
cluster: @cluster,
|
300
301
|
task_definition: task_definition.task_definition_arn,
|
@@ -303,6 +304,7 @@ module Hako
|
|
303
304
|
{
|
304
305
|
name: 'app',
|
305
306
|
command: commands,
|
307
|
+
environment: environment,
|
306
308
|
},
|
307
309
|
],
|
308
310
|
},
|
data/lib/hako/version.rb
CHANGED