ufo 2.3.0 → 3.0.0
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 +57 -0
- data/.gitmodules +3 -0
- data/.rspec +1 -0
- data/CHANGELOG.md +16 -1
- data/Gemfile.lock +16 -3
- data/README.md +5 -1
- data/docs/_docs/auto-completion.md +27 -0
- data/docs/_docs/automated-cleanup.md +1 -1
- data/docs/_docs/conventions.md +2 -2
- data/docs/_docs/helpers.md +6 -6
- data/docs/_docs/run-in-pieces.md +15 -8
- data/docs/_docs/settings.md +61 -49
- data/docs/_docs/structure.md +2 -2
- data/docs/_docs/tutorial-ufo-docker-build.md +10 -3
- data/docs/_docs/tutorial-ufo-init.md +48 -16
- data/docs/_docs/tutorial-ufo-ship.md +14 -7
- data/docs/_docs/tutorial-ufo-ships.md +1 -1
- data/docs/_docs/tutorial-ufo-tasks-build.md +23 -14
- data/docs/_docs/ufo-deploy.md +30 -0
- data/docs/_docs/ufo-docker-base.md +3 -3
- data/docs/_docs/ufo-docker-build.md +3 -3
- data/docs/_docs/ufo-docker-push.md +43 -0
- data/docs/_docs/ufo-env.md +17 -15
- data/docs/_docs/ufo-init.md +14 -1
- data/docs/_docs/ufo-scale.md +2 -4
- data/docs/_docs/ufo-ships.md +2 -2
- data/docs/_docs/variables.md +6 -6
- data/docs/_includes/commands.html +4 -4
- data/docs/_includes/subnav.html +3 -0
- data/docs/_includes/summary.html +2 -2
- data/docs/_includes/ufo-ship-options.md +0 -2
- data/docs/docs.md +5 -1
- data/docs/quick-start.md +19 -10
- data/lib/{starter_project → template}/.env +0 -0
- data/lib/template/.ufo/settings.yml.tt +27 -0
- data/lib/{starter_project/ufo/task_definitions.rb → template/.ufo/task_definitions.rb.tt} +0 -0
- data/lib/{starter_project/ufo → template/.ufo}/templates/main.json.erb +0 -0
- data/lib/{starter_project/ufo → template/.ufo}/variables/base.rb +0 -0
- data/lib/{starter_project/ufo → template/.ufo}/variables/development.rb +0 -0
- data/lib/{starter_project/ufo → template/.ufo}/variables/production.rb +0 -0
- data/lib/{starter_project → template}/Dockerfile +0 -0
- data/lib/{starter_project/bin/deploy → template/bin/deploy.tt} +0 -0
- data/lib/ufo.rb +9 -2
- data/lib/ufo/cli.rb +34 -29
- data/lib/ufo/completer.rb +86 -64
- data/lib/ufo/core.rb +42 -0
- data/lib/ufo/default.rb +4 -6
- data/lib/ufo/default/settings.yml +24 -22
- data/lib/ufo/deploy.rb +0 -0
- data/lib/ufo/docker.rb +12 -2
- data/lib/ufo/docker/builder.rb +19 -49
- data/lib/ufo/docker/cleaner.rb +4 -2
- data/lib/ufo/docker/dockerfile.rb +1 -2
- data/lib/ufo/docker/pusher.rb +53 -0
- data/lib/ufo/dsl.rb +1 -2
- data/lib/ufo/dsl/helper.rb +3 -4
- data/lib/ufo/dsl/outputter.rb +1 -1
- data/lib/ufo/dsl/task_definition.rb +17 -37
- data/lib/ufo/ecr/auth.rb +22 -2
- data/lib/ufo/ecs.rb +5 -0
- data/lib/ufo/ecs/service.rb +21 -0
- data/lib/ufo/help/completion.md +1 -1
- data/lib/ufo/help/completion_script.md +1 -1
- data/lib/ufo/help/deploy.md +14 -0
- data/lib/ufo/help/docker/name.md +13 -2
- data/lib/ufo/help/docker/push.md +11 -0
- data/lib/ufo/init.rb +48 -65
- data/lib/ufo/log_group.rb +5 -2
- data/lib/ufo/sequence.rb +27 -0
- data/lib/ufo/setting.rb +18 -8
- data/lib/ufo/ship.rb +23 -46
- data/lib/ufo/tasks/builder.rb +8 -11
- data/lib/ufo/tasks/register.rb +2 -3
- data/lib/ufo/upgrade3.rb +64 -0
- data/lib/ufo/util.rb +0 -2
- data/lib/ufo/version.rb +1 -1
- data/spec/fixtures/home_existing/.docker/config.json +1 -1
- data/spec/fixtures/settings.yml +23 -0
- data/spec/lib/cli_spec.rb +1 -9
- data/spec/lib/completion_spec.rb +18 -0
- data/spec/lib/core_spec.rb +16 -0
- data/spec/lib/ecr_auth_spec.rb +1 -3
- data/spec/lib/ecr_cleaner_spec.rb +1 -3
- data/spec/lib/setting_spec.rb +12 -0
- data/spec/lib/ship_spec.rb +2 -4
- data/spec/lib/task_spec.rb +0 -2
- data/spec/spec_helper.rb +12 -2
- data/ufo.gemspec +2 -0
- metadata +47 -13
- data/lib/starter_project/ufo/settings.yml +0 -18
- data/lib/ufo/env.rb +0 -18
- data/lib/ufo/help/sub/goodbye.md +0 -5
@@ -0,0 +1,16 @@
|
|
1
|
+
describe Ufo::Core do
|
2
|
+
before(:all) do
|
3
|
+
create_starter_project_fixture
|
4
|
+
end
|
5
|
+
|
6
|
+
it "finds the first env that contains the aws profile" do
|
7
|
+
env = Ufo.send(:env_from_profile, "dev_profile1")
|
8
|
+
expect(env).to eq "development"
|
9
|
+
env = Ufo.send(:env_from_profile, "dev_profile2")
|
10
|
+
expect(env).to eq "development"
|
11
|
+
env = Ufo.send(:env_from_profile, "prod_profile")
|
12
|
+
expect(env).to eq "production"
|
13
|
+
env = Ufo.send(:env_from_profile, "does_not_exist")
|
14
|
+
expect(env).to be nil
|
15
|
+
end
|
16
|
+
end
|
data/spec/lib/ecr_auth_spec.rb
CHANGED
@@ -1,7 +1,5 @@
|
|
1
|
-
require 'spec_helper'
|
2
|
-
|
3
1
|
describe Ufo::Ecr::Auth do
|
4
|
-
let(:repo_domain) { "
|
2
|
+
let(:repo_domain) { "123456789.dkr.ecr.us-east-1.amazonaws.com" }
|
5
3
|
let(:auth) { Ufo::Ecr::Auth.new(repo_domain) }
|
6
4
|
before(:each) do
|
7
5
|
allow(auth).to receive(:fetch_auth_token).and_return("opensesame")
|
@@ -1,8 +1,6 @@
|
|
1
|
-
require 'spec_helper'
|
2
|
-
|
3
1
|
describe Ufo::Ecr::Cleaner do
|
4
2
|
let(:docker_image_name) { "123456789.dkr.ecr.us-east-1.amazonaws.com/my-name" }
|
5
|
-
let(:repo_domain) { "
|
3
|
+
let(:repo_domain) { "123456789.dkr.ecr.us-east-1.amazonaws.com" }
|
6
4
|
let(:cleaner) do
|
7
5
|
Ufo::Ecr::Cleaner.new(docker_image_name,
|
8
6
|
project_root: "spec/fixtures/hi",
|
@@ -0,0 +1,12 @@
|
|
1
|
+
describe Ufo::Setting do
|
2
|
+
before(:all) do
|
3
|
+
create_starter_project_fixture
|
4
|
+
end
|
5
|
+
|
6
|
+
let(:setting) { Ufo::Setting.new }
|
7
|
+
|
8
|
+
it "includes base into other environments automatically" do
|
9
|
+
count = setting.data["new_service"]["desired_count"]
|
10
|
+
expect(count).to eq 1
|
11
|
+
end
|
12
|
+
end
|
data/spec/lib/ship_spec.rb
CHANGED
@@ -1,5 +1,3 @@
|
|
1
|
-
require 'spec_helper'
|
2
|
-
|
3
1
|
describe Ufo::Ship do
|
4
2
|
let(:project_root) { File.expand_path("../../fixtures/hi", __FILE__) }
|
5
3
|
let(:options) do
|
@@ -21,11 +19,11 @@ describe Ufo::Ship do
|
|
21
19
|
|
22
20
|
context "hi-web-prod service" do
|
23
21
|
it "should create or update service" do
|
24
|
-
allow(ship).to receive(:
|
22
|
+
allow(ship).to receive(:process_deployment)
|
25
23
|
|
26
24
|
ship.deploy
|
27
25
|
|
28
|
-
expect(ship).to have_received(:
|
26
|
+
expect(ship).to have_received(:process_deployment)
|
29
27
|
end
|
30
28
|
|
31
29
|
context "0 services found" do
|
data/spec/lib/task_spec.rb
CHANGED
data/spec/spec_helper.rb
CHANGED
@@ -11,10 +11,20 @@ require "byebug"
|
|
11
11
|
root = File.expand_path("../", File.dirname(__FILE__))
|
12
12
|
require "#{root}/lib/ufo"
|
13
13
|
|
14
|
+
$dest = "tmp/project"
|
15
|
+
ENV['DEST_ROOT'] = $dest
|
16
|
+
ENV['UFO_ROOT'] = $dest
|
17
|
+
|
14
18
|
module Helpers
|
15
19
|
def create_starter_project_fixture
|
16
|
-
FileUtils.rm_rf(
|
17
|
-
execute("exe/ufo init --app hi --image tongueroo/hi
|
20
|
+
FileUtils.rm_rf($dest)
|
21
|
+
execute("exe/ufo init --app hi --image tongueroo/hi")
|
22
|
+
create_test_settings
|
23
|
+
end
|
24
|
+
|
25
|
+
# modify the generated settings so we can spec the settings themselves
|
26
|
+
def create_test_settings
|
27
|
+
FileUtils.cp("spec/fixtures/settings.yml", "#{$dest}/.ufo/settings.yml")
|
18
28
|
end
|
19
29
|
|
20
30
|
def execute(cmd)
|
data/ufo.gemspec
CHANGED
@@ -29,6 +29,8 @@ Gem::Specification.new do |spec|
|
|
29
29
|
spec.add_dependency "plissken"
|
30
30
|
spec.add_dependency "thor"
|
31
31
|
|
32
|
+
spec.add_dependency "activesupport" # render_me_pretty submodule dependency
|
33
|
+
|
32
34
|
spec.add_development_dependency "bundler"
|
33
35
|
spec.add_development_dependency "byebug"
|
34
36
|
spec.add_development_dependency "rake"
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: ufo
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version:
|
4
|
+
version: 3.0.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Tung Nguyen
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2018-02-
|
11
|
+
date: 2018-02-14 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: aws-sdk-cloudwatchlogs
|
@@ -136,6 +136,20 @@ dependencies:
|
|
136
136
|
- - ">="
|
137
137
|
- !ruby/object:Gem::Version
|
138
138
|
version: '0'
|
139
|
+
- !ruby/object:Gem::Dependency
|
140
|
+
name: activesupport
|
141
|
+
requirement: !ruby/object:Gem::Requirement
|
142
|
+
requirements:
|
143
|
+
- - ">="
|
144
|
+
- !ruby/object:Gem::Version
|
145
|
+
version: '0'
|
146
|
+
type: :runtime
|
147
|
+
prerelease: false
|
148
|
+
version_requirements: !ruby/object:Gem::Requirement
|
149
|
+
requirements:
|
150
|
+
- - ">="
|
151
|
+
- !ruby/object:Gem::Version
|
152
|
+
version: '0'
|
139
153
|
- !ruby/object:Gem::Dependency
|
140
154
|
name: bundler
|
141
155
|
requirement: !ruby/object:Gem::Requirement
|
@@ -200,7 +214,9 @@ executables:
|
|
200
214
|
extensions: []
|
201
215
|
extra_rdoc_files: []
|
202
216
|
files:
|
217
|
+
- ".circleci/config.yml"
|
203
218
|
- ".gitignore"
|
219
|
+
- ".gitmodules"
|
204
220
|
- ".rspec"
|
205
221
|
- CHANGELOG.md
|
206
222
|
- CONTRIBUTING.md
|
@@ -216,6 +232,7 @@ files:
|
|
216
232
|
- docs/LICENSE
|
217
233
|
- docs/README.md
|
218
234
|
- docs/_config.yml
|
235
|
+
- docs/_docs/auto-completion.md
|
219
236
|
- docs/_docs/automated-cleanup.md
|
220
237
|
- docs/_docs/commands.md
|
221
238
|
- docs/_docs/conventions.md
|
@@ -233,11 +250,13 @@ files:
|
|
233
250
|
- docs/_docs/tutorial-ufo-ships.md
|
234
251
|
- docs/_docs/tutorial-ufo-tasks-build.md
|
235
252
|
- docs/_docs/tutorial.md
|
253
|
+
- docs/_docs/ufo-deploy.md
|
236
254
|
- docs/_docs/ufo-destroy.md
|
237
255
|
- docs/_docs/ufo-docker-base.md
|
238
256
|
- docs/_docs/ufo-docker-build.md
|
239
257
|
- docs/_docs/ufo-docker-clean.md
|
240
258
|
- docs/_docs/ufo-docker-name.md
|
259
|
+
- docs/_docs/ufo-docker-push.md
|
241
260
|
- docs/_docs/ufo-env.md
|
242
261
|
- docs/_docs/ufo-help.md
|
243
262
|
- docs/_docs/ufo-init.md
|
@@ -311,15 +330,15 @@ files:
|
|
311
330
|
- docs/quick-start.md
|
312
331
|
- docs/style.css
|
313
332
|
- exe/ufo
|
314
|
-
- lib/
|
315
|
-
- lib/
|
316
|
-
- lib/
|
317
|
-
- lib/
|
318
|
-
- lib/
|
319
|
-
- lib/
|
320
|
-
- lib/
|
321
|
-
- lib/
|
322
|
-
- lib/
|
333
|
+
- lib/template/.env
|
334
|
+
- lib/template/.ufo/settings.yml.tt
|
335
|
+
- lib/template/.ufo/task_definitions.rb.tt
|
336
|
+
- lib/template/.ufo/templates/main.json.erb
|
337
|
+
- lib/template/.ufo/variables/base.rb
|
338
|
+
- lib/template/.ufo/variables/development.rb
|
339
|
+
- lib/template/.ufo/variables/production.rb
|
340
|
+
- lib/template/Dockerfile
|
341
|
+
- lib/template/bin/deploy.tt
|
323
342
|
- lib/ufo.rb
|
324
343
|
- lib/ufo/aws_service.rb
|
325
344
|
- lib/ufo/cli.rb
|
@@ -328,13 +347,16 @@ files:
|
|
328
347
|
- lib/ufo/completer/script.rb
|
329
348
|
- lib/ufo/completer/script.sh
|
330
349
|
- lib/ufo/completion.rb
|
350
|
+
- lib/ufo/core.rb
|
331
351
|
- lib/ufo/default.rb
|
332
352
|
- lib/ufo/default/settings.yml
|
353
|
+
- lib/ufo/deploy.rb
|
333
354
|
- lib/ufo/destroy.rb
|
334
355
|
- lib/ufo/docker.rb
|
335
356
|
- lib/ufo/docker/builder.rb
|
336
357
|
- lib/ufo/docker/cleaner.rb
|
337
358
|
- lib/ufo/docker/dockerfile.rb
|
359
|
+
- lib/ufo/docker/pusher.rb
|
338
360
|
- lib/ufo/dsl.rb
|
339
361
|
- lib/ufo/dsl/helper.rb
|
340
362
|
- lib/ufo/dsl/outputter.rb
|
@@ -342,24 +364,26 @@ files:
|
|
342
364
|
- lib/ufo/ecr.rb
|
343
365
|
- lib/ufo/ecr/auth.rb
|
344
366
|
- lib/ufo/ecr/cleaner.rb
|
345
|
-
- lib/ufo/
|
367
|
+
- lib/ufo/ecs.rb
|
368
|
+
- lib/ufo/ecs/service.rb
|
346
369
|
- lib/ufo/help.rb
|
347
370
|
- lib/ufo/help/completion.md
|
348
371
|
- lib/ufo/help/completion_script.md
|
349
372
|
- lib/ufo/help/completions.md
|
350
373
|
- lib/ufo/help/completions_script.md
|
374
|
+
- lib/ufo/help/deploy.md
|
351
375
|
- lib/ufo/help/destroy.md
|
352
376
|
- lib/ufo/help/docker.md
|
353
377
|
- lib/ufo/help/docker/base.md
|
354
378
|
- lib/ufo/help/docker/build.md
|
355
379
|
- lib/ufo/help/docker/clean.md
|
356
380
|
- lib/ufo/help/docker/name.md
|
381
|
+
- lib/ufo/help/docker/push.md
|
357
382
|
- lib/ufo/help/hello.md
|
358
383
|
- lib/ufo/help/init.md
|
359
384
|
- lib/ufo/help/scale.md
|
360
385
|
- lib/ufo/help/ship.md
|
361
386
|
- lib/ufo/help/ships.md
|
362
|
-
- lib/ufo/help/sub/goodbye.md
|
363
387
|
- lib/ufo/help/task.md
|
364
388
|
- lib/ufo/help/tasks.md
|
365
389
|
- lib/ufo/help/tasks/build.md
|
@@ -367,6 +391,7 @@ files:
|
|
367
391
|
- lib/ufo/init.rb
|
368
392
|
- lib/ufo/log_group.rb
|
369
393
|
- lib/ufo/scale.rb
|
394
|
+
- lib/ufo/sequence.rb
|
370
395
|
- lib/ufo/setting.rb
|
371
396
|
- lib/ufo/ship.rb
|
372
397
|
- lib/ufo/sub.rb
|
@@ -375,13 +400,18 @@ files:
|
|
375
400
|
- lib/ufo/tasks/builder.rb
|
376
401
|
- lib/ufo/tasks/register.rb
|
377
402
|
- lib/ufo/templates/default.json.erb
|
403
|
+
- lib/ufo/upgrade3.rb
|
378
404
|
- lib/ufo/util.rb
|
379
405
|
- lib/ufo/version.rb
|
380
406
|
- spec/fixtures/home_existing/.aws/config
|
381
407
|
- spec/fixtures/home_existing/.docker/config.json
|
408
|
+
- spec/fixtures/settings.yml
|
382
409
|
- spec/lib/cli_spec.rb
|
410
|
+
- spec/lib/completion_spec.rb
|
411
|
+
- spec/lib/core_spec.rb
|
383
412
|
- spec/lib/ecr_auth_spec.rb
|
384
413
|
- spec/lib/ecr_cleaner_spec.rb
|
414
|
+
- spec/lib/setting_spec.rb
|
385
415
|
- spec/lib/ship_spec.rb
|
386
416
|
- spec/lib/task_spec.rb
|
387
417
|
- spec/spec_helper.rb
|
@@ -413,9 +443,13 @@ summary: Build Docker Containers and Ship Them to AWS ECS
|
|
413
443
|
test_files:
|
414
444
|
- spec/fixtures/home_existing/.aws/config
|
415
445
|
- spec/fixtures/home_existing/.docker/config.json
|
446
|
+
- spec/fixtures/settings.yml
|
416
447
|
- spec/lib/cli_spec.rb
|
448
|
+
- spec/lib/completion_spec.rb
|
449
|
+
- spec/lib/core_spec.rb
|
417
450
|
- spec/lib/ecr_auth_spec.rb
|
418
451
|
- spec/lib/ecr_cleaner_spec.rb
|
452
|
+
- spec/lib/setting_spec.rb
|
419
453
|
- spec/lib/ship_spec.rb
|
420
454
|
- spec/lib/task_spec.rb
|
421
455
|
- spec/spec_helper.rb
|
@@ -1,18 +0,0 @@
|
|
1
|
-
# More info: http://ufoships.com/docs/ufo-settings/
|
2
|
-
image: <%= @image %>
|
3
|
-
# clean_keep: 30
|
4
|
-
# ecr_keep: 30
|
5
|
-
|
6
|
-
# aws_profile_ufo_env_map:
|
7
|
-
# default: staging
|
8
|
-
# # More examples:
|
9
|
-
# aws_profile1: production
|
10
|
-
# aws_profile2: staging
|
11
|
-
# aws_profile3: development
|
12
|
-
|
13
|
-
# ufo_env_cluster_map:
|
14
|
-
# default: prod
|
15
|
-
# # More examples:
|
16
|
-
# production: prod
|
17
|
-
# staging: stag
|
18
|
-
# development: dev
|
data/lib/ufo/env.rb
DELETED
@@ -1,18 +0,0 @@
|
|
1
|
-
class Ufo::Env
|
2
|
-
def self.setup!(project_root='.')
|
3
|
-
# Ensures that UFO_ENV is always set to a default value.
|
4
|
-
# For Ufo::Env.setup! we do not need to check if we're in a ufo project
|
5
|
-
# Because we could not be at first. For example when: ufo init is first called.
|
6
|
-
# Other uses of Ufo::Setting assumes that we should be in a ufo project.
|
7
|
-
setting = Ufo::Setting.new(project_root, false).data
|
8
|
-
map = setting['aws_profile_ufo_env_map']
|
9
|
-
|
10
|
-
if map
|
11
|
-
ufo_env = map[ENV['AWS_PROFILE']] || map['default']
|
12
|
-
end
|
13
|
-
ufo_env ||= 'development' # defaults to development
|
14
|
-
ufo_env = ENV['UFO_ENV'] if ENV['UFO_ENV'] # highest precedence
|
15
|
-
|
16
|
-
Kernel.const_set(:UFO_ENV, ufo_env)
|
17
|
-
end
|
18
|
-
end
|