ecs_deploy 1.0.4 → 1.0.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
  SHA256:
3
- metadata.gz: a731ec39a6928bb4365fbb4784b91dd92737eb5b5796da19e3be8185d6bc10b8
4
- data.tar.gz: '04758ae740d9ab1bb9108d5dcae1df72102fd161e0f96a38f1e30b461415bc7f'
3
+ metadata.gz: a9b02fc9a3cfda6288d7e00f339487fd2050b441e973d5fc7a822f9c261ea272
4
+ data.tar.gz: 9c002ab5e543435304d8d56eb88d19fceac56b4d70916f1b740176b6c3070dfc
5
5
  SHA512:
6
- metadata.gz: 429dc1f441f7a67a973293adf8c48a62671ab3f5710cee596186a7fe5773b772b643b9ef879fb0b2143d7f7100754b6521ec6823094122fec85bfd189ca3c306
7
- data.tar.gz: 03f568218e5e77e2c9b86560ac5dd4f41e19440f98da1ee102ee09057bc7ec8fdf7caa5366b56d06946d5887a0a60d8bae0c1ce04e80e0a50df7a51e40642da0
6
+ metadata.gz: c88b02664cb84e45ae1b14b4bbd97907d984a46d3ff6eb817f48d0ffb626f7b8c88311f1b6c5a31c8f8b27a2eaeee8ed9a06c61c93551e4b3dd1c3099d382628
7
+ data.tar.gz: 144449c85ed16c1f4dbfe8340cb6a11b1b4aee8ac55de07e2322dda654932c3bbfb12a125b39776aad3294841487b0047098dd9e65e46f2d44aec125c933b9e4
data/CHANGELOG.md CHANGED
@@ -1,5 +1,11 @@
1
1
  # v1.0
2
2
 
3
+ ## Release v1.0.5 - 2023/03/15
4
+
5
+ ### Enhancement
6
+
7
+ - Add variable of capistrano `ecs_client_retry_params` to override parameter of ECS::Client#initialize https://github.com/reproio/ecs_deploy/pull/88
8
+
3
9
  ## Release v1.0.4 - 2023/02/10
4
10
 
5
11
  ### Bug fixes
data/README.md CHANGED
@@ -33,6 +33,7 @@ set :ecs_service_role, "customEcsServiceRole" # default: ecsServiceRole
33
33
  set :ecs_deploy_wait_timeout, 600 # default: 300
34
34
  set :ecs_wait_until_services_stable_max_attempts, 40 # optional
35
35
  set :ecs_wait_until_services_stable_delay, 15 # optional
36
+ set :ecs_client_params, { retry_mode: "standard", max_attempts: 10 } # default: {}
36
37
 
