ecs_deploy_cli 0.2.1 → 0.2.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/lib/ecs_deploy_cli/dsl/container.rb +4 -0
- data/lib/ecs_deploy_cli/runners/diff.rb +38 -8
- data/lib/ecs_deploy_cli/runners/logs.rb +14 -0
- data/lib/ecs_deploy_cli/runners/status.rb +23 -0
- data/lib/ecs_deploy_cli/version.rb +1 -1
- data/spec/ecs_deploy_cli/dsl/container_spec.rb +2 -0
- data/spec/ecs_deploy_cli/dsl/cron_spec.rb +2 -0
- data/spec/ecs_deploy_cli/dsl/parser_spec.rb +2 -0
- data/spec/spec_helper.rb +2 -3
- metadata +4 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 6c4714117729290e91e7d5869862246b6aee1d023bbeca7681b92620f18dd03e
|
4
|
+
data.tar.gz: e6ddab9870c19af272723491398afd4ca49bf8f647182270ac71c0c3b08aa578
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 7dc1d20820ebf9f6d9c300b8f0f31df44ca256b379d6e84ca10e0c48f120ea566e94a61cb25694462fe03f67ae35b8658e64e0af4d5253ee14a9717c614b2377
|
7
|
+
data.tar.gz: 903942389ab805b9201c46d55562994648bc8102b5ad6bed62770674cc115f39127d482fa8afd405dde058372413ef684d33e52af6509b4e0d4e4f4eab3b07bd
|
@@ -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]
|
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
|
-
|
23
|
-
|
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
|
-
|
62
|
+
case op
|
63
|
+
when '-'
|
34
64
|
EcsDeployCli.logger.info "#{op} #{path} => #{values.join(' ')}".colorize(:red)
|
35
|
-
|
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(:
|
68
|
+
EcsDeployCli.logger.info "#{op} #{path} => #{values.join(' ')}".colorize(:yellow)
|
39
69
|
end
|
40
70
|
end
|
41
71
|
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
|
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.
|
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.
|
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
|