ecs_deploy_cli 0.2.1 → 0.2.2

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: 28217ab4d8ccda5d3a2471d23aae826cbe4656f98b6432a20cfbdd5c384ad2cf
4
- data.tar.gz: cccf9283ffe25359864a8a871455981203f1cd7f30c72788e0c12f845f9b40ec
3
+ metadata.gz: 6c4714117729290e91e7d5869862246b6aee1d023bbeca7681b92620f18dd03e
4
+ data.tar.gz: e6ddab9870c19af272723491398afd4ca49bf8f647182270ac71c0c3b08aa578
5
5
  SHA512:
6
- metadata.gz: db6f191a11e22dc5f249b4d93e4e04a4a492d5576384f65282206bee0ab5872dfe033f2f0412632d8780259a1e49c2f52ec44069b297fa681a4ba17f5dbb8438
7
- data.tar.gz: a238312dbd603b9be8ea0387f278c60dc1b70465524f70d1c91c5f8567f2c9f9fb7721538f8474d8182120dcd643eb4f144905b09891580ac51d720568a735bc
6
+ metadata.gz: 7dc1d20820ebf9f6d9c300b8f0f31df44ca256b379d6e84ca10e0c48f120ea566e94a61cb25694462fe03f67ae35b8658e64e0af4d5253ee14a9717c614b2377
7
+ data.tar.gz: 903942389ab805b9201c46d55562994648bc8102b5ad6bed62770674cc115f39127d482fa8afd405dde058372413ef684d33e52af6509b4e0d4e4f4eab3b07bd
@@ -56,6 +56,10 @@ module EcsDeployCli
56
56
 
57
57
  def as_definition
58
58
  {
59
+ cpu: 0,
60
+ mount_points: [],
61
+ port_mappings: [],
62
+ volumes_from: [],
59
63
  memory_reservation: nil,
60
64
  essential: true
61
65
  }.merge(_options)
@@ -15,27 +15,57 @@ module EcsDeployCli
15
15
 
16
16
  result = ecs_client.describe_task_definition(task_definition: task_name).to_h
17
17
 
18
- current = result[:task_definition].except(:revision, :status, :registered_at, :registered_by, :requires_attributes, :task_definition_arn)
18
+ current = cleanup_source_task(result[:task_definition])
19
+ definition = cleanup_source_task(definition)
19
20
 
20
21
  print_diff Hashdiff.diff(current.except(:container_definitions), definition.except(:container_definitions))
21
22
 
22
- current[:container_definitions].zip(definition[:container_definitions]).each do |a, b|
23
- EcsDeployCli.logger.info "Container #{a&.dig(:name) || 'NONE'} <=> #{b&.dig(:name) || 'NONE'}"
23
+ diff_container_definitions(
24
+ current[:container_definitions],
25
+ definition[:container_definitions]
26
+ )
24
27
 
25
- print_diff Hashdiff.diff(a, b) if a && b
26
- end
27
28
  EcsDeployCli.logger.info '---'
28
29
  end
29
30
  end
30
31
 
32
+ private
33
+
34
+ def diff_container_definitions(first, second)
35
+ first.zip(second).each do |a, b|
36
+ EcsDeployCli.logger.info "Container #{a&.dig(:name) || 'NONE'} <=> #{b&.dig(:name) || 'NONE'}"
37
+
38
+ next if !a || !b
39
+
40
+ sort_envs! a
41
+ sort_envs! b
42
+
43
+ print_diff Hashdiff.diff(a.delete_if { |_, v| v.nil? }, b.delete_if { |_, v| v.nil? })
44
+ end
45
+ end
46
+
47
+ def sort_envs!(definition)
48
+ return unless definition[:environment]
49
+
50
+ definition[:environment].sort_by! { |e| e[:name] }
51
+ end
52
+
53
+ def cleanup_source_task(task)
54
+ task.except(
55
+ :revision, :compatibilities, :status, :registered_at, :registered_by,
56
+ :requires_attributes, :task_definition_arn
57
+ ).delete_if { |_, v| v.nil? }
58
+ end
59
+
31
60
  def print_diff(diff)
32
61
  diff.each do |(op, path, *values)|
