hako 0.10.0 → 0.11.0
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/.rubocop_todo.yml +3 -0
- data/README.md +1 -1
- data/lib/hako/commander.rb +6 -4
- data/lib/hako/container.rb +2 -0
- data/lib/hako/scheduler.rb +2 -1
- data/lib/hako/schedulers/ecs.rb +34 -0
- data/lib/hako/schedulers/ecs_definition_comparator.rb +1 -1
- 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: d38174e02789d9c6483172755239f8533b8be58a
|
4
|
+
data.tar.gz: 412c52142395ca4e316bea3149d8e643de6f9802
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 14a30482ccd6a222fb278191ef74269491f7846d0151e82e9083451e8a87c8a73c5791f35472cebc2787ce66279aa018fcbab6667c0f4a8a4f89e7a82d2e6504
|
7
|
+
data.tar.gz: 3cac7854f49ef7989b284f14c5c1cdc96e1181cd2e003419f2557886ec96021b0e002d404b78d38d2511c00a8c52592cc30b5009c8db5d4aec2c730101d90453
|
data/.rubocop_todo.yml
CHANGED
data/README.md
CHANGED
data/lib/hako/commander.rb
CHANGED
@@ -15,7 +15,8 @@ module Hako
|
|
15
15
|
def deploy(force: false, tag: 'latest', dry_run: false)
|
16
16
|
containers = load_containers(tag, dry_run: dry_run)
|
17
17
|
scripts = @app.yaml.fetch('scripts', []).map { |config| load_script(config, dry_run: dry_run) }
|
18
|
-
|
18
|
+
volumes = @app.yaml.fetch('volumes', [])
|
19
|
+
scheduler = load_scheduler(@app.yaml['scheduler'], scripts, volumes: volumes, force: force, dry_run: dry_run)
|
19
20
|
|
20
21
|
scripts.each { |script| script.before_deploy(containers) }
|
21
22
|
scheduler.deploy(containers)
|
@@ -25,7 +26,8 @@ module Hako
|
|
25
26
|
def oneshot(commands, tag:, containers:, env: {}, dry_run: false)
|
26
27
|
containers = load_containers(tag, dry_run: dry_run, with: containers)
|
27
28
|
scripts = @app.yaml.fetch('scripts', []).map { |config| load_script(config, dry_run: dry_run) }
|
28
|
-
|
29
|
+
volumes = @app.yaml.fetch('volumes', [])
|
30
|
+
scheduler = load_scheduler(@app.yaml['scheduler'], scripts, volumes: volumes, dry_run: dry_run)
|
29
31
|
|
30
32
|
exit_code = with_oneshot_signal_handlers(scheduler) do
|
31
33
|
scheduler.oneshot(containers, commands, env)
|
@@ -77,8 +79,8 @@ module Hako
|
|
77
79
|
DefinitionLoader.new(@app, dry_run: dry_run).load(tag, with: with)
|
78
80
|
end
|
79
81
|
|
80
|
-
def load_scheduler(yaml, scripts, force: false, dry_run: false)
|
81
|
-
Loader.new(Hako::Schedulers, 'hako/schedulers').load(yaml.fetch('type')).new(@app.id, yaml, scripts: scripts, force: force, dry_run: dry_run)
|
82
|
+
def load_scheduler(yaml, scripts, volumes: [], force: false, dry_run: false)
|
83
|
+
Loader.new(Hako::Schedulers, 'hako/schedulers').load(yaml.fetch('type')).new(@app.id, yaml, volumes: volumes, scripts: scripts, force: force, dry_run: dry_run)
|
82
84
|
end
|
83
85
|
|
84
86
|
def load_script(yaml, dry_run:)
|
data/lib/hako/container.rb
CHANGED
data/lib/hako/scheduler.rb
CHANGED
@@ -6,8 +6,9 @@ module Hako
|
|
6
6
|
class ValidationError < Error
|
7
7
|
end
|
8
8
|
|
9
|
-
def initialize(app_id, options, scripts:, dry_run:, force:)
|
9
|
+
def initialize(app_id, options, volumes:, scripts:, dry_run:, force:)
|
10
10
|
@app_id = app_id
|
11
|
+
@volumes = volumes
|
11
12
|
@scripts = scripts
|
12
13
|
@dry_run = dry_run
|
13
14
|
@force = force
|
data/lib/hako/schedulers/ecs.rb
CHANGED
@@ -226,6 +226,10 @@ module Hako
|
|
226
226
|
task_definition.container_definitions.each do |c|
|
227
227
|
container_definitions[c.name] = c
|
228
228
|
end
|
229
|
+
|
230
|
+
if different_volumes?(task_definition.volumes)
|
231
|
+
return true
|
232
|
+
end
|
229
233
|
if definitions.any? { |definition| different_definition?(definition, container_definitions.delete(definition[:name])) }
|
230
234
|
return true
|
231
235
|
end
|
@@ -235,6 +239,23 @@ module Hako
|
|
235
239
|
true
|
236
240
|
end
|
237
241
|
|
242
|
+
def different_volumes?(actual_volumes)
|
243
|
+
if @volumes.size != actual_volumes.size
|
244
|
+
return true
|
245
|
+
end
|
246
|
+
actual_volumes.each do |actual_volume|
|
247
|
+
expected_volume = @volumes[actual_volume.name]
|
248
|
+
if expected_volume.nil?
|
249
|
+
return true
|
250
|
+
end
|
251
|
+
if expected_volume['source_path'] != actual_volume.host.source_path
|
252
|
+
return true
|
253
|
+
end
|
254
|
+
end
|
255
|
+
|
256
|
+
false
|
257
|
+
end
|
258
|
+
|
238
259
|
def different_definition?(expected_container, actual_container)
|
239
260
|
EcsDefinitionComparator.new(expected_container).different?(actual_container)
|
240
261
|
end
|
@@ -244,6 +265,7 @@ module Hako
|
|
244
265
|
@ecs.register_task_definition(
|
245
266
|
family: @app_id,
|
246
267
|
container_definitions: definitions,
|
268
|
+
volumes: volumes_definition,
|
247
269
|
).task_definition
|
248
270
|
else
|
249
271
|
:noop
|
@@ -267,12 +289,22 @@ module Hako
|
|
267
289
|
@ecs.register_task_definition(
|
268
290
|
family: "#{@app_id}-oneshot",
|
269
291
|
container_definitions: definitions,
|
292
|
+
volumes: volumes_definition,
|
270
293
|
).task_definition
|
271
294
|
else
|
272
295
|
:noop
|
273
296
|
end
|
274
297
|
end
|
275
298
|
|
299
|
+
def volumes_definition
|
300
|
+
@volumes.map do |name, volume|
|
301
|
+
{
|
302
|
+
name: name,
|
303
|
+
host: { source_path: volume['source_path'] },
|
304
|
+
}
|
305
|
+
end
|
306
|
+
end
|
307
|
+
|
276
308
|
def front_container(front, front_port)
|
277
309
|
environment = front.env.map { |k, v| { name: k, value: v } }
|
278
310
|
{
|
@@ -285,6 +317,7 @@ module Hako
|
|
285
317
|
essential: true,
|
286
318
|
environment: environment,
|
287
319
|
docker_labels: front.docker_labels,
|
320
|
+
mount_points: front.mount_points,
|
288
321
|
}
|
289
322
|
end
|
290
323
|
|
@@ -300,6 +333,7 @@ module Hako
|
|
300
333
|
essential: true,
|
301
334
|
environment: environment,
|
302
335
|
docker_labels: app.docker_labels,
|
336
|
+
mount_points: app.mount_points,
|
303
337
|
}
|
304
338
|
end
|
305
339
|
|
@@ -6,7 +6,7 @@ module Hako
|
|
6
6
|
@expected_container = expected_container
|
7
7
|
end
|
8
8
|
|
9
|
-
CONTAINER_KEYS = %i[image cpu memory links docker_labels].freeze
|
9
|
+
CONTAINER_KEYS = %i[image cpu memory links docker_labels mount_points].freeze
|
10
10
|
PORT_MAPPING_KEYS = %i[container_port host_port protocol].freeze
|
11
11
|
ENVIRONMENT_KEYS = %i[name value].freeze
|
12
12
|
|
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.
|
4
|
+
version: 0.11.0
|
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-15 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: aws-sdk
|