ufo 3.5.7 → 4.0.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (191) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +24 -0
  3. data/Gemfile.lock +16 -10
  4. data/README.md +12 -13
  5. data/docs/_config.yml +1 -1
  6. data/docs/_docs/auto-completion.md +4 -4
  7. data/docs/_docs/automated-cleanup.md +1 -1
  8. data/docs/_docs/conventions.md +7 -7
  9. data/docs/_docs/customize-cloudformation.md +36 -0
  10. data/docs/_docs/faq.md +9 -7
  11. data/docs/_docs/fargate.md +102 -0
  12. data/docs/_docs/helpers.md +3 -3
  13. data/docs/_docs/load-balancer.md +72 -0
  14. data/docs/_docs/migrations.md +2 -2
  15. data/docs/_docs/next-steps.md +2 -2
  16. data/docs/_docs/params.md +12 -41
  17. data/docs/_docs/route53-support.md +28 -0
  18. data/docs/_docs/run-in-pieces.md +2 -2
  19. data/docs/_docs/security-groups.md +54 -0
  20. data/docs/_docs/settings-cfn.md +11 -0
  21. data/docs/_docs/settings-network.md +34 -0
  22. data/docs/_docs/settings.md +18 -15
  23. data/docs/_docs/single-task.md +3 -3
  24. data/docs/_docs/ssl-support.md +42 -0
  25. data/docs/_docs/structure.md +5 -1
  26. data/docs/_docs/stuck-cloudformation.md +30 -0
  27. data/docs/_docs/tutorial-ufo-docker-build.md +19 -31
  28. data/docs/_docs/tutorial-ufo-init.md +16 -12
  29. data/docs/_docs/tutorial-ufo-ship.md +50 -54
  30. data/docs/_docs/tutorial-ufo-ships.md +9 -7
  31. data/docs/_docs/tutorial-ufo-tasks-build.md +26 -17
  32. data/docs/_docs/ufo-current.md +50 -0
  33. data/docs/_docs/ufo-env-extra.md +21 -0
  34. data/docs/_docs/ufo-env.md +6 -13
  35. data/docs/_docs/ufo-tasks-register.md +3 -3
  36. data/docs/_docs/upgrade4.md +49 -0
  37. data/docs/_docs/variables.md +5 -5
  38. data/docs/_docs/why-cloudformation.md +22 -0
  39. data/docs/_includes/about.html +1 -1
  40. data/docs/_includes/cfn-customize.md +39 -0
  41. data/docs/_includes/commands.html +6 -6
  42. data/docs/_includes/css/ufo.css +1 -0
  43. data/docs/_includes/example.html +13 -13
  44. data/docs/_includes/reference.md +1 -1
  45. data/docs/_includes/subnav.html +22 -5
  46. data/docs/_includes/ufo-ship-options.md +7 -6
  47. data/docs/_reference/ufo-apps.md +36 -0
  48. data/docs/_reference/ufo-cancel.md +24 -0
  49. data/docs/_reference/ufo-completion.md +1 -1
  50. data/docs/_reference/ufo-completion_script.md +1 -1
  51. data/docs/_reference/ufo-current.md +93 -0
  52. data/docs/_reference/ufo-deploy.md +18 -17
  53. data/docs/_reference/ufo-destroy.md +6 -4
  54. data/docs/_reference/ufo-docker-base.md +7 -7
  55. data/docs/_reference/ufo-docker-build.md +9 -9
  56. data/docs/_reference/ufo-docker-clean.md +8 -8
  57. data/docs/_reference/ufo-docker-name.md +4 -4
  58. data/docs/_reference/ufo-docker.md +4 -2
  59. data/docs/_reference/ufo-init.md +31 -20
  60. data/docs/_reference/ufo-network-help.md +15 -0
  61. data/docs/_reference/ufo-network-init.md +38 -0
  62. data/docs/_reference/ufo-network.md +26 -0
  63. data/docs/_reference/ufo-ps.md +53 -0
  64. data/docs/_reference/ufo-releases.md +40 -0
  65. data/docs/_reference/ufo-resources.md +44 -0
  66. data/docs/_reference/ufo-rollback.md +59 -0
  67. data/docs/_reference/ufo-scale.md +23 -3
  68. data/docs/_reference/ufo-ship.md +54 -27
  69. data/docs/_reference/ufo-ships.md +17 -26
  70. data/docs/_reference/ufo-stop.md +31 -0
  71. data/docs/_reference/ufo-task.md +15 -16
  72. data/docs/_reference/ufo-tasks-build.md +10 -10
  73. data/docs/_reference/ufo-tasks-register.md +3 -3
  74. data/docs/_reference/ufo-tasks.md +1 -1
  75. data/docs/_reference/ufo-upgrade-help.md +15 -0
  76. data/docs/_reference/ufo-upgrade-v2to3.md +15 -0
  77. data/docs/_reference/ufo-upgrade-v3_3to3_4.md +15 -0
  78. data/docs/_reference/ufo-upgrade-v3to4.md +27 -0
  79. data/docs/_reference/ufo-upgrade.md +28 -0
  80. data/docs/_reference/ufo-version.md +1 -1
  81. data/docs/articles.md +2 -2
  82. data/docs/docs.md +1 -1
  83. data/docs/img/docs/cloudformation-resources.png +0 -0
  84. data/docs/img/tutorials/ecs-console-task-definitions.png +0 -0
  85. data/docs/img/tutorials/ecs-console-ufo-ship.png +0 -0
  86. data/docs/img/tutorials/ecs-console-ufo-ships.png +0 -0
  87. data/docs/quick-start.md +21 -9
  88. data/docs/reference.md +10 -2
  89. data/exe/ufo +1 -1
  90. data/lib/cfn/stack.yml +259 -0
  91. data/lib/template/.ufo/params.yml.tt +21 -60
  92. data/lib/template/.ufo/settings.yml.tt +6 -1
  93. data/lib/template/.ufo/settings/cfn/default.yml.tt +55 -0
  94. data/lib/template/.ufo/settings/network/default.yml.tt +18 -0
  95. data/lib/template/.ufo/task_definitions.rb.tt +7 -6
  96. data/lib/template/.ufo/templates/fargate.json.erb +1 -1
  97. data/lib/template/.ufo/templates/main.json.erb +1 -0
  98. data/lib/template/.ufo/variables/base.rb.tt +5 -2
  99. data/lib/template/Dockerfile +10 -15
  100. data/lib/template/bin/deploy.tt +2 -2
  101. data/lib/ufo.rb +29 -20
  102. data/lib/ufo/apps.rb +49 -0
  103. data/lib/ufo/apps/cfn_map.rb +70 -0
  104. data/lib/ufo/apps/service.rb +56 -0
  105. data/lib/ufo/aws_service.rb +15 -6
  106. data/lib/ufo/base.rb +32 -0
  107. data/lib/ufo/cancel.rb +23 -0
  108. data/lib/ufo/cli.rb +91 -27
  109. data/lib/ufo/core.rb +35 -3
  110. data/lib/ufo/current.rb +104 -0
  111. data/lib/ufo/destroy.rb +10 -41
  112. data/lib/ufo/docker/builder.rb +5 -4
  113. data/lib/ufo/docker/cleaner.rb +1 -1
  114. data/lib/ufo/docker/pusher.rb +2 -2
  115. data/lib/ufo/ecr/cleaner.rb +1 -1
  116. data/lib/ufo/help/apps.md +12 -0
  117. data/lib/ufo/help/balancer.md +3 -0
  118. data/lib/ufo/help/current.md +65 -0
  119. data/lib/ufo/help/deploy.md +4 -4
  120. data/lib/ufo/help/destroy.md +3 -3
  121. data/lib/ufo/help/docker.md +3 -1
  122. data/lib/ufo/help/docker/base.md +7 -7
  123. data/lib/ufo/help/docker/build.md +9 -9
  124. data/lib/ufo/help/docker/clean.md +8 -8
  125. data/lib/ufo/help/docker/name.md +4 -4
  126. data/lib/ufo/help/help.md +5 -0
  127. data/lib/ufo/help/init.md +24 -16
  128. data/lib/ufo/help/network/init.md +13 -0
  129. data/lib/ufo/help/ps.md +27 -0
  130. data/lib/ufo/help/releases.md +16 -0
  131. data/lib/ufo/help/resources.md +20 -0
  132. data/lib/ufo/help/rollback.md +35 -0
  133. data/lib/ufo/help/scale.md +22 -2
  134. data/lib/ufo/help/ship.md +40 -14
  135. data/lib/ufo/help/ships.md +4 -13
  136. data/lib/ufo/help/stop.md +7 -0
  137. data/lib/ufo/help/task.md +9 -9
  138. data/lib/ufo/help/tasks/build.md +10 -10
  139. data/lib/ufo/help/tasks/register.md +3 -3
  140. data/lib/ufo/help/upgrade/v3to4.md +3 -0
  141. data/lib/ufo/info.rb +62 -0
  142. data/lib/ufo/init.rb +36 -23
  143. data/lib/ufo/log_group.rb +2 -1
  144. data/lib/ufo/network.rb +24 -0
  145. data/lib/ufo/network/fetch.rb +41 -0
  146. data/lib/ufo/network/helper.rb +23 -0
  147. data/lib/ufo/network/init.rb +26 -0
  148. data/lib/ufo/param.rb +5 -5
  149. data/lib/ufo/ps.rb +102 -0
  150. data/lib/ufo/ps/task.rb +78 -0
  151. data/lib/ufo/releases.rb +14 -0
  152. data/lib/ufo/rollback.rb +53 -0
  153. data/lib/ufo/scale.rb +6 -12
  154. data/lib/ufo/sequence.rb +7 -0
  155. data/lib/ufo/setting.rb +7 -6
  156. data/lib/ufo/setting/profile.rb +24 -0
  157. data/lib/ufo/ship.rb +35 -326
  158. data/lib/ufo/stack.rb +203 -0
  159. data/lib/ufo/stack/context.rb +242 -0
  160. data/lib/ufo/stack/helper.rb +28 -0
  161. data/lib/ufo/stack/status.rb +195 -0
  162. data/lib/ufo/stop.rb +47 -0
  163. data/lib/ufo/task.rb +96 -15
  164. data/lib/ufo/tasks/register.rb +1 -1
  165. data/lib/ufo/template_scope.rb +81 -7
  166. data/lib/ufo/upgrade.rb +32 -0
  167. data/lib/ufo/{upgrade3.rb → upgrade/upgrade3.rb} +1 -1
  168. data/lib/ufo/{upgrade33_to_34.rb → upgrade/upgrade33to34.rb} +2 -2
  169. data/lib/ufo/upgrade/upgrade4.rb +161 -0
  170. data/lib/ufo/util.rb +19 -6
  171. data/lib/ufo/version.rb +1 -1
  172. data/spec/fixtures/apps/describe_services.json +96 -0
  173. data/spec/fixtures/cfn/stack-events-complete.json +1080 -0
  174. data/spec/fixtures/cfn/stack-events-in-progress.json +1080 -0
  175. data/spec/fixtures/cfn/stack-events-update-rollback-complete.json +1086 -0
  176. data/spec/fixtures/deployments.json +50 -0
  177. data/spec/fixtures/ps/describe_tasks.json +58 -0
  178. data/spec/fixtures/settings.yml +2 -0
  179. data/spec/lib/apps_spec.rb +20 -0
  180. data/spec/lib/cli_spec.rb +4 -4
  181. data/spec/lib/ps_spec.rb +14 -0
  182. data/spec/lib/setting_spec.rb +2 -1
  183. data/spec/lib/ship_spec.rb +6 -30
  184. data/spec/lib/stack/status_spec.rb +76 -0
  185. data/spec/lib/stop_spec.rb +13 -0
  186. data/spec/lib/task_spec.rb +5 -2
  187. data/spec/spec_helper.rb +1 -1
  188. data/ufo.gemspec +2 -0
  189. metadata +120 -6
  190. data/docs/_reference/ufo-upgrade3.md +0 -23
  191. data/docs/_reference/ufo-upgrade3_3_to_3_4.md +0 -23
