deployme 0.1.7.1 → 0.1.8

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
  SHA256:
3
- metadata.gz: f67f8952d4472988ebc74e81e1d152bf9fc706efb5fb335f31598f6d688857db
4
- data.tar.gz: e9f0914f227cadc9b7911725508f67a3c6e4c97f565494c2c4f33ca254a4ca90
3
+ metadata.gz: d88a687ff8a42bb4bf51888ea7a1c06a71fcc1ab1e643e27a37e4428fa6b1f8e
4
+ data.tar.gz: cb118e9220e28dc1bf457f589d1d7cd8db6b2b3f0f4633beddf56a20ced5f722
5
5
  SHA512:
6
- metadata.gz: b7a52660ca38c8e2f49dea1b60a9e16d3bb01dcfcb59a72b681f2be92f64342e30925afed2fe5a9b7a230530e659efbc41aeeb850756599adb3863ef3a8e888a
7
- data.tar.gz: 2329b6c0ecab4f980b1befa3488d36bdd02ab75e24b97c14d691767ccace4dbbea2cf6a634cd92b7fe63f767cd51fcb6c08cdb628b4222eef133b17c0635d9d4
6
+ metadata.gz: 4e0aaa3ddf5da73656bdfce837c08816739fa987c9149178adebf7078958ce59240d37749e3db05fa0f756ed9bbe6693a572f538eca1bfb19d9ca8f396e55d97
7
+ data.tar.gz: 5f04ced6a281f9520ef1ffefb50ef6556ff8f582adf3f36dccd8bd86b3956bddc68dcc741c8083d0eb1c700e1daca9601b76634b2bee8336dd0679ac6ce9a5fe
@@ -2,9 +2,11 @@ require 'aws-sdk-ecs'
2
2
 
3
3
  class Aws::ECS::Client # rubocop:disable Style/ClassAndModuleChildren
4
4
  def upsert_service(options)
5
- send(:update_service, options)
6
- rescue Aws::ECS::Errors::ServiceNotFoundException, Aws::ECS::Errors::ServiceNotActiveException
7
- options[:service_name] = options.delete(:service)
8
- send(:create_service, options)
5
+ if describe_services(cluster: options[:cluster], services: [options[:service]]).services.count.zero?
6
+ options[:service_name] = options.delete(:service)
7
+ send(:create_service, options)
8
+ else
9
+ send(:update_service, options)
10
+ end
9
11
  end
10
12
  end
@@ -5,7 +5,7 @@ module Deployme
5
5
  class Ecs < Provider
6
6
  def self.options(parser)
7
7
  parser.on('--ecs-image=IMAGE_TAG', String, 'Image tag to use for deployment') { |options, value| options.ecs_image = value }
8
- parser.on('--ecs-cluster=NAME', String, 'ECS Cluster name to deploy to') { |options, value| options.ecs_cluster = value }
8
+ parser.on('--ecs-cluster=NAME', String, 'ECS Cluster name to deploy to') { |options, value| options.ecs_cluster = value }
9
9
  end
10
10
 
11
11
  def execute
@@ -30,7 +30,7 @@ module Deployme
30
30
  end
31
31
 
32
32
  def register_services
33
- config[:services].each do |service|
33
+ services = config[:services].map do |service|
34
34
  logger.info "Registering Service #{service[:name]}"
35
35
  task_definition = task_definitions[service[:task_family].to_sym]
36
36
 
@@ -43,6 +43,18 @@ module Deployme
43
43
  )
44
44
 
45
45
  logger.info "Success: #{response.service.status}"
46
+ response.service.service_arn
47
+ end
48
+
49
+ begin
50
+ client.wait_until(:services_stable, cluster: options.ecs_cluster, services: services) do |w|
51
+ w.before_wait do
52
+ logger.info 'Waiting for services to stable...'
53
+ end
54
+ end
55
+ rescue Aws::Waiters::Errors::WaiterFailed => error
56
+ logger.error "failed waiting for service: #{error.message}"
57
+ exit(1)
46
58
  end
47
59
  end
48
60
 
@@ -1,3 +1,3 @@
1
1
  module Deployme
2
- VERSION = '0.1.7.1'.freeze
2
+ VERSION = '0.1.8'.freeze
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: deployme
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.7.1
4
+ version: 0.1.8
5
5
  platform: ruby
6
6
  authors:
7
7
  - Mikko Kokkonen