codefresh 0.78.2

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 (713) hide show
  1. package/.dockerignore +14 -0
  2. package/.eslintrc.js +20 -0
  3. package/.gitattributes +29 -0
  4. package/.nvmrc +1 -0
  5. package/Dockerfile +39 -0
  6. package/LICENSE +21 -0
  7. package/README.md +55 -0
  8. package/__mocks__/requestretry.js +35 -0
  9. package/brew/template.rb +15 -0
  10. package/check-version.js +13 -0
  11. package/cli.gif +0 -0
  12. package/codefresh-arm.yml +54 -0
  13. package/codefresh-release.yml +173 -0
  14. package/codefresh.yml +120 -0
  15. package/docs/archetypes/default.md +6 -0
  16. package/docs/config.toml +44 -0
  17. package/docs/content/_header.md +6 -0
  18. package/docs/content/_index.md +19 -0
  19. package/docs/content/contexts/spec/_index.md +28 -0
  20. package/docs/content/contexts/spec/config.md +30 -0
  21. package/docs/content/contexts/spec/helm-repository.md +16 -0
  22. package/docs/content/contexts/spec/secret-yaml.md +32 -0
  23. package/docs/content/contexts/spec/secret.md +30 -0
  24. package/docs/content/contexts/spec/yaml.md +30 -0
  25. package/docs/content/external-resources.md +8 -0
  26. package/docs/content/getting-started/_index.md +28 -0
  27. package/docs/content/installation/_index.md +13 -0
  28. package/docs/content/installation/docker.md +15 -0
  29. package/docs/content/installation/homebrew.md +29 -0
  30. package/docs/content/installation/npm.md +22 -0
  31. package/docs/content/installation/yarn.md +22 -0
  32. package/docs/content/more/_index.md +7 -0
  33. package/docs/content/operate on resources/_index.md +10 -0
  34. package/docs/content/pipelines/Run Pipeline.md +38 -0
  35. package/docs/content/pipelines/spec.md +190 -0
  36. package/docs/docs.spec.js +8 -0
  37. package/docs/index.js +407 -0
  38. package/docs/layouts/partials/menu-footer.html +13 -0
  39. package/docs/themes/docdock/LICENSE.md +22 -0
  40. package/docs/themes/docdock/README.md +129 -0
  41. package/docs/themes/docdock/archetypes/default.md +9 -0
  42. package/docs/themes/docdock/archetypes/slide.md +46 -0
  43. package/docs/themes/docdock/exampleSite/config.toml +68 -0
  44. package/docs/themes/docdock/exampleSite/content/_index.md +50 -0
  45. package/docs/themes/docdock/exampleSite/content/content-organisation/_index.md +138 -0
  46. package/docs/themes/docdock/exampleSite/content/content-organisation/customize-style/_index.md +66 -0
  47. package/docs/themes/docdock/exampleSite/content/content-organisation/customize-style/disable.md +24 -0
  48. package/docs/themes/docdock/exampleSite/content/content-organisation/customize-style/theme-variants.md +35 -0
  49. package/docs/themes/docdock/exampleSite/content/content-organisation/customize-style/themestyle.md +25 -0
  50. package/docs/themes/docdock/exampleSite/content/content-organisation/extramenu.md +28 -0
  51. package/docs/themes/docdock/exampleSite/content/content-organisation/logo.md +12 -0
  52. package/docs/themes/docdock/exampleSite/content/create-page/_index.md +54 -0
  53. package/docs/themes/docdock/exampleSite/content/create-page/homepage.md +8 -0
  54. package/docs/themes/docdock/exampleSite/content/create-page/myslide.md +48 -0
  55. package/docs/themes/docdock/exampleSite/content/create-page/page-images.md +28 -0
  56. package/docs/themes/docdock/exampleSite/content/create-page/page-slide.md +114 -0
  57. package/docs/themes/docdock/exampleSite/content/credits.md +44 -0
  58. package/docs/themes/docdock/exampleSite/content/getting-start/_index.md +12 -0
  59. package/docs/themes/docdock/exampleSite/content/getting-start/configuration.md +56 -0
  60. package/docs/themes/docdock/exampleSite/content/getting-start/installation.md +83 -0
  61. package/docs/themes/docdock/exampleSite/content/search/_index.md +13 -0
  62. package/docs/themes/docdock/exampleSite/content/shortcodes/_index.md +10 -0
  63. package/docs/themes/docdock/exampleSite/content/shortcodes/alert.md +30 -0
  64. package/docs/themes/docdock/exampleSite/content/shortcodes/attachments.files/BachGavotteShort.mp3 +0 -0
  65. package/docs/themes/docdock/exampleSite/content/shortcodes/attachments.files/Carroll_AliceAuPaysDesMerveilles.pdf +0 -0
  66. package/docs/themes/docdock/exampleSite/content/shortcodes/attachments.files/adivorciarsetoca00cape.pdf +0 -0
  67. package/docs/themes/docdock/exampleSite/content/shortcodes/attachments.files/hugo.png +0 -0
  68. package/docs/themes/docdock/exampleSite/content/shortcodes/attachments.files/movieselectricsheep-flock-244-32500-2.mp4 +0 -0
  69. package/docs/themes/docdock/exampleSite/content/shortcodes/attachments.md +59 -0
  70. package/docs/themes/docdock/exampleSite/content/shortcodes/button.md +37 -0
  71. package/docs/themes/docdock/exampleSite/content/shortcodes/children/_index.md +46 -0
  72. package/docs/themes/docdock/exampleSite/content/shortcodes/children/children-1/_index.md +6 -0
  73. package/docs/themes/docdock/exampleSite/content/shortcodes/children/children-1/children-1-1/_index.md +6 -0
  74. package/docs/themes/docdock/exampleSite/content/shortcodes/children/children-1/children-1-1/children-1-1-1/_index.md +6 -0
  75. package/docs/themes/docdock/exampleSite/content/shortcodes/children/children-1/children-1-1/children-1-1-1/children-1-1-1-1/_index.md +6 -0
  76. package/docs/themes/docdock/exampleSite/content/shortcodes/children/children-1/children-1-1/children-1-1-1/children-1-1-1-1/children-1-1-1-1-1/_index.md +6 -0
  77. package/docs/themes/docdock/exampleSite/content/shortcodes/children/children-2/_index.md +11 -0
  78. package/docs/themes/docdock/exampleSite/content/shortcodes/children/children-2/test3.md +6 -0
  79. package/docs/themes/docdock/exampleSite/content/shortcodes/children/children-3/_index.md +6 -0
  80. package/docs/themes/docdock/exampleSite/content/shortcodes/children/children-4/_index.md +7 -0
  81. package/docs/themes/docdock/exampleSite/content/shortcodes/children/test.md +6 -0
  82. package/docs/themes/docdock/exampleSite/content/shortcodes/excerpt-include.md +25 -0
  83. package/docs/themes/docdock/exampleSite/content/shortcodes/excerpt.md +39 -0
  84. package/docs/themes/docdock/exampleSite/content/shortcodes/expand.md +41 -0
  85. package/docs/themes/docdock/exampleSite/content/shortcodes/icon.md +1254 -0
  86. package/docs/themes/docdock/exampleSite/content/shortcodes/mermaid.md +98 -0
  87. package/docs/themes/docdock/exampleSite/content/shortcodes/notice.md +61 -0
  88. package/docs/themes/docdock/exampleSite/content/shortcodes/panel.md +60 -0
  89. package/docs/themes/docdock/exampleSite/content/shortcodes/revealjs.md +119 -0
  90. package/docs/themes/docdock/exampleSite/content/showcase.md +15 -0
  91. package/docs/themes/docdock/exampleSite/layouts/partials/custom-head.html +10 -0
  92. package/docs/themes/docdock/exampleSite/layouts/partials/menu-footer.html +13 -0
  93. package/docs/themes/docdock/exampleSite/layouts/shortcodes/ghcontributors.html +31 -0
  94. package/docs/themes/docdock/exampleSite/static/menu-entry-icon.png +0 -0
  95. package/docs/themes/docdock/exampleSite/static/showcase/bitfan.site.png +0 -0
  96. package/docs/themes/docdock/exampleSite/static/showcase/invincible.site.png +0 -0
  97. package/docs/themes/docdock/exampleSite/static/style-flex.png +0 -0
  98. package/docs/themes/docdock/exampleSite/static/style-original.png +0 -0
  99. package/docs/themes/docdock/exampleSite/static/variant-gold.png +0 -0
  100. package/docs/themes/docdock/exampleSite/static/variant-gray.png +0 -0
  101. package/docs/themes/docdock/exampleSite/static/variant-green.png +0 -0
  102. package/docs/themes/docdock/i18n/en.toml +44 -0
  103. package/docs/themes/docdock/i18n/es.toml +26 -0
  104. package/docs/themes/docdock/i18n/fr.toml +44 -0
  105. package/docs/themes/docdock/i18n/nb.toml +38 -0
  106. package/docs/themes/docdock/images/screenshot.png +0 -0
  107. package/docs/themes/docdock/images/tn.png +0 -0
  108. package/docs/themes/docdock/layouts/404.html +39 -0
  109. package/docs/themes/docdock/layouts/_default/baseof.html +32 -0
  110. package/docs/themes/docdock/layouts/_default/li.html +22 -0
  111. package/docs/themes/docdock/layouts/_default/list.html +20 -0
  112. package/docs/themes/docdock/layouts/_default/single.html +3 -0
  113. package/docs/themes/docdock/layouts/index.html +30 -0
  114. package/docs/themes/docdock/layouts/index.json +12 -0
  115. package/docs/themes/docdock/layouts/partials/breadcrumb.html +8 -0
  116. package/docs/themes/docdock/layouts/partials/custom-content-footer.html +6 -0
  117. package/docs/themes/docdock/layouts/partials/custom-footer.html +0 -0
  118. package/docs/themes/docdock/layouts/partials/custom-head.html +2 -0
  119. package/docs/themes/docdock/layouts/partials/flex/body-aftercontent.html +54 -0
  120. package/docs/themes/docdock/layouts/partials/flex/body-beforecontent.html +68 -0
  121. package/docs/themes/docdock/layouts/partials/flex/head.html +17 -0
  122. package/docs/themes/docdock/layouts/partials/flex/scripts.html +11 -0
  123. package/docs/themes/docdock/layouts/partials/flex/selectnavigation.html +58 -0
  124. package/docs/themes/docdock/layouts/partials/header.html +10 -0
  125. package/docs/themes/docdock/layouts/partials/language-selector.html +18 -0
  126. package/docs/themes/docdock/layouts/partials/menu-footer.html +0 -0
  127. package/docs/themes/docdock/layouts/partials/menu.html +82 -0
  128. package/docs/themes/docdock/layouts/partials/next-prev-page.html +44 -0
  129. package/docs/themes/docdock/layouts/partials/original/body-aftercontent.html +13 -0
  130. package/docs/themes/docdock/layouts/partials/original/body-beforecontent.html +128 -0
  131. package/docs/themes/docdock/layouts/partials/original/head.html +23 -0
  132. package/docs/themes/docdock/layouts/partials/original/scripts.html +10 -0
  133. package/docs/themes/docdock/layouts/partials/pagination.html +9 -0
  134. package/docs/themes/docdock/layouts/shortcodes/alert.html +6 -0
  135. package/docs/themes/docdock/layouts/shortcodes/anchor.html +1 -0
  136. package/docs/themes/docdock/layouts/shortcodes/anchorlink.html +1 -0
  137. package/docs/themes/docdock/layouts/shortcodes/attachmentlink.html +5 -0
  138. package/docs/themes/docdock/layouts/shortcodes/attachments.html +33 -0
  139. package/docs/themes/docdock/layouts/shortcodes/button.html +6 -0
  140. package/docs/themes/docdock/layouts/shortcodes/children.html +104 -0
  141. package/docs/themes/docdock/layouts/shortcodes/code.html +1 -0
  142. package/docs/themes/docdock/layouts/shortcodes/emoticon.html +29 -0
  143. package/docs/themes/docdock/layouts/shortcodes/excerpt-include.html +14 -0
  144. package/docs/themes/docdock/layouts/shortcodes/excerpt.html +7 -0
  145. package/docs/themes/docdock/layouts/shortcodes/expand.html +16 -0
  146. package/docs/themes/docdock/layouts/shortcodes/header.html +16 -0
  147. package/docs/themes/docdock/layouts/shortcodes/icon.html +13 -0
  148. package/docs/themes/docdock/layouts/shortcodes/image.html +5 -0
  149. package/docs/themes/docdock/layouts/shortcodes/info.html +10 -0
  150. package/docs/themes/docdock/layouts/shortcodes/label.html +1 -0
  151. package/docs/themes/docdock/layouts/shortcodes/mermaid.html +3 -0
  152. package/docs/themes/docdock/layouts/shortcodes/note.html +4 -0
  153. package/docs/themes/docdock/layouts/shortcodes/notice.html +1 -0
  154. package/docs/themes/docdock/layouts/shortcodes/pagelink.html +12 -0
  155. package/docs/themes/docdock/layouts/shortcodes/pagetreesearch.html +1 -0
  156. package/docs/themes/docdock/layouts/shortcodes/panel.html +5 -0
  157. package/docs/themes/docdock/layouts/shortcodes/recently-updated.html +7 -0
  158. package/docs/themes/docdock/layouts/shortcodes/relref.html +14 -0
  159. package/docs/themes/docdock/layouts/shortcodes/revealjs.html +66 -0
  160. package/docs/themes/docdock/layouts/shortcodes/section.html +1 -0
  161. package/docs/themes/docdock/layouts/shortcodes/task.html +10 -0
  162. package/docs/themes/docdock/layouts/shortcodes/tasklist.html +4 -0
  163. package/docs/themes/docdock/layouts/shortcodes/tip.html +10 -0
  164. package/docs/themes/docdock/layouts/shortcodes/toc.html +2 -0
  165. package/docs/themes/docdock/layouts/shortcodes/unknow.html +1 -0
  166. package/docs/themes/docdock/layouts/shortcodes/userlink.html +1 -0
  167. package/docs/themes/docdock/layouts/shortcodes/viewppt.html +5 -0
  168. package/docs/themes/docdock/layouts/shortcodes/viewxls.html +5 -0
  169. package/docs/themes/docdock/layouts/shortcodes/warning.html +12 -0
  170. package/docs/themes/docdock/layouts/shortcodes/well.html +1 -0
  171. package/docs/themes/docdock/layouts/slide/single.html +38 -0
  172. package/docs/themes/docdock/static/css/auto-complete.css +49 -0
  173. package/docs/themes/docdock/static/css/bootstrap.min.css +1884 -0
  174. package/docs/themes/docdock/static/css/featherlight.min.css +8 -0
  175. package/docs/themes/docdock/static/css/font-awesome.min.css +4 -0
  176. package/docs/themes/docdock/static/css/horsey.css +35 -0
  177. package/docs/themes/docdock/static/css/hybrid.css +102 -0
  178. package/docs/themes/docdock/static/css/nucleus.css +617 -0
  179. package/docs/themes/docdock/static/fonts/FontAwesome.otf +0 -0
  180. package/docs/themes/docdock/static/fonts/Inconsolata.eot +0 -0
  181. package/docs/themes/docdock/static/fonts/Inconsolata.svg +359 -0
  182. package/docs/themes/docdock/static/fonts/Inconsolata.ttf +0 -0
  183. package/docs/themes/docdock/static/fonts/Inconsolata.woff +0 -0
  184. package/docs/themes/docdock/static/fonts/Lato-Bold.ttf +0 -0
  185. package/docs/themes/docdock/static/fonts/Lato-Bold.woff2 +0 -0
  186. package/docs/themes/docdock/static/fonts/Lato-Regular.ttf +0 -0
  187. package/docs/themes/docdock/static/fonts/Lato-Regular.woff2 +0 -0
  188. package/docs/themes/docdock/static/fonts/Novecentosanswide-Normal-webfont.eot +0 -0
  189. package/docs/themes/docdock/static/fonts/Novecentosanswide-Normal-webfont.svg +1019 -0
  190. package/docs/themes/docdock/static/fonts/Novecentosanswide-Normal-webfont.ttf +0 -0
  191. package/docs/themes/docdock/static/fonts/Novecentosanswide-Normal-webfont.woff +0 -0
  192. package/docs/themes/docdock/static/fonts/Novecentosanswide-Normal-webfont.woff2 +0 -0
  193. package/docs/themes/docdock/static/fonts/Novecentosanswide-UltraLight-webfont.eot +0 -0
  194. package/docs/themes/docdock/static/fonts/Novecentosanswide-UltraLight-webfont.svg +918 -0
  195. package/docs/themes/docdock/static/fonts/Novecentosanswide-UltraLight-webfont.ttf +0 -0
  196. package/docs/themes/docdock/static/fonts/Novecentosanswide-UltraLight-webfont.woff +0 -0
  197. package/docs/themes/docdock/static/fonts/Novecentosanswide-UltraLight-webfont.woff2 +0 -0
  198. package/docs/themes/docdock/static/fonts/Roboto-Italic.ttf +0 -0
  199. package/docs/themes/docdock/static/fonts/Roboto-Medium.ttf +0 -0
  200. package/docs/themes/docdock/static/fonts/Roboto-Regular.ttf +0 -0
  201. package/docs/themes/docdock/static/fonts/RobotoMono-Medium.ttf +0 -0
  202. package/docs/themes/docdock/static/fonts/RobotoMono-Regular.ttf +0 -0
  203. package/docs/themes/docdock/static/fonts/Work_Sans_200.eot +0 -0
  204. package/docs/themes/docdock/static/fonts/Work_Sans_200.svg +332 -0
  205. package/docs/themes/docdock/static/fonts/Work_Sans_200.ttf +0 -0
  206. package/docs/themes/docdock/static/fonts/Work_Sans_200.woff +0 -0
  207. package/docs/themes/docdock/static/fonts/Work_Sans_200.woff2 +0 -0
  208. package/docs/themes/docdock/static/fonts/Work_Sans_300.eot +0 -0
  209. package/docs/themes/docdock/static/fonts/Work_Sans_300.svg +331 -0
  210. package/docs/themes/docdock/static/fonts/Work_Sans_300.ttf +0 -0
  211. package/docs/themes/docdock/static/fonts/Work_Sans_300.woff +0 -0
  212. package/docs/themes/docdock/static/fonts/Work_Sans_300.woff2 +0 -0
  213. package/docs/themes/docdock/static/fonts/Work_Sans_500.eot +0 -0
  214. package/docs/themes/docdock/static/fonts/Work_Sans_500.svg +333 -0
  215. package/docs/themes/docdock/static/fonts/Work_Sans_500.ttf +0 -0
  216. package/docs/themes/docdock/static/fonts/Work_Sans_500.woff +0 -0
  217. package/docs/themes/docdock/static/fonts/Work_Sans_500.woff2 +0 -0
  218. package/docs/themes/docdock/static/fonts/fontawesome-webfont.eot +0 -0
  219. package/docs/themes/docdock/static/fonts/fontawesome-webfont.svg +2671 -0
  220. package/docs/themes/docdock/static/fonts/fontawesome-webfont.ttf +0 -0
  221. package/docs/themes/docdock/static/fonts/fontawesome-webfont.woff +0 -0
  222. package/docs/themes/docdock/static/fonts/fontawesome-webfont.woff2 +0 -0
  223. package/docs/themes/docdock/static/fonts/glyphicons-halflings-regular.eot +0 -0
  224. package/docs/themes/docdock/static/fonts/glyphicons-halflings-regular.svg +288 -0
  225. package/docs/themes/docdock/static/fonts/glyphicons-halflings-regular.ttf +0 -0
  226. package/docs/themes/docdock/static/fonts/glyphicons-halflings-regular.woff +0 -0
  227. package/docs/themes/docdock/static/fonts/glyphicons-halflings-regular.woff2 +0 -0
  228. package/docs/themes/docdock/static/images/clippy.svg +4 -0
  229. package/docs/themes/docdock/static/images/favicon.png +0 -0
  230. package/docs/themes/docdock/static/images/gopher-404.jpg +0 -0
  231. package/docs/themes/docdock/static/js/auto-complete.js +223 -0
  232. package/docs/themes/docdock/static/js/clipboard.min.js +7 -0
  233. package/docs/themes/docdock/static/js/docdock.js +309 -0
  234. package/docs/themes/docdock/static/js/featherlight.min.js +8 -0
  235. package/docs/themes/docdock/static/js/highlight.pack.js +2 -0
  236. package/docs/themes/docdock/static/js/html5shiv-printshiv.min.js +4 -0
  237. package/docs/themes/docdock/static/js/jquery-2.x.min.js +4 -0
  238. package/docs/themes/docdock/static/js/lunr.min.js +6 -0
  239. package/docs/themes/docdock/static/js/modernizr.custom.71422.js +4 -0
  240. package/docs/themes/docdock/static/js/search.js +91 -0
  241. package/docs/themes/docdock/static/mermaid/mermaid.css +273 -0
  242. package/docs/themes/docdock/static/mermaid/mermaid.dark.css +275 -0
  243. package/docs/themes/docdock/static/mermaid/mermaid.forest.css +353 -0
  244. package/docs/themes/docdock/static/mermaid/mermaid.js +30 -0
  245. package/docs/themes/docdock/static/none.html +0 -0
  246. package/docs/themes/docdock/static/revealjs/.travis.yml +5 -0
  247. package/docs/themes/docdock/static/revealjs/CONTRIBUTING.md +23 -0
  248. package/docs/themes/docdock/static/revealjs/Gruntfile.js +192 -0
  249. package/docs/themes/docdock/static/revealjs/LICENSE +19 -0
  250. package/docs/themes/docdock/static/revealjs/README.md +1238 -0
  251. package/docs/themes/docdock/static/revealjs/bower.json +27 -0
  252. package/docs/themes/docdock/static/revealjs/css/print/paper.css +203 -0
  253. package/docs/themes/docdock/static/revealjs/css/print/pdf.css +178 -0
  254. package/docs/themes/docdock/static/revealjs/css/reveal.css +1555 -0
  255. package/docs/themes/docdock/static/revealjs/css/reveal.scss +1717 -0
  256. package/docs/themes/docdock/static/revealjs/css/theme/README.md +21 -0
  257. package/docs/themes/docdock/static/revealjs/css/theme/beige.css +268 -0
  258. package/docs/themes/docdock/static/revealjs/css/theme/black.css +264 -0
  259. package/docs/themes/docdock/static/revealjs/css/theme/blood.css +287 -0
  260. package/docs/themes/docdock/static/revealjs/css/theme/league.css +270 -0
  261. package/docs/themes/docdock/static/revealjs/css/theme/moon.css +268 -0
  262. package/docs/themes/docdock/static/revealjs/css/theme/night.css +262 -0
  263. package/docs/themes/docdock/static/revealjs/css/theme/serif.css +264 -0
  264. package/docs/themes/docdock/static/revealjs/css/theme/simple.css +267 -0
  265. package/docs/themes/docdock/static/revealjs/css/theme/sky.css +271 -0
  266. package/docs/themes/docdock/static/revealjs/css/theme/solarized.css +268 -0
  267. package/docs/themes/docdock/static/revealjs/css/theme/source/beige.scss +39 -0
  268. package/docs/themes/docdock/static/revealjs/css/theme/source/black.scss +49 -0
  269. package/docs/themes/docdock/static/revealjs/css/theme/source/blood.scss +78 -0
  270. package/docs/themes/docdock/static/revealjs/css/theme/source/league.scss +34 -0
  271. package/docs/themes/docdock/static/revealjs/css/theme/source/moon.scss +57 -0
  272. package/docs/themes/docdock/static/revealjs/css/theme/source/night.scss +34 -0
  273. package/docs/themes/docdock/static/revealjs/css/theme/source/serif.scss +35 -0
  274. package/docs/themes/docdock/static/revealjs/css/theme/source/simple.scss +43 -0
  275. package/docs/themes/docdock/static/revealjs/css/theme/source/sky.scss +46 -0
  276. package/docs/themes/docdock/static/revealjs/css/theme/source/solarized.scss +63 -0
  277. package/docs/themes/docdock/static/revealjs/css/theme/source/white.scss +49 -0
  278. package/docs/themes/docdock/static/revealjs/css/theme/template/mixins.scss +29 -0
  279. package/docs/themes/docdock/static/revealjs/css/theme/template/settings.scss +43 -0
  280. package/docs/themes/docdock/static/revealjs/css/theme/template/theme.scss +316 -0
  281. package/docs/themes/docdock/static/revealjs/css/theme/white.css +264 -0
  282. package/docs/themes/docdock/static/revealjs/demo.html +410 -0
  283. package/docs/themes/docdock/static/revealjs/index.html +49 -0
  284. package/docs/themes/docdock/static/revealjs/js/reveal.js +5239 -0
  285. package/docs/themes/docdock/static/revealjs/lib/css/zenburn.css +80 -0
  286. package/docs/themes/docdock/static/revealjs/lib/font/league-gothic/LICENSE +2 -0
  287. package/docs/themes/docdock/static/revealjs/lib/font/league-gothic/league-gothic.css +10 -0
  288. package/docs/themes/docdock/static/revealjs/lib/font/league-gothic/league-gothic.eot +0 -0
  289. package/docs/themes/docdock/static/revealjs/lib/font/league-gothic/league-gothic.ttf +0 -0
  290. package/docs/themes/docdock/static/revealjs/lib/font/league-gothic/league-gothic.woff +0 -0
  291. package/docs/themes/docdock/static/revealjs/lib/font/source-sans-pro/LICENSE +45 -0
  292. package/docs/themes/docdock/static/revealjs/lib/font/source-sans-pro/source-sans-pro-italic.eot +0 -0
  293. package/docs/themes/docdock/static/revealjs/lib/font/source-sans-pro/source-sans-pro-italic.ttf +0 -0
  294. package/docs/themes/docdock/static/revealjs/lib/font/source-sans-pro/source-sans-pro-italic.woff +0 -0
  295. package/docs/themes/docdock/static/revealjs/lib/font/source-sans-pro/source-sans-pro-regular.eot +0 -0
  296. package/docs/themes/docdock/static/revealjs/lib/font/source-sans-pro/source-sans-pro-regular.ttf +0 -0
  297. package/docs/themes/docdock/static/revealjs/lib/font/source-sans-pro/source-sans-pro-regular.woff +0 -0
  298. package/docs/themes/docdock/static/revealjs/lib/font/source-sans-pro/source-sans-pro-semibold.eot +0 -0
  299. package/docs/themes/docdock/static/revealjs/lib/font/source-sans-pro/source-sans-pro-semibold.ttf +0 -0
  300. package/docs/themes/docdock/static/revealjs/lib/font/source-sans-pro/source-sans-pro-semibold.woff +0 -0
  301. package/docs/themes/docdock/static/revealjs/lib/font/source-sans-pro/source-sans-pro-semibolditalic.eot +0 -0
  302. package/docs/themes/docdock/static/revealjs/lib/font/source-sans-pro/source-sans-pro-semibolditalic.ttf +0 -0
  303. package/docs/themes/docdock/static/revealjs/lib/font/source-sans-pro/source-sans-pro-semibolditalic.woff +0 -0
  304. package/docs/themes/docdock/static/revealjs/lib/font/source-sans-pro/source-sans-pro.css +39 -0
  305. package/docs/themes/docdock/static/revealjs/lib/js/classList.js +2 -0
  306. package/docs/themes/docdock/static/revealjs/lib/js/head.min.js +9 -0
  307. package/docs/themes/docdock/static/revealjs/lib/js/html5shiv.js +7 -0
  308. package/docs/themes/docdock/static/revealjs/package.json +43 -0
  309. package/docs/themes/docdock/static/revealjs/plugin/highlight/highlight.js +77 -0
  310. package/docs/themes/docdock/static/revealjs/plugin/markdown/example.html +129 -0
  311. package/docs/themes/docdock/static/revealjs/plugin/markdown/example.md +31 -0
  312. package/docs/themes/docdock/static/revealjs/plugin/markdown/markdown.js +412 -0
  313. package/docs/themes/docdock/static/revealjs/plugin/markdown/marked.js +6 -0
  314. package/docs/themes/docdock/static/revealjs/plugin/math/math.js +67 -0
  315. package/docs/themes/docdock/static/revealjs/plugin/multiplex/client.js +13 -0
  316. package/docs/themes/docdock/static/revealjs/plugin/multiplex/index.js +64 -0
  317. package/docs/themes/docdock/static/revealjs/plugin/multiplex/master.js +34 -0
  318. package/docs/themes/docdock/static/revealjs/plugin/multiplex/package.json +19 -0
  319. package/docs/themes/docdock/static/revealjs/plugin/notes/notes.html +759 -0
  320. package/docs/themes/docdock/static/revealjs/plugin/notes/notes.js +155 -0
  321. package/docs/themes/docdock/static/revealjs/plugin/notes-server/client.js +65 -0
  322. package/docs/themes/docdock/static/revealjs/plugin/notes-server/index.js +69 -0
  323. package/docs/themes/docdock/static/revealjs/plugin/notes-server/notes.html +585 -0
  324. package/docs/themes/docdock/static/revealjs/plugin/print-pdf/print-pdf.js +69 -0
  325. package/docs/themes/docdock/static/revealjs/plugin/search/search.js +206 -0
  326. package/docs/themes/docdock/static/revealjs/plugin/zoom-js/zoom.js +272 -0
  327. package/docs/themes/docdock/static/revealjs/test/examples/assets/image1.png +0 -0
  328. package/docs/themes/docdock/static/revealjs/test/examples/assets/image2.png +0 -0
  329. package/docs/themes/docdock/static/revealjs/test/examples/barebones.html +41 -0
  330. package/docs/themes/docdock/static/revealjs/test/examples/embedded-media.html +49 -0
  331. package/docs/themes/docdock/static/revealjs/test/examples/math.html +185 -0
  332. package/docs/themes/docdock/static/revealjs/test/examples/slide-backgrounds.html +144 -0
  333. package/docs/themes/docdock/static/revealjs/test/examples/slide-transitions.html +101 -0
  334. package/docs/themes/docdock/static/revealjs/test/qunit-1.12.0.css +244 -0
  335. package/docs/themes/docdock/static/revealjs/test/qunit-1.12.0.js +2212 -0
  336. package/docs/themes/docdock/static/revealjs/test/simple.md +12 -0
  337. package/docs/themes/docdock/static/revealjs/test/test-markdown-element-attributes.html +134 -0
  338. package/docs/themes/docdock/static/revealjs/test/test-markdown-element-attributes.js +46 -0
  339. package/docs/themes/docdock/static/revealjs/test/test-markdown-external.html +36 -0
  340. package/docs/themes/docdock/static/revealjs/test/test-markdown-external.js +24 -0
  341. package/docs/themes/docdock/static/revealjs/test/test-markdown-options.html +41 -0
  342. package/docs/themes/docdock/static/revealjs/test/test-markdown-options.js +26 -0
  343. package/docs/themes/docdock/static/revealjs/test/test-markdown-slide-attributes.html +128 -0
  344. package/docs/themes/docdock/static/revealjs/test/test-markdown-slide-attributes.js +47 -0
  345. package/docs/themes/docdock/static/revealjs/test/test-markdown.html +52 -0
  346. package/docs/themes/docdock/static/revealjs/test/test-markdown.js +15 -0
  347. package/docs/themes/docdock/static/revealjs/test/test-pdf.html +83 -0
  348. package/docs/themes/docdock/static/revealjs/test/test-pdf.js +15 -0
  349. package/docs/themes/docdock/static/revealjs/test/test.html +86 -0
  350. package/docs/themes/docdock/static/revealjs/test/test.js +597 -0
  351. package/docs/themes/docdock/static/scss/flex/article.scss +356 -0
  352. package/docs/themes/docdock/static/scss/flex/fonts.scss +38 -0
  353. package/docs/themes/docdock/static/scss/flex/footer.scss +45 -0
  354. package/docs/themes/docdock/static/scss/flex/header.scss +89 -0
  355. package/docs/themes/docdock/static/scss/flex/main.scss +164 -0
  356. package/docs/themes/docdock/static/scss/flex/medias.scss +74 -0
  357. package/docs/themes/docdock/static/scss/flex/menu.scss +126 -0
  358. package/docs/themes/docdock/static/scss/flex/shortcode.children.scss +34 -0
  359. package/docs/themes/docdock/static/scss/flex/shortcode.notice.scss +63 -0
  360. package/docs/themes/docdock/static/scss/flex/style.scss +14 -0
  361. package/docs/themes/docdock/static/scss/original/_colours.scss +14 -0
  362. package/docs/themes/docdock/static/scss/original/_functions.scss +89 -0
  363. package/docs/themes/docdock/static/scss/original/_variables.scss +137 -0
  364. package/docs/themes/docdock/static/scss/original/fonts.scss +23 -0
  365. package/docs/themes/docdock/static/scss/original/main.scss +1233 -0
  366. package/docs/themes/docdock/static/scss/original/print.scss +29 -0
  367. package/docs/themes/docdock/static/scss/original/responsive.scss +124 -0
  368. package/docs/themes/docdock/static/scss/original/shortcodes.scss +32 -0
  369. package/docs/themes/docdock/static/scss/original/sidebar.scss +276 -0
  370. package/docs/themes/docdock/static/scss/original/style.scss +16 -0
  371. package/docs/themes/docdock/static/theme-flex/ribbon.png +0 -0
  372. package/docs/themes/docdock/static/theme-flex/script.js +277 -0
  373. package/docs/themes/docdock/static/theme-flex/style.css +728 -0
  374. package/docs/themes/docdock/static/theme-original/script.js +133 -0
  375. package/docs/themes/docdock/static/theme-original/style.css +1411 -0
  376. package/docs/themes/docdock/static/theme-original/variant-blue.css +0 -0
  377. package/docs/themes/docdock/static/theme-original/variant-gold.css +61 -0
  378. package/docs/themes/docdock/static/theme-original/variant-gray.css +61 -0
  379. package/docs/themes/docdock/static/theme-original/variant-green.css +61 -0
  380. package/docs/themes/docdock/theme.toml +22 -0
  381. package/lib/binary/components.js +77 -0
  382. package/lib/binary/downloader.js +170 -0
  383. package/lib/binary/index.js +11 -0
  384. package/lib/binary/runner.js +30 -0
  385. package/lib/interface/cli/Command.js +331 -0
  386. package/lib/interface/cli/codefresh +24 -0
  387. package/lib/interface/cli/commad-line-interface.js +90 -0
  388. package/lib/interface/cli/commands/agent/apply.cmd.js +61 -0
  389. package/lib/interface/cli/commands/agent/create.cmd.js +39 -0
  390. package/lib/interface/cli/commands/agent/delete.cmd.js +40 -0
  391. package/lib/interface/cli/commands/agent/get.cmd.js +44 -0
  392. package/lib/interface/cli/commands/agent/helper.js +28 -0
  393. package/lib/interface/cli/commands/agent/install.cmd.js +205 -0
  394. package/lib/interface/cli/commands/agent/uninstall.cmd.js +92 -0
  395. package/lib/interface/cli/commands/analyzer/analyze.cmd.js +34 -0
  396. package/lib/interface/cli/commands/analyzer/analyzer.logic.js +24 -0
  397. package/lib/interface/cli/commands/annotation/annotation.logic.js +59 -0
  398. package/lib/interface/cli/commands/annotation/annotation.sdk.spec.js +64 -0
  399. package/lib/interface/cli/commands/annotation/create.cmd.js +39 -0
  400. package/lib/interface/cli/commands/annotation/delete.cmd.js +38 -0
  401. package/lib/interface/cli/commands/annotation/get.cmd.js +42 -0
  402. package/lib/interface/cli/commands/app-proxy/helper.js +63 -0
  403. package/lib/interface/cli/commands/app-proxy/install.cmd.js +204 -0
  404. package/lib/interface/cli/commands/app-proxy/uninstall.cmd.js +175 -0
  405. package/lib/interface/cli/commands/app-proxy/upgrade.cmd.js +110 -0
  406. package/lib/interface/cli/commands/audit/download.cmd.js +57 -0
  407. package/lib/interface/cli/commands/auth/create-context.cmd.js +54 -0
  408. package/lib/interface/cli/commands/auth/current-context.cmd.js +25 -0
  409. package/lib/interface/cli/commands/auth/get-contexts.cmd.js +27 -0
  410. package/lib/interface/cli/commands/auth/use-context.cmd.js +42 -0
  411. package/lib/interface/cli/commands/board/apply.cmd.js +61 -0
  412. package/lib/interface/cli/commands/board/board.sdk.spec.js +87 -0
  413. package/lib/interface/cli/commands/board/create.cmd.js +33 -0
  414. package/lib/interface/cli/commands/board/delete.cmd.js +42 -0
  415. package/lib/interface/cli/commands/board/get.cmd.js +62 -0
  416. package/lib/interface/cli/commands/cli-config/cli-config.cmd.js +41 -0
  417. package/lib/interface/cli/commands/cli-config/ops/get.cmd.js +52 -0
  418. package/lib/interface/cli/commands/cli-config/ops/help.cmd.js +36 -0
  419. package/lib/interface/cli/commands/cli-config/ops/profile.cmd.js +49 -0
  420. package/lib/interface/cli/commands/cli-config/ops/set.cmd.js +65 -0
  421. package/lib/interface/cli/commands/cluster/cluster.sdk.spec.js +61 -0
  422. package/lib/interface/cli/commands/cluster/create.cmd.js +85 -0
  423. package/lib/interface/cli/commands/cluster/delete.cmd.js +39 -0
  424. package/lib/interface/cli/commands/cluster/get.cmd.js +30 -0
  425. package/lib/interface/cli/commands/completion/bash.sh.hbs +27 -0
  426. package/lib/interface/cli/commands/completion/completion.cmd.js +66 -0
  427. package/lib/interface/cli/commands/completion/zsh.sh.hbs +20 -0
  428. package/lib/interface/cli/commands/components/update.cmd.js +30 -0
  429. package/lib/interface/cli/commands/composition/composition.sdk.spec.js +95 -0
  430. package/lib/interface/cli/commands/composition/create.cmd.js +67 -0
  431. package/lib/interface/cli/commands/composition/create.completion.js +15 -0
  432. package/lib/interface/cli/commands/composition/delete.cmd.js +40 -0
  433. package/lib/interface/cli/commands/composition/get.cmd.js +43 -0
  434. package/lib/interface/cli/commands/composition/replace.cmd.js +76 -0
  435. package/lib/interface/cli/commands/composition/replace.completion.js +15 -0
  436. package/lib/interface/cli/commands/context/apply.cmd.js +51 -0
  437. package/lib/interface/cli/commands/context/context.sdk.spec.js +158 -0
  438. package/lib/interface/cli/commands/context/create/createConfig.cmd.js +54 -0
  439. package/lib/interface/cli/commands/context/create/createSecret.cmd.js +54 -0
  440. package/lib/interface/cli/commands/context/create/createSecretYaml.cmd.js +53 -0
  441. package/lib/interface/cli/commands/context/create/createYaml.cmd.js +53 -0
  442. package/lib/interface/cli/commands/context/create/git/base.cmd.js +38 -0
  443. package/lib/interface/cli/commands/context/create/git/types/bitbucket.cmd.js +64 -0
  444. package/lib/interface/cli/commands/context/create/git/types/github.cmd.js +79 -0
  445. package/lib/interface/cli/commands/context/create/git/types/gitlab.cmd.js +71 -0
  446. package/lib/interface/cli/commands/context/create/git/types/stash.cmd.js +69 -0
  447. package/lib/interface/cli/commands/context/create/helm-repo/base.cmd.js +24 -0
  448. package/lib/interface/cli/commands/context/create/helm-repo/types/http.cmd.js +60 -0
  449. package/lib/interface/cli/commands/context/create/helm-repo/types/s3.cmd.js +97 -0
  450. package/lib/interface/cli/commands/context/create/secret-store/base.cmd.js +33 -0
  451. package/lib/interface/cli/commands/context/create/secret-store/types/hashicorp-vault.cmd.js +141 -0
  452. package/lib/interface/cli/commands/context/create/secret-store/types/kubernetes-runtime.cmd.js +67 -0
  453. package/lib/interface/cli/commands/context/create/secret-store/types/kubernetes.cmd.js +67 -0
  454. package/lib/interface/cli/commands/context/create.cmd.js +23 -0
  455. package/lib/interface/cli/commands/context/delete.cmd.js +39 -0
  456. package/lib/interface/cli/commands/context/get.cmd.js +68 -0
  457. package/lib/interface/cli/commands/environment/delete.cmd.js +28 -0
  458. package/lib/interface/cli/commands/environment/environment.sdk.spec.js +40 -0
  459. package/lib/interface/cli/commands/environment/get.cmd.js +43 -0
  460. package/lib/interface/cli/commands/gitops/argocd/install.js +9 -0
  461. package/lib/interface/cli/commands/gitops/argocd/uninstall.js +11 -0
  462. package/lib/interface/cli/commands/gitops/argocd/upgrade.js +9 -0
  463. package/lib/interface/cli/commands/gitops/codefresh/install.js +50 -0
  464. package/lib/interface/cli/commands/gitops/codefresh/uninstall.js +14 -0
  465. package/lib/interface/cli/commands/gitops/codefresh/upgrade.js +9 -0
  466. package/lib/interface/cli/commands/gitops/common/install.js +62 -0
  467. package/lib/interface/cli/commands/gitops/common/uninstall.js +39 -0
  468. package/lib/interface/cli/commands/gitops/common/upgrade.js +45 -0
  469. package/lib/interface/cli/commands/gitops/install.cmd.js +111 -0
  470. package/lib/interface/cli/commands/gitops/install.spec.js +77 -0
  471. package/lib/interface/cli/commands/gitops/uninstall.cmd.js +56 -0
  472. package/lib/interface/cli/commands/gitops/upgrade.cmd.js +56 -0
  473. package/lib/interface/cli/commands/helm/chart/helm-charts.sdk.spec.js +65 -0
  474. package/lib/interface/cli/commands/helm/chart/install-chart.cmd.js +103 -0
  475. package/lib/interface/cli/commands/helm/chart/promote-chart.cmd.js +123 -0
  476. package/lib/interface/cli/commands/helm/helm.sdk.spec.js +81 -0
  477. package/lib/interface/cli/commands/helm/release/delete-release.cmd.js +102 -0
  478. package/lib/interface/cli/commands/helm/release/helm-releases.sdk.spec.js +53 -0
  479. package/lib/interface/cli/commands/helm/release/rollback-release.cmd.js +87 -0
  480. package/lib/interface/cli/commands/helm/release/test-release.cmd.js +93 -0
  481. package/lib/interface/cli/commands/helm/release/util.js +16 -0
  482. package/lib/interface/cli/commands/helm/repo/apply.cmd.js +54 -0
  483. package/lib/interface/cli/commands/helm/repo/create.cmd.js +46 -0
  484. package/lib/interface/cli/commands/helm/repo/delete.cmd.js +37 -0
  485. package/lib/interface/cli/commands/helm/repo/get.cmd.js +61 -0
  486. package/lib/interface/cli/commands/helm/repo/helm-repo.sdk.spec.js +58 -0
  487. package/lib/interface/cli/commands/helm/set-helm-config.cmd.js +93 -0
  488. package/lib/interface/cli/commands/hybrid/InstallationPlan.js +216 -0
  489. package/lib/interface/cli/commands/hybrid/delete.cmd.js +336 -0
  490. package/lib/interface/cli/commands/hybrid/execute-test-pipeline.cmd.js +37 -0
  491. package/lib/interface/cli/commands/hybrid/helper.js +1122 -0
  492. package/lib/interface/cli/commands/hybrid/info.cmd.js +27 -0
  493. package/lib/interface/cli/commands/hybrid/init.cmd.js +958 -0
  494. package/lib/interface/cli/commands/hybrid/installation-process.js +51 -0
  495. package/lib/interface/cli/commands/hybrid/key-helper.js +82 -0
  496. package/lib/interface/cli/commands/hybrid/migration.js +192 -0
  497. package/lib/interface/cli/commands/hybrid/pipeline-helper.js +71 -0
  498. package/lib/interface/cli/commands/hybrid/upgrade.cmd.js +195 -0
  499. package/lib/interface/cli/commands/image/annotate.cmd.js +61 -0
  500. package/lib/interface/cli/commands/image/get.cmd.js +122 -0
  501. package/lib/interface/cli/commands/image/image.sdk.spec.js +134 -0
  502. package/lib/interface/cli/commands/image/tag.cmd.js +50 -0
  503. package/lib/interface/cli/commands/image/untag.cmd.js +47 -0
  504. package/lib/interface/cli/commands/imagePullSecret/generate.cmd.js +49 -0
  505. package/lib/interface/cli/commands/imagePullSecret/imagePullSecret.sdk.spec.js +21 -0
  506. package/lib/interface/cli/commands/monitor/install.cmd.js +160 -0
  507. package/lib/interface/cli/commands/monitor/uninstall.cmd.js +78 -0
  508. package/lib/interface/cli/commands/offline-logs/base.cmd.js +33 -0
  509. package/lib/interface/cli/commands/offline-logs/ensure-index.cmd.js +44 -0
  510. package/lib/interface/cli/commands/offline-logs/ensure-index.spec.js +76 -0
  511. package/lib/interface/cli/commands/offline-logs/offload-to-collection.cmd.js +188 -0
  512. package/lib/interface/cli/commands/offline-logs/offload-to-file.cmd.js +175 -0
  513. package/lib/interface/cli/commands/offline-logs/offload-to-file.spec.js +59 -0
  514. package/lib/interface/cli/commands/offline-logs/utils.js +159 -0
  515. package/lib/interface/cli/commands/pipeline/delete.cmd.js +31 -0
  516. package/lib/interface/cli/commands/pipeline/get.cmd.js +125 -0
  517. package/lib/interface/cli/commands/pipeline/get.completion.js +14 -0
  518. package/lib/interface/cli/commands/pipeline/pipeline.sdk.spec.js +137 -0
  519. package/lib/interface/cli/commands/pipeline/run.base.js +153 -0
  520. package/lib/interface/cli/commands/pipeline/run.cf.js +58 -0
  521. package/lib/interface/cli/commands/pipeline/run.cmd.js +165 -0
  522. package/lib/interface/cli/commands/pipeline/run.completion.js +15 -0
  523. package/lib/interface/cli/commands/pipeline/run.local.js +200 -0
  524. package/lib/interface/cli/commands/project/apply.cmd.js +92 -0
  525. package/lib/interface/cli/commands/project/create.cmd.js +70 -0
  526. package/lib/interface/cli/commands/project/delete.cmd.js +39 -0
  527. package/lib/interface/cli/commands/project/get.cmd.js +67 -0
  528. package/lib/interface/cli/commands/project/project.sdk.spec.js +111 -0
  529. package/lib/interface/cli/commands/registry/create/create.standard.cmd.js +53 -0
  530. package/lib/interface/cli/commands/registry/create.cmd.js +20 -0
  531. package/lib/interface/cli/commands/registry/delete.cmd.js +29 -0
  532. package/lib/interface/cli/commands/registry/get.cmd.js +30 -0
  533. package/lib/interface/cli/commands/registry/registry.sdk.spec.js +43 -0
  534. package/lib/interface/cli/commands/repo/add.cmd.js +90 -0
  535. package/lib/interface/cli/commands/repo/delete.cmd.js +43 -0
  536. package/lib/interface/cli/commands/repo/get.cmd.js +101 -0
  537. package/lib/interface/cli/commands/repo/repo.sdk.spec.js +94 -0
  538. package/lib/interface/cli/commands/root/add.cmd.js +18 -0
  539. package/lib/interface/cli/commands/root/annotate.cmd.js +17 -0
  540. package/lib/interface/cli/commands/root/apply.cmd.js +38 -0
  541. package/lib/interface/cli/commands/root/apply.completion.js +15 -0
  542. package/lib/interface/cli/commands/root/auth.cmd.js +31 -0
  543. package/lib/interface/cli/commands/root/components.cmd.js +17 -0
  544. package/lib/interface/cli/commands/root/create.cmd.js +42 -0
  545. package/lib/interface/cli/commands/root/create.completion.js +15 -0
  546. package/lib/interface/cli/commands/root/delete.cmd.js +52 -0
  547. package/lib/interface/cli/commands/root/delete.completion.js +15 -0
  548. package/lib/interface/cli/commands/root/diff.cmd.js +38 -0
  549. package/lib/interface/cli/commands/root/diff.completion.js +15 -0
  550. package/lib/interface/cli/commands/root/download.cmd.js +18 -0
  551. package/lib/interface/cli/commands/root/generate.cmd.js +18 -0
  552. package/lib/interface/cli/commands/root/get.cmd.js +72 -0
  553. package/lib/interface/cli/commands/root/get.completion.js +19 -0
  554. package/lib/interface/cli/commands/root/install.cmd.js +17 -0
  555. package/lib/interface/cli/commands/root/replace.cmd.js +72 -0
  556. package/lib/interface/cli/commands/root/replace.completion.js +15 -0
  557. package/lib/interface/cli/commands/root/root.sdk.spec.js +197 -0
  558. package/lib/interface/cli/commands/root/runner.cmd.js +18 -0
  559. package/lib/interface/cli/commands/root/synchronize.cmd.js +17 -0
  560. package/lib/interface/cli/commands/root/uninstall.cmd.js +17 -0
  561. package/lib/interface/cli/commands/root/upgrade.cmd.js +38 -0
  562. package/lib/interface/cli/commands/root/validate.cmd.js +119 -0
  563. package/lib/interface/cli/commands/root/validate.completion.js +10 -0
  564. package/lib/interface/cli/commands/root/version.cmd.js +48 -0
  565. package/lib/interface/cli/commands/runtimeEnvironments/apply.cmd.js +111 -0
  566. package/lib/interface/cli/commands/runtimeEnvironments/attach.cmd.js +161 -0
  567. package/lib/interface/cli/commands/runtimeEnvironments/create.cmd.js +23 -0
  568. package/lib/interface/cli/commands/runtimeEnvironments/delete.cmd.js +35 -0
  569. package/lib/interface/cli/commands/runtimeEnvironments/diff.cmd.js +64 -0
  570. package/lib/interface/cli/commands/runtimeEnvironments/get.cmd.js +76 -0
  571. package/lib/interface/cli/commands/runtimeEnvironments/install.cmd.js +312 -0
  572. package/lib/interface/cli/commands/runtimeEnvironments/runtimeEnvironments.sdk.spec.js +61 -0
  573. package/lib/interface/cli/commands/runtimeEnvironments/uninstall.cmd.js +149 -0
  574. package/lib/interface/cli/commands/section/apply.cmd.js +85 -0
  575. package/lib/interface/cli/commands/section/create.cmd.js +69 -0
  576. package/lib/interface/cli/commands/section/delete.cmd.js +61 -0
  577. package/lib/interface/cli/commands/section/get.cmd.js +79 -0
  578. package/lib/interface/cli/commands/section/section.sdk.spec.js +143 -0
  579. package/lib/interface/cli/commands/step/delete.cmd.js +30 -0
  580. package/lib/interface/cli/commands/step/get.cmd.js +131 -0
  581. package/lib/interface/cli/commands/step/get.completion.js +14 -0
  582. package/lib/interface/cli/commands/step/step.sdk.spec.js +67 -0
  583. package/lib/interface/cli/commands/systemRuntimeEnvironments/apply.cmd.js +69 -0
  584. package/lib/interface/cli/commands/systemRuntimeEnvironments/delete.cmd.js +44 -0
  585. package/lib/interface/cli/commands/systemRuntimeEnvironments/diff.cmd.js +74 -0
  586. package/lib/interface/cli/commands/systemRuntimeEnvironments/get.cmd.js +103 -0
  587. package/lib/interface/cli/commands/systemRuntimeEnvironments/systemRuntimeEnvironments.sdk.spec.js +128 -0
  588. package/lib/interface/cli/commands/team/add.user.cmd.js +39 -0
  589. package/lib/interface/cli/commands/team/create.cmd.js +53 -0
  590. package/lib/interface/cli/commands/team/get.cmd.js +30 -0
  591. package/lib/interface/cli/commands/team/remove.user.cmd.js +39 -0
  592. package/lib/interface/cli/commands/team/synchronize.cmd.js +76 -0
  593. package/lib/interface/cli/commands/team/team.sdk.spec.js +65 -0
  594. package/lib/interface/cli/commands/tokens/apply.cmd.js +50 -0
  595. package/lib/interface/cli/commands/tokens/create.cmd.js +67 -0
  596. package/lib/interface/cli/commands/tokens/delete.cmd.js +43 -0
  597. package/lib/interface/cli/commands/tokens/get.cmd.js +38 -0
  598. package/lib/interface/cli/commands/tokens/tokens.sdk.spec.js +43 -0
  599. package/lib/interface/cli/commands/trigger/create.cmd.js +44 -0
  600. package/lib/interface/cli/commands/trigger/delete.cmd.js +39 -0
  601. package/lib/interface/cli/commands/trigger/event/create.cmd.js +60 -0
  602. package/lib/interface/cli/commands/trigger/event/delete.cmd.js +34 -0
  603. package/lib/interface/cli/commands/trigger/event/get.cmd.js +59 -0
  604. package/lib/interface/cli/commands/trigger/event/trigger-event.sdk.spec.js +51 -0
  605. package/lib/interface/cli/commands/trigger/get.cmd.js +47 -0
  606. package/lib/interface/cli/commands/trigger/trigger.sdk.spec.js +73 -0
  607. package/lib/interface/cli/commands/trigger/type/get.cmd.js +54 -0
  608. package/lib/interface/cli/commands/trigger/type/trigger-type.sdk.spec.js +33 -0
  609. package/lib/interface/cli/commands/workflow/approve.cmd.js +31 -0
  610. package/lib/interface/cli/commands/workflow/approve.cmd.spec.js +47 -0
  611. package/lib/interface/cli/commands/workflow/deny.cmd.js +31 -0
  612. package/lib/interface/cli/commands/workflow/deny.cmd.spec.js +47 -0
  613. package/lib/interface/cli/commands/workflow/get.cmd.js +161 -0
  614. package/lib/interface/cli/commands/workflow/logs.cmd.js +38 -0
  615. package/lib/interface/cli/commands/workflow/restart.cmd.js +37 -0
  616. package/lib/interface/cli/commands/workflow/terminate.cmd.js +31 -0
  617. package/lib/interface/cli/commands/workflow/wait.cmd.js +77 -0
  618. package/lib/interface/cli/commands/workflow/workflow-data-item/create.cmd.js +44 -0
  619. package/lib/interface/cli/commands/workflow/workflow-data-item/get.cmd.js +72 -0
  620. package/lib/interface/cli/commands/workflow/workflow.sdk.spec.js +123 -0
  621. package/lib/interface/cli/completion/completion.spec.js +313 -0
  622. package/lib/interface/cli/completion/generate +102 -0
  623. package/lib/interface/cli/completion/helpers.js +90 -0
  624. package/lib/interface/cli/completion/index.js +89 -0
  625. package/lib/interface/cli/completion/tree.json +1 -0
  626. package/lib/interface/cli/defaults.js +18 -0
  627. package/lib/interface/cli/helpers/auth.js +62 -0
  628. package/lib/interface/cli/helpers/cli-config.js +110 -0
  629. package/lib/interface/cli/helpers/entitiesManifests.js +60 -0
  630. package/lib/interface/cli/helpers/general.js +235 -0
  631. package/lib/interface/cli/helpers/helm.js +51 -0
  632. package/lib/interface/cli/helpers/helpers.sdk.spec.js +201 -0
  633. package/lib/interface/cli/helpers/helpers.unit.spec.js +105 -0
  634. package/lib/interface/cli/helpers/image.js +66 -0
  635. package/lib/interface/cli/helpers/kubernetes.js +61 -0
  636. package/lib/interface/cli/helpers/logs.js +99 -0
  637. package/lib/interface/cli/helpers/progressEvents.js +25 -0
  638. package/lib/interface/cli/helpers/sys-re.js +76 -0
  639. package/lib/interface/cli/helpers/validation.js +92 -0
  640. package/lib/logic/cli-config/Manager.js +187 -0
  641. package/lib/logic/cli-config/Model.js +82 -0
  642. package/lib/logic/cli-config/errors/MultiplePropertiesError.js +8 -0
  643. package/lib/logic/cli-config/errors/NoPropertyError.js +8 -0
  644. package/lib/logic/cli-config/errors/NotFullPropertyError.js +8 -0
  645. package/lib/logic/cli-config/errors/PipelineValidationError.js +12 -0
  646. package/lib/logic/cli-config/errors/SchemaValidationError.js +14 -0
  647. package/lib/logic/cli-config/errors/awaitTo.js +16 -0
  648. package/lib/logic/cli-config/errors/helpers.js +23 -0
  649. package/lib/logic/cli-config/errors/index.js +13 -0
  650. package/lib/logic/cli-config/manager.spec.js +152 -0
  651. package/lib/logic/cli-config/schema.json +61 -0
  652. package/lib/logic/entities/Agent.js +52 -0
  653. package/lib/logic/entities/Annotation.js +24 -0
  654. package/lib/logic/entities/Board.js +22 -0
  655. package/lib/logic/entities/Cluster.js +22 -0
  656. package/lib/logic/entities/CodefreshRepo.js +22 -0
  657. package/lib/logic/entities/Composition.js +22 -0
  658. package/lib/logic/entities/Context.js +31 -0
  659. package/lib/logic/entities/Entity.js +48 -0
  660. package/lib/logic/entities/Environment.js +38 -0
  661. package/lib/logic/entities/GitRepo.js +21 -0
  662. package/lib/logic/entities/HelmRepo.js +23 -0
  663. package/lib/logic/entities/Image.js +13 -0
  664. package/lib/logic/entities/Pipeline.js +22 -0
  665. package/lib/logic/entities/Project.js +25 -0
  666. package/lib/logic/entities/Registry.js +35 -0
  667. package/lib/logic/entities/RuntimeEnvironments.js +30 -0
  668. package/lib/logic/entities/Section.js +23 -0
  669. package/lib/logic/entities/StepType.js +27 -0
  670. package/lib/logic/entities/StepTypeVersion.js +19 -0
  671. package/lib/logic/entities/Team.js +36 -0
  672. package/lib/logic/entities/Token.js +25 -0
  673. package/lib/logic/entities/Trigger.js +21 -0
  674. package/lib/logic/entities/TriggerEvent.js +28 -0
  675. package/lib/logic/entities/TriggerType.js +25 -0
  676. package/lib/logic/entities/Workflow.js +63 -0
  677. package/lib/logic/entities/WorkflowDataItem.js +48 -0
  678. package/lib/logic/index.js +7 -0
  679. package/lib/logic/sdk/index.js +5 -0
  680. package/lib/output/Formatter.js +42 -0
  681. package/lib/output/Output.js +88 -0
  682. package/lib/output/Style.js +96 -0
  683. package/lib/output/__mocks__/Output.js +8 -0
  684. package/lib/output/formatters/Annotations.formatter.js +7 -0
  685. package/lib/output/formatters/Board.formatter.js +7 -0
  686. package/lib/output/formatters/CodefreshRepo.formatter.js +7 -0
  687. package/lib/output/formatters/Composition.formatter.js +8 -0
  688. package/lib/output/formatters/Environment.formatter.js +17 -0
  689. package/lib/output/formatters/GitRepo.formatter.js +7 -0
  690. package/lib/output/formatters/HelmRepo.formatter.js +9 -0
  691. package/lib/output/formatters/Image.formatter.js +12 -0
  692. package/lib/output/formatters/Pipeline.formatter.js +8 -0
  693. package/lib/output/formatters/Project.formatter.js +10 -0
  694. package/lib/output/formatters/Registry.formatter.js +7 -0
  695. package/lib/output/formatters/Section.formatter.js +8 -0
  696. package/lib/output/formatters/StepType.formatter.js +8 -0
  697. package/lib/output/formatters/Team.formatter.js +13 -0
  698. package/lib/output/formatters/Token.formatter.js +11 -0
  699. package/lib/output/formatters/TriggerEvent.formatter.js +12 -0
  700. package/lib/output/formatters/TriggerType.formatter.js +12 -0
  701. package/lib/output/formatters/Workflow.formatter.js +28 -0
  702. package/lib/output/formatters/index.js +38 -0
  703. package/lib/output/types/id.output.js +16 -0
  704. package/lib/output/types/json.output.js +22 -0
  705. package/lib/output/types/name.output.js +16 -0
  706. package/lib/output/types/table.output.js +107 -0
  707. package/lib/output/types/table.output.spec.js +93 -0
  708. package/lib/output/types/yaml.output.js +30 -0
  709. package/openapi.json +8645 -0
  710. package/package.json +105 -0
  711. package/run-check-version.js +3 -0
  712. package/test-setup.js +34 -0
  713. package/yarn.lock +6124 -0