37
38
  set :ecs_tasks, [
38
39
  {
@@ -10,6 +10,7 @@ namespace :ecs do
10
10
  c.default_region = Array(fetch(:ecs_region))[0] if fetch(:ecs_region)
11
11
  c.ecs_wait_until_services_stable_max_attempts = fetch(:ecs_wait_until_services_stable_max_attempts) if fetch(:ecs_wait_until_services_stable_max_attempts)
12
12
  c.ecs_wait_until_services_stable_delay = fetch(:ecs_wait_until_services_stable_delay) if fetch(:ecs_wait_until_services_stable_delay)
13
+ c.ecs_client_params = fetch(:ecs_client_params) if fetch(:ecs_client_params)
13
14
  end
14
15
 
15
16
  if ENV["TARGET_CLUSTER"]
@@ -8,7 +8,8 @@ module EcsDeploy
8
8
  :deploy_wait_timeout,
9
9
  :ecs_service_role,
10
10
  :ecs_wait_until_services_stable_max_attempts,
11
- :ecs_wait_until_services_stable_delay
11
+ :ecs_wait_until_services_stable_delay,
12
+ :ecs_client_params
12
13
 
13
14
  def initialize
14
15
  @log_level = :info
@@ -16,6 +17,7 @@ module EcsDeploy
16
17
  # The following values are the default values of Aws::ECS::Waiters::ServicesStable
17
18
  @ecs_wait_until_services_stable_max_attempts = 40
18
19
  @ecs_wait_until_services_stable_delay = 15
20
+ @ecs_client_params = {}
19
21
  end
20
22
  end
21
23
  end
@@ -113,7 +113,7 @@ module EcsDeploy
113
113
  end
114
114
 
115
115
  def ecs_client
116
- @ecs_client ||= Aws::ECS::Client.new(aws_params)
116
+ @ecs_client ||= Aws::ECS::Client.new(aws_params.merge(EcsDeploy.config.ecs_client_params))
117
117
  end
118
118
 
119
119
  def fetch_auto_scaling_group
@@ -27,9 +27,10 @@ module EcsDeploy
27
27
  @platform_version = platform_version
28
28
  @group = group
29
29
  region ||= EcsDeploy.config.default_region
30
+ params ||= EcsDeploy.config.ecs_client_params
30
31
  @container_overrides = container_overrides
31
32
 
32
- @client = region ? Aws::ECS::Client.new(region: region) : Aws::ECS::Client.new
33
+ @client = region ? Aws::ECS::Client.new(params.merge(region: region)) : Aws::ECS::Client.new(params)
33
34
  @region = @client.config.region
34
35
  @cloud_watch_events = Aws::CloudWatchEvents::Client.new(region: @region)
35
36
  end
@@ -49,7 +49,8 @@ module EcsDeploy
49
49
  @response = nil
50
50
 
51
51
  region ||= EcsDeploy.config.default_region
52
- @client = region ? Aws::ECS::Client.new(region: region) : Aws::ECS::Client.new
52
+ params ||= EcsDeploy.config.ecs_client_params
53
+ @client = region ? Aws::ECS::Client.new(params.merge(region: region)) : Aws::ECS::Client.new(params)
53
54
  @region = @client.config.region
54
55
 
55
56
  @delete = delete
@@ -181,7 +182,8 @@ module EcsDeploy
181
182
 
182
183
  def self.wait_all_running(services)
183
184
  services.group_by { |s| [s.cluster, s.region] }.flat_map do |(cl, region), ss|
184
- client = Aws::ECS::Client.new(region: region)
185
+ params ||= EcsDeploy.config.ecs_client_params
186
+ client = Aws::ECS::Client.new(params.merge(region: region))
185
187
  ss.reject(&:delete).map(&:service_name).each_slice(MAX_DESCRIBE_SERVICES).map do |chunked_service_names|
186
188
  Thread.new do
187
189
  EcsDeploy.config.ecs_wait_until_services_stable_max_attempts.times do
@@ -1,15 +1,9 @@
1
1
  module EcsDeploy
2
2
  class TaskDefinition
3
- RETRY_BACKOFF = lambda do |c|
4
- sleep(1)
5
- end
6
-
7
- RETRY_LIMIT = 10
8
-
9
3
  def self.deregister(arn, region: nil)
10
4
  region ||= EcsDeploy.config.default_region
11
- param = {retry_backoff: RETRY_BACKOFF, retry_limit: RETRY_LIMIT}
12
- client = region ? Aws::ECS::Client.new(param.merge(region: region)) : Aws::ECS::Client.new(param)
5
+ params ||= EcsDeploy.config.ecs_client_params
6
+ client = region ? Aws::ECS::Client.new(params.merge(region: region)) : Aws::ECS::Client.new(params)
13
7
  client.deregister_task_definition({
14
8
  task_definition: arn,
15
9
  })
@@ -29,6 +23,7 @@ module EcsDeploy
29
23
  @task_role_arn = task_role_arn
30
24
  @execution_role_arn = execution_role_arn
31
25
  region ||= EcsDeploy.config.default_region
26
+ params ||= EcsDeploy.config.ecs_client_params
32
27
 
33
28
  @container_definitions = container_definitions.map do |cd|
34
29
  if cd[:docker_labels]
@@ -46,8 +41,7 @@ module EcsDeploy
46
41
  @cpu = cpu&.to_s
47
42
  @memory = memory&.to_s
48
43
  @tags = tags
49
- param = {retry_backoff: RETRY_BACKOFF, retry_limit: RETRY_LIMIT}
50
- @client = region ? Aws::ECS::Client.new(param.merge(region: region)) : Aws::ECS::Client.new(param)
44
+ @client = region ? Aws::ECS::Client.new(params.merge(region: region)) : Aws::ECS::Client.new(params)
51
45
  @region = @client.config.region
52
46
  end
53
47
 
@@ -1,3 +1,3 @@
1
1
  module EcsDeploy
2
- VERSION = "1.0.4"
2
+ VERSION = "1.0.5"
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: ecs_deploy
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.4
4
+ version: 1.0.5
5
5
  platform: ruby
6
6
  authors:
7
7
  - joker1007
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2023-02-10 00:00:00.000000000 Z
11
+ date: 2023-03-15 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: aws-sdk-autoscaling