dapp 0.10.2 → 0.36.24

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (287) hide show
  1. checksums.yaml +5 -5
  2. data/bin/dapp +77 -15
  3. data/config/en/common.yml +20 -11
  4. data/config/en/net_status.yml +108 -27
  5. data/lib/dapp/cli/cli.rb +1 -0
  6. data/lib/dapp/cli/command/base.rb +111 -0
  7. data/lib/dapp/cli/command/sample/base.rb +28 -0
  8. data/lib/dapp/cli/command/sample/create.rb +24 -0
  9. data/lib/dapp/cli/command/sample/list.rb +25 -0
  10. data/lib/dapp/cli/command/sample.rb +20 -0
  11. data/lib/dapp/cli/command/slug.rb +26 -0
  12. data/lib/dapp/cli/command/update.rb +65 -0
  13. data/lib/dapp/cli/options/ssh.rb +18 -0
  14. data/lib/dapp/cli/options/tag.rb +51 -0
  15. data/lib/dapp/cli.rb +11 -3
  16. data/lib/dapp/config/config.rb +21 -0
  17. data/lib/dapp/config/directive/base.rb +100 -3
  18. data/lib/dapp/core_ext/hash.rb +14 -0
  19. data/lib/dapp/core_ext/pathname.rb +6 -4
  20. data/lib/dapp/dapp/chef.rb +1 -9
  21. data/lib/dapp/dapp/command/common.rb +24 -0
  22. data/lib/dapp/dapp/command/sample/common.rb +54 -0
  23. data/lib/dapp/dapp/command/sample/create.rb +57 -0
  24. data/lib/dapp/dapp/command/sample/list.rb +13 -0
  25. data/lib/dapp/dapp/command/slug.rb +11 -0
  26. data/lib/dapp/dapp/dapp_config.rb +85 -0
  27. data/lib/dapp/dapp/dappfile.rb +108 -27
  28. data/lib/dapp/dapp/deps/base.rb +9 -32
  29. data/lib/dapp/dapp/deps/common.rb +26 -0
  30. data/lib/dapp/dapp/deps/gitartifact.rb +2 -20
  31. data/lib/dapp/dapp/deps/toolchain.rb +11 -0
  32. data/lib/dapp/dapp/git_artifact.rb +6 -4
  33. data/lib/dapp/dapp/lock.rb +6 -5
  34. data/lib/dapp/dapp/logging/base.rb +32 -20
  35. data/lib/dapp/dapp/logging/i18n.rb +5 -1
  36. data/lib/dapp/dapp/logging/process.rb +6 -6
  37. data/lib/dapp/dapp/option_tags.rb +98 -0
  38. data/lib/dapp/dapp/ruby2go.rb +130 -0
  39. data/lib/dapp/dapp/sentry.rb +97 -0
  40. data/lib/dapp/dapp/shellout/base.rb +26 -18
  41. data/lib/dapp/dapp/shellout/streaming.rb +2 -2
  42. data/lib/dapp/dapp/slug.rb +12 -0
  43. data/lib/dapp/dapp/ssh_agent.rb +25 -7
  44. data/lib/dapp/dapp.rb +192 -41
  45. data/lib/dapp/deployment.rb +1 -0
  46. data/lib/dapp/dimg/artifact.rb +12 -4
  47. data/lib/dapp/dimg/build/stage/artifact_base.rb +26 -30
  48. data/lib/dapp/dimg/build/stage/artifact_default.rb +50 -28
  49. data/lib/dapp/dimg/build/stage/base.rb +187 -52
  50. data/lib/dapp/dimg/build/stage/before_install.rb +4 -15
  51. data/lib/dapp/dimg/build/stage/before_install_artifact.rb +4 -0
  52. data/lib/dapp/dimg/build/stage/before_setup.rb +1 -20
  53. data/lib/dapp/dimg/build/stage/build_artifact.rb +1 -20
  54. data/lib/dapp/dimg/build/stage/docker_instructions.rb +5 -4
  55. data/lib/dapp/dimg/build/stage/from.rb +62 -9
  56. data/lib/dapp/dimg/build/stage/ga_archive.rb +14 -1
  57. data/lib/dapp/dimg/build/stage/ga_artifact_patch.rb +1 -5
  58. data/lib/dapp/dimg/build/stage/ga_base.rb +5 -35
  59. data/lib/dapp/dimg/build/stage/ga_latest_patch.rb +15 -34
  60. data/lib/dapp/dimg/build/stage/ga_related_base.rb +21 -0
  61. data/lib/dapp/dimg/build/stage/import_artifact.rb +22 -11
  62. data/lib/dapp/dimg/build/stage/install/ga_post_install_patch.rb +6 -2
  63. data/lib/dapp/dimg/build/stage/install/ga_pre_install_patch.rb +6 -2
  64. data/lib/dapp/dimg/build/stage/install/install.rb +1 -19
  65. data/lib/dapp/dimg/build/stage/instructions.rb +27 -0
  66. data/lib/dapp/dimg/build/stage/mod/group.rb +19 -7
  67. data/lib/dapp/dimg/build/stage/mod/logging.rb +15 -19
  68. data/lib/dapp/dimg/build/stage/setup/ga_post_setup_patch.rb +24 -1
  69. data/lib/dapp/dimg/build/stage/setup/ga_pre_setup_patch.rb +6 -2
  70. data/lib/dapp/dimg/build/stage/setup/setup.rb +1 -19
  71. data/lib/dapp/dimg/builder/ansible.rb +5 -0
  72. data/lib/dapp/dimg/builder/chef/cookbook.rb +8 -8
  73. data/lib/dapp/dimg/builder/chef.rb +29 -16
  74. data/lib/dapp/dimg/builder/none.rb +1 -34
  75. data/lib/dapp/dimg/builder/ruby2go.rb +57 -0
  76. data/lib/dapp/dimg/builder/shell.rb +1 -20
  77. data/lib/dapp/dimg/cli/cli.rb +2 -1
  78. data/lib/dapp/dimg/cli/command/base.rb +24 -0
  79. data/lib/dapp/dimg/cli/command/dimg/bp.rb +60 -0
  80. data/lib/dapp/dimg/cli/command/dimg/build.rb +43 -0
  81. data/lib/dapp/dimg/cli/{build_context → command/dimg/build_context}/export.rb +9 -4
  82. data/lib/dapp/dimg/cli/{build_context → command/dimg/build_context}/import.rb +4 -4
  83. data/lib/dapp/dimg/cli/{build_context.rb → command/dimg/build_context.rb} +5 -5
  84. data/lib/dapp/dimg/cli/{cleanup.rb → command/dimg/cleanup.rb} +4 -6
  85. data/lib/dapp/dimg/cli/command/dimg/cleanup_repo.rb +47 -0
  86. data/lib/dapp/dimg/cli/command/dimg/flush_local.rb +24 -0
  87. data/lib/dapp/dimg/cli/command/dimg/flush_repo.rb +36 -0
  88. data/lib/dapp/dimg/cli/{list.rb → command/dimg/list.rb} +6 -3
  89. data/lib/dapp/dimg/cli/{mrproper.rb → command/dimg/mrproper.rb} +4 -4
  90. data/lib/dapp/dimg/cli/command/dimg/push.rb +39 -0
  91. data/lib/dapp/dimg/cli/{run.rb → command/dimg/run.rb} +30 -15
  92. data/lib/dapp/dimg/cli/{spush.rb → command/dimg/spush.rb} +4 -4
  93. data/lib/dapp/dimg/cli/{stage_image.rb → command/dimg/stage_image.rb} +12 -3
  94. data/lib/dapp/dimg/cli/command/dimg/stages/base.rb +13 -0
  95. data/lib/dapp/dimg/cli/{stages → command/dimg/stages}/cleanup_local.rb +13 -9
  96. data/lib/dapp/dimg/cli/{stages → command/dimg/stages}/cleanup_repo.rb +6 -8
  97. data/lib/dapp/dimg/cli/command/dimg/stages/flush_local.rb +21 -0
  98. data/lib/dapp/dimg/cli/command/dimg/stages/flush_repo.rb +28 -0
  99. data/lib/dapp/dimg/cli/command/dimg/stages/pull.rb +34 -0
  100. data/lib/dapp/dimg/cli/command/dimg/stages/push.rb +30 -0
  101. data/lib/dapp/dimg/cli/command/dimg/stages.rb +22 -0
  102. data/lib/dapp/dimg/cli/command/dimg/tag.rb +24 -0
  103. data/lib/dapp/dimg/cli/command/dimg.rb +31 -0
  104. data/lib/dapp/dimg/cli/options/introspection.rb +45 -0
  105. data/lib/dapp/dimg/config/config.rb +24 -0
  106. data/lib/dapp/dimg/config/directive/artifact.rb +13 -15
  107. data/lib/dapp/dimg/config/directive/artifact_base.rb +13 -8
  108. data/lib/dapp/dimg/config/directive/artifact_dimg.rb +12 -0
  109. data/lib/dapp/dimg/config/directive/artifact_group.rb +60 -0
  110. data/lib/dapp/dimg/config/directive/dimg/instance_methods.rb +203 -0
  111. data/lib/dapp/dimg/config/directive/dimg/validation.rb +217 -0
  112. data/lib/dapp/dimg/config/directive/dimg.rb +36 -0
  113. data/lib/dapp/dimg/config/directive/dimg_group.rb +73 -0
  114. data/lib/dapp/dimg/config/directive/dimg_group_base.rb +46 -0
  115. data/lib/dapp/dimg/config/directive/docker/artifact.rb +5 -0
  116. data/lib/dapp/dimg/config/directive/docker/base.rb +2 -3
  117. data/lib/dapp/dimg/config/directive/docker/dimg.rb +4 -4
  118. data/lib/dapp/dimg/config/directive/git_artifact_local.rb +24 -5
  119. data/lib/dapp/dimg/config/directive/git_artifact_remote.rb +23 -12
  120. data/lib/dapp/dimg/config/directive/mount.rb +11 -3
  121. data/lib/dapp/dimg/config/directive/shell/dimg.rb +2 -2
  122. data/lib/dapp/dimg/dapp/command/bp.rb +3 -5
  123. data/lib/dapp/dimg/dapp/command/build.rb +4 -6
  124. data/lib/dapp/dimg/dapp/command/build_context/common.rb +2 -2
  125. data/lib/dapp/dimg/dapp/command/build_context/export.rb +14 -14
  126. data/lib/dapp/dimg/dapp/command/build_context/import.rb +28 -23
  127. data/lib/dapp/dimg/dapp/command/cleanup.rb +4 -11
  128. data/lib/dapp/dimg/dapp/command/cleanup_repo.rb +143 -0
  129. data/lib/dapp/dimg/dapp/command/common.rb +148 -38
  130. data/lib/dapp/dimg/dapp/command/flush_local.rb +25 -0
  131. data/lib/dapp/dimg/dapp/command/flush_repo.rb +25 -0
  132. data/lib/dapp/dimg/dapp/command/list.rb +1 -1
  133. data/lib/dapp/dimg/dapp/command/mrproper.rb +16 -63
  134. data/lib/dapp/dimg/dapp/command/push.rb +11 -16
  135. data/lib/dapp/dimg/dapp/command/ruby2go_cleanup.rb +48 -0
  136. data/lib/dapp/dimg/dapp/command/run.rb +4 -4
  137. data/lib/dapp/dimg/dapp/command/spush.rb +4 -5
  138. data/lib/dapp/dimg/dapp/command/stage_image.rb +2 -2
  139. data/lib/dapp/dimg/dapp/command/stages/cleanup_local.rb +13 -115
  140. data/lib/dapp/dimg/dapp/command/stages/cleanup_repo.rb +23 -102
  141. data/lib/dapp/dimg/dapp/command/stages/common.rb +57 -39
  142. data/lib/dapp/dimg/dapp/command/stages/flush_local.rb +13 -7
  143. data/lib/dapp/dimg/dapp/command/stages/flush_repo.rb +14 -8
  144. data/lib/dapp/dimg/dapp/command/stages/pull.rb +4 -13
  145. data/lib/dapp/dimg/dapp/command/stages/push.rb +4 -9
  146. data/lib/dapp/dimg/dapp/command/tag.rb +4 -6
  147. data/lib/dapp/dimg/dapp/config_artifact_group.rb +20 -0
  148. data/lib/dapp/dimg/dapp/dapp.rb +40 -0
  149. data/lib/dapp/dimg/dapp/dappfile.rb +43 -0
  150. data/lib/dapp/dimg/dapp/dimg.rb +41 -0
  151. data/lib/dapp/dimg/dimg/git_artifact.rb +25 -11
  152. data/lib/dapp/dimg/dimg/path.rb +7 -9
  153. data/lib/dapp/dimg/dimg/stages.rb +27 -15
  154. data/lib/dapp/dimg/dimg.rb +172 -69
  155. data/lib/dapp/dimg/docker_registry/base.rb +31 -74
  156. data/lib/dapp/dimg/docker_registry/dimg.rb +55 -0
  157. data/lib/dapp/dimg/docker_registry.rb +5 -23
  158. data/lib/dapp/dimg/error/build.rb +1 -1
  159. data/lib/dapp/dimg/error/chef.rb +1 -5
  160. data/lib/dapp/dimg/error/{command.rb → default.rb} +1 -1
  161. data/lib/dapp/dimg/error/dimg.rb +1 -1
  162. data/lib/dapp/dimg/error/lock.rb +1 -1
  163. data/lib/dapp/dimg/error/registry.rb +1 -1
  164. data/lib/dapp/dimg/error/rugged.rb +1 -1
  165. data/lib/dapp/dimg/error/tar_writer.rb +1 -1
  166. data/lib/dapp/dimg/git_artifact.rb +195 -179
  167. data/lib/dapp/dimg/git_repo/base.rb +49 -45
  168. data/lib/dapp/dimg/git_repo/local.rb +45 -0
  169. data/lib/dapp/dimg/git_repo/own.rb +3 -31
  170. data/lib/dapp/dimg/git_repo/remote.rb +65 -26
  171. data/lib/dapp/dimg/image/argument.rb +15 -50
  172. data/lib/dapp/dimg/image/dimg.rb +15 -0
  173. data/lib/dapp/dimg/image/scratch.rb +35 -9
  174. data/lib/dapp/dimg/image/stage.rb +223 -44
  175. data/lib/dapp/dimg/lock/file.rb +4 -4
  176. data/lib/dapp/downloader.rb +117 -0
  177. data/lib/dapp/error/base.rb +1 -5
  178. data/lib/dapp/error/command.rb +5 -0
  179. data/lib/dapp/error/config.rb +5 -0
  180. data/lib/dapp/error/dapp.rb +1 -1
  181. data/lib/dapp/error/dappfile.rb +1 -1
  182. data/lib/dapp/error/default.rb +11 -0
  183. data/lib/dapp/error/mod/user.rb +11 -0
  184. data/lib/dapp/error/shellout.rb +1 -1
  185. data/lib/dapp/exception/base.rb +1 -1
  186. data/lib/dapp/helper/case_conversion.rb +17 -0
  187. data/lib/dapp/helper/cli.rb +18 -7
  188. data/lib/dapp/helper/net_status.rb +5 -1
  189. data/lib/dapp/helper/sha256.rb +1 -1
  190. data/lib/dapp/helper/tar.rb +31 -0
  191. data/lib/dapp/helper/trivia.rb +40 -1
  192. data/lib/dapp/helper/url.rb +23 -0
  193. data/lib/dapp/helper/yaml.rb +24 -0
  194. data/lib/dapp/kube/cli/cli.rb +1 -0
  195. data/lib/dapp/kube/cli/command/base.rb +14 -0
  196. data/lib/dapp/kube/cli/command/kube/chart_create.rb +19 -0
  197. data/lib/dapp/kube/cli/command/kube/deploy.rb +80 -0
  198. data/lib/dapp/kube/cli/command/kube/dismiss.rb +31 -0
  199. data/lib/dapp/kube/cli/command/kube/lint.rb +53 -0
  200. data/lib/dapp/kube/cli/command/kube/minikube_setup.rb +19 -0
  201. data/lib/dapp/kube/cli/command/kube/render.rb +63 -0
  202. data/lib/dapp/kube/cli/command/kube/secret_edit.rb +30 -0
  203. data/lib/dapp/kube/cli/command/kube/secret_extract.rb +39 -0
  204. data/lib/dapp/kube/cli/command/kube/secret_generate.rb +34 -0
  205. data/lib/dapp/kube/cli/command/kube/secret_key_generate.rb +16 -0
  206. data/lib/dapp/kube/cli/command/kube/secret_regenerate.rb +29 -0
  207. data/lib/dapp/kube/cli/command/kube/value_get.rb +47 -0
  208. data/lib/dapp/kube/cli/command/kube.rb +28 -0
  209. data/lib/dapp/kube/dapp/command/chart_create.rb +103 -0
  210. data/lib/dapp/kube/dapp/command/common.rb +379 -0
  211. data/lib/dapp/kube/dapp/command/deploy.rb +351 -0
  212. data/lib/dapp/kube/dapp/command/dismiss.rb +50 -0
  213. data/lib/dapp/kube/dapp/command/lint.rb +69 -0
  214. data/lib/dapp/kube/dapp/command/minikube_setup.rb +402 -0
  215. data/lib/dapp/kube/dapp/command/render.rb +54 -0
  216. data/lib/dapp/kube/dapp/command/ruby2go.rb +17 -0
  217. data/lib/dapp/kube/dapp/command/secret_edit.rb +21 -0
  218. data/lib/dapp/kube/dapp/command/secret_extract.rb +17 -0
  219. data/lib/dapp/kube/dapp/command/secret_generate.rb +21 -0
  220. data/lib/dapp/kube/dapp/command/secret_key_generate.rb +13 -0
  221. data/lib/dapp/kube/dapp/command/secret_regenerate.rb +13 -0
  222. data/lib/dapp/kube/dapp/command/value_get.rb +32 -0
  223. data/lib/dapp/kube/dapp/dapp.rb +26 -0
  224. data/lib/dapp/kube/error/default.rb +7 -0
  225. data/lib/dapp/kube/helm/release.rb +189 -0
  226. data/lib/dapp/kube/helm/values.rb +148 -0
  227. data/lib/dapp/kube/helm.rb +5 -0
  228. data/lib/dapp/kube/kubernetes/client/error.rb +43 -0
  229. data/lib/dapp/kube/kubernetes/client/resource/base.rb +33 -0
  230. data/lib/dapp/kube/kubernetes/client/resource/deployment.rb +11 -0
  231. data/lib/dapp/kube/kubernetes/client/resource/event.rb +8 -0
  232. data/lib/dapp/kube/kubernetes/client/resource/job.rb +27 -0
  233. data/lib/dapp/kube/kubernetes/client/resource/pod.rb +62 -0
  234. data/lib/dapp/kube/kubernetes/client/resource/replicaset.rb +8 -0
  235. data/lib/dapp/kube/kubernetes/client.rb +314 -0
  236. data/lib/dapp/kube/kubernetes/config.rb +132 -0
  237. data/lib/dapp/kube/kubernetes/error.rb +15 -0
  238. data/lib/dapp/kube/kubernetes/manager/base.rb +15 -0
  239. data/lib/dapp/kube/kubernetes/manager/container.rb +103 -0
  240. data/lib/dapp/kube/kubernetes/manager/deployment.rb +212 -0
  241. data/lib/dapp/kube/kubernetes/manager/job.rb +65 -0
  242. data/lib/dapp/kube/kubernetes/manager/pod.rb +69 -0
  243. data/lib/dapp/kube/kubernetes.rb +6 -0
  244. data/lib/dapp/kube/secret.rb +93 -0
  245. data/lib/dapp/kube.rb +1 -0
  246. data/lib/dapp/version.rb +2 -2
  247. data/lib/dapp.rb +155 -61
  248. metadata +208 -61
  249. data/lib/dapp/cli/base.rb +0 -63
  250. data/lib/dapp/config/base.rb +0 -54
  251. data/lib/dapp/config/error/config.rb +0 -7
  252. data/lib/dapp/dimg/build/stage/ga_archive_dependencies.rb +0 -27
  253. data/lib/dapp/dimg/build/stage/ga_dependencies_base.rb +0 -20
  254. data/lib/dapp/dimg/build/stage/install/ga_post_install_patch_dependencies.rb +0 -22
  255. data/lib/dapp/dimg/build/stage/install/ga_pre_install_patch_dependencies.rb +0 -22
  256. data/lib/dapp/dimg/build/stage/mod/git_artifact_dependencies.rb +0 -23
  257. data/lib/dapp/dimg/build/stage/setup/ga_post_setup_patch_dependencies.rb +0 -32
  258. data/lib/dapp/dimg/build/stage/setup/ga_pre_setup_patch_dependencies.rb +0 -22
  259. data/lib/dapp/dimg/cli/base.rb +0 -16
  260. data/lib/dapp/dimg/cli/bp.rb +0 -37
  261. data/lib/dapp/dimg/cli/build.rb +0 -64
  262. data/lib/dapp/dimg/cli/dimg.rb +0 -30
  263. data/lib/dapp/dimg/cli/push.rb +0 -61
  264. data/lib/dapp/dimg/cli/stages/flush_local.rb +0 -23
  265. data/lib/dapp/dimg/cli/stages/flush_repo.rb +0 -24
  266. data/lib/dapp/dimg/cli/stages/pull.rb +0 -28
  267. data/lib/dapp/dimg/cli/stages/push.rb +0 -24
  268. data/lib/dapp/dimg/cli/stages.rb +0 -22
  269. data/lib/dapp/dimg/cli/tag.rb +0 -24
  270. data/lib/dapp/dimg/config/artifact_dimg.rb +0 -17
  271. data/lib/dapp/dimg/config/artifact_group.rb +0 -43
  272. data/lib/dapp/dimg/config/base.rb +0 -7
  273. data/lib/dapp/dimg/config/dimg/instance_methods.rb +0 -179
  274. data/lib/dapp/dimg/config/dimg/validation.rb +0 -126
  275. data/lib/dapp/dimg/config/dimg.rb +0 -24
  276. data/lib/dapp/dimg/config/dimg_group.rb +0 -61
  277. data/lib/dapp/dimg/config/dimg_group_base.rb +0 -54
  278. data/lib/dapp/dimg/config/dimg_group_main.rb +0 -22
  279. data/lib/dapp/dimg/dapp/command.rb +0 -21
  280. data/lib/dapp/dimg/dimg/tags.rb +0 -65
  281. data/lib/dapp/dimg/docker_registry/base/authorization.rb +0 -63
  282. data/lib/dapp/dimg/docker_registry/base/request.rb +0 -34
  283. data/lib/dapp/dimg/docker_registry/default.rb +0 -18
  284. data/lib/dapp/dimg/error/base.rb +0 -7
  285. data/lib/dapp/dimg/error/config.rb +0 -7
  286. data/lib/dapp/dimg/exception/introspect_image.rb +0 -7
  287. data/lib/dapp/dimg/image/docker.rb +0 -134
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
- SHA1:
3
- metadata.gz: c1c1c851ed5f27bd25dd4b3cf8bc1b27431fe81c
4
- data.tar.gz: 32d35c1a530a102622ad85129d74d790a5711e4b
2
+ SHA256:
3
+ metadata.gz: fb3c04c23382f99fd239a31cccabb9c40482edb8d639b4c3b1298024fee76f3c
4
+ data.tar.gz: 31ea9dd57ff7a002251142b00b9060a641757b1dbedc2f8400f3f8bf31e3c7b7
5
5
  SHA512:
6
- metadata.gz: 1ed7f72ee220ac672365bd00b5a1bc2b62ea10132816439b627c5df61a1297f66b7e008410bcf5f23257ee5e6e845a9c54f0361c79607c5c99faea352ba0c523
7
- data.tar.gz: 495cf5dc364223895564aa19c99a6590cfe58a44f0a6c492c04aabd35c8111601cc49ac8a7ef8a20f27c96d519227706f57e4796dd701c9d33d40761ae4b5fee
6
+ metadata.gz: d476052e9a3a5c579a62e2551b2f9179f5903ab220024d2376ebd1a88e90e5a001d4ef829410a59962a5e62790a2cf2a997355283a993ac117308ad960991075
7
+ data.tar.gz: 5408f406fba37919e941fc5c5ebf9b8be6c3e7f9f8cc442cf5d11a64c459bb8b10403a7eeb306f50050e1176242f149e6fece9d67e5b56595f46e531c75ebe9c
data/bin/dapp CHANGED
@@ -5,20 +5,74 @@
5
5
  require 'rubygems'
6
6
  require 'dapp'
7
7
 
8
- def check_docker_version
9
- required_docker_version = '1.10.0'
10
- if Gem::Version.new(required_docker_version) >= Gem::Version.new(`docker --version`[/(\d+\.)+\d+/])
11
- $stderr.puts(Dapp::Dapp.paint_string("Required docker version: >= #{required_docker_version}!", :warning))
12
- exit 1
8
+ Thread.abort_on_exception = true
9
+
10
+ def get_process_parent_pid(pid)
11
+ path = File.join("/proc", pid.to_s, "status")
12
+ if File.exists? path
13
+ ppid_line = File.read(path).lines.find {|line| line.split("\t").first == "PPid:"}
14
+ ppid = ppid_line.strip.split("\t").last.to_i
15
+
16
+ # zero is nil
17
+ ppid if ppid != 0
13
18
  end