@@ -0,0 +1,50 @@
1
+ [
2
+ {
3
+ "id": "ecs-svc/9223370506480701820",
4
+ "status": "PRIMARY",
5
+ "task_definition": "arn:aws:ecs:us-east-1:1111111111:task-definition/demo-web:91",
6
+ "desired_count": 1,
7
+ "pending_count": 0,
8
+ "running_count": 1,
9
+ "created_at": "2018-06-30 08:54:33 -0700",
10
+ "updated_at": "2018-06-30 08:54:33 -0700",
11
+ "launch_type": "FARGATE",
12
+ "platform_version": "1.1.0",
13
+ "network_configuration": {
14
+ "awsvpc_configuration": {
15
+ "subnets": [
16
+ "subnet-11111111",
17
+ "subnet-22222222"
18
+ ],
19
+ "security_groups": [
20
+ "sg-111111"
21
+ ],
22
+ "assign_public_ip": "ENABLED"
23
+ }
24
+ }
25
+ },
26
+ {
27
+ "id": "ecs-svc/9223370506480701819",
28
+ "status": "PRIMARY",
29
+ "task_definition": "arn:aws:ecs:us-east-1:1111111111:task-definition/demo-web:90",
30
+ "desired_count": 1,
31
+ "pending_count": 0,
32
+ "running_count": 1,
33
+ "created_at": "2018-06-30 01:54:33 -0700",
34
+ "updated_at": "2018-06-30 01:54:33 -0700",
35
+ "launch_type": "FARGATE",
36
+ "platform_version": "1.1.0",
37
+ "network_configuration": {
38
+ "awsvpc_configuration": {
39
+ "subnets": [
40
+ "subnet-11111111",
41
+ "subnet-22222222"
42
+ ],
43
+ "security_groups": [
44
+ "sg-111111"
45
+ ],
46
+ "assign_public_ip": "ENABLED"
47
+ }
48
+ }
49
+ }
50
+ ]
@@ -0,0 +1,58 @@
1
+ {
2
+ "tasks": [
3
+ {
4
+ "task_arn": "arn:aws:ecs:us-east-1:111111111111:task/f39dcfd4-06ec-4cce-9824-58c23654b3f3",
5
+ "cluster_arn": "arn:aws:ecs:us-east-1:111111111111:cluster/dev",
6
+ "task_definition_arn": "arn:aws:ecs:us-east-1:111111111111:task-definition/demo-web:259",
7
+ "container_instance_arn": "arn:aws:ecs:us-east-1:111111111111:container-instance/79529589-9d86-40c2-a205-b49ff88da5cc",
8
+ "overrides": {
9
+ "container_overrides": [
10
+ {
11
+ "name": "web"
12
+ }
13
+ ]
14
+ },
15
+ "last_status": "RUNNING",
16
+ "desired_status": "RUNNING",
17
+ "cpu": "256",
18
+ "memory": "256",
19
+ "containers": [
20
+ {
21
+ "container_arn": "arn:aws:ecs:us-east-1:111111111111:container/25ce9c62-1766-46d7-8cee-4693e3595990",
22
+ "task_arn": "arn:aws:ecs:us-east-1:111111111111:task/f39dcfd4-06ec-4cce-9824-58c23654b3f3",
23
+ "name": "web",
24
+ "last_status": "RUNNING",
25
+ "network_bindings": [
26
+ {
27
+ "bind_ip": "0.0.0.0",
28
+ "container_port": 4567,
29
+ "host_port": 32799,
30
+ "protocol": "tcp"
31
+ }
32
+ ],
33
+ "network_interfaces": [
34
+
35
+ ],
36
+ "health_status": "UNKNOWN"
37
+ }
38
+ ],
39
+ "started_by": "ecs-svc/9223370507321333803",
40
+ "version": 2,
41
+ "connectivity": "CONNECTED",
42
+ "connectivity_at": "2018-06-20 15:24:09 -0700",
43
+ "pull_started_at": "2018-06-20 15:24:10 -0700",
44
+ "pull_stopped_at": "2018-06-20 15:24:10 -0700",
45
+ "created_at": "2018-06-20 15:24:09 -0700",
46
+ "started_at": "2018-06-20 15:24:11 -0700",
47
+ "group": "service:dev-demo-web-Ecs-995XN7V9819R",
48
+ "launch_type": "EC2",
49
+ "attachments": [
50
+
51
+ ],
52
+ "health_status": "UNKNOWN"
53
+ }
54
+ ],
55
+ "failures": [
56
+
57
+ ]
58
+ }
@@ -4,6 +4,8 @@ base:
4
4
  # clean_keep: 30 # cleans up docker images on your docker server.