33
- if op == '-'
62
+ case op
63
+ when '-'
34
64
  EcsDeployCli.logger.info "#{op} #{path} => #{values.join(' ')}".colorize(:red)
35
- elsif op == '+'
65
+ when '+'
36
66
  EcsDeployCli.logger.info "#{op} #{path} => #{values.join(' ')}".colorize(:green)
37
67
  else
38
- EcsDeployCli.logger.info "#{op} #{path} => #{values.join(' ')}".colorize(:light_blue)
68
+ EcsDeployCli.logger.info "#{op} #{path} => #{values.join(' ')}".colorize(:yellow)
39
69
  end
40
70
  end
41
71
  end
@@ -0,0 +1,14 @@
1
+ # frozen_string_literal: true
2
+
3
+ module EcsDeployCli
4
+ module Runners
5
+ class Logs < Base
6
+ def run!
7
+ # _, tasks, = @parser.resolve
8
+
9
+ # tasks.
10
+ # cwl_client.
11
+ end
12
+ end
13
+ end
14
+ end
@@ -0,0 +1,23 @@
1
+ # frozen_string_literal: true
2
+
3
+ module EcsDeployCli
4
+ module Runners
5
+ class Status < Base
6
+ def run!(service)
7
+ services, = @parser.resolve
8
+
9
+ services.each do |service_name, service_definition|
10
+ next if !service.nil? && service != service_name
11
+
12
+ # task_definition = _update_task resolved_tasks[service_definition.options[:task]]
13
+ # task_name = "#{task_definition[:family]}:#{task_definition[:revision]}"
14
+
15
+ puts ecs_client.describe_service(
16
+ cluster: config[:cluster],
17
+ service: service_name
18
+ )
19
+ end
20
+ end
21
+ end
22
+ end
23
+ end
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module EcsDeployCli
4
- VERSION = '0.2.1'
4
+ VERSION = '0.2.2'
5
5
  end
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  require 'spec_helper'
2
4
 
3
5
  describe EcsDeployCli::DSL::Container do
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  require 'spec_helper'
2
4
 
3
5
  describe EcsDeployCli::DSL::Cron do
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  require 'spec_helper'
2
4
 
3
5
  describe EcsDeployCli::DSL::Parser do
data/spec/spec_helper.rb CHANGED
@@ -1,7 +1,8 @@
1
+ # frozen_string_literal: true
2
+
1
3
  require 'active_support'
2
4
  require 'rspec'
3
5
  require 'ecs_deploy_cli'
4
- # require 'kaminari-activerecord'
5
6
 
6
7
  I18n.enforce_available_locales = false
7
8
  RSpec::Expectations.configuration.warn_about_potential_false_positives = false
@@ -11,5 +12,3 @@ Dir[File.expand_path('../support/*.rb', __FILE__)].each { |f| require f }
11
12
  RSpec.configure do |config|
12
13
 
13
14
  end
14
-
15
-
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: ecs_deploy_cli
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.1
4
+ version: 0.2.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Mònade
@@ -164,8 +164,10 @@ files:
164
164
  - lib/ecs_deploy_cli/runner.rb
165
165
  - lib/ecs_deploy_cli/runners/base.rb
166
166
  - lib/ecs_deploy_cli/runners/diff.rb
167
+ - lib/ecs_deploy_cli/runners/logs.rb
167
168
  - lib/ecs_deploy_cli/runners/run_task.rb
168
169
  - lib/ecs_deploy_cli/runners/ssh.rb
170
+ - lib/ecs_deploy_cli/runners/status.rb
169
171
  - lib/ecs_deploy_cli/runners/update_crons.rb
170
172
  - lib/ecs_deploy_cli/runners/update_services.rb
171
173
  - lib/ecs_deploy_cli/runners/validate.rb
@@ -201,7 +203,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
201
203
  - !ruby/object:Gem::Version
202
204
  version: '0'
203
205
  requirements: []
204
- rubygems_version: 3.1.4
206
+ rubygems_version: 3.2.6
205
207
  signing_key:
206
208
  specification_version: 4
207
209
  summary: A command line interface to make ECS deployments easier