14
- rescue Errno::ENOENT => e
15
- $stderr.puts(Dapp::Dapp.paint_string(e.message, :warning))
16
- exit 1
17
19
  end
18
20
 
19
- begin
20
- check_docker_version
21
+ def process_alive?(pid)
22
+ begin
23
+ Process.kill(0, pid)
24
+ true
25
+ rescue ::Errno::EPERM
26
+ true
27
+ rescue ::Errno::ESRCH
28
+ # no such process
29
+ false
30
+ end
31
+ end
32
+
33
+ def get_parents
34
+ pid = Process.pid
35
+ parents = []
36
+
37
+ loop do
38
+ ppid = get_process_parent_pid(pid)
39
+ break unless ppid
40
+ parents << ppid
41
+ pid = ppid
42
+ end
43
+
44
+ parents
45
+ end
46
+
47
+ def set_gitlab_cancel_handler
48
+ parents_pids = get_parents
49
+
50
+ Thread.new do
51
+ loop do
52
+ cancelled = false
53
+
54
+ parents_pids.each do |pid|
55
+ if not process_alive? pid
56
+ home_dir = (ENV["DAPP_HOME"] || File.join(ENV["HOME"], ".dapp"))
57
+ File.open(File.join(home_dir, ".killed_pids"), "a") do |file|
58
+ file.write "#{Process.pid}\n"
59
+ end
21
60
 