5
5
  # ecr_keep: 30 # cleans up images on ECR and keeps this remaining amount. Defaults to keep all.
6
6
  # defaults when an new ECS service is created by ufo ship
7
+ cfn_profile: default
8
+ network_profile: default
7
9
 
8
10
  development:
9
11
  cluster: dev
@@ -0,0 +1,20 @@
1
+ describe Ufo::Apps do
2
+ before(:each) do
3
+ create_ufo_project
4
+ end
5
+ let(:apps) do
6
+ Ufo::Apps.new({})
7
+ end
8
+
9
+ context "running tasks" do
10
+ let(:describe_tasks_response) do
11
+ JSON.load(IO.read("spec/fixtures/apps/describe_services.json"))
12
+ end
13
+ it "displays info" do
14
+ allow(apps).to receive(:service_info).and_return([
15
+ "demo-web", "task-def", "1", "EC2", "yes"
16
+ ])
17
+ apps.display_info(describe_tasks_response)
18
+ end
19
+ end
20
+ end
@@ -8,12 +8,12 @@ describe Ufo::CLI do
8
8
  context "docker" do
9
9
  it "build builds image" do
10
10
  out = execute("exe/ufo docker build #{@args}")
11
- expect(out).to include("docker build -t tongueroo/hi")
11
+ expect(out).to include("docker build -t tongueroo/demo-ufo")
12
12
  end
