container_ship 0.1.1 → 0.1.4
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.circleci/config.yml +3 -3
- data/.github/dependabot.yml +38 -0
- data/.gitignore +1 -0
- data/Gemfile.lock +88 -66
- data/lib/container_ship/cli.rb +3 -1
- data/lib/container_ship/command/exec_command.rb +2 -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 +4 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 81784b5cc4c7f154050767adc86bfa44c61da90de8c3acfe7675317e3c05e8af
|
4
|
+
data.tar.gz: 568d9db35b31697a1892b9f2aaefd26f5c673a872ffda6541dd5ff64ae817a80
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 437ddc8b6e673f3a8a76ab4c16e371539cf99a6bfcab0a25257a2a8c1a644d723f7fdb18797612af2061f598910abc3da9cbcecac2b17777127dfa48ba79d0f1
|
7
|
+
data.tar.gz: 8c4d1bd691fc124e83e4335b93e3dd16f70bf97886d46c687167c81b0ebf5c22314faae41a07bbe1f948757452f459bbcaa004c0c82c6403bf9fe18293c5a256
|
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: circleci/ruby
|
20
|
+
- image: circleci/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: circleci/ruby
|
32
|
+
- image: circleci/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: circleci/ruby
|
41
|
+
- image: circleci/ruby:2.7.2
|
42
42
|
steps:
|
43
43
|
- checkout
|
44
44
|
- *restore_bundle_cache
|
@@ -0,0 +1,38 @@
|
|
1
|
+
version: 2
|
2
|
+
updates:
|
3
|
+
- package-ecosystem: bundler
|
4
|
+
directory: "/"
|
5
|
+
schedule:
|
6
|
+
interval: monthly
|
7
|
+
time: "11:00"
|
8
|
+
timezone: Asia/Tokyo
|
9
|
+
open-pull-requests-limit: 20
|
10
|
+
reviewers:
|
11
|
+
- avexbesuke
|
12
|
+
- amatotsuji
|
13
|
+
- yuta-sanada0089
|
14
|
+
allow:
|
15
|
+
- dependency-type: direct
|
16
|
+
- dependency-type: indirect
|
17
|
+
ignore:
|
18
|
+
- dependency-name: codecov
|
19
|
+
versions:
|
20
|
+
- ">= 0.2.14.a, < 0.2.15"
|
21
|
+
- dependency-name: aws-partitions
|
22
|
+
versions:
|
23
|
+
- 1.431.0
|
24
|
+
- 1.433.0
|
25
|
+
- 1.437.0
|
26
|
+
- 1.448.0
|
27
|
+
- dependency-name: i18n
|
28
|
+
versions:
|
29
|
+
- 1.8.10
|
30
|
+
- dependency-name: aws-sigv4
|
31
|
+
versions:
|
32
|
+
- 1.2.3
|
33
|
+
- dependency-name: aws-eventstream
|
34
|
+
versions:
|
35
|
+
- 1.1.1
|
36
|
+
- dependency-name: aws-sdk-core
|
37
|
+
versions:
|
38
|
+
- 3.112.0
|
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.4)
|
5
5
|
aws-sdk-cloudwatchlogs
|
6
6
|
aws-sdk-ecs
|
7
7
|
thor
|
@@ -15,37 +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
|
-
ast (2.4.
|
21
|
-
aws-eventstream (1.
|
22
|
-
aws-partitions (1.
|
23
|
-
aws-sdk-cloudwatchlogs (1.
|
24
|
-
aws-sdk-core (~> 3, >= 3.
|
20
|
+
ast (2.4.2)
|
21
|
+
aws-eventstream (1.2.0)
|
22
|
+
aws-partitions (1.560.0)
|
23
|
+
aws-sdk-cloudwatchlogs (1.52.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.127.0)
|
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
30
|
jmespath (~> 1.0)
|
31
|
-
aws-sdk-ecs (1.
|
32
|
-
aws-sdk-core (~> 3, >= 3.
|
31
|
+
aws-sdk-ecs (1.96.0)
|
32
|
+
aws-sdk-core (~> 3, >= 3.127.0)
|
33
33
|
aws-sigv4 (~> 1.1)
|
34
|
-
aws-sigv4 (1.
|
34
|
+
aws-sigv4 (1.4.0)
|
35
35
|
aws-eventstream (~> 1, >= 1.0.2)
|
36
|
-
codecov (0.
|
37
|
-
|
38
|
-
simplecov
|
36
|
+
codecov (0.6.0)
|
37
|
+
simplecov (>= 0.15, < 0.22)
|
39
38
|
coderay (1.1.3)
|
40
|
-
concurrent-ruby (1.1.
|
41
|
-
diff-lcs (1.
|
42
|
-
docile (1.3.
|
43
|
-
faraday (1.0
|
44
|
-
|
39
|
+
concurrent-ruby (1.1.9)
|
40
|
+
diff-lcs (1.5.0)
|
41
|
+
docile (1.3.5)
|
42
|
+
faraday (1.10.0)
|
43
|
+
faraday-em_http (~> 1.0)
|
44
|
+
faraday-em_synchrony (~> 1.0)
|
45
|
+
faraday-excon (~> 1.1)
|
46
|
+
faraday-httpclient (~> 1.0)
|
47
|
+
faraday-multipart (~> 1.0)
|
48
|
+
faraday-net_http (~> 1.0)
|
49
|
+
faraday-net_http_persistent (~> 1.0)
|
50
|
+
faraday-patron (~> 1.0)
|
51
|
+
faraday-rack (~> 1.0)
|
52
|
+
faraday-retry (~> 1.0)
|
53
|
+
ruby2_keywords (>= 0.0.4)
|
54
|
+
faraday-em_http (1.0.0)
|
55
|
+
faraday-em_synchrony (1.0.0)
|
56
|
+
faraday-excon (1.1.0)
|
45
57
|
faraday-http-cache (2.2.0)
|
46
58
|
faraday (>= 0.8)
|
47
|
-
|
48
|
-
|
59
|
+
faraday-httpclient (1.0.1)
|
60
|
+
faraday-multipart (1.0.3)
|
61
|
+
multipart-post (>= 1.2, < 3)
|
62
|
+
faraday-net_http (1.0.1)
|
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)
|
49
69
|
github_changelog_generator (1.15.2)
|
50
70
|
activesupport
|
51
71
|
faraday-http-cache
|
@@ -54,13 +74,13 @@ GEM
|
|
54
74
|
rainbow (>= 2.2.1)
|
55
75
|
rake (>= 10.0)
|
56
76
|
retriable (~> 3.0)
|
57
|
-
guard (2.
|
77
|
+
guard (2.18.0)
|
58
78
|
formatador (>= 0.2.4)
|
59
79
|
listen (>= 2.7, < 4.0)
|
60
80
|
lumberjack (>= 1.0.12, < 2.0)
|
61
81
|
nenv (~> 0.1)
|
62
82
|
notiffany (~> 0.0)
|
63
|
-
pry (>= 0.
|
83
|
+
pry (>= 0.13.0)
|
64
84
|
shellany (~> 0.0)
|
65
85
|
thor (>= 0.18.1)
|
66
86
|
guard-compat (1.2.1)
|
@@ -68,82 +88,84 @@ GEM
|
|
68
88
|
guard (~> 2.1)
|
69
89
|
guard-compat (~> 1.1)
|
70
90
|
rspec (>= 2.99.0, < 4.0)
|
71
|
-
guard-rubocop (1.
|
91
|
+
guard-rubocop (1.4.0)
|
72
92
|
guard (~> 2.0)
|
73
|
-
rubocop (
|
74
|
-
i18n (1.
|
93
|
+
rubocop (< 2.0)
|
94
|
+
i18n (1.10.0)
|
75
95
|
concurrent-ruby (~> 1.0)
|
76
|
-
jmespath (1.
|
77
|
-
|
78
|
-
listen (3.2.1)
|
96
|
+
jmespath (1.6.0)
|
97
|
+
listen (3.7.1)
|
79
98
|
rb-fsevent (~> 0.10, >= 0.10.3)
|
80
99
|
rb-inotify (~> 0.9, >= 0.9.10)
|
81
100
|
lumberjack (1.2.8)
|
82
101
|
method_source (1.0.0)
|
83
|
-
minitest (5.
|
102
|
+
minitest (5.15.0)
|
84
103
|
multi_json (1.15.0)
|
85
104
|
multipart-post (2.1.1)
|
86
105
|
nenv (0.3.0)
|
87
106
|
notiffany (0.1.3)
|
88
107
|
nenv (~> 0.1)
|
89
108
|
shellany (~> 0.0)
|
90
|
-
octokit (4.
|
109
|
+
octokit (4.22.0)
|
91
110
|
faraday (>= 0.9)
|
92
111
|
sawyer (~> 0.8.0, >= 0.5.3)
|
93
|
-
parallel (1.
|
94
|
-
parser (
|
112
|
+
parallel (1.20.1)
|
113
|
+
parser (3.1.1.0)
|
95
114
|
ast (~> 2.4.1)
|
96
|
-
pry (0.
|
115
|
+
pry (0.14.1)
|
97
116
|
coderay (~> 1.1)
|
98
117
|
method_source (~> 1.0)
|
99
118
|
public_suffix (4.0.6)
|
100
|
-
rainbow (3.
|
101
|
-
rake (13.0.
|
102
|
-
rb-fsevent (0.
|
119
|
+
rainbow (3.1.1)
|
120
|
+
rake (13.0.6)
|
121
|
+
rb-fsevent (0.11.1)
|
103
122
|
rb-inotify (0.10.1)
|
104
123
|
ffi (~> 1.0)
|
105
|
-
regexp_parser (
|
124
|
+
regexp_parser (2.2.1)
|
106
125
|
retriable (3.1.2)
|
107
|
-
rexml (3.2.
|
108
|
-
rspec (3.
|
109
|
-
rspec-core (~> 3.
|
110
|
-
rspec-expectations (~> 3.
|
111
|
-
rspec-mocks (~> 3.
|
112
|
-
rspec-core (3.
|
113
|
-
rspec-support (~> 3.
|
114
|
-
rspec-expectations (3.
|
126
|
+
rexml (3.2.5)
|
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)
|
115
134
|
diff-lcs (>= 1.2.0, < 2.0)
|
116
|
-
rspec-support (~> 3.
|
117
|
-
rspec-mocks (3.
|
135
|
+
rspec-support (~> 3.11.0)
|
136
|
+
rspec-mocks (3.11.0)
|
118
137
|
diff-lcs (>= 1.2.0, < 2.0)
|
119
|
-
rspec-support (~> 3.
|
120
|
-
rspec-support (3.
|
121
|
-
rubocop (
|
138
|
+
rspec-support (~> 3.11.0)
|
139
|
+
rspec-support (3.11.0)
|
140
|
+
rubocop (1.12.1)
|
122
141
|
parallel (~> 1.10)
|
123
|
-
parser (>=
|
142
|
+
parser (>= 3.0.0.0)
|
124
143
|
rainbow (>= 2.2.2, < 4.0)
|
125
|
-
regexp_parser (>= 1.
|
144
|
+
regexp_parser (>= 1.8, < 3.0)
|
126
145
|
rexml
|
127
|
-
rubocop-ast (>=
|
146
|
+
rubocop-ast (>= 1.2.0, < 2.0)
|
128
147
|
ruby-progressbar (~> 1.7)
|
129
|
-
unicode-display_width (>= 1.4.0, <
|
130
|
-
rubocop-ast (
|
131
|
-
parser (>= 2.7.1.
|
132
|
-
ruby-progressbar (1.
|
148
|
+
unicode-display_width (>= 1.4.0, < 3.0)
|
149
|
+
rubocop-ast (1.4.1)
|
150
|
+
parser (>= 2.7.1.5)
|
151
|
+
ruby-progressbar (1.11.0)
|
152
|
+
ruby2_keywords (0.0.5)
|
133
153
|
sawyer (0.8.2)
|
134
154
|
addressable (>= 2.3.5)
|
135
155
|
faraday (> 0.8, < 2.0)
|
136
156
|
shellany (0.0.1)
|
137
|
-
simplecov (0.
|
157
|
+
simplecov (0.21.2)
|
138
158
|
docile (~> 1.1)
|
139
159
|
simplecov-html (~> 0.11)
|
140
|
-
|
141
|
-
|
160
|
+
simplecov_json_formatter (~> 0.1)
|
161
|
+
simplecov-html (0.12.3)
|
162
|
+
simplecov_json_formatter (0.1.4)
|
163
|
+
thor (1.2.1)
|
142
164
|
thread_safe (0.3.6)
|
143
|
-
tzinfo (1.2.
|
165
|
+
tzinfo (1.2.9)
|
144
166
|
thread_safe (~> 0.1)
|
145
|
-
unicode-display_width (1.
|
146
|
-
zeitwerk (2.4.
|
167
|
+
unicode-display_width (2.1.0)
|
168
|
+
zeitwerk (2.4.2)
|
147
169
|
|
148
170
|
PLATFORMS
|
149
171
|
ruby
|
@@ -162,4 +184,4 @@ DEPENDENCIES
|
|
162
184
|
simplecov
|
163
185
|
|
164
186
|
BUNDLED WITH
|
165
|
-
2.
|
187
|
+
2.2.17
|
data/lib/container_ship/cli.rb
CHANGED
@@ -16,8 +16,10 @@ 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', desc: 'Timeout seconds for executing the task. Default 5 minutes.'
|
19
20
|
def exec(cluster_name, service_name, environment, build_number)
|
20
|
-
|
21
|
+
timeout = options['timeout']&.to_i || 300
|
22
|
+
Command::ExecCommand.new.run(cluster_name, service_name, environment, build_number, timeout: timeout)
|
21
23
|
end
|
22
24
|
|
23
25
|
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)
|
21
21
|
task_definition = TaskDefinition.new(cluster_name, 'tasks', task_name, environment, build_number)
|
22
22
|
|
23
23
|
push_image task_definition
|
@@ -31,7 +31,7 @@ module ContainerShip
|
|
31
31
|
end
|
32
32
|
|
33
33
|
exit_status = print_around_task('Waiting task is completed... ') do
|
34
|
-
wait_task task_definition, task_arn
|
34
|
+
wait_task task_definition, task_arn, timeout: timeout
|
35
35
|
end
|
36
36
|
|
37
37
|
show_log task_definition, task_arn
|
@@ -5,7 +5,9 @@ module ContainerShip
|
|
5
5
|
module Modules
|
6
6
|
module Docker
|
7
7
|
def push_image(task_definition)
|
8
|
+
puts "docker build -t \"#{task_definition.image_name}:#{task_definition.build_number}\" ."
|
8
9
|
sh "docker build -t \"#{task_definition.image_name}:#{task_definition.build_number}\" ."
|
10
|
+
puts "docker push #{task_definition.image_name}:#{task_definition.build_number}"
|
9
11
|
sh "docker push #{task_definition.image_name}:#{task_definition.build_number}"
|
10
12
|
end
|
11
13
|
|
@@ -13,8 +15,9 @@ module ContainerShip
|
|
13
15
|
|
14
16
|
def sh(command)
|
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.4
|
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-03-24 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: aws-sdk-cloudwatchlogs
|
@@ -202,6 +202,7 @@ extensions: []
|
|
202
202
|
extra_rdoc_files: []
|
203
203
|
files:
|
204
204
|
- ".circleci/config.yml"
|
205
|
+
- ".github/dependabot.yml"
|
205
206
|
- ".gitignore"
|
206
207
|
- ".rubocop.yml"
|
207
208
|
- ".travis.yml"
|
@@ -247,7 +248,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
247
248
|
- !ruby/object:Gem::Version
|
248
249
|
version: '0'
|
249
250
|
requirements: []
|
250
|
-
rubygems_version: 3.
|
251
|
+
rubygems_version: 3.1.2
|
251
252
|
signing_key:
|
252
253
|
specification_version: 4
|
253
254
|
summary: Yet another ECS deployment tool
|