mikoshi 0.2.1 → 0.3.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +4 -1
- data/lib/mikoshi/plan/service.rb +27 -16
- data/lib/mikoshi/plan/task_definition.rb +6 -0
- data/lib/mikoshi/version.rb +1 -1
- data/mikoshi.gemspec +1 -2
- metadata +3 -17
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 66ad04d55f747d3091c3cd1f31a223864561eaea
|
4
|
+
data.tar.gz: 15f22a4a24d5e8cbbb5b10689676a6bcb3571966
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 2b9ff8154a87ff40e3039e625b2612362733f8f132d4d580b8ffdb356feb24f42b4df03df0d4ecdf54ed993695df88eecf5848e8e7ad7bf44eb3efbe37db3b18
|
7
|
+
data.tar.gz: c793828dfc4816c89900db56f442661329064827736b9583fef1e9e840f225d87c5c02b8d0debd47364955124a222348d2a3c9bb881764e7c461a53ba8514c81
|
data/README.md
CHANGED
@@ -1,6 +1,9 @@
|
|
1
1
|
# Mikoshi
|
2
2
|
[![Build Status](https://travis-ci.org/unasuke/mikoshi.svg?branch=master)](https://travis-ci.org/unasuke/mikoshi)
|
3
|
-
[![
|
3
|
+
[![Codacy Badge](https://api.codacy.com/project/badge/Coverage/71ceb38e09ab4a319e54a2964725f16a)](https://www.codacy.com/app/unasuke/mikoshi?utm_source=github.com&utm_medium=referral&utm_content=unasuke/mikoshi&utm_campaign=Badge_Coverage)
|
4
|
+
[![Codacy Badge](https://api.codacy.com/project/badge/Grade/71ceb38e09ab4a319e54a2964725f16a)](https://www.codacy.com/app/unasuke/mikoshi?utm_source=github.com&utm_medium=referral&utm_content=unasuke/mikoshi&utm_campaign=Badge_Grade)
|
5
|
+
[![Gem downloads](https://img.shields.io/gem/dtv/mikoshi.svg)]()
|
6
|
+
[![Gem version](https://img.shields.io/gem/v/mikoshi.svg)]()
|
4
7
|
|
5
8
|
This gem is tool to deploy ECS task definition and service with described by yaml documents.
|
6
9
|
|
data/lib/mikoshi/plan/service.rb
CHANGED
@@ -22,37 +22,32 @@ module Mikoshi
|
|
22
22
|
invoke_before_create_hooks
|
23
23
|
|
24
24
|
@client.create_service(@data[:service].except(:service))
|
25
|
+
wait_until_services_stable
|
26
|
+
|
27
|
+
invoke_after_create_hooks
|
25
28
|
end
|
26
29
|
|
27
30
|
def update_service
|
28
31
|
invoke_before_update_hooks
|
29
32
|
|
30
33
|
@client.update_service(@data[:service].except(:service_name, :placement_strategy, :placement_constraints))
|
34
|
+
wait_until_services_stable
|
35
|
+
|
36
|
+
invoke_after_update_hooks
|
31
37
|
end
|
32
38
|
|
33
39
|
def deploy_service(message: false)
|
40
|
+
@message = message
|
41
|
+
|
34
42
|
case operation
|
35
43
|
when :create
|
36
44
|
create_service
|
37
45
|
when :update
|
38
46
|
update_service
|
39
47
|
end
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
w.delay = 10
|
44
|
-
|
45
|
-
w.before_wait do
|
46
|
-
puts 'Waiting to change status of service...' if message
|
47
|
-
end
|
48
|
-
end
|
49
|
-
|
50
|
-
case operation
|
51
|
-
when :create
|
52
|
-
invoke_after_create_hooks
|
53
|
-
when :update
|
54
|
-
invoke_after_update_hooks
|
55
|
-
end
|
48
|
+
rescue => e
|
49
|
+
invoke_failed_hooks
|
50
|
+
raise e
|
56
51
|
end
|
57
52
|
|
58
53
|
private
|
@@ -72,6 +67,19 @@ module Mikoshi
|
|
72
67
|
end
|
73
68
|
end
|
74
69
|
|
70
|
+
def wait_until_services_stable
|
71
|
+
params = { cluster: @data[:service][:cluster], services: [@data[:service][:service]] }
|
72
|
+
|
73
|
+
@client.wait_until(:services_stable, params) do |w|
|
74
|
+
w.max_attempts = 30
|
75
|
+
w.delay = 10
|
76
|
+
|
77
|
+
w.before_wait do
|
78
|
+
puts 'Waiting to change status of service...' if @message
|
79
|
+
end
|
80
|
+
end
|
81
|
+
end
|
82
|
+
|
75
83
|
%w[before after].each do |step|
|
76
84
|
%w[create update].each do |func|
|
77
85
|
define_method "invoke_#{step}_#{func}_hooks" do
|
@@ -79,6 +87,9 @@ module Mikoshi
|
|
79
87
|
end
|
80
88
|
end
|
81
89
|
end
|
90
|
+
def invoke_failed_hooks
|
91
|
+
invoke_hooks(@data[:hooks][:failed]) unless @data.dig(:hooks, :failed).nil?
|
92
|
+
end
|
82
93
|
end
|
83
94
|
end
|
84
95
|
end
|
@@ -18,6 +18,9 @@ module Mikoshi
|
|
18
18
|
invoke_after_register_hooks
|
19
19
|
|
20
20
|
resp
|
21
|
+
rescue => e
|
22
|
+
invoke_failed_hooks
|
23
|
+
raise e
|
21
24
|
end
|
22
25
|
|
23
26
|
private
|
@@ -27,6 +30,9 @@ module Mikoshi
|
|
27
30
|
invoke_hooks @data[:hooks]["#{step}_register".to_sym] unless @data.dig(:hooks, "#{step}_register".to_sym).nil?
|
28
31
|
end
|
29
32
|
end
|
33
|
+
def invoke_failed_hooks
|
34
|
+
invoke_hooks(@data[:hooks][:failed]) unless @data.dig(:hooks, :failed).nil?
|
35
|
+
end
|
30
36
|
end
|
31
37
|
end
|
32
38
|
end
|
data/lib/mikoshi/version.rb
CHANGED
data/mikoshi.gemspec
CHANGED
@@ -30,10 +30,9 @@ Gem::Specification.new do |spec|
|
|
30
30
|
spec.add_dependency 'thor'
|
31
31
|
|
32
32
|
spec.add_development_dependency 'bundler', '~> 1.14'
|
33
|
-
spec.add_development_dependency '
|
33
|
+
spec.add_development_dependency 'codacy-coverage'
|
34
34
|
spec.add_development_dependency 'rake', '~> 10.0'
|
35
35
|
spec.add_development_dependency 'rspec'
|
36
|
-
spec.add_development_dependency 'simplecov'
|
37
36
|
spec.add_development_dependency 'unasukecop'
|
38
37
|
spec.add_development_dependency 'pry'
|
39
38
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: mikoshi
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.3.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Yusuke Nakamura
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2017-05-
|
11
|
+
date: 2017-05-31 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: activesupport
|
@@ -67,7 +67,7 @@ dependencies:
|
|
67
67
|
- !ruby/object:Gem::Version
|
68
68
|
version: '1.14'
|
69
69
|
- !ruby/object:Gem::Dependency
|
70
|
-
name:
|
70
|
+
name: codacy-coverage
|
71
71
|
requirement: !ruby/object:Gem::Requirement
|
72
72
|
requirements:
|
73
73
|
- - ">="
|
@@ -108,20 +108,6 @@ dependencies:
|
|
108
108
|
- - ">="
|
109
109
|
- !ruby/object:Gem::Version
|
110
110
|
version: '0'
|
111
|
-
- !ruby/object:Gem::Dependency
|
112
|
-
name: simplecov
|
113
|
-
requirement: !ruby/object:Gem::Requirement
|
114
|
-
requirements:
|
115
|
-
- - ">="
|
116
|
-
- !ruby/object:Gem::Version
|
117
|
-
version: '0'
|
118
|
-
type: :development
|
119
|
-
prerelease: false
|
120
|
-
version_requirements: !ruby/object:Gem::Requirement
|
121
|
-
requirements:
|
122
|
-
- - ">="
|
123
|
-
- !ruby/object:Gem::Version
|
124
|
-
version: '0'
|
125
111
|
- !ruby/object:Gem::Dependency
|
126
112
|
name: unasukecop
|
127
113
|
requirement: !ruby/object:Gem::Requirement
|