hako 0.9.1 → 0.9.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/hako/cli.rb +3 -1
- data/lib/hako/commander.rb +5 -2
- data/lib/hako/schedulers/ecs.rb +21 -9
- data/lib/hako/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: bc9a0e86d4e177d1111a515c83721c43c8ef7e76
|
4
|
+
data.tar.gz: ff4f22fd4b84bb5644e571d834180476c05d735a
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: ee2903bab02577238bffe0b17acdf9414daf7972d593db13650f7dd2c0e3785748d2435568fc94cd823aa637f8e01f1a5023fe0e5a4b195eb53ce0a29658c381
|
7
|
+
data.tar.gz: 3a1cc1ffc48155bcea674b613e019fde2b61cb43f3e66f410787750b48817ba086a300dae7f2c8881da5caa74c0c421d7ea6491d7bae0c1832c9ee55375a7c41
|
data/lib/hako/cli.rb
CHANGED
@@ -101,11 +101,12 @@ 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, env: @env)
|
104
|
+
Commander.new(Application.new(@yaml_path)).oneshot(@argv, tag: @tag, containers: @containers, env: @env, dry_run: @dry_run)
|
105
105
|
end
|
106
106
|
|
107
107
|
def parse!(argv)
|
108
108
|
@tag = 'latest'
|
109
|
+
@dry_run = false
|
109
110
|
@containers = []
|
110
111
|
@env = {}
|
111
112
|
@verbose = false
|
@@ -124,6 +125,7 @@ module Hako
|
|
124
125
|
opts.banner = 'hako oneshot [OPTIONS] FILE COMMAND ARG...'
|
125
126
|
opts.version = VERSION
|
126
127
|
opts.on('-t', '--tag=TAG', 'Specify tag (default: latest)') { |v| @tag = v }
|
128
|
+
opts.on('-n', '--dry-run', 'Enable dry-run mode') { @dry_run = true }
|
127
129
|
opts.on('-c', '--container=NAME', 'Additional container name to start with the app container') { |v| @containers << v }
|
128
130
|
opts.on('-v', '--verbose', 'Enable verbose logging') { @verbose = true }
|
129
131
|
opts.on('-e', '--env=NAME=VAL', 'Add environment variable') do |arg|
|
data/lib/hako/commander.rb
CHANGED
@@ -27,7 +27,7 @@ module Hako
|
|
27
27
|
def oneshot(commands, tag:, containers:, env: {}, dry_run: false)
|
28
28
|
containers = load_containers(tag, dry_run: dry_run, with: containers)
|
29
29
|
scripts = @app.yaml.fetch('scripts', []).map { |config| load_script(config, dry_run: dry_run) }
|
30
|
-
scheduler = load_scheduler(@app.yaml['scheduler'], scripts)
|
30
|
+
scheduler = load_scheduler(@app.yaml['scheduler'], scripts, dry_run: dry_run)
|
31
31
|
|
32
32
|
exit_code = with_oneshot_signal_handlers(scheduler) do
|
33
33
|
scheduler.oneshot(containers, commands, env)
|
@@ -77,7 +77,10 @@ module Hako
|
|
77
77
|
|
78
78
|
def load_containers(tag, dry_run:, with: nil)
|
79
79
|
app = AppContainer.new(@app, @app.yaml['app'].merge('tag' => tag), dry_run: dry_run)
|
80
|
-
front =
|
80
|
+
front =
|
81
|
+
if @app.yaml.key?('front')
|
82
|
+
load_front(@app.yaml['front'], dry_run: dry_run)
|
83
|
+
end
|
81
84
|
|
82
85
|
containers = { 'app' => app, 'front' => front }
|
83
86
|
@app.yaml.fetch('additional_containers', {}).each do |name, container|
|
data/lib/hako/schedulers/ecs.rb
CHANGED
@@ -61,17 +61,29 @@ module Hako
|
|
61
61
|
definitions.each do |definition|
|
62
62
|
definition.delete(:essential)
|
63
63
|
end
|
64
|
-
|
65
|
-
if
|
66
|
-
|
67
|
-
|
64
|
+
|
65
|
+
if @dry_run
|
66
|
+
definitions.each do |d|
|
67
|
+
Hako.logger.info "Add container #{d}"
|
68
|
+
end
|
69
|
+
env.each do |k, v|
|
70
|
+
Hako.logger.info "Add environment #{k}=#{v}"
|
71
|
+
end
|
72
|
+
Hako.logger.info "Execute command #{commands}"
|
73
|
+
0
|
68
74
|
else
|
69
|
-
|
75
|
+
task_definition = register_task_definition_for_oneshot(definitions)
|
76
|
+
if task_definition == :noop
|
77
|
+
Hako.logger.info "Task definition isn't changed"
|
78
|
+
task_definition = @ecs.describe_task_definition(task_definition: "#{@app_id}-oneshot").task_definition
|
79
|
+
else
|
80
|
+
Hako.logger.info "Registered task definition: #{task_definition.task_definition_arn}"
|
81
|
+
end
|
82
|
+
@task = run_task(task_definition, commands, env)
|
83
|
+
Hako.logger.info "Started task: #{@task.task_arn}"
|
84
|
+
@scripts.each { |script| script.oneshot_started(self) }
|
85
|
+
wait_for_oneshot_finish
|
70
86
|
end
|
71
|
-
@task = run_task(task_definition, commands, env)
|
72
|
-
Hako.logger.info "Started task: #{@task.task_arn}"
|
73
|
-
@scripts.each { |script| script.oneshot_started(self) }
|
74
|
-
wait_for_oneshot_finish
|
75
87
|
end
|
76
88
|
|
77
89
|
def stop_oneshot
|
data/lib/hako/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: hako
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.9.
|
4
|
+
version: 0.9.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Kohei Suzuki
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2016-03-
|
11
|
+
date: 2016-03-10 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: aws-sdk
|