hako 2.7.0 → 2.8.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +6 -0
- data/lib/hako/app_container.rb +1 -1
- data/lib/hako/cli.rb +2 -4
- data/lib/hako/commander.rb +5 -5
- data/lib/hako/definition_loader.rb +5 -4
- data/lib/hako/schedulers/ecs.rb +5 -4
- data/lib/hako/script.rb +4 -0
- data/lib/hako/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 3eeaab8400e80caccbf550eed190e25ca59d729f04f450c0fa3c34596036a0af
|
4
|
+
data.tar.gz: '039cc2afb69aacceaa40976bb74dca8be034dc4e4780423c4a5d30040f17775f'
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 84b31ceebf0c3bc2cc3262b8b977d092269b527c6d33c1082ee01715514e61c8e439a1c78390e96590cf5d8777a44e120d631bd269269c3219c0b7818109f5d2
|
7
|
+
data.tar.gz: 136f00906ce0b1e94a67d4fe6a0919efecae7744a402fba58f0cbd4ff86f9dd6f8187a6bdd68ca52002f000c998efd87404dcf5536918360fac047a5d900db47
|
data/CHANGELOG.md
CHANGED
@@ -1,3 +1,9 @@
|
|
1
|
+
# 2.8.0 (2019-03-17)
|
2
|
+
## New features
|
3
|
+
- Add `deploy_failed` method to Hako::Script which is called when `hako deploy` fails
|
4
|
+
- Add .app.tag field to definition to specify the default value of app container's tag
|
5
|
+
- The default value was fixed to "latest", but you can now specify custom default value.
|
6
|
+
|
1
7
|
# 2.7.0 (2019-03-15)
|
2
8
|
## New features
|
3
9
|
- Support `entry_point` parameter
|
data/lib/hako/app_container.rb
CHANGED
data/lib/hako/cli.rb
CHANGED
@@ -80,7 +80,6 @@ module Hako
|
|
80
80
|
|
81
81
|
def parse!(argv)
|
82
82
|
@force = false
|
83
|
-
@tag = 'latest'
|
84
83
|
@dry_run = false
|
85
84
|
@verbose = false
|
86
85
|
@timeout = DEFAULT_TIMEOUT
|
@@ -98,7 +97,7 @@ module Hako
|
|
98
97
|
opts.banner = 'hako deploy [OPTIONS] FILE'
|
99
98
|
opts.version = VERSION
|
100
99
|
opts.on('-f', '--force', 'Run deployment even if nothing is changed') { @force = true }
|
101
|
-
opts.on('-t', '--tag=TAG', 'Specify tag
|
100
|
+
opts.on('-t', '--tag=TAG', 'Specify tag') { |v| @tag = v }
|
102
101
|
opts.on('-n', '--dry-run', 'Enable dry-run mode') { @dry_run = true }
|
103
102
|
opts.on('-v', '--verbose', 'Enable verbose logging') { @verbose = true }
|
104
103
|
opts.on('--timeout=TIMEOUT_SEC', "Timeout deployment after TIMEOUT_SEC seconds (default: #{DEFAULT_TIMEOUT})") { |v| @timeout = v.to_i }
|
@@ -167,7 +166,6 @@ module Hako
|
|
167
166
|
end
|
168
167
|
|
169
168
|
def parse!(argv)
|
170
|
-
@tag = 'latest'
|
171
169
|
@dry_run = false
|
172
170
|
@containers = []
|
173
171
|
@env = {}
|
@@ -187,7 +185,7 @@ module Hako
|
|
187
185
|
@parser ||= OptionParser.new do |opts|
|
188
186
|
opts.banner = 'hako oneshot [OPTIONS] FILE COMMAND ARG...'
|
189
187
|
opts.version = VERSION
|
190
|
-
opts.on('-t', '--tag=TAG', 'Specify tag
|
188
|
+
opts.on('-t', '--tag=TAG', 'Specify tag') { |v| @tag = v }
|
191
189
|
opts.on('-n', '--dry-run', 'Enable dry-run mode') { @dry_run = true }
|
192
190
|
opts.on('-c', '--container=NAME', 'Additional container name to start with the app container') { |v| @containers << v }
|
193
191
|
opts.on('-v', '--verbose', 'Enable verbose logging') { @verbose = true }
|
data/lib/hako/commander.rb
CHANGED
@@ -15,10 +15,10 @@ module Hako
|
|
15
15
|
end
|
16
16
|
|
17
17
|
# @param [Boolean] force
|
18
|
-
# @param [String] tag
|
18
|
+
# @param [String, nil] tag
|
19
19
|
# @param [Boolean] dry_run
|
20
20
|
# @return [nil]
|
21
|
-
def deploy(force: false, tag
|
21
|
+
def deploy(force: false, tag:, dry_run: false, timeout:)
|
22
22
|
containers = load_containers(tag, dry_run: dry_run)
|
23
23
|
scripts = @app.definition.fetch('scripts', []).map { |config| load_script(config, dry_run: dry_run) }
|
24
24
|
volumes = @app.definition.fetch('volumes', {})
|
@@ -42,7 +42,7 @@ module Hako
|
|
42
42
|
end
|
43
43
|
|
44
44
|
# @param [Array<String>] commands
|
45
|
-
# @param [String] tag
|
45
|
+
# @param [String, nil] tag
|
46
46
|
# @param [Hash<String, String>] env
|
47
47
|
# @param [Boolean] dry_run
|
48
48
|
# @param [Boolean] no_wait
|
@@ -110,12 +110,12 @@ module Hako
|
|
110
110
|
exit_code
|
111
111
|
end
|
112
112
|
|
113
|
-
# @param [String] tag
|
113
|
+
# @param [String, nil] tag
|
114
114
|
# @param [Boolean] dry_run
|
115
115
|
# @param [Array<String>, nil] with
|
116
116
|
# @return [Hash<String, Container>]
|
117
117
|
def load_containers(tag, dry_run:, with: nil)
|
118
|
-
DefinitionLoader.new(@app, dry_run: dry_run).load(tag, with: with)
|
118
|
+
DefinitionLoader.new(@app, dry_run: dry_run).load(tag: tag, with: with)
|
119
119
|
end
|
120
120
|
|
121
121
|
# @param [Hash] scheduler_definition
|
@@ -14,10 +14,10 @@ module Hako
|
|
14
14
|
@dry_run = dry_run
|
15
15
|
end
|
16
16
|
|
17
|
-
# @param [String] tag
|
17
|
+
# @param [String, nil] tag
|
18
18
|
# @param [Array<String>, nil] with
|
19
19
|
# @return [Hash<String, Container>]
|
20
|
-
def load(tag, with: nil)
|
20
|
+
def load(tag: nil, with: nil)
|
21
21
|
# XXX: Load additional_containers for compatibility
|
22
22
|
sidecars = @app.definition.fetch('sidecars', @app.definition.fetch('additional_containers', {}))
|
23
23
|
container_names = ['app']
|
@@ -32,7 +32,7 @@ module Hako
|
|
32
32
|
|
33
33
|
private
|
34
34
|
|
35
|
-
# @param [String] tag
|
35
|
+
# @param [String, nil] tag
|
36
36
|
# @param [Array<String>] container_names
|
37
37
|
# @param [Hash<String, Hash>] sidecars
|
38
38
|
# @return [Hash<String, Container>]
|
@@ -44,7 +44,8 @@ module Hako
|
|
44
44
|
containers[name] =
|
45
45
|
case name
|
46
46
|
when 'app'
|
47
|
-
|
47
|
+
@app.definition['app']['tag'] = tag if tag
|
48
|
+
AppContainer.new(@app, @app.definition['app'], dry_run: @dry_run)
|
48
49
|
else
|
49
50
|
Container.new(@app, sidecars.fetch(name), dry_run: @dry_run)
|
50
51
|
end
|
data/lib/hako/schedulers/ecs.rb
CHANGED
@@ -150,6 +150,7 @@ module Hako
|
|
150
150
|
@service_discovery.apply
|
151
151
|
end
|
152
152
|
unless wait_for_ready(service)
|
153
|
+
@scripts.each { |script| script.deploy_failed(containers, task_ids: @started_task_ids) }
|
153
154
|
if task_definition_changed
|
154
155
|
Hako.logger.error("Rolling back to #{current_service.task_definition}")
|
155
156
|
update_service(service, current_service.task_definition)
|
@@ -912,7 +913,7 @@ module Hako
|
|
912
913
|
Process.clock_gettime(Process::CLOCK_MONOTONIC)
|
913
914
|
end
|
914
915
|
|
915
|
-
started_task_ids = []
|
916
|
+
@started_task_ids = []
|
916
917
|
|
917
918
|
loop do
|
918
919
|
if started_at
|
@@ -936,16 +937,16 @@ module Hako
|
|
936
937
|
Hako.logger.info "#{e.created_at}: #{e.message}"
|
937
938
|
task_id = extract_task_id(e.message)
|
938
939
|
if task_id && e.message.include?(' has started ')
|
939
|
-
started_task_ids << task_id
|
940
|
+
@started_task_ids << task_id
|
940
941
|
end
|
941
942
|
end
|
942
943
|
latest_event_id = find_latest_event_id(s.events)
|
943
944
|
Hako.logger.debug " latest_event_id=#{latest_event_id}, deployments=#{s.deployments}"
|
944
945
|
no_active = s.deployments.all? { |d| d.status != 'ACTIVE' }
|
945
946
|
primary = s.deployments.find { |d| d.status == 'PRIMARY' }
|
946
|
-
if primary.desired_count < started_task_ids.size
|
947
|
+
if primary.desired_count < @started_task_ids.size
|
947
948
|
Hako.logger.error('Some started tasks are stopped. It seems new deployment is failing to start')
|
948
|
-
ecs_client.describe_tasks(cluster: service.cluster_arn, tasks: started_task_ids).tasks.each do |task|
|
949
|
+
ecs_client.describe_tasks(cluster: service.cluster_arn, tasks: @started_task_ids).tasks.each do |task|
|
949
950
|
report_task_diagnostics(task)
|
950
951
|
end
|
951
952
|
return false
|
data/lib/hako/script.rb
CHANGED
@@ -23,6 +23,10 @@ module Hako
|
|
23
23
|
# @param [Hash<String, Container>] _containers
|
24
24
|
def deploy_finished(_containers); end
|
25
25
|
|
26
|
+
# @param [Hash<String, Container>] _containers
|
27
|
+
# @param [Hash] _options
|
28
|
+
def deploy_failed(_containers, _options); end
|
29
|
+
|
26
30
|
def rollback_starting; end
|
27
31
|
|
28
32
|
# @param [String] _current_image_tag
|
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: 2.
|
4
|
+
version: 2.8.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: 2019-03-
|
11
|
+
date: 2019-03-18 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: aws-sdk-applicationautoscaling
|