ecs_helper 0.0.29 → 0.0.30
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Gemfile.lock +2 -4
- data/ecs_helper.gemspec +0 -2
- data/lib/ecs_helper/command/check_exec.rb +52 -0
- data/lib/ecs_helper/command/exec.rb +4 -5
- data/lib/ecs_helper/command.rb +2 -0
- data/lib/ecs_helper/version.rb +1 -1
- data/lib/ecs_helper.rb +2 -0
- metadata +3 -22
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 3d7135d95e971a93420416be037655008bcbdb414d1ff278a5d6f054f7cae45e
|
4
|
+
data.tar.gz: 315b1bc56e9ec94be1d4ab05aa2ae969d3d6a5acacebcd899dad2a4a5664b7d7
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 607ed56e8ec010436a4b7bacac2a87c1135718e4c77530111056e8d3e6076598074d366924220eab781c30226adfaeda0b2d0073e0e3d89f652e7770dcdebf07
|
7
|
+
data.tar.gz: e591908c48d43ad96a0045e342a55849f31203dedc6046162b0afef791fd30f9d9934b5afc6dce02d8407d8c07091eb9843d4311d7eeaf3c38c38b1f72ffd76c
|
data/Gemfile.lock
CHANGED
@@ -1,13 +1,12 @@
|
|
1
1
|
PATH
|
2
2
|
remote: .
|
3
3
|
specs:
|
4
|
-
ecs_helper (0.0.
|
4
|
+
ecs_helper (0.0.30)
|
5
5
|
aws-sdk-ecr (~> 1.42, >= 1.42)
|
6
6
|
aws-sdk-ecrpublic (~> 1.3, >= 1.3)
|
7
7
|
aws-sdk-ecs (~> 1.80, >= 1.80)
|
8
8
|
aws-sdk-ssm (~> 1.0.0.rc7)
|
9
9
|
colorize (~> 0.8, >= 0.8)
|
10
|
-
json (~> 2.5, >= 2.5)
|
11
10
|
terrapin (~> 0.6, >= 0.6)
|
12
11
|
|
13
12
|
GEM
|
@@ -24,7 +23,7 @@ GEM
|
|
24
23
|
aws-partitions (~> 1, >= 1.239.0)
|
25
24
|
aws-sigv4 (~> 1.1)
|
26
25
|
jmespath (~> 1.0)
|
27
|
-
aws-sdk-ecr (1.
|
26
|
+
aws-sdk-ecr (1.47.0)
|
28
27
|
aws-sdk-core (~> 3, >= 3.120.0)
|
29
28
|
aws-sigv4 (~> 1.1)
|
30
29
|
aws-sdk-ecrpublic (1.6.0)
|
@@ -47,7 +46,6 @@ GEM
|
|
47
46
|
rexml
|
48
47
|
hashdiff (1.0.1)
|
49
48
|
jmespath (1.4.0)
|
50
|
-
json (2.5.1)
|
51
49
|
method_source (1.0.0)
|
52
50
|
minitest (5.14.4)
|
53
51
|
minitest-power_assert (0.3.1)
|
data/ecs_helper.gemspec
CHANGED
@@ -39,7 +39,5 @@ Gem::Specification.new do |s|
|
|
39
39
|
s.add_runtime_dependency 'aws-sdk-ecs', '~> 1.80', '>= 1.80'
|
40
40
|
s.add_runtime_dependency 'aws-sdk-ssm', '~> 1.0.0.rc7'
|
41
41
|
s.add_runtime_dependency 'colorize', '~> 0.8', '>= 0.8'
|
42
|
-
s.add_runtime_dependency 'json', '~> 2.5', '>= 2.5'
|
43
42
|
s.add_runtime_dependency 'terrapin', '~> 0.6', '>= 0.6'
|
44
|
-
|
45
43
|
end
|
@@ -0,0 +1,52 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require 'terrapin'
|
4
|
+
|
5
|
+
class ECSHelper::Command::CheckExec < ECSHelper::Command::Base
|
6
|
+
def cmd_option_parser
|
7
|
+
options = { command: 'bash -c' }
|
8
|
+
parser = ::OptionParser.new do |opts|
|
9
|
+
opts.banner = 'Usage: ecs_helper check_exec'
|
10
|
+
opts.on('-p VALUE', '--project VALUE', "Set project name, if not specified will look at ENV['PROJECT'], will be used to detect cluster") do |p| options[:project] = processEqual(p) end
|
11
|
+
opts.on('-a VALUE', '--application VALUE', "Set application name, if not specified will look at ENV['APPLICATION'], will be used to detect service and task definition") do |a| options[:application] = processEqual(a) end
|
12
|
+
end
|
13
|
+
[parser, options]
|
14
|
+
end
|
15
|
+
|
16
|
+
def check_exec_bin
|
17
|
+
check_bin('check-ecs-exec')
|
18
|
+
end
|
19
|
+
|
20
|
+
def check_exec
|
21
|
+
exec_cmd = Terrapin::CommandLine.new("check-ecs-exec #{cluster_arn} #{task_arn}")
|
22
|
+
exec_cmd.run
|
23
|
+
end
|
24
|
+
|
25
|
+
def printable?
|
26
|
+
true
|
27
|
+
end
|
28
|
+
|
29
|
+
def run
|
30
|
+
log("Command", type)
|
31
|
+
log("Cluster", cluster_arn)
|
32
|
+
log("Service", service_arn)
|
33
|
+
log("Task", task_arn)
|
34
|
+
log("Options", options)
|
35
|
+
log("Check bin", check_exec_bin)
|
36
|
+
check_exec
|
37
|
+
end
|
38
|
+
|
39
|
+
private
|
40
|
+
|
41
|
+
def cluster_arn
|
42
|
+
helper.current_cluster
|
43
|
+
end
|
44
|
+
|
45
|
+
def service_arn
|
46
|
+
helper.current_service
|
47
|
+
end
|
48
|
+
|
49
|
+
def task_arn
|
50
|
+
@task_arn ||= helper.client.list_tasks({cluster: cluster_arn, service_name: service_arn, desired_status: "RUNNING"})[0]
|
51
|
+
end
|
52
|
+
end
|
@@ -4,7 +4,7 @@ require 'terrapin'
|
|
4
4
|
|
5
5
|
class ECSHelper::Command::Exec < ECSHelper::Command::Base
|
6
6
|
def cmd_option_parser
|
7
|
-
options = { command: 'bash
|
7
|
+
options = { command: '/bin/bash' }
|
8
8
|
parser = ::OptionParser.new do |opts|
|
9
9
|
opts.banner = 'Usage: ecs_helper exec [options]. require session-manager-plugin and aws cli v2'
|
10
10
|
opts.on('-p VALUE', '--project VALUE',
|
@@ -15,8 +15,8 @@ class ECSHelper::Command::Exec < ECSHelper::Command::Base
|
|
15
15
|
"Set application name, if not specified will look at ENV['APPLICATION'], will be used to detect service and task definition") do |a|
|
16
16
|
options[:application] = processEqual(a)
|
17
17
|
end
|
18
|
-
opts.on('-c', '--container VALUE', 'Cache image before build, default false') { |c| options[:container] = c }
|
19
|
-
opts.on('--command VALUE', 'Command to execute') { |c| options[:command] = c }
|
18
|
+
opts.on('-c', '--container VALUE', 'Cache image before build, default false') { |c| options[:container] = processEqual(c) }
|
19
|
+
opts.on('--command VALUE', 'Command to execute') { |c| options[:command] = processEqual(c) }
|
20
20
|
end
|
21
21
|
[parser, options]
|
22
22
|
end
|
@@ -74,8 +74,7 @@ class ECSHelper::Command::Exec < ECSHelper::Command::Base
|
|
74
74
|
end
|
75
75
|
|
76
76
|
def exec
|
77
|
-
exec_cmd = Terrapin::CommandLine.new("aws ecs execute-command --cluster #{cluster_arn} --task #{task_arn}
|
78
|
-
# --region us-east-1
|
77
|
+
exec_cmd = Terrapin::CommandLine.new("aws ecs execute-command --cluster #{cluster_arn} --task #{task_arn} --container #{helper.options[:container]} --command #{helper.options[:command]} --interactive")
|
79
78
|
exec_cmd.run
|
80
79
|
end
|
81
80
|
|
data/lib/ecs_helper/command.rb
CHANGED
@@ -6,6 +6,7 @@ class ECSHelper::Command
|
|
6
6
|
autoload :ExportImages, 'ecs_helper/command/export_images'
|
7
7
|
autoload :ECRLogin, 'ecs_helper/command/ecr_login'
|
8
8
|
autoload :Exec, 'ecs_helper/command/exec'
|
9
|
+
autoload :CheckExec, 'ecs_helper/command/check_exec'
|
9
10
|
autoload :RunCommand, 'ecs_helper/command/run_command'
|
10
11
|
autoload :ExportEnvSecrets, 'ecs_helper/command/export_env_secrets'
|
11
12
|
|
@@ -17,6 +18,7 @@ class ECSHelper::Command
|
|
17
18
|
"run_command" => RunCommand,
|
18
19
|
"export_env_secrets" => ExportEnvSecrets,
|
19
20
|
"exec" => Exec,
|
21
|
+
"check_exec" => CheckExec,
|
20
22
|
}
|
21
23
|
AVAILABLE_COMMANDS = CMD_MAPPING.keys
|
22
24
|
|
data/lib/ecs_helper/version.rb
CHANGED
data/lib/ecs_helper.rb
CHANGED
@@ -6,6 +6,8 @@ class ECSHelper
|
|
6
6
|
extend Forwardable
|
7
7
|
attr_accessor :options, :client, :command, :parser, :cluster_helper, :service_helper, :common_helper
|
8
8
|
|
9
|
+
|
10
|
+
autoload :VERSION, 'ecs_helper/version'
|
9
11
|
autoload :Client, 'ecs_helper/client'
|
10
12
|
autoload :CommonHelper, 'ecs_helper/common_helper'
|
11
13
|
autoload :ClusterHelper, 'ecs_helper/cluster_helper'
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: ecs_helper
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.30
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Artem Petrov
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2021-09-
|
11
|
+
date: 2021-09-22 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: awesome_print
|
@@ -286,26 +286,6 @@ dependencies:
|
|
286
286
|
- - "~>"
|
287
287
|
- !ruby/object:Gem::Version
|
288
288
|
version: '0.8'
|
289
|
-
- !ruby/object:Gem::Dependency
|
290
|
-
name: json
|
291
|
-
requirement: !ruby/object:Gem::Requirement
|
292
|
-
requirements:
|
293
|
-
- - ">="
|
294
|
-
- !ruby/object:Gem::Version
|
295
|
-
version: '2.5'
|
296
|
-
- - "~>"
|
297
|
-
- !ruby/object:Gem::Version
|
298
|
-
version: '2.5'
|
299
|
-
type: :runtime
|
300
|
-
prerelease: false
|
301
|
-
version_requirements: !ruby/object:Gem::Requirement
|
302
|
-
requirements:
|
303
|
-
- - ">="
|
304
|
-
- !ruby/object:Gem::Version
|
305
|
-
version: '2.5'
|
306
|
-
- - "~>"
|
307
|
-
- !ruby/object:Gem::Version
|
308
|
-
version: '2.5'
|
309
289
|
- !ruby/object:Gem::Dependency
|
310
290
|
name: terrapin
|
311
291
|
requirement: !ruby/object:Gem::Requirement
|
@@ -349,6 +329,7 @@ files:
|
|
349
329
|
- lib/ecs_helper/command.rb
|
350
330
|
- lib/ecs_helper/command/base.rb
|
351
331
|
- lib/ecs_helper/command/build_and_push.rb
|
332
|
+
- lib/ecs_helper/command/check_exec.rb
|
352
333
|
- lib/ecs_helper/command/deploy.rb
|
353
334
|
- lib/ecs_helper/command/ecr_login.rb
|
354
335
|
- lib/ecs_helper/command/exec.rb
|