hako 1.0.1 → 1.1.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 8132d4fdde39cc509908b3d273174ded381a501a
4
- data.tar.gz: 0fef4841bd44a96b1679ec9eebce90315702b71c
3
+ metadata.gz: 4fa62526803c7e309c566c869c1f89e6b9446fe3
4
+ data.tar.gz: 6912f420b348951e279b30d7009a1d482b410e22
5
5
  SHA512:
6
- metadata.gz: 24e62fa07fad04b8ae890799315faf3c7c6f175b7735cd53deb985f858772ccf56833c4bd59e5237ff9065cc20f22c1aea3dbf77b05af18babea36b2d4fd1336
7
- data.tar.gz: 6d3ef08bc561382969cf04552d749e09be92d6a5691415122d73487520e19e3e624d046107d34f253e7f97b562df9987b486f65900dcf788e5a1678ba08d97a1
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`
@@ -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
@@ -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
@@ -1,4 +1,4 @@
1
1
  # frozen_string_literal: true
2
2
  module Hako
3
- VERSION = '1.0.1'
3
+ VERSION = '1.1.0'
4
4
  end
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.1
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-07 00:00:00.000000000 Z
11
+ date: 2017-03-09 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: aws-sdk