container_ship 0.1.2 → 0.1.5
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/.circleci/config.yml +3 -3
- data/.github/dependabot.yml +0 -4
- data/.gitignore +1 -0
- data/Gemfile.lock +65 -55
- data/lib/container_ship/cli.rb +10 -1
- data/lib/container_ship/command/exec_command.rb +4 -2
- data/lib/container_ship/command/modules/docker.rb +4 -1
- data/lib/container_ship/command/modules/ecs.rb +13 -7
- data/lib/container_ship/task_definition.rb +12 -0
- data/lib/container_ship/version.rb +1 -1
- metadata +3 -3
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 4e4d61c12d557b710b02194829bd50f5addef1e6ec3b54a6b2a63d56f73e7b51
|
|
4
|
+
data.tar.gz: 5b5594d0a0ceed785efb79aee3a7e923f45afa6898facb6e95c85b975b25d3c7
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: bfe5f36b3b85791da6828d95a11eb566b066da80240fd484bfcd622dde4e04ff6f6229491ea104adfccdaaf50444d7c1403f8dfa571257ff5aa6dee6d2dafc2c
|
|
7
|
+
data.tar.gz: 2e2a2b9a1b436f741e802c4c4a96299b546770fd669073b3c9de7a961bcde216418bb069dd11b7a0e411980ee4048a63d4698612fe17d4a337c01d335d56675e
|
data/.circleci/config.yml
CHANGED
|
@@ -17,7 +17,7 @@ git statusrestore_bundle_cache: &restore_bundle_cache
|
|
|
17
17
|
jobs:
|
|
18
18
|
build:
|
|
19
19
|
docker:
|
|
20
|
-
- image:
|
|
20
|
+
- image: cimg/ruby:2.7.2
|
|
21
21
|
steps:
|
|
22
22
|
- checkout
|
|
23
23
|
- *restore_bundle_cache
|
|
@@ -29,7 +29,7 @@ jobs:
|
|
|
29
29
|
- vendor/bundle
|
|
30
30
|
rubocop:
|
|
31
31
|
docker:
|
|
32
|
-
- image:
|
|
32
|
+
- image: cimg/ruby:2.7.2
|
|
33
33
|
steps:
|
|
34
34
|
- checkout
|
|
35
35
|
- *restore_bundle_cache
|
|
@@ -38,7 +38,7 @@ jobs:
|
|
|
38
38
|
- run: bundle exec rubocop
|
|
39
39
|
rspec:
|
|
40
40
|
docker:
|
|
41
|
-
- image:
|
|
41
|
+
- image: cimg/ruby:2.7.2
|
|
42
42
|
steps:
|
|
43
43
|
- checkout
|
|
44
44
|
- *restore_bundle_cache
|
data/.github/dependabot.yml
CHANGED
data/.gitignore
CHANGED
data/Gemfile.lock
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
PATH
|
|
2
2
|
remote: .
|
|
3
3
|
specs:
|
|
4
|
-
container_ship (0.1.
|
|
4
|
+
container_ship (0.1.5)
|
|
5
5
|
aws-sdk-cloudwatchlogs
|
|
6
6
|
aws-sdk-ecs
|
|
7
7
|
thor
|
|
@@ -15,47 +15,57 @@ GEM
|
|
|
15
15
|
minitest (~> 5.1)
|
|
16
16
|
tzinfo (~> 1.1)
|
|
17
17
|
zeitwerk (~> 2.2, >= 2.2.2)
|
|
18
|
-
addressable (2.
|
|
18
|
+
addressable (2.8.0)
|
|
19
19
|
public_suffix (>= 2.0.2, < 5.0)
|
|
20
20
|
ast (2.4.2)
|
|
21
|
-
aws-eventstream (1.
|
|
22
|
-
aws-partitions (1.
|
|
23
|
-
aws-sdk-cloudwatchlogs (1.
|
|
24
|
-
aws-sdk-core (~> 3, >= 3.
|
|
21
|
+
aws-eventstream (1.2.0)
|
|
22
|
+
aws-partitions (1.595.0)
|
|
23
|
+
aws-sdk-cloudwatchlogs (1.53.0)
|
|
24
|
+
aws-sdk-core (~> 3, >= 3.127.0)
|
|
25
25
|
aws-sigv4 (~> 1.1)
|
|
26
|
-
aws-sdk-core (3.
|
|
26
|
+
aws-sdk-core (3.131.1)
|
|
27
27
|
aws-eventstream (~> 1, >= 1.0.2)
|
|
28
|
-
aws-partitions (~> 1, >= 1.
|
|
28
|
+
aws-partitions (~> 1, >= 1.525.0)
|
|
29
29
|
aws-sigv4 (~> 1.1)
|
|
30
|
-
jmespath (~> 1.
|
|
31
|
-
aws-sdk-ecs (1.
|
|
32
|
-
aws-sdk-core (~> 3, >= 3.
|
|
30
|
+
jmespath (~> 1, >= 1.6.1)
|
|
31
|
+
aws-sdk-ecs (1.99.0)
|
|
32
|
+
aws-sdk-core (~> 3, >= 3.127.0)
|
|
33
33
|
aws-sigv4 (~> 1.1)
|
|
34
|
-
aws-sigv4 (1.
|
|
34
|
+
aws-sigv4 (1.5.0)
|
|
35
35
|
aws-eventstream (~> 1, >= 1.0.2)
|
|
36
|
-
codecov (0.
|
|
36
|
+
codecov (0.6.0)
|
|
37
37
|
simplecov (>= 0.15, < 0.22)
|
|
38
38
|
coderay (1.1.3)
|
|
39
|
-
concurrent-ruby (1.1.
|
|
40
|
-
diff-lcs (1.
|
|
39
|
+
concurrent-ruby (1.1.10)
|
|
40
|
+
diff-lcs (1.5.0)
|
|
41
41
|
docile (1.3.5)
|
|
42
|
-
faraday (1.
|
|
42
|
+
faraday (1.10.0)
|
|
43
43
|
faraday-em_http (~> 1.0)
|
|
44
44
|
faraday-em_synchrony (~> 1.0)
|
|
45
45
|
faraday-excon (~> 1.1)
|
|
46
|
+
faraday-httpclient (~> 1.0)
|
|
47
|
+
faraday-multipart (~> 1.0)
|
|
46
48
|
faraday-net_http (~> 1.0)
|
|
47
|
-
faraday-net_http_persistent (~> 1.
|
|
48
|
-
|
|
49
|
+
faraday-net_http_persistent (~> 1.0)
|
|
50
|
+
faraday-patron (~> 1.0)
|
|
51
|
+
faraday-rack (~> 1.0)
|
|
52
|
+
faraday-retry (~> 1.0)
|
|
49
53
|
ruby2_keywords (>= 0.0.4)
|
|
50
54
|
faraday-em_http (1.0.0)
|
|
51
55
|
faraday-em_synchrony (1.0.0)
|
|
52
56
|
faraday-excon (1.1.0)
|
|
53
|
-
faraday-http-cache (2.
|
|
57
|
+
faraday-http-cache (2.3.0)
|
|
54
58
|
faraday (>= 0.8)
|
|
59
|
+
faraday-httpclient (1.0.1)
|
|
60
|
+
faraday-multipart (1.0.3)
|
|
61
|
+
multipart-post (>= 1.2, < 3)
|
|
55
62
|
faraday-net_http (1.0.1)
|
|
56
|
-
faraday-net_http_persistent (1.
|
|
57
|
-
|
|
58
|
-
|
|
63
|
+
faraday-net_http_persistent (1.2.0)
|
|
64
|
+
faraday-patron (1.0.0)
|
|
65
|
+
faraday-rack (1.0.0)
|
|
66
|
+
faraday-retry (1.0.3)
|
|
67
|
+
ffi (1.15.5)
|
|
68
|
+
formatador (1.1.0)
|
|
59
69
|
github_changelog_generator (1.15.2)
|
|
60
70
|
activesupport
|
|
61
71
|
faraday-http-cache
|
|
@@ -64,13 +74,13 @@ GEM
|
|
|
64
74
|
rainbow (>= 2.2.1)
|
|
65
75
|
rake (>= 10.0)
|
|
66
76
|
retriable (~> 3.0)
|
|
67
|
-
guard (2.
|
|
77
|
+
guard (2.18.0)
|
|
68
78
|
formatador (>= 0.2.4)
|
|
69
79
|
listen (>= 2.7, < 4.0)
|
|
70
80
|
lumberjack (>= 1.0.12, < 2.0)
|
|
71
81
|
nenv (~> 0.1)
|
|
72
82
|
notiffany (~> 0.0)
|
|
73
|
-
pry (>= 0.
|
|
83
|
+
pry (>= 0.13.0)
|
|
74
84
|
shellany (~> 0.0)
|
|
75
85
|
thor (>= 0.18.1)
|
|
76
86
|
guard-compat (1.2.1)
|
|
@@ -81,52 +91,52 @@ GEM
|
|
|
81
91
|
guard-rubocop (1.4.0)
|
|
82
92
|
guard (~> 2.0)
|
|
83
93
|
rubocop (< 2.0)
|
|
84
|
-
i18n (1.
|
|
94
|
+
i18n (1.10.0)
|
|
85
95
|
concurrent-ruby (~> 1.0)
|
|
86
|
-
jmespath (1.
|
|
87
|
-
listen (3.
|
|
96
|
+
jmespath (1.6.1)
|
|
97
|
+
listen (3.7.1)
|
|
88
98
|
rb-fsevent (~> 0.10, >= 0.10.3)
|
|
89
99
|
rb-inotify (~> 0.9, >= 0.9.10)
|
|
90
100
|
lumberjack (1.2.8)
|
|
91
101
|
method_source (1.0.0)
|
|
92
|
-
minitest (5.
|
|
102
|
+
minitest (5.15.0)
|
|
93
103
|
multi_json (1.15.0)
|
|
94
104
|
multipart-post (2.1.1)
|
|
95
105
|
nenv (0.3.0)
|
|
96
106
|
notiffany (0.1.3)
|
|
97
107
|
nenv (~> 0.1)
|
|
98
108
|
shellany (~> 0.0)
|
|
99
|
-
octokit (4.
|
|
100
|
-
faraday (>=
|
|
101
|
-
sawyer (~> 0.
|
|
109
|
+
octokit (4.23.0)
|
|
110
|
+
faraday (>= 1, < 3)
|
|
111
|
+
sawyer (~> 0.9)
|
|
102
112
|
parallel (1.20.1)
|
|
103
|
-
parser (3.
|
|
113
|
+
parser (3.1.2.0)
|
|
104
114
|
ast (~> 2.4.1)
|
|
105
115
|
pry (0.14.1)
|
|
106
116
|
coderay (~> 1.1)
|
|
107
117
|
method_source (~> 1.0)
|
|
108
|
-
public_suffix (4.0.
|
|
109
|
-
rainbow (3.
|
|
110
|
-
rake (13.0.
|
|
111
|
-
rb-fsevent (0.11.
|
|
118
|
+
public_suffix (4.0.7)
|
|
119
|
+
rainbow (3.1.1)
|
|
120
|
+
rake (13.0.6)
|
|
121
|
+
rb-fsevent (0.11.1)
|
|
112
122
|
rb-inotify (0.10.1)
|
|
113
123
|
ffi (~> 1.0)
|
|
114
|
-
regexp_parser (2.
|
|
124
|
+
regexp_parser (2.5.0)
|
|
115
125
|
retriable (3.1.2)
|
|
116
126
|
rexml (3.2.5)
|
|
117
|
-
rspec (3.
|
|
118
|
-
rspec-core (~> 3.
|
|
119
|
-
rspec-expectations (~> 3.
|
|
120
|
-
rspec-mocks (~> 3.
|
|
121
|
-
rspec-core (3.
|
|
122
|
-
rspec-support (~> 3.
|
|
123
|
-
rspec-expectations (3.
|
|
127
|
+
rspec (3.11.0)
|
|
128
|
+
rspec-core (~> 3.11.0)
|
|
129
|
+
rspec-expectations (~> 3.11.0)
|
|
130
|
+
rspec-mocks (~> 3.11.0)
|
|
131
|
+
rspec-core (3.11.0)
|
|
132
|
+
rspec-support (~> 3.11.0)
|
|
133
|
+
rspec-expectations (3.11.0)
|
|
124
134
|
diff-lcs (>= 1.2.0, < 2.0)
|
|
125
|
-
rspec-support (~> 3.
|
|
126
|
-
rspec-mocks (3.
|
|
135
|
+
rspec-support (~> 3.11.0)
|
|
136
|
+
rspec-mocks (3.11.1)
|
|
127
137
|
diff-lcs (>= 1.2.0, < 2.0)
|
|
128
|
-
rspec-support (~> 3.
|
|
129
|
-
rspec-support (3.
|
|
138
|
+
rspec-support (~> 3.11.0)
|
|
139
|
+
rspec-support (3.11.0)
|
|
130
140
|
rubocop (1.12.1)
|
|
131
141
|
parallel (~> 1.10)
|
|
132
142
|
parser (>= 3.0.0.0)
|
|
@@ -139,22 +149,22 @@ GEM
|
|
|
139
149
|
rubocop-ast (1.4.1)
|
|
140
150
|
parser (>= 2.7.1.5)
|
|
141
151
|
ruby-progressbar (1.11.0)
|
|
142
|
-
ruby2_keywords (0.0.
|
|
143
|
-
sawyer (0.
|
|
152
|
+
ruby2_keywords (0.0.5)
|
|
153
|
+
sawyer (0.9.1)
|
|
144
154
|
addressable (>= 2.3.5)
|
|
145
|
-
faraday (
|
|
155
|
+
faraday (>= 0.17.3, < 3)
|
|
146
156
|
shellany (0.0.1)
|
|
147
157
|
simplecov (0.21.2)
|
|
148
158
|
docile (~> 1.1)
|
|
149
159
|
simplecov-html (~> 0.11)
|
|
150
160
|
simplecov_json_formatter (~> 0.1)
|
|
151
161
|
simplecov-html (0.12.3)
|
|
152
|
-
simplecov_json_formatter (0.1.
|
|
153
|
-
thor (1.1
|
|
162
|
+
simplecov_json_formatter (0.1.4)
|
|
163
|
+
thor (1.2.1)
|
|
154
164
|
thread_safe (0.3.6)
|
|
155
165
|
tzinfo (1.2.9)
|
|
156
166
|
thread_safe (~> 0.1)
|
|
157
|
-
unicode-display_width (2.
|
|
167
|
+
unicode-display_width (2.1.0)
|
|
158
168
|
zeitwerk (2.4.2)
|
|
159
169
|
|
|
160
170
|
PLATFORMS
|
|
@@ -174,4 +184,4 @@ DEPENDENCIES
|
|
|
174
184
|
simplecov
|
|
175
185
|
|
|
176
186
|
BUNDLED WITH
|
|
177
|
-
2.
|
|
187
|
+
2.2.17
|
data/lib/container_ship/cli.rb
CHANGED
|
@@ -16,8 +16,17 @@ module ContainerShip
|
|
|
16
16
|
end
|
|
17
17
|
|
|
18
18
|
desc 'exec CLUSTER_NAME SERVICE_NAME ENVIRONMENT BUILD_NUMBER', 'exec specified task'
|
|
19
|
+
method_option 'timeout', default: 300, type: :numeric, desc: 'Timeout seconds for executing the task.'
|
|
20
|
+
method_option 'no_wait', default: false, type: :boolean,
|
|
21
|
+
desc: 'Exit without waiting for the task execution results. Default false.'
|
|
19
22
|
def exec(cluster_name, service_name, environment, build_number)
|
|
20
|
-
|
|
23
|
+
timeout = options['timeout']
|
|
24
|
+
no_wait = options['no_wait']
|
|
25
|
+
Command::ExecCommand.new.run(
|
|
26
|
+
cluster_name, service_name, environment, build_number,
|
|
27
|
+
timeout: timeout,
|
|
28
|
+
no_wait: no_wait
|
|
29
|
+
)
|
|
21
30
|
end
|
|
22
31
|
|
|
23
32
|
desc 'version', 'display gem version'
|
|
@@ -17,7 +17,7 @@ module ContainerShip
|
|
|
17
17
|
include Modules::Ecs
|
|
18
18
|
include Modules::PrintTask
|
|
19
19
|
|
|
20
|
-
def run(cluster_name, task_name, environment, build_number)
|
|
20
|
+
def run(cluster_name, task_name, environment, build_number, timeout: nil, no_wait: false) # rubocop:disable Metrics/ParameterLists
|
|
21
21
|
task_definition = TaskDefinition.new(cluster_name, 'tasks', task_name, environment, build_number)
|
|
22
22
|
|
|
23
23
|
push_image task_definition
|
|
@@ -30,8 +30,10 @@ module ContainerShip
|
|
|
30
30
|
run_task task_definition, revision
|
|
31
31
|
end
|
|
32
32
|
|
|
33
|
+
return if no_wait
|
|
34
|
+
|
|
33
35
|
exit_status = print_around_task('Waiting task is completed... ') do
|
|
34
|
-
wait_task task_definition, task_arn
|
|
36
|
+
wait_task task_definition, task_arn, timeout: timeout
|
|
35
37
|
end
|
|
36
38
|
|
|
37
39
|
show_log task_definition, task_arn
|
|
@@ -12,9 +12,12 @@ module ContainerShip
|
|
|
12
12
|
private
|
|
13
13
|
|
|
14
14
|
def sh(command)
|
|
15
|
+
puts command
|
|
16
|
+
|
|
15
17
|
status = nil
|
|
16
|
-
Open3.popen3(command) do |_i, o,
|
|
18
|
+
Open3.popen3(command) do |_i, o, e, w|
|
|
17
19
|
o.each { |line| puts line }
|
|
20
|
+
e.each { |line| puts line }
|
|
18
21
|
status = w.value
|
|
19
22
|
end
|
|
20
23
|
exit(status.exitstatus) unless status.success?
|
|
@@ -23,15 +23,16 @@ module ContainerShip
|
|
|
23
23
|
aws_ecs_client
|
|
24
24
|
.run_task(
|
|
25
25
|
cluster: task_definition.full_cluster_name,
|
|
26
|
-
task_definition: "#{task_definition.full_name}:#{revision}"
|
|
26
|
+
task_definition: "#{task_definition.full_name}:#{revision}",
|
|
27
|
+
**task_definition.run_task_options
|
|
27
28
|
)
|
|
28
29
|
.tasks
|
|
29
30
|
.first
|
|
30
31
|
.task_arn
|
|
31
32
|
end
|
|
32
33
|
|
|
33
|
-
def wait_task(task_definition, task_arn)
|
|
34
|
-
do_every_5_seconds do
|
|
34
|
+
def wait_task(task_definition, task_arn, timeout: nil)
|
|
35
|
+
do_every_5_seconds(timeout: timeout) do
|
|
35
36
|
aws_ecs_client.describe_tasks(cluster: task_definition.full_cluster_name, tasks: [task_arn])
|
|
36
37
|
.tasks
|
|
37
38
|
.first
|
|
@@ -47,16 +48,21 @@ module ContainerShip
|
|
|
47
48
|
@aws_ecs_client ||= Aws::ECS::Client.new
|
|
48
49
|
end
|
|
49
50
|
|
|
50
|
-
def do_every_5_seconds
|
|
51
|
-
|
|
51
|
+
def do_every_5_seconds(timeout: nil)
|
|
52
|
+
timeout ||= 300 # default is 5 minutes
|
|
53
|
+
start = Time.now
|
|
52
54
|
loop do
|
|
53
55
|
sleep 3
|
|
54
56
|
print '.'
|
|
55
57
|
exit_status = yield
|
|
56
|
-
|
|
58
|
+
elapsed = Time.now - start
|
|
59
|
+
if elapsed > timeout
|
|
60
|
+
puts "Timeout! elapsed: #{elapsed} seconds"
|
|
61
|
+
return 124
|
|
62
|
+
end
|
|
57
63
|
next if exit_status.nil?
|
|
58
|
-
return 124 if count > 60
|
|
59
64
|
|
|
65
|
+
puts "exit_code of wait_task is #{exit_status}"
|
|
60
66
|
return exit_status
|
|
61
67
|
end
|
|
62
68
|
end
|
|
@@ -49,6 +49,14 @@ module ContainerShip
|
|
|
49
49
|
"#{prefix}/#{full_name}/#{task_arn.split('/').last}"
|
|
50
50
|
end
|
|
51
51
|
|
|
52
|
+
def run_task_options
|
|
53
|
+
@run_task_options ||= if File.exist?(run_task_options_path)
|
|
54
|
+
JSON.parse(File.read(run_task_options_path), symbolize_names: true)
|
|
55
|
+
else
|
|
56
|
+
{}
|
|
57
|
+
end
|
|
58
|
+
end
|
|
59
|
+
|
|
52
60
|
private
|
|
53
61
|
|
|
54
62
|
def task_definition_hash
|
|
@@ -62,5 +70,9 @@ module ContainerShip
|
|
|
62
70
|
def main_container_definition
|
|
63
71
|
task_definition_hash[:container_definitions].find { |definition| definition[:essential] }
|
|
64
72
|
end
|
|
73
|
+
|
|
74
|
+
def run_task_options_path
|
|
75
|
+
File.join('.container_ship', @cluster_name, @type, @name, @environment, 'run_task_options.json')
|
|
76
|
+
end
|
|
65
77
|
end
|
|
66
78
|
end
|
metadata
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: container_ship
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 0.1.
|
|
4
|
+
version: 0.1.5
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Yuji Ueki
|
|
8
8
|
autorequire:
|
|
9
9
|
bindir: exe
|
|
10
10
|
cert_chain: []
|
|
11
|
-
date:
|
|
11
|
+
date: 2022-06-09 00:00:00.000000000 Z
|
|
12
12
|
dependencies:
|
|
13
13
|
- !ruby/object:Gem::Dependency
|
|
14
14
|
name: aws-sdk-cloudwatchlogs
|
|
@@ -248,7 +248,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
|
248
248
|
- !ruby/object:Gem::Version
|
|
249
249
|
version: '0'
|
|
250
250
|
requirements: []
|
|
251
|
-
rubygems_version: 3.
|
|
251
|
+
rubygems_version: 3.1.2
|
|
252
252
|
signing_key:
|
|
253
253
|
specification_version: 4
|
|
254
254
|
summary: Yet another ECS deployment tool
|