ufo 5.0.7 → 6.0.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (457) hide show
  1. checksums.yaml +4 -4
  2. data/.cody/README.md +19 -0
  3. data/.cody/acceptance/bin/build.sh +90 -0
  4. data/.cody/acceptance/buildspec.yml +10 -0
  5. data/.cody/acceptance/project.rb +11 -0
  6. data/.cody/acceptance/role.rb +28 -0
  7. data/.cody/shared/script/install/ufo.sh +40 -0
  8. data/.cody/shared/script/install.sh +5 -0
  9. data/.github/workflows/main.yml +28 -0
  10. data/CHANGELOG.md +4 -1
  11. data/Gemfile +0 -2
  12. data/README.md +1 -32
  13. data/lib/templates/docker/Dockerfile +4 -0
  14. data/lib/templates/helper/%underscore_name%_helper.rb.tt +6 -0
  15. data/lib/templates/init/.ufo/config/web/base.rb +6 -0
  16. data/lib/templates/init/.ufo/config/web/dev.rb +6 -0
  17. data/lib/templates/init/.ufo/config/web/prod.rb +6 -0
  18. data/lib/templates/init/.ufo/config.rb.tt +39 -0
  19. data/lib/templates/init/.ufo/resources/iam_roles/execution_role.rb +23 -0
  20. data/lib/templates/init/.ufo/resources/iam_roles/task_role.rb +20 -0
  21. data/lib/templates/init/.ufo/resources/task_definitions/web.yml +29 -0
  22. data/lib/templates/init/.ufo/vars/base.rb +20 -0
  23. data/lib/templates/init/.ufo/vars/dev.rb +4 -0
  24. data/lib/templates/init/.ufo/vars/prod.rb +4 -0
  25. data/lib/ufo/aws_services.rb +118 -0
  26. data/lib/ufo/booter.rb +27 -0
  27. data/lib/ufo/cfn/base.rb +7 -0
  28. data/lib/ufo/cfn/deploy.rb +54 -0
  29. data/lib/ufo/{stack → cfn/stack}/builder/base.rb +12 -23
  30. data/lib/ufo/cfn/stack/builder/conditions.rb +25 -0
  31. data/lib/ufo/{stack → cfn/stack}/builder/outputs.rb +2 -2
  32. data/lib/ufo/cfn/stack/builder/parameters.rb +34 -0
  33. data/lib/ufo/cfn/stack/builder/resources/base.rb +4 -0
  34. data/lib/ufo/cfn/stack/builder/resources/dns.rb +47 -0
  35. data/lib/ufo/{stack/builder/resources/ecs.rb → cfn/stack/builder/resources/ecs_service.rb} +11 -10
  36. data/lib/ufo/cfn/stack/builder/resources/elb.rb +35 -0
  37. data/lib/ufo/cfn/stack/builder/resources/iam_roles/base.rb +32 -0
  38. data/lib/ufo/cfn/stack/builder/resources/iam_roles/execution_role.rb +4 -0
  39. data/lib/ufo/cfn/stack/builder/resources/iam_roles/task_role.rb +4 -0
  40. data/lib/ufo/cfn/stack/builder/resources/listener.rb +65 -0
  41. data/lib/ufo/cfn/stack/builder/resources/listener_ssl.rb +44 -0
  42. data/lib/ufo/cfn/stack/builder/resources/scaling/base.rb +5 -0
  43. data/lib/ufo/cfn/stack/builder/resources/scaling/policy.rb +27 -0
  44. data/lib/ufo/cfn/stack/builder/resources/scaling/role.rb +33 -0
  45. data/lib/ufo/cfn/stack/builder/resources/scaling/target.rb +22 -0
  46. data/lib/ufo/cfn/stack/builder/resources/security_group/base.rb +4 -0
  47. data/lib/ufo/{stack → cfn/stack}/builder/resources/security_group/ecs.rb +4 -4
  48. data/lib/ufo/{stack → cfn/stack}/builder/resources/security_group/ecs_rule.rb +2 -2
  49. data/lib/ufo/{stack → cfn/stack}/builder/resources/security_group/elb.rb +5 -6
  50. data/lib/ufo/{stack → cfn/stack}/builder/resources/target_group.rb +4 -4
  51. data/lib/ufo/{stack → cfn/stack}/builder/resources/task_definition/reconstructor.rb +4 -4
  52. data/lib/ufo/{stack → cfn/stack}/builder/resources/task_definition.rb +4 -4
  53. data/lib/ufo/cfn/stack/builder/resources.rb +24 -0
  54. data/lib/ufo/cfn/stack/builder.rb +30 -0
  55. data/lib/ufo/{stack → cfn/stack}/custom_properties.rb +21 -5
  56. data/lib/ufo/cfn/stack/params.rb +51 -0
  57. data/lib/ufo/{stack → cfn/stack}/status.rb +2 -2
  58. data/lib/ufo/cfn/stack/template.rb +8 -0
  59. data/lib/ufo/cfn/stack/vars.rb +110 -0
  60. data/lib/ufo/cfn/stack/vpc.rb +31 -0
  61. data/lib/ufo/cfn/stack.rb +175 -0
  62. data/lib/ufo/cli/base.rb +18 -0
  63. data/lib/ufo/cli/build.rb +30 -0
  64. data/lib/ufo/cli/cancel.rb +18 -0
  65. data/lib/ufo/cli/central/update.rb +80 -0
  66. data/lib/ufo/cli/central.rb +12 -0
  67. data/lib/ufo/cli/clean.rb +17 -0
  68. data/lib/ufo/cli/destroy.rb +31 -0
  69. data/lib/ufo/{docker.rb → cli/docker.rb} +18 -18
  70. data/lib/ufo/cli/exec.rb +82 -0
  71. data/lib/ufo/cli/help/central/update.md +20 -0
  72. data/lib/ufo/{help → cli/help}/completion.md +0 -0
  73. data/lib/ufo/{help → cli/help}/completion_script.md +0 -0
  74. data/lib/ufo/cli/help/destroy.md +9 -0
  75. data/lib/ufo/cli/help/docker/base.md +39 -0
  76. data/lib/ufo/{help → cli/help}/docker/build.md +9 -9
  77. data/lib/ufo/{help → cli/help}/docker/clean.md +8 -8
  78. data/lib/ufo/{help → cli/help}/docker/compile.md +0 -0
  79. data/lib/ufo/cli/help/docker/name.md +16 -0
  80. data/lib/ufo/{help → cli/help}/docker/push.md +0 -0
  81. data/lib/ufo/cli/help/docker.md +6 -0
  82. data/lib/ufo/{help → cli/help}/help.md +1 -1
  83. data/lib/ufo/cli/help/init.md +27 -0
  84. data/lib/ufo/{help → cli/help}/logs.md +5 -4
  85. data/lib/ufo/cli/help/ps.md +12 -0
  86. data/lib/ufo/cli/help/releases.md +15 -0
  87. data/lib/ufo/cli/help/rollback.md +40 -0
  88. data/lib/ufo/cli/help/scale.md +7 -0
  89. data/lib/ufo/cli/help/ship.md +41 -0
  90. data/lib/ufo/cli/help/stop.md +3 -0
  91. data/lib/ufo/cli/help.rb +62 -0
  92. data/lib/ufo/{logs.rb → cli/logs.rb} +13 -6
  93. data/lib/ufo/cli/new/concerns.rb +16 -0
  94. data/lib/ufo/cli/new/helper.rb +24 -0
  95. data/lib/ufo/cli/new/init.rb +68 -0
  96. data/lib/ufo/{sequence.rb → cli/new/sequence.rb} +26 -4
  97. data/lib/ufo/cli/new.rb +10 -0
  98. data/lib/ufo/cli/opts.rb +35 -0
  99. data/lib/ufo/{ps → cli/ps}/task.rb +22 -29
  100. data/lib/ufo/cli/ps.rb +190 -0
  101. data/lib/ufo/{releases.rb → cli/releases.rb} +4 -4
  102. data/lib/ufo/{rollback.rb → cli/rollback.rb} +24 -12
  103. data/lib/ufo/cli/scale.rb +76 -0
  104. data/lib/ufo/cli/ship.rb +28 -0
  105. data/lib/ufo/cli/status.rb +8 -0
  106. data/lib/ufo/cli/stop.rb +49 -0
  107. data/lib/ufo/{tasks.rb → cli/tasks.rb} +2 -2
  108. data/lib/ufo/{upgrade.rb → cli/upgrade.rb} +2 -2
  109. data/lib/ufo/cli.rb +82 -172
  110. data/lib/ufo/command.rb +56 -1
  111. data/lib/ufo/concerns/autoscaling.rb +11 -0
  112. data/lib/ufo/concerns/names.rb +9 -0
  113. data/lib/ufo/concerns.rb +26 -0
  114. data/lib/ufo/config/inits.rb +13 -0
  115. data/lib/ufo/config.rb +187 -0
  116. data/lib/ufo/core.rb +32 -44
  117. data/lib/ufo/docker/builder.rb +44 -40
  118. data/lib/ufo/docker/cleaner.rb +9 -12
  119. data/lib/ufo/docker/compiler.rb +10 -4
  120. data/lib/ufo/docker/concerns.rb +7 -0
  121. data/lib/ufo/docker/dockerfile.rb +13 -9
  122. data/lib/ufo/docker/pusher.rb +13 -25
  123. data/lib/ufo/docker/state.rb +63 -0
  124. data/lib/ufo/ecr/auth.rb +8 -7
  125. data/lib/ufo/ecr/cleaner.rb +10 -14
  126. data/lib/ufo/ext/core/module.rb +31 -0
  127. data/lib/ufo/ext/core/nil_class.rb +11 -0
  128. data/lib/ufo/ext.rb +2 -0
  129. data/lib/ufo/{role → iam_role}/builder.rb +1 -1
  130. data/lib/ufo/{role → iam_role}/dsl.rb +8 -2
  131. data/lib/ufo/{role → iam_role}/registry.rb +1 -1
  132. data/lib/ufo/info.rb +22 -4
  133. data/lib/ufo/layering/layer.rb +95 -0
  134. data/lib/ufo/layering.rb +23 -0
  135. data/lib/ufo/log_group.rb +18 -10
  136. data/lib/ufo/logger/formatter.rb +13 -0
  137. data/lib/ufo/logger.rb +32 -0
  138. data/lib/ufo/names.rb +69 -0
  139. data/lib/ufo/param.rb +2 -1
  140. data/lib/ufo/task_definition/builder.rb +7 -0
  141. data/lib/ufo/task_definition/context.rb +45 -0
  142. data/lib/ufo/task_definition/erb/base.rb +18 -0
  143. data/lib/ufo/task_definition/erb/json.rb +28 -0
  144. data/lib/ufo/task_definition/erb/yaml.rb +18 -0
  145. data/lib/ufo/task_definition/erb.rb +78 -0
  146. data/lib/ufo/task_definition/helpers/aws_data_helper.rb +18 -0
  147. data/lib/ufo/task_definition/helpers/core.rb +50 -0
  148. data/lib/ufo/task_definition/helpers/ssm/fetcher.rb +39 -0
  149. data/lib/ufo/task_definition/helpers/ssm.rb +8 -0
  150. data/lib/ufo/task_definition/helpers/stack_output.rb +23 -0
  151. data/lib/ufo/{dsl/helper → task_definition/helpers}/vars.rb +40 -19
  152. data/lib/ufo/task_definition/helpers/vpc.rb +48 -0
  153. data/lib/ufo/task_definition/helpers.rb +5 -0
  154. data/lib/ufo/task_definition.rb +19 -0
  155. data/lib/ufo/upgrade/upgrade3.rb +1 -1
  156. data/lib/ufo/upgrade/upgrade4.rb +3 -3
  157. data/lib/ufo/utils/execute.rb +30 -0
  158. data/lib/ufo/utils/logging.rb +7 -0
  159. data/lib/ufo/utils/pretty.rb +18 -0
  160. data/lib/ufo/utils/squeezer.rb +1 -1
  161. data/lib/ufo/utils/sure.rb +23 -0
  162. data/lib/ufo/version.rb +1 -1
  163. data/lib/ufo/yaml/loader.rb +48 -0
  164. data/lib/ufo/yaml/validator.rb +51 -0
  165. data/lib/ufo/yaml.rb +13 -0
  166. data/lib/ufo.rb +12 -2
  167. data/spec/spec_helper.rb +4 -26
  168. data/spec/{lib → ufo}/ecr_auth_spec.rb +0 -0
  169. data/spec/{lib → ufo}/ecr_cleaner_spec.rb +0 -2
  170. data/spec/{lib/role → ufo/iam_role}/builder_spec.rb +5 -5
  171. data/spec/{lib/role → ufo/iam_role}/dsl_spec.rb +3 -3
  172. data/spec/{lib → ufo}/logs_spec.rb +2 -2
  173. data/ufo.gemspec +9 -3
  174. metadata +244 -341
  175. data/.circleci/bin/commit_docs.sh +0 -26
  176. data/.circleci/config.yml +0 -78
  177. data/.gitmodules +0 -0
  178. data/docs/.gitignore +0 -5
  179. data/docs/CNAME +0 -1
  180. data/docs/Gemfile +0 -4
  181. data/docs/LICENSE +0 -21
  182. data/docs/README.md +0 -20
  183. data/docs/_config.yml +0 -75
  184. data/docs/_docs/aws-ecs-task-execution-role.md +0 -28
  185. data/docs/_docs/conventions.md +0 -47
  186. data/docs/_docs/extras/codebuild-iam-role.md +0 -46
  187. data/docs/_docs/extras/dockerfile-erb.md +0 -60
  188. data/docs/_docs/extras/ecs-network-mode.md +0 -37
  189. data/docs/_docs/extras/load-balancer.md +0 -83
  190. data/docs/_docs/extras/minimal-deploy-iam.md +0 -79
  191. data/docs/_docs/extras/notification-arns.md +0 -21
  192. data/docs/_docs/extras/redirection-support.md +0 -27
  193. data/docs/_docs/extras/route53-support.md +0 -27
  194. data/docs/_docs/extras/security-groups.md +0 -36
  195. data/docs/_docs/extras/ssl-support.md +0 -20
  196. data/docs/_docs/faq.md +0 -100
  197. data/docs/_docs/fargate.md +0 -5
  198. data/docs/_docs/helpers.md +0 -24
  199. data/docs/_docs/iam-roles.md +0 -112
  200. data/docs/_docs/install.md +0 -25
  201. data/docs/_docs/more/auto-completion.md +0 -24
  202. data/docs/_docs/more/automated-cleanup.md +0 -14
  203. data/docs/_docs/more/customize-cloudformation.md +0 -35
  204. data/docs/_docs/more/migrations.md +0 -25
  205. data/docs/_docs/more/run-in-pieces.md +0 -30
  206. data/docs/_docs/more/single-task.md +0 -25
  207. data/docs/_docs/more/stuck-cloudformation.md +0 -29
  208. data/docs/_docs/more/why-cloudformation.md +0 -21
  209. data/docs/_docs/next-steps.md +0 -16
  210. data/docs/_docs/quick-start-ec2.md +0 -86
  211. data/docs/_docs/secrets.md +0 -135
  212. data/docs/_docs/settings/aws_profile.md +0 -36
  213. data/docs/_docs/settings/cfn.md +0 -12
  214. data/docs/_docs/settings/cluster.md +0 -66
  215. data/docs/_docs/settings/manage-security-groups.md +0 -24
  216. data/docs/_docs/settings/network.md +0 -45
  217. data/docs/_docs/settings.md +0 -55
  218. data/docs/_docs/ssl_errors.md +0 -40
  219. data/docs/_docs/structure.md +0 -41
  220. data/docs/_docs/tutorial-ufo-docker-build.md +0 -61
  221. data/docs/_docs/tutorial-ufo-init.md +0 -86
  222. data/docs/_docs/tutorial-ufo-ship.md +0 -95
  223. data/docs/_docs/tutorial-ufo-ships.md +0 -38
  224. data/docs/_docs/tutorial-ufo-tasks-build.md +0 -177
  225. data/docs/_docs/tutorial.md +0 -14
  226. data/docs/_docs/ufo-current.md +0 -49
  227. data/docs/_docs/ufo-env-extra.md +0 -22
  228. data/docs/_docs/ufo-env.md +0 -46
  229. data/docs/_docs/ufo-logs.md +0 -49
  230. data/docs/_docs/ufo-task-params.md +0 -43
  231. data/docs/_docs/ufo-tasks-register.md +0 -21
  232. data/docs/_docs/upgrading/upgrade4.5.md +0 -52
  233. data/docs/_docs/upgrading/upgrade4.md +0 -48
  234. data/docs/_docs/upgrading/upgrade5.md +0 -19
  235. data/docs/_docs/upgrading.md +0 -13
  236. data/docs/_docs/variables.md +0 -55
  237. data/docs/_includes/about.html +0 -19
  238. data/docs/_includes/banner/foot.html +0 -2
  239. data/docs/_includes/banner/head.html +0 -5
  240. data/docs/_includes/cfn-customize.md +0 -53
  241. data/docs/_includes/commands.html +0 -80
  242. data/docs/_includes/contact.html +0 -17
  243. data/docs/_includes/contact_disqus.html +0 -16
  244. data/docs/_includes/contact_static.html +0 -17
  245. data/docs/_includes/content.html +0 -26
  246. data/docs/_includes/css/bootstrap.min.css +0 -7
  247. data/docs/_includes/css/main.css +0 -501
  248. data/docs/_includes/css/quotes.css +0 -102
  249. data/docs/_includes/css/syntax.css +0 -65
  250. data/docs/_includes/css/table.css +0 -53
  251. data/docs/_includes/css/timeline.css +0 -201
  252. data/docs/_includes/css/ufo.css +0 -218
  253. data/docs/_includes/edit-on-github.html +0 -11
  254. data/docs/_includes/example.html +0 -63
  255. data/docs/_includes/footer.html +0 -44
  256. data/docs/_includes/google_analytics.html +0 -10
  257. data/docs/_includes/head.html +0 -32
  258. data/docs/_includes/header.html +0 -15
  259. data/docs/_includes/js.html +0 -32
  260. data/docs/_includes/js_disqus.html +0 -21
  261. data/docs/_includes/modals.html +0 -40
  262. data/docs/_includes/nav.html +0 -27
  263. data/docs/_includes/prev_next.md +0 -19
  264. data/docs/_includes/quotes.html +0 -19
  265. data/docs/_includes/reference.md +0 -5
  266. data/docs/_includes/repo_push_access.md +0 -11
  267. data/docs/_includes/subnav.html +0 -78
  268. data/docs/_includes/summary.html +0 -22
  269. data/docs/_includes/ufo-ship-options.md +0 -12
  270. data/docs/_includes/uses.html +0 -19
  271. data/docs/_layouts/default.html +0 -13
  272. data/docs/_layouts/style.css +0 -6
  273. data/docs/_reference/ufo-apps.md +0 -37
  274. data/docs/_reference/ufo-cancel.md +0 -24
  275. data/docs/_reference/ufo-completion.md +0 -46
  276. data/docs/_reference/ufo-completion_script.md +0 -27
  277. data/docs/_reference/ufo-current.md +0 -93
  278. data/docs/_reference/ufo-deploy.md +0 -76
  279. data/docs/_reference/ufo-destroy.md +0 -36
  280. data/docs/_reference/ufo-docker-base.md +0 -71
  281. data/docs/_reference/ufo-docker-build.md +0 -91
  282. data/docs/_reference/ufo-docker-clean.md +0 -44
  283. data/docs/_reference/ufo-docker-compile.md +0 -19
  284. data/docs/_reference/ufo-docker-help.md +0 -15
  285. data/docs/_reference/ufo-docker-name.md +0 -37
  286. data/docs/_reference/ufo-docker-push.md +0 -49
  287. data/docs/_reference/ufo-docker.md +0 -38
  288. data/docs/_reference/ufo-init.md +0 -125
  289. data/docs/_reference/ufo-logs.md +0 -40
  290. data/docs/_reference/ufo-network-help.md +0 -15
  291. data/docs/_reference/ufo-network-init.md +0 -39
  292. data/docs/_reference/ufo-network.md +0 -26
  293. data/docs/_reference/ufo-ps.md +0 -56
  294. data/docs/_reference/ufo-releases.md +0 -40
  295. data/docs/_reference/ufo-resources.md +0 -44
  296. data/docs/_reference/ufo-rollback.md +0 -61
  297. data/docs/_reference/ufo-scale.md +0 -50
  298. data/docs/_reference/ufo-ship.md +0 -129
  299. data/docs/_reference/ufo-ships.md +0 -68
  300. data/docs/_reference/ufo-status.md +0 -23
  301. data/docs/_reference/ufo-stop.md +0 -31
  302. data/docs/_reference/ufo-task.md +0 -56
  303. data/docs/_reference/ufo-tasks-build.md +0 -178
  304. data/docs/_reference/ufo-tasks-help.md +0 -15
  305. data/docs/_reference/ufo-tasks-register.md +0 -29
  306. data/docs/_reference/ufo-tasks.md +0 -35
  307. data/docs/_reference/ufo-upgrade-help.md +0 -15
  308. data/docs/_reference/ufo-upgrade-v2to3.md +0 -15
  309. data/docs/_reference/ufo-upgrade-v33to34.md +0 -15
  310. data/docs/_reference/ufo-upgrade-v3to4.md +0 -27
  311. data/docs/_reference/ufo-upgrade-v43to45.md +0 -15
  312. data/docs/_reference/ufo-upgrade.md +0 -29
  313. data/docs/_reference/ufo-version.md +0 -23
  314. data/docs/articles.md +0 -14
  315. data/docs/bin/web +0 -4
  316. data/docs/css/font-awesome/css/font-awesome.css +0 -1566
  317. data/docs/css/font-awesome/css/font-awesome.min.css +0 -4
  318. data/docs/css/font-awesome/fonts/FontAwesome.otf +0 -0
  319. data/docs/css/font-awesome/fonts/fontawesome-webfont.eot +0 -0
  320. data/docs/css/font-awesome/fonts/fontawesome-webfont.svg +0 -504
  321. data/docs/css/font-awesome/fonts/fontawesome-webfont.ttf +0 -0
  322. data/docs/css/font-awesome/fonts/fontawesome-webfont.woff +0 -0
  323. data/docs/docs.md +0 -29
  324. data/docs/img/docs/cloudformation-resources.png +0 -0
  325. data/docs/img/logos/boltops-logo-full.png +0 -0
  326. data/docs/img/logos/boltops-logo.png +0 -0
  327. data/docs/img/logos/ufo-logo-2.png +0 -0
  328. data/docs/img/logos/ufo-logo.png +0 -0
  329. data/docs/img/logos/ufo-site-header.png +0 -0
  330. data/docs/img/logos/ufo.jpg +0 -0
  331. data/docs/img/tutorials/ecs-console-task-definitions.png +0 -0
  332. data/docs/img/tutorials/ecs-console-ufo-ship.png +0 -0
  333. data/docs/img/tutorials/ecs-console-ufo-ships.png +0 -0
  334. data/docs/index.html +0 -10
  335. data/docs/js/bootstrap.js +0 -2114
  336. data/docs/js/bootstrap.min.js +0 -6
  337. data/docs/js/cbpAnimatedHeader.js +0 -44
  338. data/docs/js/cbpAnimatedHeader.min.js +0 -11
  339. data/docs/js/classie.js +0 -80
  340. data/docs/js/contact_me.js +0 -70
  341. data/docs/js/contact_me_static.js +0 -23
  342. data/docs/js/freelancer.js +0 -37
  343. data/docs/js/jqBootstrapValidation.js +0 -912
  344. data/docs/js/jquery-1.11.0.js +0 -4
  345. data/docs/js/jquery.easing.min.js +0 -44
  346. data/docs/js/nav.js +0 -53
  347. data/docs/quick-start.md +0 -133
  348. data/docs/reference.md +0 -29
  349. data/docs/style.css +0 -3
  350. data/docs/utils/ssl-doctor.rb +0 -89
  351. data/docs/utils/test-aws-api-access.rb +0 -11
  352. data/docs/utils/update-cert-chains.sh +0 -11
  353. data/lib/template/.env +0 -3
  354. data/lib/template/.secrets +0 -5
  355. data/lib/template/.ufo/iam_roles/execution_role.rb +0 -7
  356. data/lib/template/.ufo/iam_roles/task_role.rb +0 -21
  357. data/lib/template/.ufo/params.yml.tt +0 -27
  358. data/lib/template/.ufo/settings/cfn/default.yml.tt +0 -72
  359. data/lib/template/.ufo/settings/network/default.yml.tt +0 -26
  360. data/lib/template/.ufo/settings.yml.tt +0 -26
  361. data/lib/template/.ufo/task_definitions.rb.tt +0 -61
  362. data/lib/template/.ufo/templates/fargate.json.erb +0 -39
  363. data/lib/template/.ufo/templates/main.json.erb +0 -43
  364. data/lib/template/.ufo/variables/base.rb.tt +0 -19
  365. data/lib/template/.ufo/variables/development.rb +0 -8
  366. data/lib/template/.ufo/variables/production.rb +0 -7
  367. data/lib/template/Dockerfile +0 -15
  368. data/lib/template/bin/deploy.tt +0 -7
  369. data/lib/ufo/apps/cfn_map.rb +0 -70
  370. data/lib/ufo/apps/cluster.rb +0 -24
  371. data/lib/ufo/apps/service.rb +0 -56
  372. data/lib/ufo/apps.rb +0 -56
  373. data/lib/ufo/aws_service.rb +0 -36
  374. data/lib/ufo/base.rb +0 -35
  375. data/lib/ufo/cancel.rb +0 -23
  376. data/lib/ufo/current.rb +0 -104
  377. data/lib/ufo/default/settings.yml +0 -24
  378. data/lib/ufo/default/templates/main.json.erb +0 -39
  379. data/lib/ufo/destroy.rb +0 -41
  380. data/lib/ufo/docker/variables.rb +0 -26
  381. data/lib/ufo/dsl/helper.rb +0 -79
  382. data/lib/ufo/dsl/outputter.rb +0 -43
  383. data/lib/ufo/dsl/task_definition.rb +0 -108
  384. data/lib/ufo/dsl.rb +0 -96
  385. data/lib/ufo/help/apps.md +0 -12
  386. data/lib/ufo/help/balancer.md +0 -3
  387. data/lib/ufo/help/completions.md +0 -16
  388. data/lib/ufo/help/completions_script.md +0 -1
  389. data/lib/ufo/help/current.md +0 -65
  390. data/lib/ufo/help/deploy.md +0 -38
  391. data/lib/ufo/help/destroy.md +0 -9
  392. data/lib/ufo/help/docker/base.md +0 -49
  393. data/lib/ufo/help/docker/name.md +0 -16
  394. data/lib/ufo/help/docker.md +0 -6
  395. data/lib/ufo/help/init.md +0 -91
  396. data/lib/ufo/help/network/init.md +0 -13
  397. data/lib/ufo/help/ps.md +0 -27
  398. data/lib/ufo/help/releases.md +0 -16
  399. data/lib/ufo/help/resources.md +0 -20
  400. data/lib/ufo/help/rollback.md +0 -35
  401. data/lib/ufo/help/scale.md +0 -26
  402. data/lib/ufo/help/ship.md +0 -95
  403. data/lib/ufo/help/ships.md +0 -35
  404. data/lib/ufo/help/stop.md +0 -7
  405. data/lib/ufo/help/task.md +0 -27
  406. data/lib/ufo/help/tasks/build.md +0 -158
  407. data/lib/ufo/help/tasks/register.md +0 -14
  408. data/lib/ufo/help/tasks.md +0 -7
  409. data/lib/ufo/help/upgrade/v3to4.md +0 -3
  410. data/lib/ufo/help.rb +0 -9
  411. data/lib/ufo/init.rb +0 -119
  412. data/lib/ufo/network/fetch.rb +0 -48
  413. data/lib/ufo/network/helper.rb +0 -23
  414. data/lib/ufo/network/init.rb +0 -26
  415. data/lib/ufo/network.rb +0 -21
  416. data/lib/ufo/ps.rb +0 -129
  417. data/lib/ufo/scale.rb +0 -28
  418. data/lib/ufo/setting/profile.rb +0 -44
  419. data/lib/ufo/setting/security_groups.rb +0 -22
  420. data/lib/ufo/setting.rb +0 -75
  421. data/lib/ufo/settings.rb +0 -20
  422. data/lib/ufo/ship.rb +0 -103
  423. data/lib/ufo/stack/builder/conditions.rb +0 -23
  424. data/lib/ufo/stack/builder/parameters.rb +0 -45
  425. data/lib/ufo/stack/builder/resources/base.rb +0 -4
  426. data/lib/ufo/stack/builder/resources/dns.rb +0 -17
  427. data/lib/ufo/stack/builder/resources/elb.rb +0 -45
  428. data/lib/ufo/stack/builder/resources/listener.rb +0 -42
  429. data/lib/ufo/stack/builder/resources/listener_ssl.rb +0 -16
  430. data/lib/ufo/stack/builder/resources/roles/base.rb +0 -22
  431. data/lib/ufo/stack/builder/resources/roles/execution_role.rb +0 -4
  432. data/lib/ufo/stack/builder/resources/roles/task_role.rb +0 -4
  433. data/lib/ufo/stack/builder/resources/security_group/base.rb +0 -4
  434. data/lib/ufo/stack/builder/resources.rb +0 -20
  435. data/lib/ufo/stack/builder.rb +0 -26
  436. data/lib/ufo/stack/context.rb +0 -253
  437. data/lib/ufo/stack/helper.rb +0 -55
  438. data/lib/ufo/stack/template_body.rb +0 -13
  439. data/lib/ufo/stack.rb +0 -213
  440. data/lib/ufo/status.rb +0 -56
  441. data/lib/ufo/stop.rb +0 -49
  442. data/lib/ufo/task.rb +0 -225
  443. data/lib/ufo/tasks/builder.rb +0 -40
  444. data/lib/ufo/tasks/register.rb +0 -90
  445. data/lib/ufo/template_scope.rb +0 -57
  446. data/lib/ufo/util.rb +0 -69
  447. data/spec/lib/apps_spec.rb +0 -20
  448. data/spec/lib/builder_spec.rb +0 -23
  449. data/spec/lib/cli_spec.rb +0 -73
  450. data/spec/lib/completion_spec.rb +0 -18
  451. data/spec/lib/ps_spec.rb +0 -14
  452. data/spec/lib/register_spec.rb +0 -49
  453. data/spec/lib/setting_spec.rb +0 -18
  454. data/spec/lib/ship_spec.rb +0 -46
  455. data/spec/lib/stack/status_spec.rb +0 -76
  456. data/spec/lib/stop_spec.rb +0 -13
  457. data/spec/lib/task_spec.rb +0 -54