61
+ Process.kill("INT", Process.pid)
62
+ cancelled = true
63
+ end
64
+ end
65
+
66
+ break if cancelled
67
+
68
+ sleep 1
69
+ end
70
+ end
71
+ end
72
+
73
+ set_gitlab_cancel_handler if ENV["GITLAB_CI"]
74
+
75
+ begin
22
76
  begin
23
77
  begin
24
78
  Dapp::CLI.new.run
@@ -29,8 +83,8 @@ begin
29
83
 
30
84
  raise
31
85
  end
32
- rescue ::SystemExit
33
- raise
86
+ rescue ::SystemExit then raise
87
+ rescue Errno::EPIPE then nil
34
88
  rescue ::Exception => e
35
89
  "/tmp/dapp-stacktrace-#{SecureRandom.uuid}.out".tap do |filename|
36
90
  ::File.open(filename, 'w') do |dapp_stacktrace|
@@ -39,14 +93,22 @@ begin
39
93
  $stderr.puts "\033[1m\033[90mStacktrace dumped to #{filename}\033[0m"
40
94
  end
41
95
 
96
+ if Dapp::CLI.dapp_object
97
+ Dapp::CLI.dapp_object.sentry_exception(e)
98
+ end
99
+
42
100
  raise
43
101
  end
44
102
  rescue Dapp::Error::Shellout => e
45
103
  $stderr.puts(Dapp::Helper::NetStatus.message(e))
46
104
  exit 1
47
- rescue Dapp::Error::Base, NetStatus::Exception => e
48
- $stderr.puts(Dapp::Dapp.paint_string(Dapp::Helper::NetStatus.message(e), :warning))
49
- exit 1
105
+ rescue Dapp::Error::Base, Dapp::Dapp::Logging::I18n::I18nError => e
106
+ if e.respond_to?(:user?) && e.user?
107
+ $stderr.puts(Dapp::Dapp.paint_string(Dapp::Helper::NetStatus.message(e), :warning))
108
+ exit 1
109
+ else
110
+ raise
111
+ end
50
112
  rescue Interrupt => _e
51
113
  $stderr.puts(Dapp::Dapp.paint_string('Interrupted', :warning))
52
114
  exit 1
data/config/en/common.yml CHANGED
@@ -13,19 +13,23 @@ en:
13
13
  process:
14
14
  artifact_copy: "copying artifact `%{name}`"
15
15
  artifact_building: "building artifact `%{name}`"