13
13
 
14
14
  it "tag shows the tag" do
15
15
  out = execute("exe/ufo docker name #{@args}")
16
- expect(out).to match(%r{tongueroo/hi:ufo-.{7}})
16
+ expect(out).to match(%r{tongueroo/demo-ufo:ufo-.{7}})
17
17
  end
18
18
  end
19
19
 
@@ -39,7 +39,7 @@ describe Ufo::CLI do
39
39
 
40
40
  context "ship" do
41
41
  it "deploys software" do
42
- out = execute("exe/ufo ship hi-web-prod #{@args} --no-wait")
42
+ out = execute("exe/ufo ship demo-web-prod #{@args} --no-wait")
43
43
  # cannot look for Software shipped! because
44
44
  # ship.deploy unless ENV['TEST'] # to allow me to quickly test CLI portion only
45
45
  # just testing the CLI portion. The ship class itself is tested via ship_spec.rb
@@ -49,7 +49,7 @@ describe Ufo::CLI do
49
49
 
50
50
  context "ships" do
51
51
  it "deploys software to multiple services" do
52
- out = execute("exe/ufo ships hi-web-prod hi-worker-prod #{@args} --no-wait")
52
+ out = execute("exe/ufo ships demo-web-prod demo-worker-prod #{@args} --no-wait")
53
53
  # cannot look for Software shipped! because
54
54
  # ship.deploy unless ENV['TEST'] # to allow me to quickly test CLI portion only
55
55
  # just testing the CLI portion. The ship class itself is tested via ship_spec.rb
@@ -0,0 +1,14 @@
1
+ describe Ufo::Ps do
2
+ let(:ps) do
3
+ Ufo::Ps.new("test-web", {})
4
+ end
5
+
6
+ context "running tasks" do
7
+ let(:describe_tasks_response) do
8
+ JSON.load(IO.read("spec/fixtures/ps/describe_tasks.json"))
9
+ end
10
+ it "displays info" do
11
+ ps.display_info(describe_tasks_response)
12
+ end
13
+ end
14
+ end
@@ -6,7 +6,8 @@ describe Ufo::Setting do
6
6
  let(:setting) { Ufo::Setting.new }
7
7
 
8
8
  it "includes the cluster setting" do
9
- cluster = setting.data["cluster"]
9
+ puts "Ufo.env #{Ufo.env}"
10
+ cluster = setting.data[:cluster]
10
11
  expect(cluster).to eq "dev"
11
12
  end
12
13
  end
@@ -1,51 +1,27 @@
1
1
  describe Ufo::Ship do
2
- let(:project_root) { File.expand_path("../../fixtures/hi", __FILE__) }
3
2
  let(:options) do
4
3
  {
5
4
  noop: true,
6
- project_root: project_root,
7
5
  mute: true,
8
6
  wait: false,
7
+ task_definition: service,
9
8
  stop_old_tasks: false,
10
9
  }
11
10
  end
12
- let(:service) { "hi-web-prod" }
13
- let(:task_definition) { service }
11
+ let(:service) { "demo-web-prod" }
14
12
  let(:ship) do
15
- ship = Ufo::Ship.new(service, task_definition, options)
13
+ ship = Ufo::Ship.new(service, options)
16
14
  allow(ship).to receive(:ecs).and_return(ecs_client)
17
15
  ship
18
16
  end
19
17
 
20
- context "hi-web-prod service" do
18
+ context "demo-web-prod service" do
21
19
  it "should create or update service" do
22
- allow(ship).to receive(:process_deployment)
20
+ allow(ship).to receive(:deploy_stack)
23
21
 
24
22
  ship.deploy