data/lib/ufo/task.rb DELETED
@@ -1,225 +0,0 @@
1
- module Ufo
2
- class Task < Base
3
- extend Memoist
4
-
5
- include AwsService
6
- include Ufo::Settings
7
- include Util
8
-
9
- def initialize(task_definition, options)
10
- @task_definition = task_definition
11
- @options = options
12
- # Assume task_definition is the same name as the ecs service name
13
- @cluster = @options[:cluster] || default_cluster(task_definition)
14
- end
15
-
16
- def run
17
- puts "Running task_definition: #{@task_definition}".color(:green) unless @options[:mute]
18
- return if @options[:noop]
19
-
20
- task_options = {
21
- cluster: @cluster,
22
- task_definition: @task_definition
23
- }
24
- task_options = adjust_fargate_options(task_options)
25
- task_options = task_options.merge(user_params[:run_task] || {})
26
- task_options = adjust_security_groups(task_options)
27
-
28
- if @options[:command]
29
- task_options.merge!(overrides: overrides)
30
- puts "Running task with container overrides."
31
- puts "Command: #{command_in_human_readable_form}"
32
- end
33
-
34
- unless @options[:mute]
35
- puts "Running task with params:"
36
- display_params(task_options)
37
- end
38
-
39
- ensure_log_group_exist
40
-
41
- resp = run_task(task_options)
42
- exit_if_failures!(resp)
43
- unless @options[:mute]
44
- task_arn = resp.tasks[0].task_arn
45
- puts "Task ARN: #{task_arn}"
46
- puts " aws ecs describe-tasks --tasks #{task_arn} --cluster #{@cluster}"
47
- cloudwatch_info(task_arn)
48
- end
49
- end
50
-
51
- def ensure_log_group_exist
52
- LogGroup.new(@task_definition, @options).create
53
- end
54
-
55
- # Pretty hard to produce this edge case. Happens when:
56
- # launch_type: EC2
57
- # network_mode: awsvpc
58
- # assign_public_ip: DISABLED
59
- def exit_if_failures!(resp)
60
- return if resp[:failures].nil? || resp[:failures].empty?
61
-
62
- puts "There was a failure running the ECS task.".color(:red)
63
- puts "This might be happen if you have a network_mode of awsvpc and have assigned_public_ip to DISABLED."
64
- puts "This cryptic error also shows up if the network settings have security groups and subnets that are not in the same vpc as the ECS cluster container instances. Please double check that."
65
- puts "You can use this command to quickly reconfigure the network settings:"
66
- puts " ufo network init --vpc-id XXX."
67
- puts "More details on the can be found under the 'Task Networking Considerations' section at: "
68
- puts "https://docs.aws.amazon.com/AmazonECS/latest/developerguide/task-networking.html"
69
- puts "Original response with failures:"
70
- pp resp
71
- exit 1
72
- end
73
-
74
- def run_task(options)
75
- puts "Equivalent aws cli command:"
76
- puts " aws ecs run-task --cluster #{@cluster} --task-definition #{options[:task_definition]}".color(:green)
77
- run_task_result = ecs.run_task(options)
78
- if @options[:wait]
79
- task_arn = run_task_result.tasks[0].task_arn
80
- raise SystemExit, exit_status_of_task(task_arn)
81
- else
82
- run_task_result
83
- end
84
- rescue Aws::ECS::Errors::ClientException => e
85
- if e.message =~ /ECS was unable to assume the role/
86
- puts "ERROR: #{e.class} #{e.message}".color(:red)
87
- puts "Please double check the executionRoleArn in your task definition."
88
- exit 1
89
- else
90
- raise
91
- end
92
- rescue Aws::ECS::Errors::InvalidParameterException => e
93
- if e.message =~ /Network Configuration must be provided when networkMode 'awsvpc' is specified/
94
- puts "ERROR: #{e.class} #{e.message}".color(:red)
95
- puts "Please double check .ufo/params.yml and make sure that network_configuration is set."
96
- puts "Or run change the task definition template in .ufo/templates so it does not use vpcmode."
97
- exit 1
98
- else
99
- raise
100
- end
101
- end
102
-
103
- private
104
- # adjust network_configuration based on fargate and network mode of awsvpc
105
- def adjust_fargate_options(options)
106
- task_def = recent_task_definition
107
- return options unless task_def[:network_mode] == "awsvpc"
108
-
109
- awsvpc_conf = { subnets: network[:ecs_subnets] }
110
- if task_def[:requires_compatibilities] == ["FARGATE"]
111
- awsvpc_conf[:assign_public_ip] = "ENABLED"
112
- options[:launch_type] = "FARGATE"
113
- end
114
-
115
- options[:network_configuration] = { awsvpc_configuration: awsvpc_conf }
116
- options
117
- end
118
-
119
- # Ensures at least 1 security group is assigned if awsvpc_configuration
120
- # is provided.
121
- def adjust_security_groups(options)
122
- return options unless options[:network_configuration] &&
123
- options[:network_configuration][:awsvpc_configuration]
124
-
125
- awsvpc_conf = options[:network_configuration][:awsvpc_configuration]
126
-
127
- security_groups = awsvpc_conf[:security_groups]
128
- if [nil, '', 'nil'].include?(security_groups)
129
- security_groups = []
130
- end
131
- if security_groups.empty?
132
- fetch = Network::Fetch.new(network[:vpc])
133
- sg = fetch.security_group_id
134
- security_groups << sg
135
- security_groups.uniq!
136
- end
137
-
138
- # override security groups
139
- options[:network_configuration][:awsvpc_configuration][:security_groups] = security_groups
140
- options
141
- end
142
-
143
- def cloudwatch_info(task_arn)
144
- config = container_definition[:log_configuration]
145
- container_name = container_definition[:name]
146
-
147
- return unless config && config[:log_driver] == "awslogs"
148
-
149
- log_group = config[:options]["awslogs-group"]
150
- log_stream_prefix = config[:options]["awslogs-stream-prefix"]
151
- task_id = task_arn.split('/').last
152
- log_stream = "#{log_stream_prefix}/#{container_name}/#{task_id}"
153
- # website/web/d473440a-9a0e-4262-a53d-f9e345cf2b7e
154
- region = `aws configure get region`.strip rescue 'us-east-1'
155
- url = "https://#{region}.console.aws.amazon.com/cloudwatch/home?region=#{region}#logEventViewer:group=#{log_group};stream=#{log_stream}"
156
-
157
- puts "To see the task output visit CloudWatch:\n #{url}"
158
- puts "NOTE: It will take some time for the log to show up because it takes time for the task to start. Run the `aws ecs describe-tasks` above for the task status."
159
- end
160
-
161
- # only using the overrides to override the container command
162
- def overrides
163
- command = @options[:command] # Thor parser ensure this is always an array
164
- {
165
- container_overrides: [
166
- {
167
- name: container_definition[:name],
168
- command: command,
169
- environment: container_definition[:environment],
170
- },
171
- ]
172
- }
173
- end
174
-
175
- # Usually most recent task definition.
176
- # If user has specified task_definition with specific version like
177
- # demo-web:8
178
- # Then it'll be that exact task definnition.
179
- def recent_task_definition
180
- arns = task_definition_arns(@task_definition)
181
- # "arn:aws:ecs:us-east-1:<aws_account_id>:task-definition/wordpress:6",
182
- last_definition_arn = arns.first
183
- # puts "last_definition_arn #{last_definition_arn}"
184
- task_name = last_definition_arn.split("/").last
185
- resp = ecs.describe_task_definition(task_definition: task_name)
186
-
187
- resp.task_definition
188
- end
189
- memoize :recent_task_definition
190
-
191
- # container definition from the most recent task definition
192
- def container_definition
193
- recent_task_definition.container_definitions[0].to_h
194
- end
195
-
196
- def exit_status_of_task(task_arn)
197
- waiter_max_attempts = @options[:timeout] / 5
198
- waiter_delay = 5 # seconds long polling.
199
-
200
- print "Waiting for task to complete."
201
- ecs.wait_until(:tasks_stopped, { cluster: @cluster, tasks: [task_arn] }) do |waiter|
202
- waiter.before_wait { print '.' }
203
- waiter.delay = waiter_delay
204
- waiter.max_attempts = waiter_max_attempts
205
- end
206
- puts
207
- container = ecs.describe_tasks(cluster: @cluster, tasks: [task_arn]).tasks[0].containers[0]
208
-
209
- if container.exit_code.nil?
210
- puts "Command failed!".color(:red)
211
- puts "Reason: #{container.reason}"
212
- 1
213
- else
214
- container.exit_code
215
- end
216
- rescue Aws::Waiters::Errors::WaiterFailed
217
- puts "It took longer than #{options[:timeout]} seconds to run #{command_in_human_readable_form} (#{task_arn})"
218
- exit 1
219
- end
220
-
221
- def command_in_human_readable_form
222
- @options[:command].join(' ')
223
- end
224
- end
225
- end
@@ -1,40 +0,0 @@
1
- module Ufo
2
- class Tasks::Builder
3
- # ship: build and registers task definitions together
4
- def self.ship(task_definition, options)
5
- # When handling task definitions in with the ship command and class, we always want to
6
- # build and register task definitions. There is little point of running them independently
7
- # This method helps us do that.
8
- build(options)
9
- end
10
-
11
- # ship: build and registers task definitions together
12
- def self.build(options)
13
- Tasks::Builder.new(options).build
14
- end
15
-
16
- def initialize(options={})
17
- @options = options
18
- end
19
-
20
- def build
21
- puts "Building Task Definitions...".color(:green) unless @options[:mute]
22
- check_templates_definitions_path
23
- dsl = DSL.new(template_definitions_path, @options.merge(quiet: false, mute: true))
24
- dsl.run
25
- puts "Task Definitions built in .ufo/output" unless @options[:mute]
26
- end
27
-
28
- def check_templates_definitions_path
29
- unless File.exist?(template_definitions_path)
30
- pretty_path = template_definitions_path.sub("#{Ufo.root}/", '')
31
- puts "ERROR: #{pretty_path} does not exist. Run: `ufo init` to create a starter file" unless @options[:mute]
32
- exit 1
33
- end
34
- end
35
-
36
- def template_definitions_path
37
- "#{Ufo.root}/.ufo/task_definitions.rb"
38
- end
39
- end
40
- end
@@ -1,90 +0,0 @@
1
- require 'plissken' # Hash#to_snake_keys
2
- require 'json'
3
-
4
- module Ufo
5
- class Tasks::Register
6
- include Util
7
- include AwsService
8
-
9
- def self.register(task_name, options={})
10
- Dir.glob("#{Ufo.root}/.ufo/output/*").each do |path|
11
- if task_name == :all or path.include?(task_name)
12
- task_register = Tasks::Register.new(path, options)
13
- task_register.register
14
- end
15
- end
16
- end
17
-
18
- def initialize(template_definition_path, options={})
19
- @template_definition_path = template_definition_path
20
- @options = options
21
- end
22
-
23
- # aws ecs register-task-definition --cli-input-json file://.ufo/output/demo-web-prod.json
24
- def register
25
- data = JSON.parse(IO.read(@template_definition_path))
26
- data = rubyize_format(data)
27
-
28
- message = "#{data[:family]} task definition registered."
29
- if @options[:noop]
30
- message = "NOOP: #{message}"
31
- else
32
- register_task_definition(data)
33
- end
34
-
35
- unless @options[:mute]
36
- puts "Equivalent aws cli command:"
37
- file_path = "file://#{@template_definition_path.sub(/^\.\//,'')}"
38
- puts " aws ecs register-task-definition --cli-input-json #{file_path}".color(:green)
39
- puts message
40
- end
41
- end
42
-
43
- def register_task_definition(data)
44
- if ENV["UFO_SHOW_REGISTER_TASK_DEFINITION"]
45
- puts "Registering task definition with:"
46
- display_params(data)
47
- end
48
-
49
- ecs.register_task_definition(data)
50
- rescue Aws::ECS::Errors::ClientException => e
51
- if e.message =~ /No Fargate configuration exists for given values/
52
- puts "ERROR: #{e.message}".color(:red)
53
- puts "Configured values are: cpu #{data[:cpu]} memory #{data[:memory]}"
54
- puts "Check that the cpu and memory values are a supported combination by Fargate."
55
- puts "More info: https://docs.aws.amazon.com/AmazonECS/latest/developerguide/task-cpu-memory-error.html"
56
- exit 1
57
- else
58
- raise
59
- end
60
- end
61
-
62
- # The ruby aws-sdk expects symbols for keys and AWS docs for the task
63
- # definition uses json camelCase for the keys. This method transforms
64
- # the keys to the expected ruby aws-sdk format.
65
- #
66
- # One quirk is that the logConfiguration options casing should not be
67
- # transformed.
68
- def rubyize_format(original_data)
69
- data = original_data.to_snake_keys.deep_symbolize_keys
70
-
71
- definitions = data[:container_definitions]
72
- definitions.each_with_index do |definition, i|
73
- next unless definition[:log_configuration] || definition[:firelens_configuration]
74
- { log_configuration: 'logConfiguration',
75
- firelens_configuration: 'firelensConfiguration' }.each_pair do |key, value|
76
-
77
- next unless definition.dig(key, :options)
78
-
79
- # LogConfiguration and firelensConfiguration options do not get transformed and
80
- # keep their original structure:
81
- # https://docs.aws.amazon.com/sdk-for-ruby/v3/api/Aws/ECS/Types/ContainerDefinition.html
82
- original_definition = original_data["containerDefinitions"][i]
83
- definition[key][:options] = original_definition[value]["options"]
84
- end
85
- end
86
-
87
- data
88
- end
89
- end
90
- end
@@ -1,57 +0,0 @@
1
- module Ufo
2
- class TemplateScope
3
- extend Memoist
4
- include Ufo::Settings
5
-
6
- attr_reader :helper
7
- attr_reader :task_definition_name
8
- def initialize(helper=nil, task_definition_name=nil)
9
- @helper = helper
10
- @task_definition_name = task_definition_name # only available from task_definition
11
- # not available from params
12
- load_variables_file("base")
13
- load_variables_file(Ufo.env)
14
- end
15
-
16
- # Load the variables defined in ufo/variables/* to make available in the
17
- # template blocks in ufo/templates/*.
18
- #
19
- # Example:
20
- #
21
- # `ufo/variables/base.rb`:
22
- # @name = "docker-process-name"
23
- # @image = "docker-image-name"
24
- #
25
- # `ufo/templates/main.json.erb`:
26
- # {
27
- # "containerDefinitions": [
28
- # {
29
- # "name": "<%= @name %>",
30
- # "image": "<%= @image %>",
31
- # ....
32
- # }
33
- #
34
- # NOTE: Only able to make instance variables avaialble with instance_eval
35
- # Wasnt able to make local variables available.
36
- def load_variables_file(filename)
37
- path = "#{Ufo.root}/.ufo/variables/#{filename}.rb"
38
- instance_eval(IO.read(path), path) if File.exist?(path)
39
- end
40
-
41
- # Add additional instance variables to template_scope
42
- def assign_instance_variables(vars)
43
- vars.each do |k,v|
44
- instance_variable_set("@#{k}".to_sym, v)
45
- end
46
- end
47
-
48
- def pretty_name?
49
- # env variable takes highest precedence
50
- if ENV["STATIC_NAME"]
51
- ENV["STATIC_NAME"] != "0"
52
- else
53
- settings[:pretty_name]
54
- end
55
- end
56
- end
57
- end
data/lib/ufo/util.rb DELETED
@@ -1,69 +0,0 @@
1
- require 'active_support/core_ext/hash'
2
-
3
- module Ufo
4
- module Util
5
- # The default cluster normally defaults to the Ufo.env value.
6
- # But it can be overriden by ufo/settings.yml cluster
7
- #
8
- # More info: http://ufoships.com/docs/settings/
9
- def default_cluster(service)
10
- # to_s.to_sym in case service is nil
11
- settings.dig(:service_cluster, service.to_s.to_sym) ||
12
- settings[:cluster] ||
13
- Ufo.env
14
- end
15
-
16
- # Keys are strings for simplicity.
17
- def settings
18
- @settings ||= Ufo.settings
19
- end
20
-
21
- # Custom user params from .ufo/params.yml
22
- # Param keys are symbols for the aws-sdk calls.
23
- def user_params
24
- @user_params ||= Param.new.data
25
- end
26
-
27
- def execute(command, local_options={})
28
- if @options[:noop] && !local_options[:live]
29
- say "NOOP: #{command}"
30
- result = true # always success with no noop for specs
31
- else
32
- if local_options[:use_system]
33
- result = system(command)
34
- else
35
- result = `#{command}`
36
- end
37
- end
38
- result
39
- end
40
-
41
- # http://stackoverflow.com/questions/4175733/convert-duration-to-hoursminutesseconds-or-similar-in-rails-3-or-ruby
42
- def pretty_time(total_seconds)
43
- minutes = (total_seconds / 60) % 60
44
- seconds = total_seconds % 60
45
- if total_seconds < 60
46
- "#{seconds.to_i}s"
47
- else
48
- "#{minutes.to_i}m #{seconds.to_i}s"
49
- end
50
- end
51
-
52
- def display_params(options)
53
- puts YAML.dump(options.deep_stringify_keys)
54
- end
55
-
56
- def task_definition_arns(service, max_items=10)
57
- resp = ecs.list_task_definitions(
58
- family_prefix: service,
59
- sort: "DESC",
60
- )
61
- arns = resp.task_definition_arns
62
- arns = arns.select do |arn|
63
- task_definition = arn.split('/').last.split(':').first
64
- task_definition == service
65
- end
66
- arns[0..max_items]
67
- end
68
- end
69
- end
@@ -1,20 +0,0 @@
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
@@ -1,23 +0,0 @@
1
- describe Ufo::Docker::Builder do
2
- before(:all) do
3
- create_ufo_project
4
- end
5
-
6
- let(:builder) { Ufo::Docker::Builder.new }
7
-
8
- context "dockerfile uses ecr image for FROM instruction" do
9
- it "updates the auth token before building the image" do
10
- # builder.from_ecr_image?("spec/fixtures/dockerfiles/dockerhub/Dockerfile")
11
- names = builder.ecr_image_names("spec/fixtures/dockerfiles/ecr/Dockerfile")
12
- expect(names).not_to be_empty
13
- end
14
- end
15
-
16
- context "dockerfile uses dockerhub image for FROM instruction" do
17
- it "does not update the auth token before building the image" do
18
- # builder.from_ecr_image?("spec/fixtures/dockerfiles/dockerhub/Dockerfile")
19
- names = builder.ecr_image_names("spec/fixtures/dockerfiles/dockerhub/Dockerfile")
20
- expect(names).to be_empty
21
- end
22
- end
23
- end
data/spec/lib/cli_spec.rb DELETED
@@ -1,73 +0,0 @@
1
- describe Ufo::CLI do
2
- before(:all) do
3
- create_ufo_project
4
- @args = "--noop"
5
- end
6
-
7
- describe "ufo" do
8
- context "docker" do
9
- it "build builds image" do
10
- out = execute("exe/ufo docker build #{@args}")
11
- expect(out).to include("docker build -t tongueroo/demo-ufo")
12
- end
13
-
14
- it "tag shows the tag" do
15
- out = execute("exe/ufo docker name #{@args}")
16
- expect(out).to match(%r{tongueroo/demo-ufo:ufo-.{7}})
17
- end
18
-
19
- it "compiles Dockerfile from Dockerfile.erb" do
20
- FileUtils.cp("spec/fixtures/dockerfiles/Dockerfile.erb", "#{Ufo.root}/Dockerfile.erb")
21
- out = execute("exe/ufo docker compile #{@args}")
22
- expect(out).to include("Compiled Dockerfile.erb to Dockerfile")
23
- end
24
- end
25
-
26
- context "tasks" do
27
- before(:each) do
28
- FileUtils.mkdir_p("#{Ufo.root}/.ufo/data/")
29
- FileUtils.touch("#{Ufo.root}/.ufo/data/docker_image_name_ufo.txt")
30
- end
31
- after(:each) do
32
- FileUtils.rm_f("#{Ufo.root}/.ufo/data/docker_image_name_ufo.txt")
33
- end
34
-
35
- it "build builds task definition" do
36
- out = execute("exe/ufo tasks build #{@args}")
37
- expect(out).to include("Task Definitions built")
38
- end
39
-
40
- it "register it registers all the output task definitions" do
41
- out = execute("exe/ufo tasks register #{@args}")
42
- expect(out).to include("register")
43
- end
44
- end
45
-
46
- context "ship" do
47
- it "deploys software" do
48
- out = execute("exe/ufo ship demo-web-prod #{@args} --no-wait")
49
- # cannot look for Software shipped! because
50
- # ship.deploy unless ENV['TEST'] # to allow me to quickly test CLI portion only
51
- # just testing the CLI portion. The ship class itself is tested via ship_spec.rb
52
- expect(out).to include("Task Definitions built")
53
- end
54
- end
55
-
56
- context "ships" do
57
- it "deploys software to multiple services" do
58
- out = execute("exe/ufo ships demo-web-prod demo-worker-prod #{@args} --no-wait")
59
- # cannot look for Software shipped! because
60
- # ship.deploy unless ENV['TEST'] # to allow me to quickly test CLI portion only
61
- # just testing the CLI portion. The ship class itself is tested via ship_spec.rb
62
- expect(out).to include("Task Definitions built")
63
- end
64
- end
65
-
66
- context "task" do
67
- it "runs one time task" do
68
- out = execute("exe/ufo completion ship name")
69
- expect(out).to include("--help")
70
- end
71
- end
72
- end
73
- end
@@ -1,18 +0,0 @@
1
- describe Ufo::CLI do
2
- describe "ufo completion" do
3
- commands = {
4
- "ship" => "service",
5
- "ship service" => "--task",
6
- "docker" => "build",
7
- "docker build" => "--push",
8
- "docker clean" => "image_name",
9
- "init" => "--image",
10
- }
11
- commands.each do |command, expected_word|
12
- it "#{command}" do
13
- out = execute("exe/ufo completion #{command}")
14
- expect(out).to include(expected_word) # only checking for one word for simplicity
15
- end
16
- end
17
- end
18
- end
data/spec/lib/ps_spec.rb DELETED
@@ -1,14 +0,0 @@
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(:task_arns) do
8
- JSON.load(IO.read("spec/fixtures/ps/describe_tasks.json"))["tasks"]
9
- end
10
- it "display_tasks" do
11
- ps.display_tasks(task_arns)
12
- end
13
- end
14
- end
@@ -1,49 +0,0 @@
1
- describe Ufo::Tasks::Register do
2
- before(:all) do
3
- create_ufo_project
4
- end
5
-
6
- let(:register) { Ufo::Tasks::Register.new("fake_task_definition_path") }
7
-
8
- context "syslog" do
9
- let(:data) do
10
- {
11
- "containerDefinitions" => [{
12
- "logConfiguration" => {
13
- "logDriver" => "syslog"
14
- }
15
- }]
16
- }
17
- end
18
-
19
- it "#rubyize_format" do
20
- result = register.rubyize_format(data)
21
- driver = result[:container_definitions][0][:log_configuration][:log_driver]
22
- expect(driver).to eq "syslog"
23
- end
24
- end
25
-
26
- context "awslogs" do
27
- let(:data) do
28
- {
29
- "containerDefinitions" => [{
30
- "logConfiguration" => {
31
- "logDriver" => "awslogs",
32
- "options" => {
33
- "awslogs-group" => "mygroup",
34
- "awslogs-region" => "us-east-1",
35
- "awslogs-stream-prefix" => "mystream"
36
- }
37
- }
38
- }]
39
- }
40
- end
41
-
42
- it "rubyize_format" do
43
- result = register.rubyize_format(data)
44
- log_configuration = result[:container_definitions][0][:log_configuration]
45
- expect(log_configuration[:log_driver]).to eq "awslogs"
46
- expect(log_configuration[:options].keys).to include("awslogs-group")
47
- end
48
- end
49
- end