@sap/cds-dk 6.8.2 → 7.0.0

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 (218) hide show
  1. package/bin/activate.js +15 -7
  2. package/bin/add.js +29 -15
  3. package/bin/bind.js +49 -116
  4. package/bin/build.js +114 -0
  5. package/bin/cds.js +67 -24
  6. package/bin/compile/index.js +2 -2
  7. package/bin/deploy/index.js +46 -39
  8. package/bin/deploy/to-hana.js +11 -8
  9. package/bin/deploy/to-postgres.js +8 -2
  10. package/bin/deploy/to-sqlite.js +0 -1
  11. package/bin/env.js +75 -41
  12. package/bin/eval.js +3 -3
  13. package/bin/extend.js +17 -10
  14. package/bin/help.js +22 -21
  15. package/bin/import.js +10 -7
  16. package/bin/init.js +38 -17
  17. package/bin/login.js +69 -55
  18. package/bin/logout.js +12 -9
  19. package/bin/migrate.js +10 -4
  20. package/bin/pull.js +12 -5
  21. package/bin/push.js +24 -13
  22. package/bin/repl.js +1 -0
  23. package/bin/run.js +25 -0
  24. package/bin/subscribe.js +13 -8
  25. package/bin/unsubscribe.js +15 -8
  26. package/bin/upgrade.js +15 -9
  27. package/bin/util/log.js +24 -0
  28. package/bin/version.js +124 -0
  29. package/bin/watch.js +1 -35
  30. package/bin/watched.js +39 -0
  31. package/lib/bind/KubernetesApiAccessor.js +2 -2
  32. package/lib/bind/bindingManager.js +1 -1
  33. package/lib/bind/bindingUtil.js +0 -9
  34. package/lib/bind/cfKeyProvider.js +10 -72
  35. package/lib/bind/index.js +114 -0
  36. package/lib/bind/kubernetesCredentialsProvider.js +2 -2
  37. package/lib/bind/userCdsrcJsonStorageProvider.js +7 -44
  38. package/lib/build/buildTaskEngine.js +355 -0
  39. package/lib/build/buildTaskFactory.js +284 -0
  40. package/lib/build/buildTaskHandler.js +240 -0
  41. package/lib/build/buildTaskProvider.js +22 -0
  42. package/lib/build/buildTaskProviderFactory.js +182 -0
  43. package/lib/build/constants.js +56 -0
  44. package/lib/build/index.js +21 -0
  45. package/lib/build/provider/buildTaskHandlerEdmx.js +83 -0
  46. package/lib/build/provider/buildTaskHandlerFeatureToggles.js +132 -0
  47. package/lib/build/provider/buildTaskHandlerInternal.js +228 -0
  48. package/lib/build/provider/buildTaskProviderInternal.js +370 -0
  49. package/lib/build/provider/fiori/index.js +167 -0
  50. package/lib/build/provider/hana/2migration.js +179 -0
  51. package/lib/build/provider/hana/index.js +522 -0
  52. package/lib/build/provider/hana/migrationtable.js +472 -0
  53. package/lib/build/provider/hana/template/.hdiconfig-all +163 -0
  54. package/lib/build/provider/hana/template/.hdiconfig-cloud +137 -0
  55. package/lib/build/provider/hana/template/.hdinamespace +4 -0
  56. package/lib/build/provider/hana/template/package.json +12 -0
  57. package/lib/build/provider/hana/template/undeploy.json +5 -0
  58. package/lib/build/provider/java/index.js +93 -0
  59. package/lib/build/provider/java-cf/index.js +1 -0
  60. package/lib/build/provider/mtx/index.js +37 -0
  61. package/lib/build/provider/mtx/resourcesTarBuilder.js +94 -0
  62. package/lib/build/provider/mtx-extension/index.js +131 -0
  63. package/lib/build/provider/mtx-sidecar/index.js +138 -0
  64. package/lib/build/provider/node-cf/index.js +1 -0
  65. package/lib/build/provider/nodejs/index.js +178 -0
  66. package/lib/build/util.js +263 -0
  67. package/lib/cds.js +9 -21
  68. package/lib/client/auth_manager.js +39 -16
  69. package/lib/client/helper/dependency_helper.js +7 -6
  70. package/lib/client/push.js +2 -1
  71. package/lib/client/settings_manager.js +10 -39
  72. package/lib/deploy/to-hana/hana.js +273 -0
  73. package/lib/deploy/to-hana/hdiDeployUtil.js +68 -0
  74. package/lib/deploy/to-hana/mtaUtil.js +171 -0
  75. package/lib/import/asyncapi/importAsyncAPI.js +3 -2
  76. package/lib/import/asyncapi/index.js +5 -2
  77. package/lib/import/asyncapi/parserContext.js +67 -26
  78. package/lib/import/asyncapi/utils.js +34 -3
  79. package/lib/import/common.js +40 -30
  80. package/lib/import/importapi.js +36 -35
  81. package/lib/index.js +12 -17
  82. package/lib/init/constants.js +36 -71
  83. package/lib/init/index.js +18 -52
  84. package/lib/init/template/_merging/registry-mta.js +21 -3
  85. package/lib/init/template/approuter/files/mta.yaml.hbs +29 -29
  86. package/lib/init/template/approuter/files/values.yaml.hbs +5 -5
  87. package/lib/init/template/approuter/files/xs-app.json.hbs +8 -2
  88. package/lib/init/template/approuter/index.js +7 -8
  89. package/lib/init/template/auditlog/files/mta.yaml.hbs +5 -5
  90. package/lib/init/template/auditlog/files/package.json.hbs +13 -13
  91. package/lib/init/template/auditlog/index.js +3 -3
  92. package/lib/init/template/cf-manifest/files/manifest.yml.hbs +22 -22
  93. package/lib/init/template/cf-manifest/files/services-manifest.yml.hbs +3 -3
  94. package/lib/init/template/connectivity/files/mta.yaml.hbs +14 -0
  95. package/lib/init/template/connectivity/files/package.json.hbs +17 -0
  96. package/lib/init/template/connectivity/index.js +21 -4
  97. package/lib/init/template/data/index.js +5 -1
  98. package/lib/init/template/destination/files/mta.yaml.hbs +14 -0
  99. package/lib/init/template/destination/files/package.json.hbs +17 -0
  100. package/lib/init/template/{destinations → destination}/index.js +19 -13
  101. package/lib/init/template/enterprise-messaging/files/event-mesh.json.hbs +3 -3
  102. package/lib/init/template/enterprise-messaging/files/mta.yaml.hbs +5 -5
  103. package/lib/init/template/enterprise-messaging/files/package.json.hbs +9 -9
  104. package/lib/init/template/enterprise-messaging/files/xs-security.json.hbs +19 -0
  105. package/lib/init/template/enterprise-messaging/index.js +27 -6
  106. package/lib/init/template/enterprise-messaging-shared/files/event-mesh.json.hbs +3 -3
  107. package/lib/init/template/enterprise-messaging-shared/files/mta.yaml.hbs +5 -5
  108. package/lib/init/template/enterprise-messaging-shared/files/package.json.hbs +9 -9
  109. package/lib/init/template/enterprise-messaging-shared/index.js +4 -5
  110. package/lib/init/template/extensibility/files/package.json.hbs +10 -10
  111. package/lib/init/template/extensibility/index.js +8 -9
  112. package/lib/init/template/file-based-messaging/files/package.json.hbs +9 -9
  113. package/lib/init/template/file-based-messaging/index.js +3 -4
  114. package/lib/init/template/hana/files/db/package.json +1 -1
  115. package/lib/init/template/hana/files/mta.yaml.hbs +21 -21
  116. package/lib/init/template/hana/files/package.json.hbs +16 -22
  117. package/lib/init/template/hana/files/values.yaml.hbs +1 -1
  118. package/lib/init/template/hana/index.js +5 -15
  119. package/lib/init/template/helm/files/Chart.yaml.hbs +4 -4
  120. package/lib/init/template/helm/files/values.yaml.hbs +6 -6
  121. package/lib/init/template/helm/index.js +5 -10
  122. package/lib/init/template/helm/subcharts/content-deployment/Chart.yaml +2 -0
  123. package/lib/init/template/helm/subcharts/content-deployment/templates/_helpers.tpl +37 -31
  124. package/lib/init/template/helm/subcharts/content-deployment/templates/job.yaml +13 -14
  125. package/lib/init/template/helm/subcharts/content-deployment/templates/secret.yaml +2 -2
  126. package/lib/init/template/helm/subcharts/content-deployment/templates/service-account.yaml +1 -1
  127. package/lib/init/template/helm/subcharts/content-deployment/templates/service-binding.yaml +3 -3
  128. package/lib/init/template/helm/subcharts/content-deployment/values.md +116 -116
  129. package/lib/init/template/helm/subcharts/service-instance/Chart.yaml +2 -0
  130. package/lib/init/template/helm/subcharts/service-instance/templates/_helpers.tpl +9 -9
  131. package/lib/init/template/helm/subcharts/service-instance/templates/serviceinstance.yaml +2 -2
  132. package/lib/init/template/helm/subcharts/service-instance/values.md +15 -15
  133. package/lib/init/template/helm/subcharts/web-application/Chart.yaml +2 -0
  134. package/lib/init/template/helm/subcharts/web-application/templates/NOTES.txt +15 -0
  135. package/lib/init/template/helm/subcharts/web-application/templates/_helpers.tpl +23 -23
  136. package/lib/init/template/helm/subcharts/web-application/templates/api-rule.yaml +4 -4
  137. package/lib/init/template/helm/subcharts/web-application/templates/deployment.yaml +17 -17
  138. package/lib/init/template/helm/subcharts/web-application/templates/network-policy.yaml +24 -3
  139. package/lib/init/template/helm/subcharts/web-application/templates/pod-disruption-budget.yaml +3 -3
  140. package/lib/init/template/helm/subcharts/web-application/templates/secret.yaml +2 -2
  141. package/lib/init/template/helm/subcharts/web-application/templates/service-account.yaml +1 -1
  142. package/lib/init/template/helm/subcharts/web-application/templates/service-binding.yaml +3 -3
  143. package/lib/init/template/helm/subcharts/web-application/templates/service.yaml +3 -3
  144. package/lib/init/template/helm/subcharts/web-application/values.md +141 -123
  145. package/lib/init/template/helm/subcharts/web-application/values.schema.json +7 -0
  146. package/lib/init/template/helm/subcharts/web-application/values.yaml +1 -0
  147. package/lib/init/template/html5-repo/index.js +4 -5
  148. package/lib/init/template/java/index.js +5 -5
  149. package/lib/init/template/kibana-logging/files/mta.yaml.hbs +5 -5
  150. package/lib/init/template/kibana-logging/files/package.json.hbs +9 -9
  151. package/lib/init/template/kibana-logging/index.js +3 -4
  152. package/lib/init/template/lint/index.js +3 -3
  153. package/lib/init/template/mta/files/mta.yaml.hbs +14 -14
  154. package/lib/init/template/mta/files/package.json +5 -0
  155. package/lib/init/template/mta/index.js +12 -13
  156. package/lib/init/template/mtx/index.js +2 -2
  157. package/lib/init/template/multitenancy/files/mta.yaml.hbs +29 -27
  158. package/lib/init/template/multitenancy/files/package.json.hbs +17 -14
  159. package/lib/init/template/multitenancy/files/package.sidecar.json.hbs +7 -7
  160. package/lib/init/template/multitenancy/files/values.yaml.hbs +19 -19
  161. package/lib/init/template/multitenancy/index.js +14 -16
  162. package/lib/init/template/nodejs/files/package.json.hbs +1 -1
  163. package/lib/init/template/nodejs/index.js +5 -8
  164. package/lib/init/template/redis-messaging/files/mta.yaml.hbs +5 -5
  165. package/lib/init/template/redis-messaging/files/package.json.hbs +9 -9
  166. package/lib/init/template/redis-messaging/index.js +4 -5
  167. package/lib/init/template/sample/files/app/_i18n/i18n.properties +43 -0
  168. package/lib/init/template/sample/files/app/_i18n/i18n_de.properties +14 -0
  169. package/lib/init/template/sample/files/app/admin-books/fiori-service.cds +114 -0
  170. package/lib/init/template/sample/files/app/admin-books/webapp/Component.js +8 -0
  171. package/lib/init/template/sample/files/app/admin-books/webapp/i18n/i18n.properties +11 -0
  172. package/lib/init/template/sample/files/app/admin-books/webapp/manifest.json +129 -0
  173. package/lib/init/template/sample/files/app/appconfig/fioriSandboxConfig.json +57 -0
  174. package/lib/init/template/sample/files/app/common.cds +263 -0
  175. package/lib/init/template/sample/files/app/index.html +30 -0
  176. package/lib/init/template/sample/files/app/services.cds +5 -0
  177. package/lib/init/template/sample/files/db/data/sap.capire.bookshop-Authors.csv +5 -0
  178. package/lib/init/template/sample/files/db/data/sap.capire.bookshop-Books.csv +6 -0
  179. package/lib/init/template/sample/files/db/data/sap.capire.bookshop-Books_texts.csv +5 -0
  180. package/lib/init/template/sample/files/db/data/sap.capire.bookshop-Genres.csv +16 -0
  181. package/lib/init/template/sample/files/db/schema.cds +31 -0
  182. package/lib/init/template/sample/files/nodejs/admin-service.js +12 -0
  183. package/lib/init/template/sample/files/nodejs/cat-service.js +26 -0
  184. package/lib/init/template/sample/files/srv/admin-service.cds +5 -0
  185. package/lib/init/template/sample/files/srv/cat-service.cds +16 -0
  186. package/lib/init/template/sample/index.js +24 -0
  187. package/lib/init/template/sample-tiny/index.js +39 -0
  188. package/lib/init/template/samples/index.js +5 -56
  189. package/lib/init/template/sqlite/files/package.json.hbs +13 -13
  190. package/lib/init/template/sqlite/index.js +2 -2
  191. package/lib/init/template/templateBase.js +24 -1
  192. package/lib/init/template/toggles/files/package.json.hbs +10 -10
  193. package/lib/init/template/toggles/index.js +3 -3
  194. package/lib/init/template/typer/files/gitignore +1 -0
  195. package/lib/init/template/typer/files/package.json +8 -0
  196. package/lib/init/template/typer/files/xsconfig.json +9 -0
  197. package/lib/init/template/typer/index.js +36 -0
  198. package/lib/init/template/xsuaa/files/mta.yaml.hbs +12 -12
  199. package/lib/init/template/xsuaa/files/package.json.hbs +13 -13
  200. package/lib/init/template/xsuaa/files/values.yaml.hbs +8 -8
  201. package/lib/init/template/xsuaa/index.js +8 -19
  202. package/lib/init/util/merge.js +73 -59
  203. package/lib/init/util/mvn.js +21 -17
  204. package/lib/init/util/projectReader.js +49 -87
  205. package/lib/init/util/xml.js +14 -23
  206. package/lib/util/cfUtil.js +366 -0
  207. package/lib/util/command.js +3 -3
  208. package/lib/util/gitUtil.js +55 -0
  209. package/lib/util/version.js +27 -0
  210. package/npm-shrinkwrap.json +339 -277
  211. package/package.json +6 -6
  212. package/CHANGELOG.md +0 -1453
  213. package/bin/build/all.js +0 -88
  214. package/bin/build/index.js +0 -82
  215. package/lib/compile/index.js +0 -14
  216. /package/lib/init/template/{samples → sample-tiny}/files/nodejs/db/data/my.bookshop-Books.csv +0 -0
  217. /package/lib/init/template/{samples → sample-tiny}/files/nodejs/db/data-model.cds +0 -0
  218. /package/lib/init/template/{samples → sample-tiny}/files/nodejs/srv/cat-service.cds.hbs +0 -0