25
23
 
26
- expect(ship).to have_received(:process_deployment)
27
- end
28
-
29
- context "0 services found" do
30
- it "should create service on first cluster" do
31
- allow(ship).to receive(:find_ecs_service)
32
- allow(ship).to receive(:create_service)
33
-
34
- ship.deploy
35
-
36
- expect(ship).to have_received(:create_service)
37
- end
38
- end
39
-
40
- context "1 services found" do
41
- it "should call update service" do
42
- allow(ship).to receive(:find_ecs_service).and_return(ecs_service("hi-web-prod"))
43
- allow(ship).to receive(:update_service)
44
-
45
- ship.deploy
46
-
47
- expect(ship).to have_received(:update_service).exactly(1).times
48
- end
24
+ expect(ship).to have_received(:deploy_stack)
49
25
  end
50
26
  end
51
27
 
@@ -0,0 +1,76 @@
1
+ describe Ufo::Stack::Status do
2
+ let(:status) do
3
+ status = Ufo::Stack::Status.new(stack_name: "test-web")
4
+ allow(status).to receive(:cloudformation).and_return(cloudformation)
5
+ status
6
+ end
7
+ let(:cloudformation) do
8
+ service = double("service").as_null_object
9
+ allow(service).to receive(:describe_stacks).and_return(stack_status)
10
+ allow(service).to receive(:describe_stack_events).and_return(stack_events)
11
+ service
12
+ end
13
+
14
+ context "in progress" do
15
+ let(:stack_status) { "UPDATE_IN_PROGRESS" }
16
+ let(:stack_events) { JSON.load(IO.read("spec/fixtures/cfn/stack-events-in-progress.json")) }
17
+ it "lists events since user initiated event" do
18
+ status.refresh_events
19
+ i = status.find_index(:start)
20
+ expect(i).to eq 15
21
+ # uncomment to view and debug
22
+ # status.show_events
23
+ # puts "****"
24
+ # status.show_events # show not show anything
25
+ end
26
+
27
+ it "lists events since last shown event" do
28
+ # first display
29
+ status.refresh_events
30
+ i = status.find_index(:start)
31
+ expect(i).to eq 15
32
+
33
+ # move the last event back in time 4 events, so should print 3 events
34
+ status.instance_variable_set(:@last_shown_event_id, "TargetGroup-ec634c43-b887-4bde-a525-7c69782865a6")
35
+
36
+ captured_events = []
37
+ allow(status).to receive(:print_event) do |e|
38
+ captured_events << "#{e["resource_type"]} #{e["resource_status"]}"
39
+ end
40
+ status.show_events
41
+ expect(captured_events).to eq([
42
+ "AWS::ElasticLoadBalancingV2::LoadBalancer DELETE_IN_PROGRESS",
43
+ "AWS::ElasticLoadBalancingV2::LoadBalancer DELETE_COMPLETE",
44
+ "AWS::EC2::SecurityGroup DELETE_IN_PROGRESS",
45
+ ])
46
+ end
47
+ end
48
+
49
+ context "complete" do
50
+ let(:stack_status) { "UPDATE_COMPLETE" }
51
+ let(:stack_events) { JSON.load(IO.read("spec/fixtures/cfn/stack-events-complete.json")) }
52
+ it "lists events all the way to completion" do
53
+ status.refresh_events
54
+ i = status.find_index(:start)
55
+ expect(i).to eq 17
56
+ # uncomment to view and debug
57
+ # status.show_events
58
+ end
59
+ end
60
+
61
+ context "update_rollback" do
62
+ let(:stack_status) { "UPDATE_ROLLBACK_COMPLETE" }
63
+ let(:stack_events) { JSON.load(IO.read("spec/fixtures/cfn/stack-events-update-rollback-complete.json")) }
64
+ it "lists events all the way to update rollback complete" do
65
+ status.refresh_events
66
+ expect(status.success?).to be false
67
+ expect(status.update_rollback?).to be true
68
+ expect(status.rollback_error_message).to include("STATIC_NAME")
69
+
70
+ # i = status.find_index(:start)
71
+ # expect(i).to eq 17
72
+ # uncomment to view and debug
73
+ # status.show_events
74
+ end
75
+ end
76
+ end
@@ -0,0 +1,13 @@
1
+ describe Ufo::Stop do
2
+ before(:all) do
3
+ create_ufo_project
4
+ end
5
+ let(:stop) { Ufo::Stop.new("test-web") }
6
+ let(:deployments) { JSON.load(IO.read("spec/fixtures/deployments.json")) }
7
+
8
+ it "stop" do
9
+ stop.instance_variable_set(:@deployments, deployments)
10
+ arn = stop.latest_deployed_arn
11
+ expect(arn).to include "demo-web:91"
12
+ end
13
+ end
@@ -1,8 +1,9 @@
1
1
  describe Ufo::Ship do
2
- let(:project_root) { File.expand_path("../../fixtures/hi", __FILE__) }
2
+ before(:each) do
3
+ create_ufo_project
4
+ end
3
5
  let(:options) do
4
6
  {
5
- project_root: project_root,
6
7
  mute: true
7
8
  }
8
9
  end
@@ -26,6 +27,8 @@ describe Ufo::Ship do
26
27
  ecs = double("ecs")
27
28
  fake_response = double('fake-response').as_null_object
28
29
  allow(ecs).to receive(:run_task).and_return(fake_response)
