ecs_helper 0.0.3 → 0.0.4

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: f4e312a9d8447eeb797b242831cdd654d03a5110eb2334868a33066761de47bd
4
- data.tar.gz: ac1cdddf44eaeeabf20dcbc6fe05f677461bc8b67f8726bfda20f0890c69f978
3
+ metadata.gz: b3a8956a9f6eda0de978eae11de21c36ff09fd45c6c0a9c1df13ccd6b2bdba95
4
+ data.tar.gz: 40391c6c317e96687b9ad72ebcf03df0cdb0bb1b1a1fd381db720df7720d2801
5
5
  SHA512:
6
- metadata.gz: 704028fcd8b9669af080ba8cce93fff3149440ea22529a3a1c1c2582eec384cf261b8662e10f1274de3d8b359ec1e0cfdf3c7bd896478f3f8e05ff36f076ae8c
7
- data.tar.gz: 5684fb3b793b810d89b9ad080acdad03fa79d91f7276ce3f2e41cc90cbf9c7e5f01e4b81cbdfbd13f036ae0c957c177361287ccc1048c5b04ebc38bb61035d3b
6
+ metadata.gz: 497a68f0ae2b2e8cce1701b821195dc1f07f5a7a7a6f67b442abc59a4e69005ff5de067943037b63e5e4ec1f09e318b4ec3136a6b92f5b2ec92d3911be58199c
7
+ data.tar.gz: 1a01a3f9ca2b5c94fdd5a146b6cc3f41c6fa6b35620748068f9cbee3f10afc102f2dee0a32e5884007bb7f6cb7c6d02a9e72dfddcf1df1c0ddfd94fb2d831a5f
@@ -3,10 +3,14 @@ class ECSHelper::Command
3
3
  autoload :Base, 'ecs_helper/command/base'
4
4
  autoload :BuildAndPush, 'ecs_helper/command/build_and_push'
5
5
  autoload :Deploy, 'ecs_helper/command/deploy'
6
+ autoload :ExportImages, 'ecs_helper/command/export_images'
7
+ autoload :ECRLogin, 'ecs_helper/command/ecr_login'
6
8
 
7
9
  CMD_MAPPING = {
8
10
  "build_and_push" => BuildAndPush,
9
- "deploy" => Deploy
11
+ "deploy" => Deploy,
12
+ "export_images" => ExportImages,
13
+ "ecr_login" => ECRLogin,
10
14
  }
11
15
  AVAILABLE_COMMANDS = CMD_MAPPING.keys
12
16
 
@@ -1,13 +1,11 @@
1
1
  require 'terrapin'
2
2
 
3
3
  class ECSHelper::Command::BuildAndPush < ECSHelper::Command::Base
4
- # attr_accessor :type, :client, :project, :application, :version
5
4
 
6
5
  def cmd_option_parser
7
6
  options = {}
8
7
  parser = ::OptionParser.new do |opts|
9
- opts.banner = "Usage: ecs_helper build_and_push [options]]"
10
- opts.on("-v", "--verbose", "Show debug information") { o[:verbose] = true }
8
+ opts.banner = "Usage: ecs_helper build_and_push [options]"
11
9
  opts.on("-i VALUE", "--image VALUE", "Set image name, will be used to detect ecr repo where to push image, for example web/nginx/toolbox (required)") { |c| options[:image] = processEqual(c) }
12
10
  opts.on("-d VALUE", "--directory VALUE", "Set directory for dockerfile and context, default = './'") { |c| options[:directory] = processEqual(c) }
13
11
  opts.on("-p VALUE", "--project VALUE", "Set project name, if not specified will look at ENV['PROJECT'], will be used to detect cluster") { |p| options[:project] = processEqual(p) }
@@ -8,8 +8,7 @@ class ECSHelper::Command::Deploy < ECSHelper::Command::Base
8
8
  def cmd_option_parser
9
9
  options = {}
10
10
  parser = ::OptionParser.new do |opts|
11
- opts.banner = "Usage: ecs_helper deploy [options]]"
12
- opts.on("-v", "--verbose", "Show debug information") { o[:verbose] = true }
11
+ opts.banner = "Usage: ecs_helper deploy [options]"
13
12
  opts.on("-p VALUE", "--project VALUE", "Set project name, if not specified will look at ENV['PROJECT'], will be used to detect cluster") { |p| options[:project] = processEqual(p) }
14
13
  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") { |a| options[:application] = processEqual(a) }
15
14
  opts.on("-e VALUE", "--environment VALUE", "Set environment, if not specified will look at ENV['ENVIRONMENT'], it there is empty will try to detect based on the branch") { |e| options[:environment] = processEqual(e) }