@@ -6,8 +6,7 @@ const { mergeJSON } = require('../../util/merge')
6
6
  module.exports = class FileBasedMessagingTemplate extends require('../templateBase') {
7
7
 
8
8
  async canRun() {
9
- const projectDescriptor = await readProject(this.options)
10
- const { isJava } = projectDescriptor.cap
9
+ const { isJava } = await readProject(this.options)
11
10
  if (isJava) throw `'cds add file-based-messaging' is not available for Java yet`
12
11
  return true
13
12
  }
@@ -18,8 +17,8 @@ module.exports = class FileBasedMessagingTemplate extends require('../templateBa
18
17
 
19
18
  async run() {
20
19
  const projectDescriptor = await readProject(this.options)
21
- const { configFile } = projectDescriptor.cap
22
- projectDescriptor.cap.shortcut = !(await read(configFile)).cds?.requires?.messaging?.kind
20
+ const { configFile } = projectDescriptor
21
+ projectDescriptor.shortcut = !(await read(configFile)).cds?.requires?.messaging?.kind
23
22
  await mergeJSON(configFile, join(__dirname, 'files', 'package.json.hbs'), projectDescriptor)
24
23
  }
25
24
  }
@@ -8,6 +8,6 @@
8
8
  },
9
9
  "scripts": {
10
10
  "start": "node node_modules/@sap/hdi-deploy/deploy.js",
11
- "build": "npm i && npx -p @sap/cds-dk@^6 cds build .. --for hana --production"
11
+ "build": "npm i && npx cds build .. --for hana --production"
12
12
  }
