shipitron 1.0.1 → 1.3.1
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/.dockerignore +1 -0
- data/.gitattributes +1 -0
- data/.gitignore +1 -0
- data/Dockerfile +28 -8
- data/Dockerfile.release +25 -3
- data/Gemfile +1 -0
- data/README.md +48 -9
- data/build_dev.sh +1 -1
- data/docker-compose.yml +24 -0
- data/lib/shipitron/cli.rb +33 -3
- data/lib/shipitron/client.rb +9 -0
- data/lib/shipitron/client/bootstrap_application.rb +1 -0
- data/lib/shipitron/client/create_ecs_services.rb +1 -0
- data/lib/shipitron/client/deploy_application.rb +1 -0
- data/lib/shipitron/client/ensure_deploy_not_running.rb +2 -1
- data/lib/shipitron/client/fetch_clusters.rb +1 -0
- data/lib/shipitron/client/force_deploy.rb +58 -0
- data/lib/shipitron/client/load_application_config.rb +4 -0
- data/lib/shipitron/client/load_templates.rb +1 -0
- data/lib/shipitron/client/register_ecs_task_definitions.rb +1 -0
- data/lib/shipitron/client/run_ecs_tasks.rb +14 -1
- data/lib/shipitron/docker_image.rb +4 -1
- data/lib/shipitron/find_docker_volume_name.rb +68 -0
- data/lib/shipitron/git_info.rb +57 -0
- data/lib/shipitron/s3_copy.rb +46 -0
- data/lib/shipitron/server/deploy_application.rb +3 -0
- data/lib/shipitron/server/docker/build_image.rb +4 -1
- data/lib/shipitron/server/docker/configure.rb +46 -10
- data/lib/shipitron/server/docker/push_image.rb +3 -0
- data/lib/shipitron/server/docker/run_build_script.rb +17 -10
- data/lib/shipitron/server/download_build_cache.rb +17 -4
- data/lib/shipitron/server/git/clone_local_copy.rb +3 -4
- data/lib/shipitron/server/git/update_cache.rb +1 -0
- data/lib/shipitron/server/run_post_build.rb +40 -1
- data/lib/shipitron/server/transform_cli_args.rb +6 -0
- data/lib/shipitron/server/update_ecs_task_definitions.rb +2 -1
- data/lib/shipitron/server/upload_build_cache.rb +14 -8
- data/lib/shipitron/version.rb +1 -1
- data/scripts/docker-entrypoint.sh +9 -0
- data/shipitron.gemspec +8 -6
- metadata +50 -16
@@ -1,5 +1,6 @@
|
|
1
1
|
require 'shipitron'
|
2
2
|
require 'shipitron/fetch_bucket'
|
3
|
+
require 'shipitron/s3_copy'
|
3
4
|
|
4
5
|
module Shipitron
|
5
6
|
module Server
|
@@ -8,20 +9,28 @@ module Shipitron
|
|
8
9
|
|
9
10
|
required :application
|
10
11
|
required :s3_cache_bucket
|
12
|
+
required :build_cache_location
|
13
|
+
required :region
|
11
14
|
|
12
15
|
def call
|
13
16
|
Logger.info "Downloading build cache from bucket #{s3_cache_bucket}"
|
14
17
|
|
15
|
-
s3_file = bucket.files.
|
18
|
+
s3_file = bucket.files.head("#{application}.build-cache.archive")
|
16
19
|
if s3_file.nil?
|
17
20
|
Logger.warn 'Build cache not found.'
|
18
21
|
return
|
19
22
|
end
|
20
23
|
|
21
|
-
build_cache = Pathname.new("/home/shipitron/#{application}
|
24
|
+
build_cache = Pathname.new("/home/shipitron/#{application}/#{build_cache_location}")
|
22
25
|
build_cache.parent.mkpath
|
23
|
-
|
24
|
-
|
26
|
+
|
27
|
+
result = S3Copy.call(
|
28
|
+
source: "s3://#{s3_cache_bucket}/#{application}.build-cache.archive",
|
29
|
+
destination: build_cache.to_s,
|
30
|
+
region: context.region
|
31
|
+
)
|
32
|
+
if result.failure?
|
33
|
+
fail_with_error!(message: 'Failed to download build cache!')
|
25
34
|
end
|
26
35
|
|
27
36
|
Logger.info 'Download complete.'
|
@@ -36,6 +45,10 @@ module Shipitron
|
|
36
45
|
context.s3_cache_bucket
|
37
46
|
end
|
38
47
|
|
48
|
+
def build_cache_location
|
49
|
+
context.build_cache_location
|
50
|
+
end
|
51
|
+
|
39
52
|
def bucket
|
40
53
|
@bucket ||= FetchBucket.call!(name: s3_cache_bucket).bucket
|
41
54
|
end
|
@@ -1,5 +1,6 @@
|
|
1
1
|
require 'shipitron'
|
2
2
|
require 'shellwords'
|
3
|
+
require 'shipitron/git_info'
|
3
4
|
|
4
5
|
module Shipitron
|
5
6
|
module Server
|
@@ -22,10 +23,8 @@ module Shipitron
|
|
22
23
|
end
|
23
24
|
|
24
25
|
Logger.info 'Using this git commit:'
|
25
|
-
|
26
|
-
|
27
|
-
Logger.info `git --no-pager log --format='%aN (%h): %s' -n 1`.chomp
|
28
|
-
end
|
26
|
+
context.git_info = GitInfo.from_path(path: "/home/shipitron/#{application}")
|
27
|
+
Logger.info context.git_info.one_liner
|
29
28
|
end
|
30
29
|
|
31
30
|
private
|
@@ -25,6 +25,7 @@ module Shipitron
|
|
25
25
|
else
|
26
26
|
Logger.info 'Fetching new git commits'
|
27
27
|
FileUtils.cd('/home/shipitron/git-cache') do
|
28
|
+
`git gc --auto`
|
28
29
|
`git fetch -f #{Shellwords.escape repository_url} #{Shellwords.escape repository_branch}:#{Shellwords.escape repository_branch}`
|
29
30
|
end
|
30
31
|
end
|
@@ -9,6 +9,7 @@ module Shipitron
|
|
9
9
|
|
10
10
|
required :region
|
11
11
|
required :clusters
|
12
|
+
required :git_info
|
12
13
|
optional :post_builds
|
13
14
|
|
14
15
|
def call
|
@@ -26,7 +27,41 @@ module Shipitron
|
|
26
27
|
container_overrides: [
|
27
28
|
{
|
28
29
|
name: post_build.container_name,
|
29
|
-
command: post_build.command_ary
|
30
|
+
command: post_build.command_ary,
|
31
|
+
environment: [
|
32
|
+
{
|
33
|
+
name: "GIT_SHA",
|
34
|
+
value: git_info.sha
|
35
|
+
},
|
36
|
+
{
|
37
|
+
name: "GIT_SHORT_SHA",
|
38
|
+
value: git_info.short_sha
|
39
|
+
},
|
40
|
+
{
|
41
|
+
name: "GIT_EMAIL",
|
42
|
+
value: git_info.email
|
43
|
+
},
|
44
|
+
{
|
45
|
+
name: "GIT_NAME",
|
46
|
+
value: git_info.name
|
47
|
+
},
|
48
|
+
{
|
49
|
+
name: "GIT_MESSAGE",
|
50
|
+
value: git_info.summary
|
51
|
+
},
|
52
|
+
{
|
53
|
+
name: "GIT_TIMESTAMP",
|
54
|
+
value: git_info.timestamp
|
55
|
+
},
|
56
|
+
{
|
57
|
+
name: "GIT_BRANCH",
|
58
|
+
value: git_info.branch
|
59
|
+
},
|
60
|
+
{
|
61
|
+
name: "GIT_TAG",
|
62
|
+
value: git_info.tag
|
63
|
+
}
|
64
|
+
]
|
30
65
|
}
|
31
66
|
]
|
32
67
|
},
|
@@ -75,6 +110,10 @@ module Shipitron
|
|
75
110
|
def clusters
|
76
111
|
context.clusters
|
77
112
|
end
|
113
|
+
|
114
|
+
def git_info
|
115
|
+
context.git_info
|
116
|
+
end
|
78
117
|
end
|
79
118
|
end
|
80
119
|
end
|
@@ -12,7 +12,9 @@ module Shipitron
|
|
12
12
|
required :application
|
13
13
|
required :repository_url
|
14
14
|
optional :repository_branch
|
15
|
+
optional :registry
|
15
16
|
required :s3_cache_bucket
|
17
|
+
required :build_cache_location
|
16
18
|
required :image_name
|
17
19
|
required :named_tag
|
18
20
|
required :region
|
@@ -22,6 +24,7 @@ module Shipitron
|
|
22
24
|
optional :ecs_services
|
23
25
|
optional :ecs_service_templates
|
24
26
|
optional :build_script
|
27
|
+
optional :skip_push, default: false
|
25
28
|
optional :post_builds
|
26
29
|
|
27
30
|
before do
|
@@ -36,12 +39,15 @@ module Shipitron
|
|
36
39
|
application
|
37
40
|
repository_url
|
38
41
|
repository_branch
|
42
|
+
registry
|
39
43
|
s3_cache_bucket
|
44
|
+
build_cache_location
|
40
45
|
named_tag
|
41
46
|
region
|
42
47
|
clusters
|
43
48
|
ecs_services
|
44
49
|
build_script
|
50
|
+
skip_push
|
45
51
|
].each_with_object(cli_args) { |k, args| args[k] = context[k] }
|
46
52
|
|
47
53
|
cli_args.docker_image = DockerImage.new(name: context.image_name)
|
@@ -14,11 +14,12 @@ module Shipitron
|
|
14
14
|
required :docker_image
|
15
15
|
required :ecs_task_defs
|
16
16
|
optional :ecs_task_def_templates
|
17
|
+
optional :registry
|
17
18
|
|
18
19
|
before do
|
19
20
|
context.ecs_task_def_templates ||= []
|
20
21
|
context.templates = context.ecs_task_def_templates
|
21
|
-
context.template_context = { tag: docker_image.tag }
|
22
|
+
context.template_context = { tag: docker_image.tag, registry: context.registry }
|
22
23
|
end
|
23
24
|
|
24
25
|
organize [
|
@@ -8,21 +8,27 @@ module Shipitron
|
|
8
8
|
|
9
9
|
required :application
|
10
10
|
required :s3_cache_bucket
|
11
|
+
required :build_cache_location
|
12
|
+
required :region
|
11
13
|
|
12
14
|
def call
|
13
15
|
Logger.info "Uploading build cache to bucket #{s3_cache_bucket}"
|
14
16
|
|
15
|
-
build_cache = Pathname.new("/home/shipitron/#{application}
|
17
|
+
build_cache = Pathname.new("/home/shipitron/#{application}/#{build_cache_location}")
|
16
18
|
unless build_cache.exist?
|
17
19
|
Logger.warn 'Build cache not found.'
|
18
20
|
return
|
19
21
|
end
|
20
22
|
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
23
|
+
result = S3Copy.call(
|
24
|
+
source: build_cache.to_s,
|
25
|
+
destination: "s3://#{s3_cache_bucket}/#{application}.build-cache.archive",
|
26
|
+
region: context.region
|
27
|
+
)
|
28
|
+
if result.failure?
|
29
|
+
Logger.warn 'Failed to upload build cache!'
|
30
|
+
else
|
31
|
+
Logger.info 'Upload complete.'
|
26
32
|
end
|
27
33
|
end
|
28
34
|
|
@@ -35,8 +41,8 @@ module Shipitron
|
|
35
41
|
context.s3_cache_bucket
|
36
42
|
end
|
37
43
|
|
38
|
-
def
|
39
|
-
|
44
|
+
def build_cache_location
|
45
|
+
context.build_cache_location
|
40
46
|
end
|
41
47
|
end
|
42
48
|
end
|
data/lib/shipitron/version.rb
CHANGED
data/shipitron.gemspec
CHANGED
@@ -17,21 +17,23 @@ Gem::Specification.new do |spec|
|
|
17
17
|
spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
|
18
18
|
spec.require_paths = ["lib"]
|
19
19
|
|
20
|
-
spec.add_runtime_dependency 'thor', '~> 0
|
20
|
+
spec.add_runtime_dependency 'thor', '~> 1.0'
|
21
21
|
spec.add_runtime_dependency 'aws-sdk-ecs', '~> 1.8'
|
22
|
-
spec.add_runtime_dependency 'hashie', '~>
|
23
|
-
spec.add_runtime_dependency 'metaractor', '~> 0
|
22
|
+
spec.add_runtime_dependency 'hashie', '~> 4.1'
|
23
|
+
spec.add_runtime_dependency 'metaractor', '~> 3.0'
|
24
24
|
spec.add_runtime_dependency 'diplomat', '~> 2.0'
|
25
|
-
spec.add_runtime_dependency 'fog-aws', '~>
|
25
|
+
spec.add_runtime_dependency 'fog-aws', '~> 3.6'
|
26
26
|
spec.add_runtime_dependency 'mime-types', '~> 3.1'
|
27
27
|
spec.add_runtime_dependency 'minitar', '~> 0.6'
|
28
28
|
spec.add_runtime_dependency 'mustache', '~> 1.0'
|
29
29
|
spec.add_runtime_dependency 'tty-command', '~> 0.7'
|
30
30
|
spec.add_runtime_dependency 'tty-table', '~> 0.9'
|
31
31
|
spec.add_runtime_dependency 'pastel', '~> 0.7'
|
32
|
+
spec.add_runtime_dependency 'excon', '~> 0.76'
|
33
|
+
spec.add_runtime_dependency 'rugged', '~> 1.0'
|
32
34
|
|
33
|
-
spec.add_development_dependency "bundler", "~> 1
|
34
|
-
spec.add_development_dependency "rake", "~>
|
35
|
+
spec.add_development_dependency "bundler", "~> 2.1"
|
36
|
+
spec.add_development_dependency "rake", "~> 13.0"
|
35
37
|
spec.add_development_dependency "pry-byebug", "~> 3.5"
|
36
38
|
spec.add_development_dependency "rspec", "~> 3.7"
|
37
39
|
spec.add_development_dependency "fivemat", "~> 1.3"
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: shipitron
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.
|
4
|
+
version: 1.3.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Ryan Schlesinger
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2020-09-30 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: thor
|
@@ -16,14 +16,14 @@ dependencies:
|
|
16
16
|
requirements:
|
17
17
|
- - "~>"
|
18
18
|
- !ruby/object:Gem::Version
|
19
|
-
version: '0
|
19
|
+
version: '1.0'
|
20
20
|
type: :runtime
|
21
21
|
prerelease: false
|
22
22
|
version_requirements: !ruby/object:Gem::Requirement
|
23
23
|
requirements:
|
24
24
|
- - "~>"
|
25
25
|
- !ruby/object:Gem::Version
|
26
|
-
version: '0
|
26
|
+
version: '1.0'
|
27
27
|
- !ruby/object:Gem::Dependency
|
28
28
|
name: aws-sdk-ecs
|
29
29
|
requirement: !ruby/object:Gem::Requirement
|
@@ -44,28 +44,28 @@ dependencies:
|
|
44
44
|
requirements:
|
45
45
|
- - "~>"
|
46
46
|
- !ruby/object:Gem::Version
|
47
|
-
version: '
|
47
|
+
version: '4.1'
|
48
48
|
type: :runtime
|
49
49
|
prerelease: false
|
50
50
|
version_requirements: !ruby/object:Gem::Requirement
|
51
51
|
requirements:
|
52
52
|
- - "~>"
|
53
53
|
- !ruby/object:Gem::Version
|
54
|
-
version: '
|
54
|
+
version: '4.1'
|
55
55
|
- !ruby/object:Gem::Dependency
|
56
56
|
name: metaractor
|
57
57
|
requirement: !ruby/object:Gem::Requirement
|
58
58
|
requirements:
|
59
59
|
- - "~>"
|
60
60
|
- !ruby/object:Gem::Version
|
61
|
-
version: '0
|
61
|
+
version: '3.0'
|
62
62
|
type: :runtime
|
63
63
|
prerelease: false
|
64
64
|
version_requirements: !ruby/object:Gem::Requirement
|
65
65
|
requirements:
|
66
66
|
- - "~>"
|
67
67
|
- !ruby/object:Gem::Version
|
68
|
-
version: '0
|
68
|
+
version: '3.0'
|
69
69
|
- !ruby/object:Gem::Dependency
|
70
70
|
name: diplomat
|
71
71
|
requirement: !ruby/object:Gem::Requirement
|
@@ -86,14 +86,14 @@ dependencies:
|
|
86
86
|
requirements:
|
87
87
|
- - "~>"
|
88
88
|
- !ruby/object:Gem::Version
|
89
|
-
version: '
|
89
|
+
version: '3.6'
|
90
90
|
type: :runtime
|
91
91
|
prerelease: false
|
92
92
|
version_requirements: !ruby/object:Gem::Requirement
|
93
93
|
requirements:
|
94
94
|
- - "~>"
|
95
95
|
- !ruby/object:Gem::Version
|
96
|
-
version: '
|
96
|
+
version: '3.6'
|
97
97
|
- !ruby/object:Gem::Dependency
|
98
98
|
name: mime-types
|
99
99
|
requirement: !ruby/object:Gem::Requirement
|
@@ -178,34 +178,62 @@ dependencies:
|
|
178
178
|
- - "~>"
|
179
179
|
- !ruby/object:Gem::Version
|
180
180
|
version: '0.7'
|
181
|
+
- !ruby/object:Gem::Dependency
|
182
|
+
name: excon
|
183
|
+
requirement: !ruby/object:Gem::Requirement
|
184
|
+
requirements:
|
185
|
+
- - "~>"
|
186
|
+
- !ruby/object:Gem::Version
|
187
|
+
version: '0.76'
|
188
|
+
type: :runtime
|
189
|
+
prerelease: false
|
190
|
+
version_requirements: !ruby/object:Gem::Requirement
|
191
|
+
requirements:
|
192
|
+
- - "~>"
|
193
|
+
- !ruby/object:Gem::Version
|
194
|
+
version: '0.76'
|
195
|
+
- !ruby/object:Gem::Dependency
|
196
|
+
name: rugged
|
197
|
+
requirement: !ruby/object:Gem::Requirement
|
198
|
+
requirements:
|
199
|
+
- - "~>"
|
200
|
+
- !ruby/object:Gem::Version
|
201
|
+
version: '1.0'
|
202
|
+
type: :runtime
|
203
|
+
prerelease: false
|
204
|
+
version_requirements: !ruby/object:Gem::Requirement
|
205
|
+
requirements:
|
206
|
+
- - "~>"
|
207
|
+
- !ruby/object:Gem::Version
|
208
|
+
version: '1.0'
|
181
209
|
- !ruby/object:Gem::Dependency
|
182
210
|
name: bundler
|
183
211
|
requirement: !ruby/object:Gem::Requirement
|
184
212
|
requirements:
|
185
213
|
- - "~>"
|
186
214
|
- !ruby/object:Gem::Version
|
187
|
-
version: '1
|
215
|
+
version: '2.1'
|
188
216
|
type: :development
|
189
217
|
prerelease: false
|
190
218
|
version_requirements: !ruby/object:Gem::Requirement
|
191
219
|
requirements:
|
192
220
|
- - "~>"
|
193
221
|
- !ruby/object:Gem::Version
|
194
|
-
version: '1
|
222
|
+
version: '2.1'
|
195
223
|
- !ruby/object:Gem::Dependency
|
196
224
|
name: rake
|
197
225
|
requirement: !ruby/object:Gem::Requirement
|
198
226
|
requirements:
|
199
227
|
- - "~>"
|
200
228
|
- !ruby/object:Gem::Version
|
201
|
-
version: '
|
229
|
+
version: '13.0'
|
202
230
|
type: :development
|
203
231
|
prerelease: false
|
204
232
|
version_requirements: !ruby/object:Gem::Requirement
|
205
233
|
requirements:
|
206
234
|
- - "~>"
|
207
235
|
- !ruby/object:Gem::Version
|
208
|
-
version: '
|
236
|
+
version: '13.0'
|
209
237
|
- !ruby/object:Gem::Dependency
|
210
238
|
name: pry-byebug
|
211
239
|
requirement: !ruby/object:Gem::Requirement
|
@@ -271,6 +299,7 @@ extensions: []
|
|
271
299
|
extra_rdoc_files: []
|
272
300
|
files:
|
273
301
|
- ".dockerignore"
|
302
|
+
- ".gitattributes"
|
274
303
|
- ".gitignore"
|
275
304
|
- ".rspec"
|
276
305
|
- Dockerfile
|
@@ -280,14 +309,17 @@ files:
|
|
280
309
|
- README.md
|
281
310
|
- Rakefile
|
282
311
|
- build_dev.sh
|
312
|
+
- docker-compose.yml
|
283
313
|
- exe/shipitron
|
284
314
|
- lib/shipitron.rb
|
285
315
|
- lib/shipitron/cli.rb
|
316
|
+
- lib/shipitron/client.rb
|
286
317
|
- lib/shipitron/client/bootstrap_application.rb
|
287
318
|
- lib/shipitron/client/create_ecs_services.rb
|
288
319
|
- lib/shipitron/client/deploy_application.rb
|
289
320
|
- lib/shipitron/client/ensure_deploy_not_running.rb
|
290
321
|
- lib/shipitron/client/fetch_clusters.rb
|
322
|
+
- lib/shipitron/client/force_deploy.rb
|
291
323
|
- lib/shipitron/client/load_application_config.rb
|
292
324
|
- lib/shipitron/client/load_templates.rb
|
293
325
|
- lib/shipitron/client/register_ecs_task_definitions.rb
|
@@ -298,10 +330,13 @@ files:
|
|
298
330
|
- lib/shipitron/ecs_client.rb
|
299
331
|
- lib/shipitron/ecs_task_def.rb
|
300
332
|
- lib/shipitron/fetch_bucket.rb
|
333
|
+
- lib/shipitron/find_docker_volume_name.rb
|
334
|
+
- lib/shipitron/git_info.rb
|
301
335
|
- lib/shipitron/logger.rb
|
302
336
|
- lib/shipitron/mustache_yaml_parser.rb
|
303
337
|
- lib/shipitron/parse_templates.rb
|
304
338
|
- lib/shipitron/post_build.rb
|
339
|
+
- lib/shipitron/s3_copy.rb
|
305
340
|
- lib/shipitron/server/deploy_application.rb
|
306
341
|
- lib/shipitron/server/docker/build_image.rb
|
307
342
|
- lib/shipitron/server/docker/configure.rb
|
@@ -345,8 +380,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
345
380
|
- !ruby/object:Gem::Version
|
346
381
|
version: '0'
|
347
382
|
requirements: []
|
348
|
-
|
349
|
-
rubygems_version: 2.7.6
|
383
|
+
rubygems_version: 3.1.2
|
350
384
|
signing_key:
|
351
385
|
specification_version: 4
|
352
386
|
summary: A deployment tool for use with Docker and ECS.
|