30
+ allow(ecs).to receive(:list_task_definitions).and_return(fake_response)
31
+ allow(ecs).to receive(:describe_task_definition).and_return(fake_response)
29
32
  ecs
30
33
  end
31
34
  end
@@ -16,7 +16,7 @@ ENV['UFO_ROOT'] = "tmp/project"
16
16
  module Helpers
17
17
  def create_ufo_project
18
18
  FileUtils.rm_rf(Ufo.root)
19
- execute("exe/ufo init --app hi --image tongueroo/hi")
19
+ execute("exe/ufo init --app demo --image tongueroo/demo-ufo")
20
20
  create_test_settings
21
21
  end
22
22
 
@@ -18,6 +18,7 @@ Gem::Specification.new do |spec|
18
18
  spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
19
19
  spec.require_paths = ["lib"]
20
20
 
21
+ spec.add_dependency "aws-sdk-cloudformation"
21
22
  spec.add_dependency "aws-sdk-cloudwatchlogs"
22
23
  spec.add_dependency "aws-sdk-ec2"
23
24
  spec.add_dependency "aws-sdk-ecr"
@@ -28,6 +29,7 @@ Gem::Specification.new do |spec|
28
29
  spec.add_dependency "memoist"
29
30
  spec.add_dependency "plissken"
30
31
  spec.add_dependency "render_me_pretty"
32
+ spec.add_dependency "text-table"
31
33
  spec.add_dependency "thor"
32
34
 
33
35
  spec.add_development_dependency "bundler"
metadata CHANGED
@@ -1,15 +1,29 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: ufo
3
3
  version: !ruby/object:Gem::Version
4
- version: 3.5.7
4
+ version: 4.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-06-09 00:00:00.000000000 Z
11
+ date: 2018-07-04 00:00:00.000000000 Z
12
12
  dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: aws-sdk-cloudformation
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - ">="
18
+ - !ruby/object:Gem::Version
19
+ version: '0'
20
+ type: :runtime
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - ">="
25
+ - !ruby/object:Gem::Version
26
+ version: '0'
13
27
  - !ruby/object:Gem::Dependency
14
28
  name: aws-sdk-cloudwatchlogs
15
29
  requirement: !ruby/object:Gem::Requirement
@@ -150,6 +164,20 @@ dependencies:
150
164
  - - ">="
151
165
  - !ruby/object:Gem::Version
152
166
  version: '0'
167
+ - !ruby/object:Gem::Dependency
168
+ name: text-table
169
+ requirement: !ruby/object:Gem::Requirement
170
+ requirements:
171
+ - - ">="
172
+ - !ruby/object:Gem::Version
173
+ version: '0'
174
+ type: :runtime
175
+ prerelease: false
176
+ version_requirements: !ruby/object:Gem::Requirement
177
+ requirements:
178
+ - - ">="
179
+ - !ruby/object:Gem::Version
180
+ version: '0'
153
181
  - !ruby/object:Gem::Dependency
154
182
  name: thor
155
183
  requirement: !ruby/object:Gem::Requirement
@@ -264,26 +292,40 @@ files:
264
292
  - docs/_docs/auto-completion.md
265
293
  - docs/_docs/automated-cleanup.md
266
294
  - docs/_docs/conventions.md
295
+ - docs/_docs/customize-cloudformation.md
267
296
  - docs/_docs/faq.md
297
+ - docs/_docs/fargate.md
268
298
  - docs/_docs/helpers.md
269
299
  - docs/_docs/install.md
300
+ - docs/_docs/load-balancer.md
270
301
  - docs/_docs/migrations.md
271
302
  - docs/_docs/next-steps.md
272
303
  - docs/_docs/params.md
304
+ - docs/_docs/route53-support.md
273
305
  - docs/_docs/run-in-pieces.md
306
+ - docs/_docs/security-groups.md
307
+ - docs/_docs/settings-cfn.md
308
+ - docs/_docs/settings-network.md
274
309
  - docs/_docs/settings.md
275
310
  - docs/_docs/single-task.md
311
+ - docs/_docs/ssl-support.md
276
312
  - docs/_docs/structure.md
313
+ - docs/_docs/stuck-cloudformation.md
277
314
  - docs/_docs/tutorial-ufo-docker-build.md
278
315
  - docs/_docs/tutorial-ufo-init.md
279
316
  - docs/_docs/tutorial-ufo-ship.md
280
317
  - docs/_docs/tutorial-ufo-ships.md
281
318
  - docs/_docs/tutorial-ufo-tasks-build.md
282
319
  - docs/_docs/tutorial.md
320
+ - docs/_docs/ufo-current.md
321
+ - docs/_docs/ufo-env-extra.md
283
322
  - docs/_docs/ufo-env.md
284
323
  - docs/_docs/ufo-tasks-register.md
324
+ - docs/_docs/upgrade4.md
285
325
  - docs/_docs/variables.md
326
+ - docs/_docs/why-cloudformation.md
286
327
  - docs/_includes/about.html
328
+ - docs/_includes/cfn-customize.md
287
329
  - docs/_includes/commands.html
288
330
  - docs/_includes/contact.html
289
331
  - docs/_includes/contact_disqus.html
@@ -314,8 +356,11 @@ files:
314
356
  - docs/_includes/uses.html
315
357
  - docs/_layouts/default.html
316
358
  - docs/_layouts/style.css
359
+ - docs/_reference/ufo-apps.md
360
+ - docs/_reference/ufo-cancel.md
317
361
  - docs/_reference/ufo-completion.md
318
362
  - docs/_reference/ufo-completion_script.md
