hako 1.0.1 → 1.1.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/CHANGELOG.md +10 -0
- data/lib/hako/commander.rb +2 -0
- data/lib/hako/schedulers/ecs.rb +15 -0
- data/lib/hako/script.rb +8 -0
- 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: 4fa62526803c7e309c566c869c1f89e6b9446fe3
|
4
|
+
data.tar.gz: 6912f420b348951e279b30d7009a1d482b410e22
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 72770b616872cb3d9fc73882c2ac977d35370dc46592c2291bd147e09cf0e7c519f78e54f2bea82f4a39317edf4b96d1b34c8c9d656927a54189ace40d873f1d
|
7
|
+
data.tar.gz: 1c55da209092dc268dfcbe260bb2873858b2412a591ea3121c32267b1e9c9fe7094bfb1be5a8294522d72da9942b118c483c15a70b51736b12d8faf31196e8f1
|
data/CHANGELOG.md
CHANGED
@@ -1,3 +1,13 @@
|
|
1
|
+
# 1.1.0 (2017-03-09)
|
2
|
+
## New features
|
3
|
+
- Add script hooks to rollback
|
4
|
+
- `Script#rollback_starting`
|
5
|
+
- Similar to deploy_starting, but without containers
|
6
|
+
- `Script#rollback_started`
|
7
|
+
- Current running image tag and target image tag are passed
|
8
|
+
- `Script#rollback_finished`
|
9
|
+
- Similar to deploy_finished, but without containers
|
10
|
+
|
1
11
|
# 1.0.1 (2017-03-07)
|
2
12
|
## Bug fixes
|
3
13
|
- Fix default value of `@volumes`
|
data/lib/hako/commander.rb
CHANGED
@@ -35,7 +35,9 @@ module Hako
|
|
35
35
|
scripts = @app.yaml.fetch('scripts', []).map { |config| load_script(config, dry_run: dry_run) }
|
36
36
|
scheduler = load_scheduler(@app.yaml['scheduler'], scripts, dry_run: dry_run)
|
37
37
|
|
38
|
+
scripts.each(&:rollback_starting)
|
38
39
|
scheduler.rollback
|
40
|
+
scripts.each(&:rollback_finished)
|
39
41
|
end
|
40
42
|
|
41
43
|
# @param [Array<String>] commands
|
data/lib/hako/schedulers/ecs.rb
CHANGED
@@ -114,6 +114,7 @@ module Hako
|
|
114
114
|
current_definition = "#{task_definition.family}:#{task_definition.revision}"
|
115
115
|
target_definition = find_rollback_target(task_definition)
|
116
116
|
Hako.logger.info "Current task defintion is #{current_definition}. Rolling back to #{target_definition}"
|
117
|
+
call_rollback_started(task_definition, target_definition)
|
117
118
|
|
118
119
|
if @dry_run
|
119
120
|
Hako.logger.info 'Deployment completed (dry-run)'
|
@@ -855,6 +856,20 @@ module Hako
|
|
855
856
|
Hako.logger.warn "Ignoring updated placement_strategy in the configuration, because AWS doesn't allow updating them for now."
|
856
857
|
end
|
857
858
|
end
|
859
|
+
|
860
|
+
# @param [Aws::ECS::Types::TaskDefinition] task_definition
|
861
|
+
# @param [String] target_definition
|
862
|
+
# @return [nil]
|
863
|
+
def call_rollback_started(task_definition, target_definition)
|
864
|
+
current_app = task_definition.container_definitions.find { |c| c.name == 'app' }
|
865
|
+
target_app = ecs_client.describe_task_definition(task_definition: target_definition).task_definition.container_definitions.find { |c| c.name == 'app' }
|
866
|
+
if current_app && target_app
|
867
|
+
@scripts.each { |script| script.rollback_started(current_app.image, target_app.image) }
|
868
|
+
else
|
869
|
+
Hako.logger.warn("Cannot find image_tag. current_app=#{current_app.inspect} target_app=#{target_app.inspect}. Skip calling Script#rollback_started")
|
870
|
+
end
|
871
|
+
nil
|
872
|
+
end
|
858
873
|
end
|
859
874
|
end
|
860
875
|
end
|
data/lib/hako/script.rb
CHANGED
@@ -22,6 +22,14 @@ module Hako
|
|
22
22
|
# @param [Hash<String, Container>] _containers
|
23
23
|
def deploy_finished(_containers); end
|
24
24
|
|
25
|
+
def rollback_starting; end
|
26
|
+
|
27
|
+
# @param [String] _current_image_tag
|
28
|
+
# @param [String] _target_image_tag
|
29
|
+
def rollback_started(_current_image_tag, _target_image_tag); end
|
30
|
+
|
31
|
+
def rollback_finished; end
|
32
|
+
|
25
33
|
# @param [Hash<String, Container>] _containers
|
26
34
|
def oneshot_starting(_containers); end
|
27
35
|
|
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: 1.0
|
4
|
+
version: 1.1.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: 2017-03-
|
11
|
+
date: 2017-03-09 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: aws-sdk
|