16
- git_artifact_clone: "cloning remote git_artifact `%{name}`"
17
- git_artifact_fetch: "fetching remote git_artifact `%{name}`"
16
+ from_dimg_building: "building from dimg `%{name}`"
17
+ git_artifact_clone: "cloning remote git_artifact `%{url}`"
18
+ git_artifact_fetch: "fetching remote git_artifact `%{url}`"
18
19
  vendoring_builder_cookbooks: 'vendoring builder cookbooks'
19
20
  waiting_resouce_lock: "waiting for locked resource `%{name}`"
20
- gitartifact_container_creating: 'creating dappdeps/gitartifact container'
21
- base_container_creating: 'creating dappdeps/base container'
22
- chefdk_container_creating: 'creating dappdeps/chefdk container'
21
+ gitartifact_container_creating: 'creating dappdeps/gitartifact container `%{name}`'
22
+ toolchain_container_creating: 'creating dappdeps/toolchain container `%{name}`'
23
+ base_container_creating: 'creating dappdeps/base container `%{name}`'
24
+ chefdk_container_creating: 'creating dappdeps/chefdk container `%{name}`'
25
+ ansible_container_creating: 'creating dappdeps/ansible container `%{name}`'
23
26
  image_pull: "pulling image `%{name}`"
24
27
  image_push: "pushing image `%{name}`"
25
28
  image_save: "saving image `%{name}`"
26
29
  status:
27
30
  process:
28
31
  pushing: '[PUSHING]'
32
+ exporting: '[EXPORTING]'
29
33
  pulling: '[PULLING]'
30
34
  building: '[BUILDING]'
31
35
  default: '[RUNNING]'
@@ -38,11 +42,14 @@ en:
38
42
  state:
39
43
  using_cache: '[USING CACHE]'
40
44
  not_present: '[NOT PRESENT]'
45
+ rebuild: '[REBUILD]'
41
46
  build: '[BUILD]'
42
- empty: '[EMPTY]'
43
47
  push: '[PUSH]'
48
+ export: '[EXPORT]'
44
49
  pull: '[PULL]'
45
50
  tag: '[TAG]'
51
+ exist: '[EXIST]'
52
+ not_exist: '[NOT EXIST]'
46
53
  warning:
47
54
  wrong_using_base_directive: "WARNING: Directive `%{directive}` has declared after dimg_group|dimg|artifact!"
48
55
  wrong_using_directive: "WARNING: Directive `%{directive}` has declared after dimg_group|dimg!"
@@ -54,6 +61,13 @@ en:
54
61
  stage_artifact_rewritten: "WARNING: Artifact stage rewritten from %{conflict_stage} to %{stage}."
55
62
  recipe_does_not_used: "WARNING: Recipe `%{recipe}` doesn't used in any stage."
56
63
  context_archive_not_found: "WARNING: context archive `%{path}` not found!"
64
+ dapp_secret_key_not_found: "WARNING: Secrets haven't decoded: secret key not found in %{not_found_in}!"
65
+ introspect_image_impossible: "WARNING: You can't introspect stage `%{name}`!"
66
+ stage_dependencies_not_found: "WARNING: Stage dependencies `%{dependencies}` haven't been found in repo `%{repo}`!"
67
+ stage_dependencies_file_not_found: "WARNING: Stage dependencies `%{dependencies}` haven't been found in repo `%{repo}`!\nIf you want to consider specific file you should use one of the following git-artifact configuration:\n\n```\ngit:\n- add: /folder/file\n to: /folder/file\n stageDependencies:\n install: ''\n```\n\n```\ngit:\n- add: /folder\n to: /folder\n includePaths: file\n stageDependencies:\n install: file\n```"
68
+ unsupported_dapp_config_options: "WARNING: .dapp_config includes unsupported options [%{options}]: use only following options [%{supported_options}]"
69
+ submodule_mapping_not_found: "WARNING: Repository `%{repo}`: No submodule mapping found in `.gitmodules` for path `%{path}`!"
70
+ submodule_url_scheme_not_detected: "WARNING: Submodule url scheme of `%{url}` not detected: using local repository `%{path}`!"
57
71
  group:
58
72
  install: 'Install group'
59
73
  setup: 'Setup group'
@@ -62,22 +76,17 @@ en:
62
76
  import_artifact: 'Import Artifact'
63
77
  before_install: 'Before install'
64
78
  before_install_artifact: 'Before install artifact'
65
- g_a_archive_dependencies: 'Git artifacts dependencies'
66
79
  g_a_archive: 'Git artifacts: create archive'
67
80
  install:
68
- g_a_pre_install_patch_dependencies: 'Git artifacts dependencies'
69
81
  g_a_pre_install_patch: 'Git artifacts: apply patches (before install)'
70
82
  install: 'Install'
71
- g_a_post_install_patch_dependencies: 'Git artifacts dependencies'
72
83
  g_a_post_install_patch: 'Git artifacts: apply patches (after install)'
73
84
  after_install_artifact: 'After install artifact'
74
85
  before_setup: 'Before setup'
75
86
  before_setup_artifact: 'Before setup artifact'
76
87
  setup:
77
- g_a_pre_setup_patch_dependencies: 'Git artifacts dependencies'
78
88
  g_a_pre_setup_patch: 'Git artifacts: apply patches (before setup)'
79
89
  setup: 'Setup'
80
- g_a_post_setup_patch_dependencies: 'Git artifacts dependencies'
81
90
  g_a_post_setup_patch: 'Git artifacts: apply patches (after setup)'
82
91
  after_setup_artifact: 'After setup artifact'
83
92
  g_a_latest_patch: 'Git artifacts: latest patch'
@@ -5,36 +5,79 @@ en:
5
5
  shell_command_failed: ">>> START STREAM\n%{stream}\n>>> END STREAM"
6
6
  dimg:
7
7
  dimg_not_built: "Dimg hasn't been built yet!"
8
+ dimg_stage_not_built: "Dimg stage `%{stage_name}` hasn't been built yet!"
8
9
  dimg_not_run: "Dimg run failed!"
9
- git_branch_without_name: "Dimg has specific revision that isn't associated with a branch name!"
10
- ci_environment_required: 'CI environment required (Travis or GitLab CI)!'
11
10
  dappfile:
12
11
  incorrect: "Dappfile with `%{error}`:\n%{message}"
13
12
  build:
13
+ ruby2go_image_unexpected_exitstatus: 'ruby2go_image exited with unexpected code `%{status_code}`!'
14
+ ruby2go_image_command_failed: 'ruby2go_image command `%{command}` failed!'
15
+ ruby2go_image_command_failed_unexpected_error: 'ruby2go_image command `%{command}` failed: `%{message}`!'
16
+ ruby2go_builder_command_failed_unexpected_error: 'ruby2go_builder command `%{command}` failed: `%{message}`!'
14
17
  from_image_required: 'Missing from_image!'
15
- image_already_untagged: "Image `%{name}` already untagged!"
16
- image_not_exist: "Image `%{name}` not exist!"
18
+ image_already_untagged: "Image `%{name}` untagged already!"
19
+ image_not_exist: "Image `%{name}` doesn't exist!"
17
20
  built_id_not_defined: '`from.built_id` not defined!'
18
21
  from_image_not_found: 'Image `%{name}` not found!'
19
22
  unsupported_patch_format: "Unsupported patch format:\n\n%{patch}"
20
23
  unsupported_docker_image_size_format: "Unsupported docker image size format `%{value}`"
24
+ export_failed: "Artifact export failed (`%{artifact_name}`): check artifact.export in Dappfile!"
21
25
  command:
22
26
  command_unexpected_dimgs_number: "Command can process only one dimg!\nAmbiguous dimg pattern: `%{dimgs_names}`!"
