ecs_deployer 0.1.4 → 0.1.5

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: 47b8f97fb9482d7736def886976477700742787b
4
- data.tar.gz: 4d9f5cf0333818a5df1482ece0fc06ead1b9abb0
3
+ metadata.gz: 022b3442f88234d68a859aea13ab1be47f7d357b
4
+ data.tar.gz: 62578b367ebf2d506b745d304068a1ac07ccd3cd
5
5
  SHA512:
6
- metadata.gz: 13d158aa62c0e9e9ffa17f19b6a8c1d4b676e3144f2db0294064f69f0e93e684c7dafa79f936a3eec96a82e45de57733b1fe9872af31460155524aca7991416c
7
- data.tar.gz: 9c6a7a38501ca9709762bfd0689bdcea6baac07896504fdd2700a89427f3f772641328227efd8f36ca6133c6e0514bf7ed032f73568deb5d5e1683fd34d340b0
6
+ metadata.gz: 590fb52f78f7181d1e1a2cf2c8a68dfb0847718aa9a2ee84d4d61ec1d55bf8a0f7d74fdc7abd89491ea0d5b0def2fb4c3a7bcf7af6c19a47cfbf9588c7d488e3
7
+ data.tar.gz: ac1d5b859568aa7f6d5efb95c0f5f62faef1d17ba247b870c3424600bb065af54e9d3356299a04473277aab4212075ad165126704ba4e431093ee248ecf2963c
data/README.md CHANGED
@@ -50,7 +50,7 @@ family: hello_world
50
50
  ## Usage
51
51
 
52
52
  ```
53
- ecs_deployer = EcsDeployer::Client.new('cluster_name')
53
+ ecs_deployer = EcsDeployer::Client.new()
54
54
  ecs_deployer.register_task('development.yml')
55
- ecs_deployer.update_service('application')
55
+ ecs_deployer.update_service('cluster', 'application')
56
56
  ```
data/example/sample.rb CHANGED
@@ -6,4 +6,4 @@ task_path = File.expand_path('./fixtures/task.yml', File.dirname(File.realpath(_
6
6
  ecs_deployer = EcsDeployer::Client.new('sandbox-ecs-production')
7
7
  ecs_deployer.register_task(task_path)
8
8
  ecs_deployer.update_service('application')
9
- # ecs_deployer.log
9
+ #ecs_deployer.log
@@ -6,13 +6,11 @@ module EcsDeployer
6
6
  class Client
7
7
  PAULING_INTERVAL = 20
8
8
 
9
- # @param [String] cluster
10
9
  # @param [Hash] options
11
10
  # @option options [String] :profile
12
11
  # @option options [String] :region
13
12
  # @return [EcsDeployer::Client]
14
- def initialize(cluster, options = {})
15
- @cluster = cluster
13
+ def initialize(options = {})
16
14
  @runtime = RuntimeCommand::Builder.new
17
15
  @ecs_command = Commander.new(@runtime, options)
18
16
  @family = ''
@@ -37,12 +35,13 @@ module EcsDeployer
37
35
  @new_task_definition_arn = result['taskDefinition']['taskDefinitionArn']
38
36
  end
39
37
 
38
+ # @param [String] cluster
40
39
  # @param [String] service
41
40
  # @return [String]
42
- def register_clone_task(service)
41
+ def register_clone_task(cluster, service)
43
42
  detected_service = false
44
43
 
45
- result = @ecs_command.describe_services([service], { 'cluster': @cluster })
44
+ result = @ecs_command.describe_services([service], { 'cluster': cluster })
46
45
  result['services'].each do |svc|
47
46
  if svc['serviceName'] == service
48
47
  result = @ecs_command.describe_task_definition(svc['taskDefinition'])
@@ -57,16 +56,17 @@ module EcsDeployer
57
56
  @new_task_definition_arn
58
57
  end
59
58
 
59
+ # @param [String] cluster
60
60
  # @param [String] service
61
61
  # @param [Fixnum] timeout
62
- def update_service(service, wait = true, timeout = 600)
62
+ def update_service(cluster, service, wait = true, timeout = 600)
63
63
  register_clone_task(service) if @new_task_definition_arn.empty?
64
64
  options = {
65
- 'cluster': @cluster,
65
+ 'cluster': cluster,
66
66
  'task-definition': @family + ':' + @revision.to_s
67
67
  }
68
68
  @ecs_command.update_service(service, options)
69
- wait_for_deploy(service, timeout) if wait
69
+ wait_for_deploy(cluster, service, timeout) if wait
70
70
  end
71
71
 
72
72
  # @return [String]
@@ -75,10 +75,13 @@ module EcsDeployer
75
75
  end
76
76
 
77
77
  private
78
- def wait_for_deploy(service, timeout)
78
+ # @param [String] cluster
79
+ # @param [String] service
80
+ # @param [Fixnum] timeout
81
+ def wait_for_deploy(cluster, service, timeout)
79
82
  detected_service = false
80
83
 
81
- result = @ecs_command.describe_services([service], { 'cluster': @cluster })
84
+ result = @ecs_command.describe_services([service], { 'cluster': cluster })
82
85
  result['services'].each do |svc|
83
86
  next unless svc['serviceName'] == service
84
87
  detected_service = true
@@ -96,7 +99,7 @@ module EcsDeployer
96
99
 
97
100
  # Get current tasks
98
101
  options = {
99
- 'cluster': @cluster,
102
+ 'cluster': cluster,
100
103
  'service-name': service,
101
104
  'desired-status': 'RUNNING'
102
105
  }
@@ -105,7 +108,7 @@ module EcsDeployer
105
108
  raise TaskNotFoundError.new('Desired count is 0.') if result['taskArns'].size == 0
106
109
 
107
110
  new_running_count = 0
108
- result = @ecs_command.describe_tasks(result['taskArns'], { 'cluster': @cluster })
111
+ result = @ecs_command.describe_tasks(result['taskArns'], { 'cluster': cluster })
109
112
 
110
113
  result['tasks'].each do |task|
111
114
  new_running_count += 1 if @new_task_definition_arn == task['taskDefinitionArn']
@@ -1,3 +1,3 @@
1
1
  module EcsDeployer
2
- VERSION = "0.1.4"
2
+ VERSION = "0.1.5"
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: ecs_deployer
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.4
4
+ version: 0.1.5
5
5
  platform: ruby
6
6
  authors:
7
7
  - naomichi-y
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2017-02-28 00:00:00.000000000 Z
11
+ date: 2017-03-01 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: runtime_command
@@ -122,7 +122,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
122
122
  version: '0'
123
123
  requirements: []
124
124
  rubyforge_project:
125
- rubygems_version: 2.6.10
125
+ rubygems_version: 2.5.1
126
126
  signing_key:
127
127
  specification_version: 4
128
128
  summary: Deploy application to ECS.