@@ -0,0 +1,1122 @@
1
+ const { prettyError } = require('../../../../logic/cli-config/errors/helpers');
2
+ const colors = require('colors');
3
+ const { to } = require('./../../../../logic/cli-config/errors/awaitTo');
4
+ const sdk = require('../../../../logic/sdk');
5
+ const _ = require('lodash');
6
+ const { status: STATUSES } = require('./installation-process');
7
+ const pipelinesRunCmd = require('../pipeline/run.cmd');
8
+ const { getAllNamespaces } = require('../../helpers/kubernetes');
9
+ const { followLogs } = require('../../helpers/logs');
10
+ const ProgressEvents = require('../../helpers/progressEvents');
11
+ const cliProgress = require('cli-progress');
12
+ const figlet = require('figlet');
13
+ const path = require('path');
14
+ const { homedir } = require('os');
15
+ const {
16
+ components, Runner, Downloader, CommonProgressFormat,
17
+ CODEFRESH_PATH,
18
+ } = require('./../../../../binary');
19
+ const { pathExists } = require('../../helpers/general');
20
+ const Promise = require('bluebird');
21
+ const YAML = require('yaml');
22
+ const fs = require('fs');
23
+
24
+ const INSTALLATION_DEFAULTS = {
25
+ NAMESPACE: 'codefresh',
26
+ MAKE_DEFAULT_RE: false,
27
+ RUN_DEMO_PIPELINE: true,
28
+ DEMO_PIPELINE_NAME: 'CF_Runner_Demo',
29
+ PROJECT_NAME: 'Runner',
30
+ CF_CONTEXT_NAME: 'cf-runner',
31
+ STORAGE_CLASS_PREFIX: 'dind-local-volumes-runner',
32
+ RUNTIME_SERVICE_ACCOUNT: 'codefresh-engine',
33
+ RESUME_OLD_INSTALLATION: true,
34
+ COMPONENTS_FOLDER: 'components',
35
+ KUBECONFIG_PATH: path.join(homedir(), '.kube', 'config'),
36
+ SAAS_RUNTIME: 'SAAS runtime',
37
+ HELM_FILE_PATH: path.join(process.cwd(), 'generated_values.yaml'),
38
+ };
39
+
40
+ const RUNTIME_IMAGES = {
41
+ DOCKER_PUSHER_IMAGE: 'codefresh/cf-docker-pusher:6.0.3',
42
+ DOCKER_PULLER_IMAGE: 'codefresh/cf-docker-puller:8.0.2',
43
+ DOCKER_TAG_PUSHER_IMAGE: 'codefresh/cf-docker-tag-pusher:v2',
44
+ DOCKER_BUILDER_IMAGE: 'codefresh/cf-docker-builder:1.1.12',
45
+ GC_BUILDER_IMAGE: 'codefresh/cf-gc-builder:0.4.0',
46
+ CONTAINER_LOGGER_IMAGE: 'codefresh/cf-container-logger:1.4.5',
47
+ GIT_CLONE_IMAGE: 'codefresh/cf-git-cloner:10.0.3',
48
+ COMPOSE_IMAGE: 'docker/compose:1.11.2',
49
+ KUBE_DEPLOY: 'codefresh/cf-deploy-kubernetes:latest',
50
+ FS_OPS_IMAGE: 'codefresh/fs-ops:latest',
51
+ TEMPLATE_ENGINE: 'codefresh/pikolo:latest',
52
+ PIPELINE_DEBUGGER_IMAGE: 'codefresh/cf-debugger:1.1.2',
53
+ };
54
+
55
+ const DEMO_STEP_IMAGE = {
56
+ 'docker.io': 'alpine:latest',
57
+ 'quay.io': 'quay.io/codefresh/alpine:3.11',
58
+ 'gcr.io': 'gcr.io/google-containers/alpine-with-bash',
59
+ default: 'quay.io/codefresh/alpine:3.11',
60
+ };
61
+
62
+ const maxRuntimeNameLength = 63;
63
+ const DefaultLogFormatter = 'plain';
64
+
65
+ const defaultOpenIssueMessage = 'If you had any issues with this process please report them at: ' +
66
+ `${colors.blue('https://github.com/codefresh-io/cli/issues/new')}`;
67
+
68
+ async function _createRunnerProjectIfNotExists() {
69
+ const [err, projectExists] = await to(sdk.projects.getByName({ name: INSTALLATION_DEFAULTS.PROJECT_NAME }));
70
+ if (_.get(err, 'message', '').includes('not found') || !projectExists) {
71
+ await sdk.projects.create({ projectName: INSTALLATION_DEFAULTS.PROJECT_NAME });
72
+ console.log(`Project "${colors.cyan(INSTALLATION_DEFAULTS.PROJECT_NAME)}" was created`);
73
+ } else {
74
+ console.log(`Project "${colors.cyan(INSTALLATION_DEFAULTS.PROJECT_NAME)}" already exists`);
75
+ }
76
+ }
77
+
78
+ async function getTestPipelineLink(pipelineName, pipeline) {
79
+ const url = _.get(sdk, 'config.context.url', 'https://g.codefresh.io');
80
+ let _pipeline = pipeline;
81
+ if (!_pipeline) {
82
+ const pipelines = await sdk.pipelines.list({ id: `${INSTALLATION_DEFAULTS.PROJECT_NAME}/${pipelineName}` });
83
+ if (_.get(pipelines, 'docs.length')) {
84
+ [_pipeline] = pipelines.docs;
85
+ }
86
+ }
87
+
88
+ if (_pipeline) {
89
+ const cleanPipelineName = _pipeline.metadata.name.replace(`${INSTALLATION_DEFAULTS.PROJECT_NAME}/`, ''); // remove the project prefix
90
+ return `${url}/pipelines/edit/workflow?id=${_pipeline.metadata.id}&pipeline=${encodeURI(cleanPipelineName)}` +
91
+ `&projects=${encodeURI(INSTALLATION_DEFAULTS.PROJECT_NAME)}`;
92
+ }
93
+
94
+ return '';
95
+ }
96
+
97
+ async function createTestPipeline(runtimeName, pipelineName, pipelineCommands, dockerRegistry) {
98
+ await _createRunnerProjectIfNotExists();
99
+ console.log(`Creating test pipeline with the name: "${colors.cyan(pipelineName)}" ` +
100
+ `in project "${colors.cyan(INSTALLATION_DEFAULTS.PROJECT_NAME)}"`);
101
+ const pipeline = await sdk.pipelines.create({ metadata: { name: `${INSTALLATION_DEFAULTS.PROJECT_NAME}/${pipelineName}` } });
102
+
103
+ pipeline.spec.runtimeEnvironment = {
104
+ name: runtimeName,
105
+ };
106
+
107
+ const demoStepImage = DEMO_STEP_IMAGE[dockerRegistry] || DEMO_STEP_IMAGE.default;
108
+
109
+ pipeline.spec.steps = {};
110
+ pipeline.spec.stages = ['test'];
111
+ pipeline.spec.steps.test = {
112
+ stage: 'test',
113
+ title: 'test',
114
+ image: demoStepImage,
115
+ commands: pipelineCommands || ['echo hello Codefresh Runner!'],
116
+ };
117
+
118
+ await sdk.pipelines.replace(
119
+ { name: `${INSTALLATION_DEFAULTS.PROJECT_NAME}/${pipelineName}` },
120
+ {
121
+ kind: pipeline.kind,
122
+ spec: pipeline.spec,
123
+ metadata: pipeline.metadata,
124
+ version: pipeline.version,
125
+ },
126
+ );
127
+
128
+ const pipelineLink = await getTestPipelineLink(undefined, pipeline);
129
+ console.log(`Created test pipeline with the name "${colors.cyan(pipelineName)}". Watch it here: ${colors.blue(pipelineLink)}`);
130
+
131
+ return pipeline;
132
+ }
133
+
134
+ async function getTestPipeline(pipelineName) {
135
+ const pipelines = await sdk.pipelines.list({ id: `${INSTALLATION_DEFAULTS.PROJECT_NAME}/${pipelineName}` });
136
+ if (_.get(pipelines, 'docs.length')) {
137
+ const pipeline = pipelines.docs[0];
138
+ const pipelineLink = await getTestPipelineLink(undefined, pipeline);
139
+ console.log(`Test pipeline with the name: "${colors.cyan(pipelineName)}" already exists.` +
140
+ ` Watch it here: ${colors.blue(pipelineLink)}`);
141
+ return pipeline;
142
+ }
143
+
144
+ return null;
145
+ }
146
+
147
+ async function updateTestPipelineRuntime(pipeline, runtimeName, pipelineName, dockerRegistry) {
148
+ let _pipeline = pipeline;
149
+ if (!_pipeline) {
150
+ const testPipeline = await getTestPipeline(pipelineName);
151
+ if (!testPipeline) {
152
+ throw new Error('Could not get test pipeline');
153
+ }
154
+ _pipeline = testPipeline;
155
+ }
156
+ _pipeline.spec.runtimeEnvironment = {
157
+ name: runtimeName,
158
+ };
159
+
160
+ const demoStepImage = DEMO_STEP_IMAGE[dockerRegistry] || DEMO_STEP_IMAGE.default;
161
+
162
+ _pipeline.spec.steps.test.image = demoStepImage;
163
+
164
+ await sdk.pipelines.replace(
165
+ { name: _pipeline.metadata.name },
166
+ {
167
+ kind: _pipeline.kind,
168
+ spec: _pipeline.spec,
169
+ metadata: _pipeline.metadata,
170
+ version: _pipeline.version,
171
+ },
172
+ );
173
+ }
174
+
175
+ async function executeTestPipeline(runtimeName, pipelineName) {
176
+ const url = _.get(sdk, 'config.context.url', 'https://g.codefresh.io');
177
+ const projectPrefix = `${INSTALLATION_DEFAULTS.PROJECT_NAME}/`;
178
+ console.log(`${colors.yellow('*NOTE* Running a pipeline for the first time might take longer than usual.')}`);
179
+ let _pipelineName = pipelineName;
180
+ if (!pipelineName.includes(projectPrefix)) {
181
+ _pipelineName = `${projectPrefix}${pipelineName}`;
182
+ }
183
+ const workflowId = await pipelinesRunCmd.handler({
184
+ name: _pipelineName,
185
+ exitProcess: false,
186
+ annotation: [],
187
+ 'runtime-name': runtimeName,
188
+ returnWorkflowId: true,
189
+ });
190
+ const buildLink = `${url}/build/${workflowId}`;
191
+ console.log(`Executing pipeline "${colors.cyan(pipelineName)}", watch it at: ${colors.blue(buildLink)}`);
192
+ await followLogs(workflowId);
193
+ }
194
+
195
+ function createErrorHandler(openIssueMessage = defaultOpenIssueMessage) {
196
+ return async (error, message, progressReporter, event, exitOnError = true) => {
197
+ if (!error) {
198
+ return;
199
+ }
200
+
201
+ if (progressReporter && event) {
202
+ await to(progressReporter.report(event, STATUSES.FAILURE));
203
+ }
204
+
205
+ console.log(`${colors.red('Error:')} ${message}: ${prettyError(error)}`);
206
+ if (exitOnError) {
207
+ console.log(colors.green(openIssueMessage));
208
+ process.exit(1);
209
+ }
210
+ };
211
+ }
212
+
213
+ async function getRelatedAgents(kubeNamespace, runtimes, agents, errHandler) {
214
+ let allAgents = agents;
215
+ if (!agents) {
216
+ const [listAgentsErr, _agents] = await to(sdk.agents.list({}));
217
+ await errHandler(listAgentsErr, 'Failed to get agents');
218
+ allAgents = _agents;
219
+ }
220
+
221
+ const relatedREs = new Set();
222
+ _.forEach(runtimes, (r) => {
223
+ if (_.get(r, 'runtimeScheduler.cluster.namespace') === kubeNamespace) {
224
+ relatedREs.add(r.metadata.name);
225
+ }
226
+ });
227
+
228
+ const relatedAgents = [];
229
+ _.forEach(allAgents, (a) => {
230
+ _.forEach(_.get(a, 'runtimes', []), (r) => {
231
+ if (relatedREs.has(r)) {
232
+ relatedAgents.push(a);
233
+ }
234
+ });
235
+ });
236
+
237
+ return relatedAgents;
238
+ }
239
+
240
+ // Try to get the most relevant namespaces
241
+ async function getRelatedNamespaces(kubeConfigPath, kubeContextName, runtimes) {
242
+ const [err, namespacesOnCluster] = await to(getAllNamespaces(kubeConfigPath, kubeContextName));
243
+ if (err) {
244
+ throw err;
245
+ }
246
+
247
+ const nsOnCluster = new Set(namespacesOnCluster || []);
248
+ return _(runtimes)
249
+ .filter(re => nsOnCluster.has(_.get(re, 'runtimeScheduler.cluster.namespace')))
250
+ .map(re => _.get(re, 'runtimeScheduler.cluster.namespace'))
251
+ .uniq()
252
+ .value();
253
+ }
254
+
255
+ function getRuntimesWithVersions(runtimes, agents) {
256
+ const hybridRuntimes = runtimes.filter(re => _.get(re, 'metadata.agent'));
257
+ const runtimesWithOldVersion = new Set(_.map(hybridRuntimes, re => re.metadata.name));
258
+ const runtimesWithNewVersion = new Set();
259
+ _.forEach(agents, (a) => {
260
+ _.forEach(a.runtimes, (re) => {
261
+ runtimesWithOldVersion.delete(re);
262
+ runtimesWithNewVersion.add(re);
263
+ });
264
+ });
265
+
266
+ const runtimesWithVersions = [...runtimesWithOldVersion, ...runtimesWithNewVersion].reduce((acc, cur, i) => {
267
+ acc[cur] = i < runtimesWithOldVersion.size ? '0.x.x' : '1.x.x';
268
+ return acc;
269
+ }, {});
270
+
271
+ return runtimesWithVersions;
272
+ }
273
+
274
+ function getRuntimeVersion(runtimeName, agents) {
275
+ let hasAgentsAttached = false;
276
+ _.forEach(agents, (a) => {
277
+ _.forEach(a.runtimes, (re) => {
278
+ if (re === runtimeName) {
279
+ hasAgentsAttached = true;
280
+ }
281
+ });
282
+ });
283
+
284
+ return hasAgentsAttached ? '1.0.0' : '0.0.1';
285
+ }
286
+
287
+ function createProgressBar() {
288
+ const runtimeEvents = new ProgressEvents();
289
+ const runtimeFormat = 'downloading runtime installer [{bar}] {percentage}% | {value}/{total}';
290
+ const runtimmrProgressBar = new cliProgress.SingleBar(
291
+ { stopOnComplete: true, format: runtimeFormat },
292
+ cliProgress.Presets.shades_classic,
293
+ );
294
+ let runtimeTotalSize;
295
+ runtimeEvents.onStart((size) => {
296
+ console.log('Downloading runtime installer:\n');
297
+ runtimmrProgressBar.start(size, 0);
298
+ runtimeTotalSize = size;
299
+ });
300
+ runtimeEvents.onProgress((progress) => {
301
+ runtimmrProgressBar.update(progress);
302
+ if (progress >= runtimeTotalSize) {
303
+ console.log('\n');
304
+ }
305
+ });
306
+
307
+ return runtimeEvents;
308
+ }
309
+
310
+ function drawCodefreshFiglet() {
311
+ return Promise.race([new Promise((resolve) => {
312
+ figlet('CODEFRESH', (err, data) => {
313
+ if (err) {
314
+ resolve();
315
+ }
316
+ if (data) {
317
+ console.log(data);
318
+ }
319
+ resolve();
320
+ });
321
+ }), Promise.delay(5000)]);
322
+ }
323
+
324
+ async function getDefaultRuntime(runtimes) {
325
+ let _runtimes = runtimes;
326
+ if (!_runtimes) {
327
+ _runtimes = await sdk.runtimeEnvs.list({ });
328
+ }
329
+ const defaultRe = _.find(_runtimes, re => re.default);
330
+
331
+ return defaultRe;
332
+ }
333
+
334
+ async function getRecommendedKubeNamespace(kubeconfigPath, kubeContextName) {
335
+ const defaultName = INSTALLATION_DEFAULTS.NAMESPACE;
336
+ const [err, namespaces] = await to(getAllNamespaces(kubeconfigPath, kubeContextName));
337
+ let name;
338
+
339
+ if (err || !_.isArray(namespaces) || !_.find(namespaces, ns => ns === defaultName)) {
340
+ name = defaultName; // use the default name if there are no collisions
341
+ } else {
342
+ const namespacesSet = new Set(namespaces); // for fast lookup
343
+ let i = 1;
344
+ while (namespacesSet.has(`${defaultName}-${i}`)) {
345
+ i += 1;
346
+ }
347
+ name = `${defaultName}-${i}`;
348
+ }
349
+
350
+ return name;
351
+ }
352
+
353
+ async function getComponent(location = CODEFRESH_PATH, component, bypassDownload) {
354
+ const componentName = component.name || 'component';
355
+ const localBinLocation = path.join(
356
+ process.cwd(),
357
+ INSTALLATION_DEFAULTS.COMPONENTS_FOLDER,
358
+ _.get(component, 'local.dir', ''),
359
+ _.get(component, 'local.bin', ''),
360
+ );
361
+
362
+ const downloadedBinLocation = path.join(
363
+ process.cwd(),
364
+ location,
365
+ _.get(component, 'local.dir', ''),
366
+ _.get(component, 'local.bin', ''),
367
+ );
368
+
369
+ if (bypassDownload) {
370
+ if (await pathExists(localBinLocation)) {
371
+ return path.join(process.cwd(), INSTALLATION_DEFAULTS.COMPONENTS_FOLDER);
372
+ }
373
+ if (await pathExists(downloadedBinLocation)) {
374
+ return location;
375
+ }
376
+
377
+ throw new Error(`cannot bypass download, ${componentName} not found, aborting.`);
378
+ }
379
+
380
+ const downloader = new Downloader({
381
+ progress: new cliProgress.SingleBar(
382
+ {
383
+ stopOnComplete: true,
384
+ format: CommonProgressFormat,
385
+ },
386
+ cliProgress.Presets.shades_classic,
387
+ ),
388
+ location,
389
+ });
390
+
391
+ const [err] = await to(downloader.download(component));
392
+ if (err) {
393
+ if (await pathExists(localBinLocation)) {
394
+ console.log(`failed to download ${componentName}, using local binary instead`);
395
+
396
+ return path.resolve(process.cwd(), INSTALLATION_DEFAULTS.COMPONENTS_FOLDER);
397
+ }
398
+
399
+ throw new Error(`failed to download ${componentName}, aborting.`);
400
+ }
401
+
402
+ return location;
403
+ }
404
+
405
+ async function downloadVeonona(location, bypassDownload = false) {
406
+ return await getComponent(location, components.venona, bypassDownload);
407
+ }
408
+
409
+ async function downloadProvider({ provider, location }, bypassDownload = false) {
410
+ return await await getComponent(location, components.gitops[provider], bypassDownload);
411
+ }
412
+
413
+ async function downloadSteveDore(location, bypassDownload = false) {
414
+ return await getComponent(location, components.stevedore, bypassDownload);
415
+ }
416
+
417
+ async function downloadHybridComponents(location, bypassDownload = false) {
418
+ await downloadVeonona(location, bypassDownload);
419
+ console.log(`Kubernetes components installer downloaded successfully to ${location} `);
420
+ await downloadSteveDore(location, bypassDownload);
421
+ console.log(`Kubernetes registrator installer downloaded successfully ${location}`);
422
+ }
423
+
424
+ async function runClusterAcceptanceTests({
425
+ apiHost,
426
+ kubeNamespace,
427
+ kubeConfigPath,
428
+ kubeContextName,
429
+ dockerRegistry,
430
+ envVars,
431
+ verbose,
432
+ valuesFile, // --values
433
+ setValue, // --set-value
434
+ setFile, // --set-file
435
+ bypassDownload, // --bypass-download
436
+ }) {
437
+ const binLocation = await downloadVeonona(undefined, bypassDownload);
438
+ const componentRunner = new Runner(binLocation);
439
+ const cmd = ['test', '--log-formtter', DefaultLogFormatter];
440
+ if (apiHost) {
441
+ cmd.push(`--api-host=${apiHost}`);
442
+ }
443
+ if (kubeNamespace) {
444
+ cmd.push('--kube-namespace');
445
+ cmd.push(kubeNamespace);
446
+ }
447
+ if (kubeContextName) {
448
+ cmd.push('--kube-context-name');
449
+ cmd.push(kubeContextName);
450
+ }
451
+ if (kubeConfigPath) {
452
+ cmd.push('--kube-config-path');
453
+ cmd.push(kubeConfigPath);
454
+ }
455
+ if (process.env.NODE_TLS_REJECT_UNAUTHORIZED === '0') {
456
+ cmd.push('--insecure');
457
+ }
458
+ if (dockerRegistry) {
459
+ cmd.push(`--set-value=DockerRegistry=${dockerRegistry}`);
460
+ }
461
+ if (verbose) {
462
+ cmd.push(`--verbose=${verbose}`);
463
+ }
464
+ if (envVars) {
465
+ envVars.forEach((item) => {
466
+ const parts = item.split('=');
467
+ cmd.push(`--set-value=EnvVars.${parts[0]}=${parts[1].replace(/,/g, '\\,')}`);
468
+ });
469
+ }
470
+ if (valuesFile) {
471
+ cmd.push(`--values=${valuesFile}`);
472
+ }
473
+ if (setValue) {
474
+ cmd.push(`--set-value=${setValue}`);
475
+ }
476
+ if (setFile) {
477
+ cmd.push(`--set-file=${setFile}`);
478
+ }
479
+ await componentRunner.run(components.venona, cmd);
480
+ }
481
+
482
+ async function runUpgrade({ kubeNamespace, kubeContextName, bypassDownload }) {
483
+ const binLocation = await downloadVeonona(undefined, bypassDownload);
484
+ const componentRunner = new Runner(binLocation);
485
+ const cmd = ['upgrade', '--log-formtter', DefaultLogFormatter];
486
+ if (kubeNamespace) {
487
+ cmd.push('--kube-namespace');
488
+ cmd.push(kubeNamespace);
489
+ }
490
+ if (kubeContextName) {
491
+ cmd.push('--kube-context-name');
492
+ cmd.push(kubeContextName);
493
+ }
494
+ await componentRunner.run(components.venona, cmd);
495
+ }
496
+
497
+ async function installAgent({
498
+ apiHost, // --api-host
499
+ agentId, // --agnetId
500
+ kubeContextName, // kube-context-name
501
+ kubeNamespace, // --kube-namespace
502
+ dockerRegistry, // --docker-registry
503
+ token, // --agentToken
504
+ kubeNodeSelector, // --kube-node-selector
505
+ dryRun, // --dryRun
506
+ bypassDownload, // --bypass-download
507
+ inCluster, // -inCluster
508
+ tolerations, // --tolerations
509
+ venonaVersion, // --venona-version
510
+ kubeConfigPath, // --kube-config-path
511
+ skipVersionCheck, // --skip-version-check
512
+ verbose, // --verbose
513
+ logFormatting = DefaultLogFormatter, // --log-formtter
514
+ envVars,
515
+ valuesFile, // --values
516
+ setValue, // --set-value
517
+ setFile, // --set-file
518
+ }) {
519
+ const binLocation = await downloadVeonona(undefined, bypassDownload);
520
+ const componentRunner = new Runner(binLocation);
521
+ const cmd = [
522
+ 'install',
523
+ 'agent',
524
+ '--agentId',
525
+ agentId,
526
+ '--api-host',
527
+ apiHost,
528
+ '--kube-context-name',
529
+ kubeContextName,
530
+ '--kube-namespace',
531
+ kubeNamespace,
532
+ '--log-formtter',
533
+ logFormatting,
534
+ ];
535
+ if (kubeNodeSelector) {
536
+ cmd.push('--kube-node-selector');
537
+ cmd.push(kubeNodeSelector);
538
+ }
539
+
540
+ if (dockerRegistry) {
541
+ cmd.push(`--docker-registry=${dockerRegistry}`);
542
+ }
543
+
544
+ if (token) {
545
+ cmd.push(`--agentToken=${token}`);
546
+ }
547
+ if (dryRun) {
548
+ cmd.push('--dry-run');
549
+ }
550
+
551
+ if (bypassDownload) {
552
+ cmd.push(`--bypass-download=${bypassDownload}`);
553
+ }
554
+
555
+ if (inCluster) {
556
+ cmd.push('--in-cluster');
557
+ }
558
+ if (tolerations) {
559
+ cmd.push(`--tolerations=${tolerations}`);
560
+ }
561
+ if (venonaVersion) {
562
+ cmd.push(`--venona-version=${venonaVersion}`);
563
+ }
564
+ if (kubeConfigPath) {
565
+ cmd.push(`--kube-config-path=${kubeConfigPath}`);
566
+ }
567
+ if (skipVersionCheck) {
568
+ cmd.push('--skip-version-check');
569
+ }
570
+ if (verbose) {
571
+ cmd.push('--verbose');
572
+ }
573
+ if (envVars) {
574
+ envVars.forEach((item) => {
575
+ const parts = item.split('=');
576
+ cmd.push(`--set-value=EnvVars.${parts[0]}=${parts[1].replace(/,/g, '\\,')}`);
577
+ });
578
+ }
579
+ if (valuesFile) {
580
+ cmd.push(`--values=${valuesFile}`);
581
+ }
582
+ if (setValue) {
583
+ cmd.push(`--set-value=${setValue}`);
584
+ }
585
+ if (setFile) {
586
+ cmd.push(`--set-file=${setFile}`);
587
+ }
588
+ await componentRunner.run(components.venona, cmd);
589
+ }
590
+
591
+ async function installRuntime({
592
+ apiHost, // --api-host
593
+ token, // --agent-token
594
+ kubeContextName, // kube-context-name
595
+ kubeNamespace, // --kube-namespace
596
+ dockerRegistry, // --docker-registry
597
+ dryRun, // --dryRun
598
+ bypassDownload, // --bypass-download
599
+ inCluster, // -inCluster
600
+ kubeConfigPath, // --kube-config-path
601
+ verbose, // --verbose
602
+ name, // --runtimeEnvironmentName
603
+ envVars,
604
+ valuesFile, // --values
605
+ setValue, // --set-value
606
+ setFile, // --set-file
607
+ kubeNodeSelector, // --kube-node-selector
608
+ storageClassName, // --storage-class
609
+ logFormatting = DefaultLogFormatter, // --log-formtter
610
+ }) {
611
+ const binLocation = await downloadVeonona(undefined, bypassDownload);
612
+ const componentRunner = new Runner(binLocation);
613
+ const cmd = [
614
+ 'install',
615
+ 'runtime',
616
+ '--codefreshToken',
617
+ token,
618
+ '--api-host',
619
+ apiHost,
620
+ '--kube-context-name',
621
+ kubeContextName,
622
+ '--kube-namespace',
623
+ kubeNamespace,
624
+ '--log-formtter',
625
+ logFormatting,
626
+ ];
627
+
628
+ if (dockerRegistry) {
629
+ cmd.push(`--docker-registry=${dockerRegistry}`);
630
+ }
631
+
632
+ if (dryRun) {
633
+ cmd.push('--dry-run');
634
+ }
635
+ if (inCluster) {
636
+ cmd.push('--in-cluster');
637
+ }
638
+ if (kubeConfigPath) {
639
+ cmd.push(`--kube-config-path=${kubeConfigPath}`);
640
+ }
641
+ if (verbose) {
642
+ cmd.push('--verbose');
643
+ }
644
+ if (valuesFile) {
645
+ cmd.push(`--values=${valuesFile}`);
646
+ }
647
+ if (setValue) {
648
+ cmd.push(`--set-value=${setValue}`);
649
+ }
650
+ if (envVars) {
651
+ envVars.forEach((item) => {
652
+ const parts = item.split('=');
653
+ cmd.push(`--set-value=EnvVars.${parts[0]}=${parts[1].replace(/,/g, '\\,')}`);
654
+ });
655
+ }
656
+ if (setFile) {
657
+ cmd.push(`--set-file=${setFile}`);
658
+ }
659
+ if (kubeNodeSelector) {
660
+ cmd.push(`--kube-node-selector=${kubeNodeSelector}`);
661
+ }
662
+ if (name) {
663
+ cmd.push('--runtimeName');
664
+ cmd.push(name);
665
+ }
666
+ if (storageClassName) {
667
+ cmd.push(`--storage-class=${storageClassName}`);
668
+ }
669
+ if (process.env.NODE_TLS_REJECT_UNAUTHORIZED === '0') {
670
+ cmd.push('--insecure');
671
+ }
672
+
673
+ await componentRunner.run(components.venona, cmd);
674
+ }
675
+
676
+ async function installAppProxy({
677
+ kubeContextName, // kube-context-name
678
+ kubeNamespace, // --kube-namespace
679
+ kubeConfigPath, // --kube-config-path
680
+ verbose, // --verbose
681
+ dockerRegistry, // --docker-registry
682
+ logFormatting = DefaultLogFormatter, // --log-formtter
683
+ bypassDownload, // --bypass-download
684
+ valuesFile, // --values
685
+ setValue, // --set-value
686
+ setFile, // --set-file
687
+ appProxyHost, // --app-proxy-host
688
+ appProxyIngressClass, // --app-proxy-ingress-class
689
+ apiHost, // --api-host
690
+ envVars, // --envVars
691
+ dryRun, // --dry-run
692
+ }) {
693
+ const binLocation = await downloadVeonona(undefined, bypassDownload);
694
+ const componentRunner = new Runner(binLocation);
695
+ const cmd = [
696
+ 'install',
697
+ 'app-proxy',
698
+ '--kube-context-name',
699
+ kubeContextName,
700
+ '--kube-namespace',
701
+ kubeNamespace,
702
+ '--log-formtter',
703
+ logFormatting,
704
+ ];
705
+
706
+ if (dockerRegistry) {
707
+ cmd.push(`--docker-registry=${dockerRegistry}`);
708
+ }
709
+
710
+ if (apiHost) {
711
+ cmd.push(`--api-host=${apiHost}`);
712
+ }
713
+
714
+ if (kubeConfigPath) {
715
+ cmd.push(`--kube-config-path=${kubeConfigPath}`);
716
+ }
717
+ if (verbose) {
718
+ cmd.push('--verbose');
719
+ }
720
+ if (process.env.NODE_TLS_REJECT_UNAUTHORIZED === '0') {
721
+ cmd.push('--insecure');
722
+ }
723
+ if (setValue) {
724
+ if (_.isArray(setValue)) {
725
+ setValue.forEach(sv => cmd.push(`--set-value=${sv}`));
726
+ } else {
727
+ cmd.push(`--set-value=${setValue}`);
728
+ }
729
+ }
730
+ if (envVars) {
731
+ envVars.forEach((item) => {
732
+ const parts = item.split('=');
733
+ cmd.push(`--set-value=EnvVars.${parts[0]}=${parts[1].replace(/,/g, '\\,')}`);
734
+ });
735
+ }
736
+ if (valuesFile) {
737
+ cmd.push(`--values=${valuesFile}`);
738
+ }
739
+ if (setFile) {
740
+ cmd.push(`--set-file=${setFile}`);
741
+ }
742
+ if (appProxyHost) {
743
+ cmd.push(`--host=${appProxyHost}`);
744
+ }
745
+ if (dryRun) {
746
+ cmd.push('--dry-run');
747
+ }
748
+ if (appProxyIngressClass) {
749
+ cmd.push(`--ingress-class=${appProxyIngressClass}`);
750
+ }
751
+
752
+ await componentRunner.run(components.venona, cmd, true);
753
+ }
754
+
755
+ async function unInstallAppProxy({
756
+ kubeContextName, // kube-context-name
757
+ kubeNamespace, // --kube-namespace
758
+ kubeConfigPath, // --kube-config-path
759
+ verbose, // --verbose
760
+ bypassDownload, // --bypass-download
761
+ logFormatting = DefaultLogFormatter, // --log-formtter
762
+ valuesFile, // --values
763
+ setValue, // --set-value
764
+ }) {
765
+ const binLocation = await downloadVeonona(undefined, bypassDownload);
766
+ const componentRunner = new Runner(binLocation);
767
+ const cmd = [
768
+ 'uninstall',
769
+ 'app-proxy',
770
+ '--kube-context-name',
771
+ kubeContextName,
772
+ '--kube-namespace',
773
+ kubeNamespace,
774
+ '--log-formtter',
775
+ logFormatting,
776
+ ];
777
+
778
+ if (kubeConfigPath) {
779
+ cmd.push(`--kube-config-path=${kubeConfigPath}`);
780
+ }
781
+ if (verbose) {
782
+ cmd.push('--verbose');
783
+ }
784
+ if (setValue) {
785
+ if (_.isArray(setValue)) {
786
+ setValue.forEach(sv => cmd.push(`--set-value=${sv}`));
787
+ } else {
788
+ cmd.push(`--set-value=${setValue}`);
789
+ }
790
+ }
791
+ if (valuesFile) {
792
+ cmd.push(`--values=${valuesFile}`);
793
+ }
794
+ await componentRunner.run(components.venona, cmd);
795
+ }
796
+
797
+ async function upgradeAppProxy({
798
+ kubeContextName, // kube-context-name
799
+ kubeNamespace, // --kube-namespace
800
+ kubeConfigPath, // --kube-config-path
801
+ verbose, // --verbose
802
+ bypassDownload, // --bypass-download
803
+ logFormatting = DefaultLogFormatter, // --log-formtter
804
+ valuesFile, // --values
805
+ setValue, // --set-value
806
+ }) {
807
+ const binLocation = await downloadVeonona(undefined, bypassDownload);
808
+ const componentRunner = new Runner(binLocation);
809
+ const cmd = [
810
+ 'upgrade',
811
+ 'app-proxy',
812
+ '--kube-context-name',
813
+ kubeContextName,
814
+ '--kube-namespace',
815
+ kubeNamespace,
816
+ '--log-formtter',
817
+ logFormatting,
818
+ ];
819
+
820
+ if (kubeConfigPath) {
821
+ cmd.push(`--kube-config-path=${kubeConfigPath}`);
822
+ }
823
+ if (verbose) {
824
+ cmd.push('--verbose');
825
+ }
826
+ if (setValue) {
827
+ if (_.isArray(setValue)) {
828
+ setValue.forEach(sv => cmd.push(`--set-value=${sv}`));
829
+ } else {
830
+ cmd.push(`--set-value=${setValue}`);
831
+ }
832
+ }
833
+ if (valuesFile) {
834
+ cmd.push(`--values=${valuesFile}`);
835
+ }
836
+ await componentRunner.run(components.venona, cmd);
837
+ }
838
+
839
+ async function attachRuntime({
840
+ kubeServiceAccount, // kube-service-account
841
+ kubeContextName, // kube-context-name
842
+ kubeNamespace, // --kube-namespace
843
+ kubeConfigPath, // --kube-config-path
844
+ agentKubeContextName, // --kube-context-name-agent
845
+ agentKubeNamespace, // --kube-namespace-agent
846
+ agentKubeConfigPath, // --kube-config-path-agent
847
+ restartAgent, // --restart-agent
848
+ verbose, // --verbose
849
+ runtimeName, // --runtimeName
850
+ logFormatting = DefaultLogFormatter, // --log-formtter
851
+ valuesFile, // --values
852
+ setValue, // --set-value
853
+ setFile, // --set-file
854
+ dryRun,
855
+ bypassDownload,
856
+ }) {
857
+ const binLocation = await downloadVeonona(undefined, bypassDownload);
858
+ const componentRunner = new Runner(binLocation);
859
+ const cmd = [
860
+ 'attach',
861
+ '--kube-context-name',
862
+ kubeContextName,
863
+ '--kube-namespace',
864
+ kubeNamespace,
865
+ '--runtime-name',
866
+ runtimeName,
867
+ '--log-formtter',
868
+ logFormatting,
869
+ ];
870
+
871
+ if (kubeServiceAccount) {
872
+ cmd.push(`--kube-service-account=${kubeServiceAccount}`);
873
+ }
874
+
875
+ if (kubeConfigPath) {
876
+ cmd.push(`--kube-config-path=${kubeConfigPath}`);
877
+ }
878
+ if (agentKubeContextName) {
879
+ cmd.push(`--kube-context-name-agent=${agentKubeContextName}`);
880
+ }
881
+ if (agentKubeNamespace) {
882
+ cmd.push(`--kube-namespace-agent=${agentKubeNamespace}`);
883
+ }
884
+ if (agentKubeConfigPath) {
885
+ cmd.push(`--kube-config-path-agent=${agentKubeConfigPath}`);
886
+ }
887
+ if (verbose) {
888
+ cmd.push('--verbose');
889
+ }
890
+ if (restartAgent) {
891
+ cmd.push('--restart-agent');
892
+ }
893
+ if (logFormatting) {
894
+ cmd.push(`--log-formtter=${logFormatting}`);
895
+ }
896
+
897
+ if (valuesFile) {
898
+ cmd.push(`--values=${valuesFile}`);
899
+ }
900
+ if (setValue) {
901
+ if (_.isArray(setValue)) {
902
+ setValue.forEach(sv => cmd.push(`--set-value=${sv}`));
903
+ } else {
904
+ cmd.push(`--set-value=${setValue}`);
905
+ }
906
+ }
907
+ if (setFile) {
908
+ cmd.push(`--set-file=${setFile}`);
909
+ }
910
+ if (dryRun) {
911
+ cmd.push('--dry-run');
912
+ }
913
+ await componentRunner.run(components.venona, cmd);
914
+ }
915
+
916
+ async function newRuntimeName(kubeContextName, kubeNamespace) {
917
+ const defaultName = `${kubeContextName}/${kubeNamespace}`.slice(0, maxRuntimeNameLength);
918
+ const runtimes = await sdk.runtimeEnvs.list({ });
919
+ let name;
920
+
921
+ if (!_.isArray(runtimes) || !_.find(runtimes, re => _.get(re, 'metadata.name') === defaultName)) {
922
+ name = defaultName; // use the default name if there are no collisions
923
+ } else {
924
+ const reNames = new Set(_.map(runtimes, re => _.get(re, 'metadata.name'))); // for fast lookup
925
+ let i = 1;
926
+ let suggestName;
927
+ // eslint-disable-next-line no-constant-condition
928
+ while (true) {
929
+ suggestName = `${defaultName.slice(0, maxRuntimeNameLength - 1 - i.toString().length)}_${i}`;
930
+ if (!reNames.has(suggestName)) {
931
+ break;
932
+ }
933
+ i += 1;
934
+ }
935
+ name = suggestName;
936
+ }
937
+
938
+ return name;
939
+ }
940
+
941
+ async function newAgentName(kubeContextName, kubeNamespace, agents) {
942
+ const defaultName = `${kubeContextName}_${kubeNamespace}`;
943
+ if (!agents) {
944
+ // eslint-disable-next-line no-param-reassign
945
+ agents = await sdk.agents.list({ });
946
+ }
947
+ let name;
948
+
949
+ if (!_.isArray(agents) || !_.find(agents, a => a.name === defaultName)) {
950
+ name = defaultName; // use the default name if there are no collisions
951
+ } else {
952
+ const agentsNames = new Set(_.map(agents, a => a.name)); // for fast lookup
953
+ let i = 1;
954
+ while (agentsNames.has(`${defaultName}_${i}`)) {
955
+ i += 1;
956
+ }
957
+ name = `${defaultName}_${i}`;
958
+ }
959
+
960
+ return name;
961
+ }
962
+
963
+ function keyValueAsStringToObject(nodeSelectorStr) {
964
+ if (_.isString(nodeSelectorStr)) {
965
+ const kubeNodeSelectorObj = {};
966
+ const nsSplitParts = nodeSelectorStr.split(',');
967
+ nsSplitParts.forEach((nsPart) => {
968
+ const nsRecordSplit = nsPart.split('=');
969
+ if (nsRecordSplit.length !== 2) {
970
+ throw new Error('invalid kube-node-selector parameter');
971
+ }
972
+ // eslint-disable-next-line prefer-destructuring
973
+ kubeNodeSelectorObj[nsRecordSplit[0]] = nsRecordSplit[1];
974
+ });
975
+ return kubeNodeSelectorObj;
976
+ }
977
+ return nodeSelectorStr;
978
+ }
979
+
980
+ function objectToKeyValueArray(obj) {
981
+ return Object.keys(obj).reduce((acc, key) => {
982
+ acc.push(`${key}=${obj[key]}`);
983
+ return acc;
984
+ }, []);
985
+ }
986
+
987
+ function serealizeToKeyValuePairs(obj) {
988
+ return _.keys(obj).reduce((acc, key) => {
989
+ if (acc) {
990
+ return `${acc},${key}=${obj[key]}`;
991
+ }
992
+ return `${key}=${obj[key]}`;
993
+ }, '');
994
+ }
995
+
996
+ function getRuntimeImagesWithRegistryUrl(registry) {
997
+ return Object.keys(RUNTIME_IMAGES).reduce((acc, cur) => {
998
+ acc[cur] = `${registry}/${RUNTIME_IMAGES[cur]}`;
999
+ return acc;
1000
+ }, {});
1001
+ }
1002
+
1003
+ function mergeValuesFromValuesFile(argv, valuesFile, handleError) {
1004
+ const valuesFileStr = fs.readFileSync(valuesFile, 'utf8');
1005
+ const valuesObj = YAML.parse(valuesFileStr);
1006
+ const _argv = _.cloneDeep(argv);
1007
+
1008
+ _argv.yes = true; // don't ask any questions
1009
+
1010
+ if (!_.has(_argv, 'kube-config-path') && _.has(valuesObj, 'ConfigPath')) {
1011
+ _.set(_argv, 'kube-config-path', valuesObj.ConfigPath);
1012
+ }
1013
+ if (!_.has(_argv, 'kube-context-name') && _.has(valuesObj, 'Context')) {
1014
+ _.set(_argv, 'kube-context-name', valuesObj.Context);
1015
+ }
1016
+ if (!_.has(_argv, 'kube-namespace') && _.has(valuesObj, 'Namespace')) {
1017
+ _.set(_argv, 'kube-namespace', valuesObj.Namespace);
1018
+ }
1019
+ if (!_.has(_argv, 'url') && _.has(valuesObj, 'CodefreshHost')) {
1020
+ _.set(_argv, 'url', valuesObj.CodefreshHost);
1021
+ }
1022
+ if (!_.has(_argv, 'token') && _.has(valuesObj, 'Token')) {
1023
+ _.set(_argv, 'token', valuesObj.Token);
1024
+ }
1025
+ if (!_.has(_argv, 'name') && _.has(valuesObj, 'AgentId')) {
1026
+ _.set(_argv, 'name', valuesObj.AgentId);
1027
+ }
1028
+ if (!_.has(_argv, 'install-monitor') && _.has(valuesObj, 'Monitor.Enabled')) {
1029
+ _.set(_argv, 'install-monitor', valuesObj.Monitor.Enabled);
1030
+ }
1031
+ if (_.get(valuesObj, 'AppProxy')) {
1032
+ _.set(_argv, 'app-proxy', true);
1033
+ }
1034
+ if (!_.has(_argv, 'app-proxy-host') && _.get(valuesObj, 'AppProxy.Ingress.Host')) {
1035
+ _.set(_argv, 'app-proxy-host', valuesObj.AppProxy.Ingress.Host);
1036
+ }
1037
+ if (_argv.appProxy && !_argv['app-proxy-host']) {
1038
+ handleError(new Error('no hostname provided'), 'cannot install app-proxy component without a hostname', undefined, undefined, true);
1039
+ }
1040
+ if (!_.has(_argv, 'app-proxy-path-prefix') && _.get(valuesObj, 'AppProxy.Ingress.PathPrefix')) {
1041
+ _.set(_argv, 'app-proxy-path-prefix', valuesObj.AppProxy.Ingress.PathPrefix);
1042
+ }
1043
+ if (!_.has(_argv, 'docker-daemon-access') && _.has(valuesObj, 'dockerDaemonScheduler.userAccess')) {
1044
+ _.set(_argv, 'docker-daemon-access', valuesObj.dockerDaemonScheduler.userAccess);
1045
+ }
1046
+ if (_.get(_argv, 'envVars.length') === 0 && _.has(valuesObj, 'EnvVars')) {
1047
+ _argv.envVars.push(...objectToKeyValueArray(_.get(valuesObj, 'EnvVars')));
1048
+ }
1049
+ if (!_.has(_argv, 'docker-registry') && _.has(valuesObj, 'DockerRegistry')) {
1050
+ _.set(_argv, 'docker-registry', valuesObj.DockerRegistry);
1051
+ }
1052
+ if (!_.has(_argv, 'skip-cluster-test') && _.has(valuesObj, 'SkipClusterTest')) {
1053
+ _.set(_argv, 'skip-cluster-test', valuesObj.SkipClusterTest);
1054
+ }
1055
+ if (_.has(valuesObj, 'RuntimeEnvironmentName')) {
1056
+ _.set(_argv, 'runtimeName', valuesObj.RuntimeEnvironmentName);
1057
+ }
1058
+ if (_.has(valuesObj, 'Runtime.AdditionalEnvVars')) {
1059
+ _.set(_argv, 'reEnvVars', valuesObj.Runtime.AdditionalEnvVars);
1060
+ }
1061
+ if (_.has(valuesObj, 'Runtime.NodeSelector')) {
1062
+ _.set(_argv, 'build-node-selector', valuesObj.Runtime.NodeSelector);
1063
+ }
1064
+ if (_.has(valuesObj, 'Runtime.resources')) {
1065
+ _.set(_argv, 'reResources', valuesObj.Runtime.resources);
1066
+ }
1067
+ if (_.has(valuesObj, 'Runtime.tolerations')) {
1068
+ _.set(_argv, 'reTolerations', valuesObj.Runtime.tolerations);
1069
+ }
1070
+ if (_.has(valuesObj, 'Runtime.userVolumeMounts')) {
1071
+ _.set(_argv, 'userVolumeMounts', valuesObj.Runtime.userVolumeMounts);
1072
+ }
1073
+ if (_.has(valuesObj, 'Runtime.userVolumes')) {
1074
+ _.set(_argv, 'userVolumes', valuesObj.Runtime.userVolumes);
1075
+ }
1076
+ if (!_.has(_argv, 'storage-class-name') && _.has(valuesObj, 'StorageClass')) {
1077
+ _.set(_argv, 'storage-class-name', valuesObj.StorageClass);
1078
+ }
1079
+ if (!_.has(_argv, 'skip-cluster-integration') && _.has(valuesObj, 'SkipClusterIntegration')) {
1080
+ _.set(_argv, 'skip-cluster-integration', valuesObj.SkipClusterIntegration);
1081
+ }
1082
+
1083
+ return _argv;
1084
+ }
1085
+
1086
+ module.exports = {
1087
+ getRelatedAgents,
1088
+ createErrorHandler,
1089
+ getRelatedNamespaces,
1090
+ getRuntimesWithVersions,
1091
+ getRuntimeVersion,
1092
+ createTestPipeline,
1093
+ getTestPipeline,
1094
+ updateTestPipelineRuntime,
1095
+ executeTestPipeline,
1096
+ createProgressBar,
1097
+ getTestPipelineLink,
1098
+ drawCodefreshFiglet,
1099
+ getDefaultRuntime,
1100
+ getRecommendedKubeNamespace,
1101
+ runClusterAcceptanceTests,
1102
+ installAgent,
1103
+ installRuntime,
1104
+ attachRuntime,
1105
+ newRuntimeName,
1106
+ newAgentName,
1107
+ keyValueAsStringToObject,
1108
+ objectToKeyValueArray,
1109
+ downloadRelatedComponents: downloadHybridComponents,
1110
+ downloadSteveDore,
1111
+ downloadVeonona,
1112
+ downloadProvider,
1113
+ runUpgrade,
1114
+ serealizeToKeyValuePairs,
1115
+ getRuntimeImagesWithRegistryUrl,
1116
+ installAppProxy,
1117
+ unInstallAppProxy,
1118
+ upgradeAppProxy,
1119
+ mergeValuesFromValuesFile,
1120
+ INSTALLATION_DEFAULTS,
1121
+ DefaultLogFormatter,
1122
+ };