23
27
  mrproper_required_option: "Expected command option `--improper-dev-mode-cache`, `--improper-cache-version-stages` or `--all`!"
28
+ cleanup_repo_required_option: "Expected command option `--improper-nonexistent-git-tag-branch-commit`!"
24
29
  stages_cleanup_required_option: "Expected command option `--improper-cache-version`, `--improper-git-commit` or `--improper-repo-cache`!"
25
- tag_command_incorrect_tag: "Incorrect tag (`%{name}`) given!"
26
- repo_name_incorrect: "Incorrect repo (`%{name}`) given!"
30
+ repo_name_incorrect: "Incorrect repo name `%{name}` given!"
31
+ image_name_incorrect: "Incorrect image name `%{name}` given!"
32
+ tag_name_incorrect: "Incorrect tag name `%{name}` given!"
27
33
  context_directory_not_found: "Context directory `%{path}` not found!"
28
34
  stored_build_dir_already_exist: "Cannot store current build_dir `%{path}`: restore or delete old build_dir!"
35
+ secret_key_not_found: "Secret key not found in %{not_found_in}!"
36
+ minikube_not_found: "Minikube not found: install minikube (https://github.com/kubernetes/minikube/releases)!"
37
+ minikube_not_started: "Minikube not started!"
38
+ helm_not_found: "Helm not found: install helm (https://github.com/kubernetes/helm/blob/master/docs/install.md)"
39
+ helm_template_plugin_not_installed: "Helm plugin `template` isn't installed: run command `helm plugin install https://github.com/technosophos/helm-template`"
40
+ helm_release_not_exist: "Helm release `%{name}` doesn't exist!"
41
+ no_helm_chart_spec_name: "Bad name `%{name}` in helm chart spec %{path}:\n%{raw_spec}"
42
+ file_not_exist: "File `%{path}` doesn't exist!"
43
+ helm_directory_not_exist: "Helm directory doesn't exist in project!"
44
+ chart_yaml_not_found: "Chart.yaml file `%{path}` not found!"
45
+ values_file_not_found: "Values file `%{path}` not found!"
46
+ secret_file_not_found: "Secret file `%{path}` not found!"
47
+ secret_file_empty: "Secret file `%{path}` can't be empty!"
48
+ incorrect_yaml_structure: "Incorrect YAML structure in `%{path}`!"
49
+ editor_not_found: "Editor not found!"
50
+ expected_only_one_tag: 'Expected only one tag (`%{tags}`)!'
51
+ kube_deploy_timeout: "Deploy timeout!"
52
+ kube_connect_timeout: "Connect timeout when connecting to kube API."
53
+ kube_helm_failed: "Helm failed: %{output}"
54
+ samples_directory_not_exist: "Samples directory `%{path}` not exist in repository `%{url}`!"
55
+ sample_not_exist: "Sample `%{name}` not exist in repository `%{url}` (inside samples directory `%{path}`)!"
56
+ ruby2go_deploy_command_failed: "ruby2go_deploy command `%{command}` failed: `%{message}`!"
29
57
  dapp:
30
58
  no_such_dimg: "No such dimg: `%{dimgs_patterns}`!"
31
- dappfile_not_found: "Dappfile not found!"
32
- cannot_run_ssh_agent: "Cannot run ssh-agent"
33
- ssh_key_not_found: "Ssh key `%{path}` not exist!"
59
+ no_such_app: "No such app: `%{apps_patterns}`!"
60
+ dappfile_not_found: "dappfile.yml, dappfile.yaml or Dappfile not found!"
61
+ cannot_run_ssh_agent: "Can't run ssh-agent!"
62
+ ssh_key_not_found: "Ssh key `%{path}` doesn't exist!"
63
+ docker_not_found: "Docker not found!"
64
+ docker_version: "Required docker version (`%{version}`): VERSION must be newer than `%{min_version}`!"
65
+ dapp_config_file_incorrect: "%{message}"
66
+ yaml_file_incorrect: "Yaml file `%{file}`: `%{message}`"
67
+ yaml_incorrect: "`%{message}`"
68
+ incorrect_dapp_config_option: ".dapp_config includes option `%{option}` with incorrect value `%{value}`: expected one of the following types [%{expected}]"
69
+ incorrect_dapp_config_option_color: ".dapp_config includes option `color` with incorrect value `%{value}`: expected one of the following values [%{expected}]"
70
+ ci_environment_required: 'CI environment required (Travis or GitLab CI)!'
71
+ git_branch_without_name: "Dimg has specific revision that isn't associated with a branch name!"
72
+ download_failed_bad_dappfile_yml_checksum: "Cannot download dappfile-yml binary dependency from %{url}: checksum validation failed"
73
+ ruby2go_download_failed_bad_checksum: "Cannot download `%{progname}` binary dependency from %{url}: checksum validation failed"
74
+ ruby2go_command_unexpected_exitstatus: 'ruby2go `%{progname}` exited with unexpected code `%{status_code}`!'
75
+ ruby2go_dappdeps_command_failed_unexpected_error: 'ruby2go_dappdeps command `%{dappdeps}`/`%{command}` failed: `%{message}`!'
34
76
  config:
35
77
  dimg_name_required: 'Dimg name required!'
36
- dimg_name_incorrect: "Dimg has incorrect name `%{name}`: doesn't match regex `%{reg}`!"
37
- mount_from_required: "Mount: `from` directive required!"
78
+ dimg_name_incorrect: "Dimg has incorrect name `%{value}`: doesn't match regex `%{pattern}`!"
79
+ mount_from_or_from_path_required: "Mount: `from` or `from_path` directive required!"
80
+ mount_duplicate_to: "Duplicate mount point `%{path}`!"
38
81
  export_to_required: "Export: `to` directive required!"
39
82
  add_to_required: "Add: `to` directive required!"
40
83
  export_cwd_absolute_path_required: "Export: given cwd path must be absolute!"
@@ -45,35 +88,73 @@ en:
45
88
  mount_from_absolute_path_required: "Mount: given `from` path must be absolute!"
46
89
  mount_from_type_required: "Mount: `from` directive expect `build_dir` or `tmp_dir` type!"
47
90
  builder_type_conflict: 'Conflict between builder types!'
48
- builder_type_unsupported: "Defined unsupported builder type `%{type}`!"
49
91
  docker_from_incorrect: "`docker.from` has incorrect value `%{name}`!"
50
- docker_from_without_tag: "`docker.from`: image `%{name}` without tag!"
92
+ docker_artifact_unsupported_directive: "`artifact.docker` supports only `from` subdirective!"
51
93
  stage_artifact_not_associated: "Artifact not associated with any stage: expected `before` or `after` attribute!"
52
- stage_artifact_double_associate: "Cannot use `%{stage}` stage for artifact, already used in `%{conflict_stage}` stage!"
94
+ stage_artifact_double_associate: "Can't use `%{stage}` stage for artifact; already used in `%{conflict_stage}` stage!"
53
95
  stage_artifact_not_supported_associated_stage: "Bad artifact stage `%{stage}`!"