363
+ - docs/_reference/ufo-current.md
319
364
  - docs/_reference/ufo-deploy.md
320
365
  - docs/_reference/ufo-destroy.md
321
366
  - docs/_reference/ufo-docker-base.md
@@ -326,16 +371,27 @@ files:
326
371
  - docs/_reference/ufo-docker-push.md
327
372
  - docs/_reference/ufo-docker.md
328
373
  - docs/_reference/ufo-init.md
374
+ - docs/_reference/ufo-network-help.md
375
+ - docs/_reference/ufo-network-init.md
376
+ - docs/_reference/ufo-network.md
377
+ - docs/_reference/ufo-ps.md
378
+ - docs/_reference/ufo-releases.md
379
+ - docs/_reference/ufo-resources.md
380
+ - docs/_reference/ufo-rollback.md
329
381
  - docs/_reference/ufo-scale.md
330
382
  - docs/_reference/ufo-ship.md
331
383
  - docs/_reference/ufo-ships.md
384
+ - docs/_reference/ufo-stop.md
332
385
  - docs/_reference/ufo-task.md
333
386
  - docs/_reference/ufo-tasks-build.md
334
387
  - docs/_reference/ufo-tasks-help.md
335
388
  - docs/_reference/ufo-tasks-register.md
336
389
  - docs/_reference/ufo-tasks.md
337
- - docs/_reference/ufo-upgrade3.md
338
- - docs/_reference/ufo-upgrade3_3_to_3_4.md
390
+ - docs/_reference/ufo-upgrade-help.md
391
+ - docs/_reference/ufo-upgrade-v2to3.md
392
+ - docs/_reference/ufo-upgrade-v3_3to3_4.md
393
+ - docs/_reference/ufo-upgrade-v3to4.md
394
+ - docs/_reference/ufo-upgrade.md
339
395
  - docs/_reference/ufo-version.md
340
396
  - docs/articles.md
341
397
  - docs/bin/web
@@ -347,6 +403,7 @@ files:
347
403
  - docs/css/font-awesome/fonts/fontawesome-webfont.ttf
348
404
  - docs/css/font-awesome/fonts/fontawesome-webfont.woff
349
405
  - docs/docs.md
406
+ - docs/img/docs/cloudformation-resources.png
350
407
  - docs/img/logos/boltops-logo-full.png
351
408
  - docs/img/logos/boltops-logo.png
352
409
  - docs/img/logos/ufo-logo.png
@@ -372,9 +429,12 @@ files:
372
429
  - docs/reference.md
373
430
  - docs/style.css
374
431
  - exe/ufo
432
+ - lib/cfn/stack.yml
375
433
  - lib/template/.env
376
434
  - lib/template/.ufo/params.yml.tt
377
435
  - lib/template/.ufo/settings.yml.tt
436
+ - lib/template/.ufo/settings/cfn/default.yml.tt
437
+ - lib/template/.ufo/settings/network/default.yml.tt
378
438
  - lib/template/.ufo/task_definitions.rb.tt
379
439
  - lib/template/.ufo/templates/fargate.json.erb
380
440
  - lib/template/.ufo/templates/main.json.erb
@@ -384,13 +444,19 @@ files:
384
444
  - lib/template/Dockerfile
385
445
  - lib/template/bin/deploy.tt
386
446
  - lib/ufo.rb
447
+ - lib/ufo/apps.rb
448
+ - lib/ufo/apps/cfn_map.rb
449
+ - lib/ufo/apps/service.rb
387
450
  - lib/ufo/aws_service.rb
451
+ - lib/ufo/base.rb
452
+ - lib/ufo/cancel.rb
388
453
  - lib/ufo/cli.rb
389
454
  - lib/ufo/command.rb
390
455
  - lib/ufo/completer.rb
391
456
  - lib/ufo/completer/script.rb
392
457
  - lib/ufo/completer/script.sh
393
458
  - lib/ufo/core.rb
459
+ - lib/ufo/current.rb
394
460
  - lib/ufo/default/settings.yml
395
461
  - lib/ufo/default/templates/main.json.erb
396
462
  - lib/ufo/destroy.rb
@@ -409,10 +475,13 @@ files:
409
475
  - lib/ufo/ecs.rb
410
476
  - lib/ufo/ecs/service.rb
411
477
  - lib/ufo/help.rb
478
+ - lib/ufo/help/apps.md
479
+ - lib/ufo/help/balancer.md
412
480
  - lib/ufo/help/completion.md
413
481
  - lib/ufo/help/completion_script.md
414
482
  - lib/ufo/help/completions.md
415
483
  - lib/ufo/help/completions_script.md
484
+ - lib/ufo/help/current.md
416
485
  - lib/ufo/help/deploy.md
417
486
  - lib/ufo/help/destroy.md
418
487
  - lib/ufo/help/docker.md
@@ -421,45 +490,80 @@ files:
421
490
  - lib/ufo/help/docker/clean.md
422
491
  - lib/ufo/help/docker/name.md
423
492
  - lib/ufo/help/docker/push.md
493
+ - lib/ufo/help/help.md
424
494
  - lib/ufo/help/init.md
495
+ - lib/ufo/help/network/init.md
496
+ - lib/ufo/help/ps.md
497
+ - lib/ufo/help/releases.md
498
+ - lib/ufo/help/resources.md
499
+ - lib/ufo/help/rollback.md
425
500
  - lib/ufo/help/scale.md
426
501
  - lib/ufo/help/ship.md