13
13
  }
@@ -1,46 +1,46 @@
1
1
  ---
2
2
  modules:
3
- - name: {{cap.appName}}-srv
4
- type: {{cap.language}}
5
- path: {{& cap.srvPath}}
3
+ - name: {{appName}}-srv
4
+ type: {{language}}
5
+ path: {{& srvPath}}
6
6
  requires:
7
- - name: {{cap.appName}}-db
7
+ - name: {{appName}}-db
8
8
 
9
- {{^cap.isMultitenant}}
10
- - name: {{cap.appName}}-db-deployer
9
+ {{^isMultitenant}}
10
+ - name: {{appName}}-db-deployer
11
11
  type: hdb
12
- path: {{& cap.db.0.path}}
12
+ path: {{& db.0.path}}
13
13
  parameters:
14
14
  buildpack: nodejs_buildpack
15
- {{#cap.isJava}}
15
+ {{#isJava}}
16
16
  build-parameters:
17
17
  builder: custom
18
18
  commands:
19
19
  - npm run build
20
- {{/cap.isJava}}
20
+ {{/isJava}}
21
21
  requires:
22
- - name: {{cap.appName}}-db
23
- {{/cap.isMultitenant}}
22
+ - name: {{appName}}-db
23
+ {{/isMultitenant}}
24
24
 
25
- {{#cap.isMultitenant}}
26
- - name: {{cap.appName}}-mtx
25
+ {{#isMultitenant}}
26
+ - name: {{appName}}-mtx
27
27
  type: nodejs
28
- path: {{#cap.isNodejs}}gen/{{/cap.isNodejs}}mtx/sidecar
28
+ path: {{#isNodejs}}gen/{{/isNodejs}}mtx/sidecar
29
29
  requires:
30
- - name: {{cap.appName}}-db
31
- {{/cap.isMultitenant}}
30
+ - name: {{appName}}-db
31
+ {{/isMultitenant}}
32
32
 
33
33
  resources:
34
- - name: {{cap.appName}}-db
35
- {{^cap.isMultitenant}}
34
+ - name: {{appName}}-db
35
+ {{^isMultitenant}}
36
36
  type: com.sap.xs.hdi-container
37
37
  parameters:
38
38
  service: hana
39
39
  service-plan: hdi-shared
40
- {{/cap.isMultitenant}}
41
- {{#cap.isMultitenant}}
40
+ {{/isMultitenant}}
41
+ {{#isMultitenant}}
42
42
  type: org.cloudfoundry.managed-service
43
43
  parameters:
44
44
  service: service-manager
45
45
  service-plan: container
46
- {{/cap.isMultitenant}}
46
+ {{/isMultitenant}}
@@ -1,33 +1,27 @@
1
1
  {
2
- {{#cap.isNodejs}}
2
+ {{#isNodejs}}
3
3
  "dependencies": {
4
- "hdb": "^0.19.0"
4
+ "@sap/cds-hana": "^2"
5
5
  },
6
6
  "cds": {
7
- {{/cap.isNodejs}}
7
+ {{/isNodejs}}
8
8
  "requires": {
9
- {{#cap.for}}
10
- "[{{cap.for}}]": {
11
- {{#cap.shortcut}}
12
- "db": "hana-cloud"
13
- {{/cap.shortcut}}
14
- {{^cap.shortcut}}
9
+ {{#profile}}
10
+ "[{{profile}}]": {
11
+ {{/profile}}
12
+ {{#shortcut}}
13
+ "db": "hana"
14
+ {{/shortcut}}
15
+ {{^shortcut}}
15
16
  "db": {
16
- "kind": "hana-cloud"
17
+ "kind": "hana"
17
18
  }
18
- {{/cap.shortcut}}
19
- },
20
- {{/cap.for}}
21
- {{#cap.shortcut}}
22
- "db": "{{^cap.for}}hana-cloud{{/cap.for}}{{#cap.for}}sql{{/cap.for}}"
23
- {{/cap.shortcut}}
24
- {{^cap.shortcut}}
25
- "db": {
26
- "kind": "sql"
19
+ {{/shortcut}}
20
+ {{#profile}}
27
21
  }
28
- {{/cap.shortcut}}
22
+ {{/profile}}
29
23
  }
30
- {{#cap.isNodejs}}
24
+ {{#isNodejs}}
31
25
  }
32
- {{/cap.isNodejs}}
26
+ {{/isNodejs}}
33
27
  }
@@ -5,7 +5,7 @@ srv:
5
5
  serviceInstanceName: hana
6
6
  hana-deployer:
7
7
  image:
8
- repository: <your-container-registry>/{{cap.appName}}-hana-deployer
8
+ repository: <your-container-registry>/{{appName}}-hana-deployer
9
9
  tag: latest
10
10
  bindings:
11
11
  hana:
@@ -9,7 +9,7 @@ const { parseMd5File, writeMd5File } = require('../../util/md5')
9
9
  const { copyFiles } = require('../../util/template')
10
10
  const { readProject } = require('../../util/projectReader');
11
11
 
12
- const { OPTION_JAVA, URLS } = require('../../constants');
12
+ const { OPTIONS: { JAVA }, URLS } = require('../../constants');
13
13
 
14
14
  const { srvNode4, srvJava4, hdbDeployer, serviceManager, hdiContainer, mtxSidecar4 } = require('../_merging/registry-mta');
15
15
 
@@ -19,20 +19,10 @@ module.exports = class HanaTemplate extends require('../templateBase') {
19
19
  return env.requires?.db?.kind === 'hana'
20
20
  }
21
21
 
22
- // REVISIT: Remove with CDS 7
23
- async canRun() {
24
- const cds = require('../../../cds')
25
- const [major, minor] = cds.version.split('.').map(Number)
26
- if (major < 5 || major === 5 && minor < 9) {
27
- cds.error('The added configuration requires @sap/cds 5.9.0 or higher. Please update @sap/cds to the latest version and run \x1b[1mcds add hana\x1b[0m again.')
28
- }
29
- return true
30
- }
31
-
32
22
  async run() {
33
23
  const projectDescriptor = await readProject(this.options)
34
- const { isJava, configFile } = projectDescriptor.cap
35
- projectDescriptor.cap.shortcut = !(await read(configFile)).cds?.requires?.db?.kind
24
+ const { isJava, configFile } = projectDescriptor
25
+ projectDescriptor.shortcut = !(await read(configFile)).cds?.requires?.db?.kind
36
26
 
37
27
  const env = await this.getEnv() // REVISIT: Get info from projectDescriptor
38
28
 
@@ -77,7 +67,7 @@ module.exports = class HanaTemplate extends require('../templateBase') {
77
67
 
78
68
  async runDependentMerging(context = {}) {
79
69
  const projectDescriptor = await readProject(this.options)
80
- const { hasMta, hasHelm, hasHtml5Repo, isJava, isMultitenant, srvPath } = projectDescriptor.cap
70
+ const { hasMta, hasHelm, hasHtml5Repo, isJava, isMultitenant, srvPath } = projectDescriptor
81
71
 
82
72
 
83
73
  if (hasMta) {
@@ -205,7 +195,7 @@ module.exports = class HanaTemplate extends require('../templateBase') {
205
195
 
206
196
  async _updatePomXml() {
207
197
  // if called during cds init the project generation call to AT will add settings
208
- if (!this.options.add.has(OPTION_JAVA)) {
198
+ if (!this.options.add.has(JAVA)) {
209
199
  const mvnAddHanaArgs = mvnArchetypes.getAddHanaCmdArgs(this.options);
210
200
  try {
211
201
  await commandUtil.spawnCommand('mvn', mvnAddHanaArgs, {
@@ -2,9 +2,9 @@
2
2
  #
3
3
  # This file is generated by "cds add helm"
4
4
  apiVersion: v2
5
- name: {{cap.appName}}
6
- description: {{cap.appDescription}}
5
+ name: {{appName}}
6
+ description: {{appDescription}}
7
7
  type: application
8
- version: {{cap.appVersion}}
9
- appVersion: {{cap.appVersion}}
8
+ version: {{appVersion}}
9
+ appVersion: {{appVersion}}
10
10
 
@@ -5,20 +5,20 @@ global:
5
5
  srv:
6
6
  bindings: {}
7
7
  image:
8
- repository: <your-container-registry>/{{cap.appName}}-srv
8
+ repository: <your-container-registry>/{{appName}}-srv
9
9
  tag: latest
10
- {{#cap.isJava}}
10
+ {{#isJava}}
11
11
  env:
12
12
  SPRING_PROFILES_ACTIVE: cloud
13
- {{/cap.isJava}}
13
+ {{/isJava}}
14
14
  resources:
15
15
  limits:
16
16
  ephemeral-storage: 1G
17
- memory: {{#cap.isJava}}1G{{/cap.isJava}}{{^cap.isJava}}500M{{/cap.isJava}}
17
+ memory: {{#isJava}}1G{{/isJava}}{{^isJava}}500M{{/isJava}}
18
18
  requests:
19
19
  ephemeral-storage: 1G
20
- cpu: {{#cap.isJava}}1000m{{/cap.isJava}}{{^cap.isJava}}500m{{/cap.isJava}}
21
- memory: {{#cap.isJava}}1G{{/cap.isJava}}{{^cap.isJava}}500M{{/cap.isJava}}
20
+ cpu: {{#isJava}}1000m{{/isJava}}{{^isJava}}500m{{/isJava}}
21
+ memory: {{#isJava}}1G{{/isJava}}{{^isJava}}500M{{/isJava}}
22
22
  health:
23
23
  liveness:
24
24
  path: /
@@ -5,12 +5,17 @@ const { mergeYAML } = require('../../util/merge')
5
5
  const { parseMd5File, writeMd5File, copyAndTrack } = require('../../util/md5')
6
6
 
7
7
  module.exports = class HelmTemplate extends require('../templateBase') {
8
+
8
9
  constructor(generator, oldTrackingData = undefined, newTrackingData = {}) {
9
10
  super(generator)
10
11
  this.oldTrackingData = oldTrackingData;
11
12
  this.newTrackingData = newTrackingData;
12
13
  }
13
14
 
15
+ getRelatedFacets() {
16
+ return ['hana', 'xsuaa', 'auditlog', 'enterprise-messaging', 'destination' , 'multitenancy', 'extensibility', 'approuter', 'connectivity']
17
+ }
18
+
14
19
  static hasFacet(_, options) {
15
20
  // REVISIT: this works, but could be semantically nicer with a 'shouldRunDependentMerging' or the like
16
21
  if (options?.add.has('mta') && !options?.add.has('helm')) return false
@@ -98,14 +103,4 @@ module.exports = class HelmTemplate extends require('../templateBase') {
98
103
  await this.runDependentMerging();
99
104
  await writeMd5File(join('chart', '.cds-add-helm-files.md5'), this.newTrackingData);
100
105
  }
101
-
102
- async runDependentMerging() {
103
- // Re-applying the dependent merging part of other facets if necessary.
104
- const dependentFacets = ['hana', 'xsuaa', 'auditlog', 'enterprise-messaging', 'destinations' , 'multitenancy', 'extensibility', 'approuter']
105
- for (const facet of dependentFacets) {
106
- const Template = require('../'+facet)
107
- const template = new Template(this.generator)
108
- if (Template.hasFacet(await this.getEnv(), this.options)) await template.runDependentMerging(this)
109
- }
110
- }
111
106
  };
@@ -3,3 +3,5 @@ name: content-deployment
3
3
  description: A Helm Chart for creating a Content Deployment job
4
4
  type: application
5
5
  version: 0.1.0
6
+ sources:
7
+ - "https://github.tools.sap/unified-runtime/content-deployment"
@@ -1,7 +1,7 @@
1
1
  {{/*
2
2
  Expand the name of the chart.
3
3
  */}}
4
- {{- define "content-deployment.name" -}}
4
+ {{- define "content-deployment.internal.name" -}}
5
5
  {{- default .Chart.Name .Values.nameOverride | trunc 63 | trimSuffix "-" }}
6
6
  {{- end }}
7
7
 
@@ -10,47 +10,53 @@ Create a default fully qualified app name.
10
10
  We truncate at 63 chars because some Kubernetes name fields are limited to this (by the DNS naming spec).
11
11
  If release name contains chart name it will be used as a full name.
12
12
  */}}
13
- {{- define "content-deployment.fullname" -}}
14
- {{- if .Values.fullnameOverride }}
15
- {{- .Values.fullnameOverride | trunc 63 | trimSuffix "-" }}
16
- {{- else }}
17
- {{- $name := default .Chart.Name .Values.nameOverride }}
18
- {{- if contains $name .Release.Name }}
19
- {{- .Release.Name | trunc 63 | trimSuffix "-" }}
20
- {{- else }}
21
- {{- printf "%s-%s" .Release.Name $name | trunc 63 | trimSuffix "-" }}
22
- {{- end }}
23
- {{- end }}
13
+ {{- define "content-deployment.internal.fullname" -}}
14
+ {{- if .Values.fullnameOverride }}
15
+ {{- if gt (len .Values.fullnameOverride) 63 }}
16
+ {{- fail (printf "name exceeds 63 characters: '%s'" .Values.fullnameOverride) }}
17
+ {{- end }}
18
+ {{- .Values.fullnameOverride }}
19
+ {{- else }}
20
+ {{- $name := default .Chart.Name .Values.nameOverride }}
21
+ {{- if not (eq .Release.Name $name)}}
22
+ {{- $name = printf "%s-%s" .Release.Name $name }}
23
+ {{- end }}
24
+ {{- if gt (len $name) 63 }}
25
+ {{- fail (printf "name exceeds 63 characters: '%s'" $name) }}
26
+ {{- end }}
27
+ {{- $name }}
28
+ {{- end }}
24
29
  {{- end }}
25
30
 
26
31
  {{/*
27
32
  Define a name for the Job object
28
33
  */}}
29
- {{- define "content-deployment.jobName" -}}
30
- {{- printf "%s-%04d" ((include "content-deployment.fullname" . ) | trunc 59) (mod .Release.Revision 1000) }}
34
+ {{- define "content-deployment.internal.jobName" -}}
35
+ {{- printf "%s-%04d" ((include "content-deployment.internal.fullname" . ) | trunc 59) (mod .Release.Revision 1000) }}
31
36
  {{- end }}
32
37
 
33
38
  {{/*
34
39
  Define a name for a ServiceBinding object
35
40
  */}}
36
- {{- define "content-deployment.bindingName" -}}
37
- {{- printf "%s-%s" (include "content-deployment.fullname" .root ) .name }}
41
+ {{- define "content-deployment.internal.bindingName" -}}
42
+ {{- printf "%s-%s" (include "content-deployment.internal.fullname" .root ) .name }}
38
43
  {{- end }}
39
44
 
40
45
  {{/*
41
46
  Create chart name and version as used by the chart label.
42
47
  */}}
43
- {{- define "content-deployment.chart" -}}
48
+ {{- define "content-deployment.internal.chart" -}}
44
49
  {{- printf "%s-%s" .Chart.Name .Chart.Version | replace "+" "_" | trunc 63 | trimSuffix "-" }}
45
50
  {{- end }}
46
51
 
47
52
  {{/*
48
53
  Common labels
49
54
  */}}
50
- {{- define "content-deployment.labels" -}}
55
+ {{- define "content-deployment.internal.labels" -}}
56
+ sidecar.istio.io/inject: "false"
51
57
  helm.sh/revision: {{ .Release.Revision | quote }}
52
- helm.sh/chart: {{ include "content-deployment.chart" . }}
53
- {{ include "content-deployment.selectorLabels" . }}
58
+ helm.sh/chart: {{ include "content-deployment.internal.chart" . }}
59
+ {{ include "content-deployment.internal.selectorLabels" . }}
54
60
  {{- if .Chart.AppVersion }}
55
61
  app.kubernetes.io/version: {{ .Chart.AppVersion | quote }}
56
62
  {{- end }}
@@ -59,9 +65,9 @@ app.kubernetes.io/version: {{ .Chart.AppVersion | quote }}
59
65
  {{/*
60
66
  Selector labels
61
67
  */}}
62
- {{- define "content-deployment.selectorLabels" -}}
68
+ {{- define "content-deployment.internal.selectorLabels" -}}
63
69
  app.kubernetes.io/managed-by: {{ .Release.Service }}
64
- app.kubernetes.io/name: {{ include "content-deployment.name" . }}
70
+ app.kubernetes.io/name: {{ include "content-deployment.internal.name" . }}
65
71
  app.kubernetes.io/instance: {{ .Release.Name }}
66
72
  {{- if .Values.global}}
67
73
  {{- if .Values.global.component }}
@@ -76,7 +82,7 @@ app.kubernetes.io/partOf: {{ .Values.global.partOf }}
76
82
  {{/*
77
83
  Service Binding secret mounts
78
84
  */}}
79
- {{- define "content-deployment.serviceMounts" -}}
85
+ {{- define "content-deployment.internal.serviceMounts" -}}
80
86
  {{- range $name, $params := .Values.bindings }}
81
87
  - mountPath: /bindings/{{ $name }}/
82
88
  name: {{ $name }}-binding
@@ -87,9 +93,9 @@ Service Binding secret mounts
87
93
  {{/*
88
94
  Service Binding secret volumes
89
95
  */}}
90
- {{- define "content-deployment.serviceVolumes" -}}
96
+ {{- define "content-deployment.internal.serviceVolumes" -}}
91
97
  {{- range $name, $params := .Values.bindings }}
92
- {{- $secretName := (include "content-deployment.bindingName" (dict "root" $ "name" $name)) }}
98
+ {{- $secretName := (include "content-deployment.internal.bindingName" (dict "root" $ "name" $name)) }}
93
99
  {{- if $params.fromSecret }}
94
100
  {{- $secretName = $params.fromSecret}}
95
101
  {{- else if $params.secretName }}
@@ -104,21 +110,21 @@ Service Binding secret volumes
104
110
  {{/*
105
111
  Name of the imagePullSecret
106
112
  */}}
107
- {{- define "content-deployment.imagePullSecretName" -}}
113
+ {{- define "content-deployment.internal.imagePullSecretName" -}}
108
114
  {{ $ips := (dict "local" .Values.imagePullSecret "global" .Values.global.imagePullSecret) }}
109
115
  {{- if $ips.local.name }}
110
116
  {{- $ips.local.name }}
111
117
  {{- else if $ips.global.name }}
112
118
  {{- $ips.global.name }}
113
119
  {{- else if or $ips.local.dockerconfigjson $ips.global.dockerconfigjson }}
114
- {{- include "content-deployment.fullname" . }}
120
+ {{- include "content-deployment.internal.fullname" . }}
115
121
  {{- end }}
116
122
  {{- end }}
117
123
 
118
124
  {{/*
119
125
  Calculate the final image name
120
126
  */}}
121
- {{- define "content-deployment.imageName" -}}
127
+ {{- define "content-deployment.internal.imageName" -}}
122
128
  {{- $tag := .Values.image.tag | default .Values.global.image.tag | default "latest" }}
123
129
  {{- $registry := .Values.image.registry | default .Values.global.image.registry }}
124
130
  {{- if $registry }}
@@ -133,7 +139,7 @@ Create the name of a service instance.
133
139
  We truncate at 63 chars because some Kubernetes name fields are limited to this (by the DNS naming spec).
134
140
  If release name contains chart name it will be used as service instance name.
135
141
  */}}
136
- {{- define "content-deployment.serviceInstanceName" -}}
142
+ {{- define "content-deployment.internal.serviceInstanceName" -}}
137
143
  {{- $name := "" }}
138
144
  {{- if .binding.serviceInstanceFullname }}
139
145
  {{- if gt (len .binding.serviceInstanceFullname) 63 }}
@@ -152,7 +158,7 @@ If release name contains chart name it will be used as service instance name.
152
158
  {{- tpl $name .root }}
153
159
  {{- end }}
154
160
 
155
- {{- define "content-deployment.processEnv" -}}
161
+ {{- define "content-deployment.internal.processEnv" -}}
156
162
  {{- $result := dict }}
157
163
  {{- $variables := list }}
158
164
  {{- range $k, $v := .Values.env }}
@@ -178,7 +184,7 @@ If release name contains chart name it will be used as service instance name.
178
184
  {{- (fromYaml (tpl (toYaml $result) $)) | mustToJson }}
179
185
  {{- end }}
180
186
 
181
- {{- define "content-deployment.processEnvFrom" -}}
187
+ {{- define "content-deployment.internal.processEnvFrom" -}}
182
188
  {{- $result := dict }}
183
189
  {{- $variables := list }}
184
190
  {{- range $secretName := .Values.envSecretNames }}
@@ -2,8 +2,8 @@
2
2
  apiVersion: batch/v1
3
3
  kind: Job
4
4
  metadata:
5
- labels: {{- include "content-deployment.labels" . | nindent 4 }}
6
- name: {{ include "content-deployment.jobName" . }}
5
+ labels: {{- include "content-deployment.internal.labels" . | nindent 4 }}
6
+ name: {{ include "content-deployment.internal.jobName" . }}
7
7
  spec:
8
8
  completions: 1
9
9
  manualSelector: false
@@ -11,20 +11,19 @@ spec:
11
11
  ttlSecondsAfterFinished: {{ mul .Values.ttlDaysAfterFinished 24 60 60 }}
12
12
  template:
13
13
  metadata:
14
- labels: {{- include "content-deployment.labels" . | nindent 8 }}
14
+ labels: {{- include "content-deployment.internal.labels" . | nindent 8 }}
15
15
  annotations:
16
- sidecar.istio.io/inject: "false"
17
- container.apparmor.security.beta.kubernetes.io/{{ include "content-deployment.name" . }}: runtime/default
16
+ container.apparmor.security.beta.kubernetes.io/{{ include "content-deployment.internal.name" . }}: runtime/default
18
17
  spec:
19
- {{- if (include "content-deployment.imagePullSecretName" .) }}
18
+ {{- if (include "content-deployment.internal.imagePullSecretName" .) }}
20
19
  imagePullSecrets:
21
- - name: {{ include "content-deployment.imagePullSecretName" . }}
20
+ - name: {{ include "content-deployment.internal.imagePullSecretName" . }}
22
21
  {{- end }}
23
22
  automountServiceAccountToken: false
24
- serviceAccountName: {{ tpl (.Values.serviceAccountName | default (include "content-deployment.fullname" .)) $ }}
23
+ serviceAccountName: {{ tpl (.Values.serviceAccountName | default (include "content-deployment.internal.fullname" .)) $ }}
25
24
  containers:
26
- - image: {{ include "content-deployment.imageName" . }}
27
- name: {{ include "content-deployment.name" . }}
25
+ - image: {{ include "content-deployment.internal.imageName" . }}
26
+ name: {{ include "content-deployment.internal.name" . }}
28
27
  env:
29
28
  - name: EXIT
30
29
  value: "1"
@@ -34,12 +33,12 @@ spec:
34
33
  value: /tmp
35
34
  - name: SERVICE_BINDING_ROOT
36
35
  value: /bindings
37
- {{- $envVars := (include "content-deployment.processEnv" $ | fromJson) }}
36
+ {{- $envVars := (include "content-deployment.internal.processEnv" $ | fromJson) }}
38
37
  {{- if not (eq (len $envVars.vars) 0) }}
39
38
  {{- $envVars.vars | toYaml | nindent 8}}
40
39
  {{- end }}
41
40
  envFrom:
42
- {{- $envFromVars := (include "content-deployment.processEnvFrom" . | fromJson) }}
41
+ {{- $envFromVars := (include "content-deployment.internal.processEnvFrom" . | fromJson) }}
43
42
  {{- if not (eq (len $envFromVars.vars) 0) }}
44
43
  {{- $envFromVars.vars | toYaml | nindent 8}}
45
44
  {{- end }}
@@ -55,7 +54,7 @@ spec:
55
54
  volumeMounts:
56
55
  - mountPath: /tmp
57
56
  name: tmp
58
- {{- include "content-deployment.serviceMounts" . | nindent 8 }}
57
+ {{- include "content-deployment.internal.serviceMounts" . | nindent 8 }}
59
58
  restartPolicy: OnFailure
60
59
  securityContext:
61
60
  runAsNonRoot: true
@@ -63,4 +62,4 @@ spec:
63
62
  volumes:
64
63
  - name: tmp
65
64
  emptyDir: {}
66
- {{- include "content-deployment.serviceVolumes" . | nindent 6 }}
65
+ {{- include "content-deployment.internal.serviceVolumes" . | nindent 6 }}
@@ -3,8 +3,8 @@ apiVersion: v1
3
3
  kind: Secret
4
4
  type: kubernetes.io/dockerconfigjson
5
5
  metadata:
6
- name: {{ include "content-deployment.imagePullSecretName" . }}
7
- labels: {{- include "content-deployment.labels" . | nindent 4 }}
6
+ name: {{ include "content-deployment.internal.imagePullSecretName" . }}
7
+ labels: {{- include "content-deployment.internal.labels" . | nindent 4 }}
8
8
  data:
9
9
  .dockerconfigjson: {{ default .Values.global.imagePullSecret.dockerconfigjson .Values.imagePullSecret.dockerconfigjson }}
10
10
  {{- end -}}
@@ -2,5 +2,5 @@
2
2
  apiVersion: v1
3
3
  kind: ServiceAccount
4
4
  metadata:
5
- name: {{ include "content-deployment.fullname" . }}
5
+ name: {{ include "content-deployment.internal.fullname" . }}
6
6
  {{end}}
@@ -4,10 +4,10 @@
4
4
  apiVersion: services.cloud.sap.com/v1
5
5
  kind: ServiceBinding
6
6
  metadata:
7
- name: {{ include "content-deployment.bindingName" (dict "root" $ "name" $name) }}
8
- labels: {{- include "content-deployment.labels" $ | nindent 4 }}
7
+ name: {{ include "content-deployment.internal.bindingName" (dict "root" $ "name" $name) }}
8
+ labels: {{- include "content-deployment.internal.labels" $ | nindent 4 }}
9
9
  spec:
10
- serviceInstanceName: {{include "content-deployment.serviceInstanceName" (dict "binding" $params "root" $) }}
10
+ serviceInstanceName: {{include "content-deployment.internal.serviceInstanceName" (dict "binding" $params "root" $) }}
11
11
  secretKey: credentials
12
12
  {{- if $params.externalName }}
13
13
  externalName: {{ $params.externalName }}