54
- git_artifact_remote_unsupported_protocol: "Remote git repo `%{url}`: unsupported protocol!"
55
- git_artifact_remote_branch_with_commit: "Remote git repo: use `commit` or `branch` directive!"
56
- artifact_conflict: "Conflict between artifacts paths!"
96
+ git_artifact_remote_with_refs: "Remote git repo: use `commit`, `tag` or `branch` directive!"
97
+ artifact_conflict: "Conflict between artifacts!\n\n%{dappfile_context}"
98
+ artifact_not_found: "Invalid Dappfile: artifact `%{name}` should be defined before import directive!"
99
+ artifact_already_exists: "Invalid Dappfile: artifact `%{name}` already exists!"
57
100
  scratch_unsupported_directive: "Scratch dimg has unsupported directive `%{directive}`!"
58
101
  scratch_artifact_required: "Scratch dimg without artifacts!"
59
- scratch_artifact_associated: "Scratch artifact cannot be associated: not expected `before`/`after` attribute!"
102
+ scratch_artifact_associated: "Scratch artifact can't be associated: not expected `before`/`after` attribute!"
60
103
  scratch_artifact_docker_from: "Scratch artifact must have directive `docker.from`!"
104
+ unsupported_scale_value: "Define unsupported scale value `%{value}`!"
105
+ app_name_required: 'App name required!'
106
+ app_dimg_not_found: 'Not found dimg `%{dimg}` for app `%{app}`!'
107
+ app_dimg_not_defined: 'Not defined dimg for app `%{app}`!'
108
+ app_bootstrap_dimg_not_defined: "Not defined dimg for app.bootstrap!"
109
+ app_bootstrap_dimg_not_found: "Not found dimg `%{dimg}` for app.bootstrap!"
110
+ app_before_apply_job_dimg_not_defined: "Not defined dimg for app.before_apply_job!"
111
+ app_before_apply_job_dimg_not_found: "Not found dimg `%{dimg}` for app.before_apply_job!"
112
+ unsupported_port_number: "Port number `%{number}` isn't supported!"
113
+ unsupported_target_number: "Target number `%{number}` isn't supported!"
114
+ app_name_incorrect: "App has incorrect name `%{value}`: doesn't match regex `%{pattern}`!"
115
+ namespace_name_incorrect: "Namespace has incorrect name `%{value}`: doesn't match regex `%{pattern}`!"
116
+ deployment_bootstrap_dimg_not_defined: "Not defined dimg for deployment.bootstrap!"
117
+ deployment_bootstrap_dimg_not_found: "Not found dimg `%{dimg}` for deployment.bootstrap!"
118
+ deployment_before_apply_job_dimg_not_defined: "Not defined dimg for deployment.before_apply_job!"
119
+ deployment_before_apply_job_dimg_not_found: "Not found dimg `%{dimg}` for deployment.before_apply_job!"
61
120
  chef:
62
- stage_checksum_not_calculated: "Chef stage `%{stage}` checksum is not calculated yet, run build first"
63
- stage_path_overlap: "Cannot install `%{cookbook}` cookbook's path %{from} into %{to}: already exists"
121
+ stage_checksum_not_calculated: "Chef stage `%{stage}` checksum isn't calculated yet, run build first!"
122
+ stage_path_overlap: "Can't install `%{cookbook}` cookbook's path %{from} into %{to} already exists!"
64
123
  builder_cookbook_not_found: "Dapp cookbook directory not found at %{path}"
65
124
  berksfile_absolute_path_forbidden: "Absolute paths in Berksfile are not allowed (cookbook `%{cookbook}`, path: `%{path}`)"
66
125
  registry:
67
- no_such_dimg: 'Registry `%{registry}`: no such dimg in registry!'
68
- authenticate_type_not_supported: 'Registry `%{registry}`: authenticate type not supported!'
69
- page_not_found: "Registry `%{registry}`: page `%{url}` not found!"
70
- user_not_authorized: 'Registry `%{registry}`: user not authorized!'
126
+ ruby2go_docker_registry_command_failed_unexpected_error: 'ruby2go_docker_registry command `%{command}` failed: `%{message}`!'
71
127
  rugged:
72
128
  git_repository_reference_error: "Git repo `%{name}`: %{message}!"
73
129
  rugged_remote_error: "Remote git repo `%{url}`: `%{message}`!"
74
- local_git_repository_does_not_exist: "Local git repo: doesn't exist!"
75
- commit_not_found_in_local_git_repository: "Local git repo: commit `%{commit}` not found!\nIf commit has been rebased: run command `dapp dimg stages cleanup local --improper-git-commit`!"
130
+ local_git_repository_does_not_exist: "Local git repo (`%{path}`): doesn't exist!"
131
+ commit_not_found_in_local_git_repository: "Local git repo (`%{path}`): commit `%{commit}` not found!\nIf commit has been rebased: run command `dapp dimg stages cleanup local --improper-git-commit`!"
76
132
  commit_not_found_in_remote_git_repository: "Remote git repo `%{url}`: commit `%{commit}` not found!\nIf commit has been rebased: run command `dapp dimg stages cleanup local --improper-git-commit`!"
133
+ git_local_submodule_commit_not_found: "Git repo `%{path}`: submodule commit `%{commit}` not found!"
134
+ git_remote_submodule_commit_not_found: "Git repo `%{url}`: submodule commit `%{commit}` not found!"
77
135
  branch_not_exist_in_remote_git_repository: "Remote git repo `%{url}`: branch `%{branch}` not exist!"
136
+ tag_not_exist_in_remote_git_repository: "Remote git repo `%{url}`: tag `%{tag}` not exist!"
137
+ rugged_protocol_not_supported: "Rugged has been compiled without support for `%{protocol}`.\nGit repositories will not be reachable via `%{protocol}` (`%{url}`).\nRugged.features should include `%{protocol}`."
138
+ git_local_incorrect_gitmodules_params: "Local git repo with invalid `.gitmodules` file: %{error}"
139
+ incorrect_gitmodules_file: "Git repo `%{name}` with invalid `.gitmodules` file: %{error}\n\n%{content}"
140
+ git_repository_without_remote_url: "Git repo `%{name}`: remote url cannot be detected!\nYou should check `remote origin url` in `%{path}` repository."
141
+ git_repository_not_found: "Git repository `%{path}` not found!\nYou should check `remote origin url` in `%{parent_git_path}` repository."
78
142
  lock:
79
- timeout: "Could not obtain lock for `%{name}` within %{timeout} seconds"
143
+ timeout: "Could not obtain lock for `%{name}` within %{timeout} seconds!"
144
+ app:
145
+ namespace_not_found: "App `%{name}`: namespace `%{namespace}` not found!"
146
+ namespace_not_defined: "App `%{name}`: namespace not defined!"
147
+ kubernetes:
148
+ config_not_found: "Kube config not found in: KUBECONFIG, kubectl (through `kubectl config view`), `~/.kube/config`"
149
+ config_file_not_found: "Kube config file `%{config_path}` not found!"
150
+ user_config_not_found: "User's `%{user}` config is not found in config `%{config_path}`"
151
+ cluster_config_not_found: "Cluster's `%{cluster}` config is not found in config `%{config_path}`"
152
+ context_config_not_found: "Context `%{context_name}` is not found in config `%{config_path}`"
153
+ server_connection_refused: "Kube server `%{url}` connection refused: %{error}"
154
+ server_error: "Kube respond with server error code %{response_http_status}, request parameters: `%{request_parameters}`, response: `%{response_raw_body}`"
155
+ container_stuck: "Pod's `%{pod_name}` container `%{container_name}` stuck in %{state} state: %{state_reason}: %{state_message}"
156
+ bad_image: "Pod `%{pod_name}` bad image: %{reason}: %{message}"
157
+ container_crash: "Pod's `%{pod_name}` container crashed: %{reason}: %{message}"
158
+ secret:
159
+ bad_data: "Data `%{data}` can't be decrypted: check encryption key and data!"
160
+ key_length_too_short: "Encryption key isn't valid (required size %{required_size} bytes)!"
@@ -0,0 +1 @@
1
+ ::Dapp::CLI.send(:include, ::Dapp::CLI::Command)
@@ -0,0 +1,111 @@
1
+ module Dapp
2
+ class CLI
3
+ module Command
4
+ class Base < ::Dapp::CLI
5
+ option :dir,
6
+ long: '--dir PATH',
7
+ description: 'Change to directory',
8
+ on: :head
9
+
10
+ option :name,
11
+ long: "--name NAME",
12
+ description: "Use custom dapp name. Chaging default name will cause full cache rebuild. By default dapp name is the last element of remote.origin.url from project git, or it is the name of the directory where Dappfile resides."
13
+
14
+ option :quiet,
15
+ short: '-q',
16
+ long: '--quiet',
17
+ description: 'Suppress logging',
18
+ default: false,
19
+ boolean: true
20
+
21
+ option :verbose,
22
+ long: '--verbose',
23
+ description: 'Enable verbose output',
24
+ default: false,
25
+ boolean: true
26
+
27
+ option :time,
28
+ long: '--time',
29
+ description: 'Enable output with time',
30
+ default: false,
31
+ boolean: true
32
+
33
+ option :ignore_config_warning,
34
+ long: '--ignore-config-sequential-processing-warnings',
35
+ default: false,
36
+ boolean: true
37
+
38
+ option :color,
39
+ long: '--color MODE',
40
+ description: 'Display output in color on the terminal',
41
+ in: %w(auto on off),
42
+ default: 'auto'
43
+
44
+ option :dry_run,
45
+ long: '--dry-run',
46
+ default: false,
47
+ boolean: true
48
+
49
+ option :dev,
50
+ long: '--dev',
51
+ default: false,
52
+ boolean: true
53
+
54
+ def initialize
55
+ self.class.options.merge!(Base.options)
56
+ super()
57
+ end
58
+
59
+ def run_dapp_command(run_method, options: {})
60
+ dapp = ::Dapp::Dapp.new(options: options)
61
+ ::Dapp::CLI.dapp_object = dapp
62
+ dapp.sentry_message("Manual usage: `#{options[:dapp_command]}` command") unless ENV['CI']
63
+
64
+ log_dapp_running_time(dapp) do
65
+ begin
66
+ if block_given?
67
+ yield dapp
68
+ elsif !run_method.nil?
69
+ dapp.public_send(run_method)
70
+ end
71
+ ensure
72
+ dapp.terminate
73
+ end
74
+ end
75
+ end
76
+
77
+ def run_method
78
+ class_to_lowercase
79
+ end
80
+
81
+ def log_dapp_running_time(dapp)
82
+ return yield unless log_running_time
83
+
84
+ begin
85
+ start_time = Time.now
86
+ yield
87
+ ensure
88
+ dapp.log_step("Running time #{(Time.now - start_time).round(2)} seconds")
89
+ end
90
+ end
91
+
92
+ def log_running_time
93
+ true
94
+ end
95
+
96
+ def run(_argv = ARGV)
97
+ raise
98
+ end
99
+
100
+ def cli_options(**kwargs)
101
+ dirs = [config[:build_dir], config[:run_dir], config[:deploy_dir]]
102
+ if dirs.compact.size > 1
103
+ self.class.print_error_with_help_and_die! self, "cannot use alias options --run-dir, --build-dir, --deploy-dir at the same time"
104
+ end
105
+
106
+ config.merge(build_dir: dirs.compact.first, dapp_command: run_method, **kwargs)
107
+ end
108
+ end
109
+ end
110
+ end
111
+ end
@@ -0,0 +1,28 @@
1
+ module Dapp
2
+ class CLI
3
+ module Command
4
+ class Sample < ::Dapp::CLI
5
+ class Base < Base
6
+ option :samples_repo,
7
+ long: '--samples-repo GIT_REPO',
8
+ description: 'Git repository with samples (\'https://github.com/flant/dapp.git\' by default).',
9
+ default: 'https://github.com/flant/dapp.git'
10
+
11
+ option :samples_branch,
12
+ long: '--samples-branch GIT_BRANCH',
13
+ description: 'Specific git branch (\'master\' by default).',
14
+ default: 'master'
15
+
16
+ option :samples_dir,
17
+ long: '--samples-dir DIR',
18
+ description: 'Directory with samples (\'samples\' by default)',
19
+ default: 'samples'
20
+
21
+ def run_method
22
+ "sample_#{super}"
23
+ end
24
+ end
25
+ end
26
+ end
27
+ end
28
+ end
@@ -0,0 +1,24 @@
1
+ module Dapp
2
+ class CLI
3
+ module Command
4
+ class Sample < ::Dapp::CLI
5
+ class Create < Base
6
+ banner <<BANNER.freeze
7
+ Usage:
8
+
9
+ dapp sample create SAMPLE_NAME [options]
10
+
11
+ Options:
12
+ BANNER
13
+ def run(argv = ARGV)
14
+ self.class.parse_options(self, argv)
15
+ sample_name = self.class.required_argument(self, 'sample_name')
16
+ run_dapp_command(nil, options: cli_options) do |dapp|
17
+ dapp.sample_create(sample_name)
18
+ end
19
+ end
20
+ end
21
+ end
22
+ end
23
+ end
24
+ end
@@ -0,0 +1,25 @@
1
+ module Dapp
2
+ class CLI
3
+ module Command
4
+ class Sample < ::Dapp::CLI
5
+ class List < Base
6
+ banner <<BANNER.freeze
7
+ Usage:
8
+
9
+ dapp sample list [options]
10
+
11
+ Options:
12
+ BANNER
13
+ def run(argv = ARGV)
14
+ self.class.parse_options(self, argv)
15
+ run_dapp_command(run_method, options: cli_options)
16
+ end
17
+
18
+ def log_running_time
19
+ false
20
+ end
21
+ end
22
+ end
23
+ end
24
+ end
25
+ end
@@ -0,0 +1,20 @@
1
+ module Dapp
2
+ class CLI
3
+ module Command
4
+ class Sample < ::Dapp::CLI
5
+ SUBCOMMANDS = %w(list create).freeze
6
+
7
+ banner <<BANNER.freeze
8
+ Usage: dapp sample [options] subcommand [subcommand options]
9
+
10
+ Available subcommands: (for details, dapp sample SUB-COMMAND --help)
11
+
12
+ dapp sample list [options]
13
+ dapp sample create SAMPLE_NAME [options]
14
+
15
+ Options:
16
+ BANNER
17
+ end
18
+ end
19
+ end
20
+ end
@@ -0,0 +1,26 @@
1
+ module Dapp
2
+ class CLI
3
+ module Command
4
+ class Slug < Base
5
+ banner <<BANNER.freeze
6
+ Usage:
7
+
8
+ dapp slug STRING
9
+
10
+ Options:
11
+ BANNER
12
+ def run(argv = ARGV)
13
+ self.class.parse_options(self, argv)
14
+ str = self.class.required_argument(self, 'string')
15
+ run_dapp_command(nil, options: cli_options) do |dapp|
16
+ dapp.slug([cli_arguments, str].flatten.join(' '))
17
+ end
18
+ end
19
+
20
+ def log_running_time
21
+ false
22
+ end
23
+ end
24
+ end
25
+ end
26
+ end