427
502
  - lib/ufo/help/ships.md
503
+ - lib/ufo/help/stop.md
428
504
  - lib/ufo/help/task.md
429
505
  - lib/ufo/help/tasks.md
430
506
  - lib/ufo/help/tasks/build.md
431
507
  - lib/ufo/help/tasks/register.md
508
+ - lib/ufo/help/upgrade/v3to4.md
509
+ - lib/ufo/info.rb
432
510
  - lib/ufo/init.rb
433
511
  - lib/ufo/log_group.rb
512
+ - lib/ufo/network.rb
513
+ - lib/ufo/network/fetch.rb
514
+ - lib/ufo/network/helper.rb
515
+ - lib/ufo/network/init.rb
434
516
  - lib/ufo/param.rb
517
+ - lib/ufo/ps.rb
518
+ - lib/ufo/ps/task.rb
519
+ - lib/ufo/releases.rb
520
+ - lib/ufo/rollback.rb
435
521
  - lib/ufo/scale.rb
436
522
  - lib/ufo/sequence.rb
437
523
  - lib/ufo/setting.rb
524
+ - lib/ufo/setting/profile.rb
438
525
  - lib/ufo/ship.rb
526
+ - lib/ufo/stack.rb
527
+ - lib/ufo/stack/context.rb
528
+ - lib/ufo/stack/helper.rb
529
+ - lib/ufo/stack/status.rb
530
+ - lib/ufo/stop.rb
439
531
  - lib/ufo/task.rb
440
532
  - lib/ufo/tasks.rb
441
533
  - lib/ufo/tasks/builder.rb
442
534
  - lib/ufo/tasks/register.rb
443
535
  - lib/ufo/template_scope.rb
536
+ - lib/ufo/upgrade.rb
444
537
  - lib/ufo/upgrade/params.yml
445
- - lib/ufo/upgrade3.rb
446
- - lib/ufo/upgrade33_to_34.rb
538
+ - lib/ufo/upgrade/upgrade3.rb
539
+ - lib/ufo/upgrade/upgrade33to34.rb
540
+ - lib/ufo/upgrade/upgrade4.rb
447
541
  - lib/ufo/util.rb
448
542
  - lib/ufo/version.rb
543
+ - spec/fixtures/apps/describe_services.json
544
+ - spec/fixtures/cfn/stack-events-complete.json
545
+ - spec/fixtures/cfn/stack-events-in-progress.json
546
+ - spec/fixtures/cfn/stack-events-update-rollback-complete.json
547
+ - spec/fixtures/deployments.json
449
548
  - spec/fixtures/dockerfiles/dockerhub/Dockerfile
450
549
  - spec/fixtures/dockerfiles/ecr/Dockerfile
451
550
  - spec/fixtures/home_existing/.aws/config
452
551
  - spec/fixtures/home_existing/.docker/config.json
552
+ - spec/fixtures/ps/describe_tasks.json
453
553
  - spec/fixtures/settings.yml
554
+ - spec/lib/apps_spec.rb
454
555
  - spec/lib/builder_spec.rb
455
556
  - spec/lib/cli_spec.rb
456
557
  - spec/lib/completion_spec.rb
457
558
  - spec/lib/core_spec.rb
458
559
  - spec/lib/ecr_auth_spec.rb
459
560
  - spec/lib/ecr_cleaner_spec.rb
561
+ - spec/lib/ps_spec.rb
460
562
  - spec/lib/register_spec.rb
461
563
  - spec/lib/setting_spec.rb
462
564
  - spec/lib/ship_spec.rb
565
+ - spec/lib/stack/status_spec.rb
566
+ - spec/lib/stop_spec.rb
463
567
  - spec/lib/task_spec.rb
464
568
  - spec/spec_helper.rb
465
569
  - ufo.gemspec
@@ -488,19 +592,29 @@ signing_key:
488
592
  specification_version: 4
489
593
  summary: Build Docker Containers and Ship Them to AWS ECS
490
594
  test_files:
595
+ - spec/fixtures/apps/describe_services.json
596
+ - spec/fixtures/cfn/stack-events-complete.json
597
+ - spec/fixtures/cfn/stack-events-in-progress.json
598
+ - spec/fixtures/cfn/stack-events-update-rollback-complete.json
599
+ - spec/fixtures/deployments.json
491
600
  - spec/fixtures/dockerfiles/dockerhub/Dockerfile
492
601
  - spec/fixtures/dockerfiles/ecr/Dockerfile
493
602
  - spec/fixtures/home_existing/.aws/config
494
603
  - spec/fixtures/home_existing/.docker/config.json
604
+ - spec/fixtures/ps/describe_tasks.json
495
605
  - spec/fixtures/settings.yml
606
+ - spec/lib/apps_spec.rb
496
607
  - spec/lib/builder_spec.rb
497
608
  - spec/lib/cli_spec.rb
498
609
  - spec/lib/completion_spec.rb
499
610
  - spec/lib/core_spec.rb
500
611
  - spec/lib/ecr_auth_spec.rb
501
612
  - spec/lib/ecr_cleaner_spec.rb
613
+ - spec/lib/ps_spec.rb
502
614
  - spec/lib/register_spec.rb
503
615
  - spec/lib/setting_spec.rb
504
616
  - spec/lib/ship_spec.rb
617
+ - spec/lib/stack/status_spec.rb
618
+ - spec/lib/stop_spec.rb
505
619
  - spec/lib/task_spec.rb
506
620
  - spec/spec_helper.rb