ufo 2.3.0 → 3.0.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (93) hide show
  1. checksums.yaml +4 -4
  2. data/.circleci/config.yml +57 -0
  3. data/.gitmodules +3 -0
  4. data/.rspec +1 -0
  5. data/CHANGELOG.md +16 -1
  6. data/Gemfile.lock +16 -3
  7. data/README.md +5 -1
  8. data/docs/_docs/auto-completion.md +27 -0
  9. data/docs/_docs/automated-cleanup.md +1 -1
  10. data/docs/_docs/conventions.md +2 -2
  11. data/docs/_docs/helpers.md +6 -6
  12. data/docs/_docs/run-in-pieces.md +15 -8
  13. data/docs/_docs/settings.md +61 -49
  14. data/docs/_docs/structure.md +2 -2
  15. data/docs/_docs/tutorial-ufo-docker-build.md +10 -3
  16. data/docs/_docs/tutorial-ufo-init.md +48 -16
  17. data/docs/_docs/tutorial-ufo-ship.md +14 -7
  18. data/docs/_docs/tutorial-ufo-ships.md +1 -1
  19. data/docs/_docs/tutorial-ufo-tasks-build.md +23 -14
  20. data/docs/_docs/ufo-deploy.md +30 -0
  21. data/docs/_docs/ufo-docker-base.md +3 -3
  22. data/docs/_docs/ufo-docker-build.md +3 -3
  23. data/docs/_docs/ufo-docker-push.md +43 -0
  24. data/docs/_docs/ufo-env.md +17 -15
  25. data/docs/_docs/ufo-init.md +14 -1
  26. data/docs/_docs/ufo-scale.md +2 -4
  27. data/docs/_docs/ufo-ships.md +2 -2
  28. data/docs/_docs/variables.md +6 -6
  29. data/docs/_includes/commands.html +4 -4
  30. data/docs/_includes/subnav.html +3 -0
  31. data/docs/_includes/summary.html +2 -2
  32. data/docs/_includes/ufo-ship-options.md +0 -2
  33. data/docs/docs.md +5 -1
  34. data/docs/quick-start.md +19 -10
  35. data/lib/{starter_project → template}/.env +0 -0
  36. data/lib/template/.ufo/settings.yml.tt +27 -0
  37. data/lib/{starter_project/ufo/task_definitions.rb → template/.ufo/task_definitions.rb.tt} +0 -0
  38. data/lib/{starter_project/ufo → template/.ufo}/templates/main.json.erb +0 -0
  39. data/lib/{starter_project/ufo → template/.ufo}/variables/base.rb +0 -0
  40. data/lib/{starter_project/ufo → template/.ufo}/variables/development.rb +0 -0
  41. data/lib/{starter_project/ufo → template/.ufo}/variables/production.rb +0 -0
  42. data/lib/{starter_project → template}/Dockerfile +0 -0
  43. data/lib/{starter_project/bin/deploy → template/bin/deploy.tt} +0 -0
  44. data/lib/ufo.rb +9 -2
  45. data/lib/ufo/cli.rb +34 -29
  46. data/lib/ufo/completer.rb +86 -64
  47. data/lib/ufo/core.rb +42 -0
  48. data/lib/ufo/default.rb +4 -6
  49. data/lib/ufo/default/settings.yml +24 -22
  50. data/lib/ufo/deploy.rb +0 -0
  51. data/lib/ufo/docker.rb +12 -2
  52. data/lib/ufo/docker/builder.rb +19 -49
  53. data/lib/ufo/docker/cleaner.rb +4 -2
  54. data/lib/ufo/docker/dockerfile.rb +1 -2
  55. data/lib/ufo/docker/pusher.rb +53 -0
  56. data/lib/ufo/dsl.rb +1 -2
  57. data/lib/ufo/dsl/helper.rb +3 -4
  58. data/lib/ufo/dsl/outputter.rb +1 -1
  59. data/lib/ufo/dsl/task_definition.rb +17 -37
  60. data/lib/ufo/ecr/auth.rb +22 -2
  61. data/lib/ufo/ecs.rb +5 -0
  62. data/lib/ufo/ecs/service.rb +21 -0
  63. data/lib/ufo/help/completion.md +1 -1
  64. data/lib/ufo/help/completion_script.md +1 -1
  65. data/lib/ufo/help/deploy.md +14 -0
  66. data/lib/ufo/help/docker/name.md +13 -2
  67. data/lib/ufo/help/docker/push.md +11 -0
  68. data/lib/ufo/init.rb +48 -65
  69. data/lib/ufo/log_group.rb +5 -2
  70. data/lib/ufo/sequence.rb +27 -0
  71. data/lib/ufo/setting.rb +18 -8
  72. data/lib/ufo/ship.rb +23 -46
  73. data/lib/ufo/tasks/builder.rb +8 -11
  74. data/lib/ufo/tasks/register.rb +2 -3
  75. data/lib/ufo/upgrade3.rb +64 -0
  76. data/lib/ufo/util.rb +0 -2
  77. data/lib/ufo/version.rb +1 -1
  78. data/spec/fixtures/home_existing/.docker/config.json +1 -1
  79. data/spec/fixtures/settings.yml +23 -0
  80. data/spec/lib/cli_spec.rb +1 -9
  81. data/spec/lib/completion_spec.rb +18 -0
  82. data/spec/lib/core_spec.rb +16 -0
  83. data/spec/lib/ecr_auth_spec.rb +1 -3
  84. data/spec/lib/ecr_cleaner_spec.rb +1 -3
  85. data/spec/lib/setting_spec.rb +12 -0
  86. data/spec/lib/ship_spec.rb +2 -4
  87. data/spec/lib/task_spec.rb +0 -2
  88. data/spec/spec_helper.rb +12 -2
  89. data/ufo.gemspec +2 -0
  90. metadata +47 -13
  91. data/lib/starter_project/ufo/settings.yml +0 -18
  92. data/lib/ufo/env.rb +0 -18
  93. 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
@@ -1,7 +1,5 @@
1
- require 'spec_helper'
2
-
3
1
  describe Ufo::Ecr::Auth do
4
- let(:repo_domain) { "https://123456789.dkr.ecr.us-east-1.amazonaws.com" }
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) { "https://123456789.dkr.ecr.us-east-1.amazonaws.com" }
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
@@ -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(:process_single_service)
22
+ allow(ship).to receive(:process_deployment)
25
23
 
26
24
  ship.deploy
27
25
 
28
- expect(ship).to have_received(:process_single_service)
26
+ expect(ship).to have_received(:process_deployment)
29
27
  end
30
28
 
31
29
  context "0 services found" do
@@ -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
@@ -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("spec/fixtures/hi")
17
- execute("exe/ufo init --app hi --image tongueroo/hi --project-root spec/fixtures/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)
@@ -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: 2.3.0
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 00:00:00.000000000 Z
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/starter_project/.env
315
- - lib/starter_project/Dockerfile
316
- - lib/starter_project/bin/deploy
317
- - lib/starter_project/ufo/settings.yml
318
- - lib/starter_project/ufo/task_definitions.rb
319
- - lib/starter_project/ufo/templates/main.json.erb
320
- - lib/starter_project/ufo/variables/base.rb
321
- - lib/starter_project/ufo/variables/development.rb
322
- - lib/starter_project/ufo/variables/production.rb
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/env.rb
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
@@ -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
@@ -1,5 +0,0 @@
1
- Examples:
2
-
3
- ufo sub:goodbye
4
- ufo sub:goodbye NAME
5
- ufo sub:goodbye NAME --from me