@@ -0,0 +1,26 @@
1
+ require 'terrapin'
2
+
3
+ class ECSHelper::Command::ECRLogin < ECSHelper::Command::Base
4
+
5
+ def cmd_option_parser
6
+ options = {}
7
+ parser = ::OptionParser.new do |opts|
8
+ opts.banner = "Usage: ecs_helper ecr_login"
9
+ end
10
+ [parser, options]
11
+ end
12
+
13
+ def required
14
+ []
15
+ end
16
+
17
+ def run
18
+ log("Command", type)
19
+ log("Auth", auth)
20
+ end
21
+
22
+ def auth
23
+ auth_cmd = Terrapin::CommandLine.new("aws ecr get-login --no-include-email | sh")
24
+ auth_cmd.run
25
+ end
26
+ end
@@ -0,0 +1,46 @@
1
+ require 'terrapin'
2
+
3
+ class ECSHelper::Command::ExportImages < ECSHelper::Command::Base
4
+
5
+ def cmd_option_parser
6
+ options = {}
7
+ parser = ::OptionParser.new do |opts|
8
+ opts.banner = "Usage: ecs_helper export_images"
9
+ end
10
+ [parser, options]
11
+ end
12
+
13
+ def required
14
+ []
15
+ end
16
+
17
+ def run
18
+ puts export_images
19
+ end
20
+
21
+ def auth
22
+ auth_cmd = Terrapin::CommandLine.new("aws ecr get-login --no-include-email | sh")
23
+ auth_cmd.run
24
+ end
25
+
26
+
27
+ private
28
+
29
+ def project
30
+ helper.project
31
+ end
32
+
33
+ def application
34
+ helper.application
35
+ end
36
+
37
+ def export_images
38
+ variables = (['export'] + client.repositories.map do |repo|
39
+ container_name = repo.repository_name.scan(/#{project}-#{application}-(.*)/).flatten.first
40
+ key = container_name.upcase.gsub("-", "_") + "_IMAGE"
41
+ value = "#{repo.repository_uri}:#{helper.version}"
42
+ "#{key}=#{value}"
43
+ end).join(' ')
44
+ variables
45
+ end
46
+ end
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.3
4
+ version: 0.0.4
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-06-13 00:00:00.000000000 Z
11
+ date: 2021-06-14 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: aws-sdk-ecs
@@ -70,26 +70,6 @@ dependencies:
70
70
  - - ">="
71
71
  - !ruby/object:Gem::Version
72
72
  version: '2.5'
73
- - !ruby/object:Gem::Dependency
74
- name: thor
75
- requirement: !ruby/object:Gem::Requirement
76
- requirements:
77
- - - "~>"
78
- - !ruby/object:Gem::Version
79
- version: '1.1'
80
- - - ">="
81
- - !ruby/object:Gem::Version
82
- version: '1.1'
83
- type: :runtime
84
- prerelease: false
85
- version_requirements: !ruby/object:Gem::Requirement
86
- requirements:
87
- - - "~>"
88
- - !ruby/object:Gem::Version
89
- version: '1.1'
90
- - - ">="
91
- - !ruby/object:Gem::Version
92
- version: '1.1'
93
73
  - !ruby/object:Gem::Dependency
94
74
  name: colorize
95
75
  requirement: !ruby/object:Gem::Requirement
@@ -110,26 +90,6 @@ dependencies:
110
90
  - - ">="
111
91
  - !ruby/object:Gem::Version
112
92
  version: '0.8'
113
- - !ruby/object:Gem::Dependency
114
- name: docker-api
115
- requirement: !ruby/object:Gem::Requirement
116
- requirements:
117
- - - "~>"
118
- - !ruby/object:Gem::Version
119
- version: '2.1'
120
- - - ">="
121
- - !ruby/object:Gem::Version
122
- version: '2.1'
123
- type: :runtime
124
- prerelease: false
125
- version_requirements: !ruby/object:Gem::Requirement
126
- requirements:
127
- - - "~>"
128
- - !ruby/object:Gem::Version
129
- version: '2.1'
130
- - - ">="
131
- - !ruby/object:Gem::Version
132
- version: '2.1'
133
93
  - !ruby/object:Gem::Dependency
134
94
  name: terrapin
135
95
  requirement: !ruby/object:Gem::Requirement
@@ -165,6 +125,8 @@ files:
165
125
  - lib/ecs_helper/command/base.rb
166
126
  - lib/ecs_helper/command/build_and_push.rb
167
127
  - lib/ecs_helper/command/deploy.rb
128
+ - lib/ecs_helper/command/ecr_login.rb
129
+ - lib/ecs_helper/command/export_images.rb
168
130
  - lib/ecs_helper/common_helper.rb
169
131
  - lib/ecs_helper/logging.rb
170
132
  - lib/ecs_helper/service_helper.rb