@sap/cds-dk 6.3.2 → 6.4.1

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 (93) hide show
  1. package/CHANGELOG.md +38 -7
  2. package/bin/cds.js +2 -0
  3. package/bin/compile/index.js +2 -1
  4. package/bin/deploy/index.js +5 -3
  5. package/bin/deploy/to-sqlite.js +17 -15
  6. package/bin/help.js +7 -4
  7. package/bin/init.js +1 -1
  8. package/bin/login.js +3 -4
  9. package/bin/migrate.js +33 -0
  10. package/bin/pull.js +4 -4
  11. package/bin/push.js +1 -1
  12. package/bin/subscribe.js +58 -66
  13. package/bin/unsubscribe.js +67 -0
  14. package/bin/watch.js +4 -3
  15. package/lib/bind/bindingUtil.js +2 -0
  16. package/lib/bind/cfKeyProvider.js +5 -1
  17. package/lib/client/activate.js +3 -3
  18. package/lib/client/auth_manager.js +2 -2
  19. package/lib/client/base_command.js +7 -6
  20. package/lib/client/extend.js +2 -2
  21. package/lib/client/helper/errors.js +8 -2
  22. package/lib/client/helper/logging.js +13 -11
  23. package/lib/client/params.js +3 -0
  24. package/lib/client/pull.js +1 -1
  25. package/lib/client/push.js +4 -4
  26. package/lib/client/settings_manager.js +13 -6
  27. package/lib/client/subscription.js +81 -0
  28. package/lib/compile/to-xsuaa.js +25 -19
  29. package/lib/import/odata/metadataconverter/MetadataConverter.js +3 -3
  30. package/lib/import/odata/v2parser.js +37 -24
  31. package/lib/import/odata/v4parser.js +111 -37
  32. package/lib/init/constants.js +1 -1
  33. package/lib/init/index.js +2 -2
  34. package/lib/init/template/_merging/registry-mta.js +0 -3
  35. package/lib/init/template/approuter/files/approuter-configmap.yaml +10 -0
  36. package/lib/init/template/approuter/files/approuter-mtxs-configmap.yaml +15 -0
  37. package/lib/init/template/approuter/files/chart.yaml +4 -0
  38. package/lib/init/template/approuter/files/package.json +1 -1
  39. package/lib/init/template/approuter/files/values.yaml.hbs +31 -0
  40. package/lib/init/template/approuter/index.js +60 -12
  41. package/lib/init/template/auditlog/index.js +16 -8
  42. package/lib/init/template/cf-manifest/index.js +3 -3
  43. package/lib/init/template/connectivity/index.js +19 -10
  44. package/lib/init/template/destinations/index.js +23 -7
  45. package/lib/init/template/enterprise-messaging/files/cds.package.json +1 -2
  46. package/lib/init/template/enterprise-messaging/files/cds.profile.package.json.hbs +1 -2
  47. package/lib/init/template/enterprise-messaging/files/cdsrc.json +1 -2
  48. package/lib/init/template/enterprise-messaging/files/cdsrc.json.hbs +1 -2
  49. package/lib/init/template/enterprise-messaging/files/event-mesh.json.hbs +31 -0
  50. package/lib/init/template/enterprise-messaging/files/mta.yaml.hbs +1 -0
  51. package/lib/init/template/enterprise-messaging/index.js +26 -13
  52. package/lib/init/template/extensibility/index.js +19 -10
  53. package/lib/init/template/hana/files/mta.yaml.hbs +0 -4
  54. package/lib/init/template/hana/index.js +58 -22
  55. package/lib/init/template/helm/chart/templates/NOTES.txt +4 -3
  56. package/lib/init/template/helm/chart/templates/_deployment_helpers.tpl +25 -2
  57. package/lib/init/template/helm/chart/values.root.schema.json +5 -0
  58. package/lib/init/template/helm/chart/values.schema.json +27 -0
  59. package/lib/init/template/helm/files/values.yaml.hbs +1 -1
  60. package/lib/init/template/helm/index.js +25 -23
  61. package/lib/init/template/helm/subchart/templates/_helpers.tpl +29 -0
  62. package/lib/init/template/helm/subchart/templates/api-rule.yaml +5 -5
  63. package/lib/init/template/helm/subchart/templates/deployment.yaml +12 -9
  64. package/lib/init/template/helm/subchart/values.md +258 -88
  65. package/lib/init/template/helm/subchart/values.schema.json +96 -13
  66. package/lib/init/template/helm/subchart/values.yaml +6 -2
  67. package/lib/init/template/html5-repo/index.js +28 -11
  68. package/lib/init/template/java/index.js +5 -5
  69. package/lib/init/template/kibana-logging/index.js +5 -4
  70. package/lib/init/template/mta/index.js +2 -2
  71. package/lib/init/template/mtx/index.js +1 -1
  72. package/lib/init/template/multitenancy/files/chart.yaml +4 -0
  73. package/lib/init/template/multitenancy/files/java/mtxs-configmap.yaml +20 -0
  74. package/lib/init/template/multitenancy/files/java/package.json +6 -9
  75. package/lib/init/template/multitenancy/files/mtxs-configmap.yaml +15 -0
  76. package/lib/init/template/multitenancy/files/saas-registry.yaml +17 -19
  77. package/lib/init/template/multitenancy/files/values.yaml.hbs +47 -0
  78. package/lib/init/template/multitenancy/files/xs-security.json.hbs +0 -7
  79. package/lib/init/template/multitenancy/index.js +83 -37
  80. package/lib/init/template/nodejs/files/.eslintrc +26 -0
  81. package/lib/init/template/nodejs/files/package.json.hbs +0 -28
  82. package/lib/init/template/nodejs/index.js +7 -10
  83. package/lib/init/template/pipeline/index.js +4 -4
  84. package/lib/init/template/samples/index.js +5 -5
  85. package/lib/init/template/templateBase.js +1 -4
  86. package/lib/init/template/toggles/index.js +5 -5
  87. package/lib/init/template/xsuaa/files/values.yaml.hbs +21 -0
  88. package/lib/init/template/xsuaa/index.js +34 -24
  89. package/lib/init/util/md5Tracking.js +113 -0
  90. package/lib/init/util/merge.js +19 -2
  91. package/lib/init/util/projectReader.js +15 -12
  92. package/npm-shrinkwrap.json +211 -686
  93. package/package.json +3 -3
@@ -1,24 +1,27 @@
1
- const path = require('path');
2
- const { exists, read, copy, rimraf } = require('../../../cds').utils;
1
+ const { join } = require('path');
2
+ const { exists, read, rimraf } = require('../../../cds').utils;
3
3
  const ProjectReader = require('../../util/projectReader');
4
4
  const { mergeYAML } = require('../../util/merge')
5
+ const { parseMd5File, writeMd5File, copyAndTrack } = require('../../util/md5Tracking')
5
6
  //const { yaml } = require('@sap/cds-foss')
6
7
 
7
8
  module.exports = class HelmTemplate extends require('../templateBase') {
8
9
  constructor(projectPath, generator) {
9
10
  super(projectPath, generator, __dirname);
10
11
  this.projectReader = new ProjectReader(projectPath);
12
+ this.oldTrackingData = undefined;
13
+ this.newTrackingData = {};
11
14
  }
12
15
 
13
16
  static hasFacet(_, projectPath, options) {
14
17
  // REVISIT: this works, but could be semantically nicer with a 'shouldRunDependentMerging' or the like
15
18
  if (options?.add.has('mta') && !options?.add.has('helm')) return false
16
- return exists(path.join(projectPath, 'chart', 'values.yaml'))
19
+ return exists(join(projectPath, 'chart', 'values.yaml'))
17
20
  }
18
21
 
19
22
  async canRun() {
20
23
  if (this.options.force) {
21
- await rimraf(path.join(this.projectPath, 'chart'))
24
+ await rimraf(join(this.projectPath, 'chart'))
22
25
  return true;
23
26
  }
24
27
  return true;
@@ -26,42 +29,41 @@ module.exports = class HelmTemplate extends require('../templateBase') {
26
29
 
27
30
  async run() {
28
31
  const projectDescriptor = await this.projectReader.read(this.options)
32
+ this.oldTrackingData = await parseMd5File(join(this.projectPath, 'chart', '.cds-add-helm-files.md5'));
29
33
 
30
- await copy(
31
- path.join(__dirname, 'subchart'),
32
- path.join(this.projectPath, 'chart', 'charts', 'web-application'),
34
+ await copyAndTrack(
35
+ join(__dirname, 'subchart'),
36
+ join(this.projectPath, 'chart', 'charts', 'web-application'),
37
+ this
33
38
  )
34
- await copy(
35
- path.join(__dirname, 'chart'),
36
- path.join(this.projectPath, 'chart')
39
+ await copyAndTrack(
40
+ join(__dirname, 'chart'),
41
+ join(this.projectPath, 'chart'),
42
+ this
37
43
  )
38
44
 
39
- const webApplicationChartPath = process.env.WEB_APPLICATION_CHART ?? path.join(__dirname, 'subchart')
40
- const chartFilePath = path.join(webApplicationChartPath, 'Chart.yaml')
41
- const chartFile = await read(chartFilePath)
42
- //const { version } = yaml.parse(chartFile)
43
-
44
45
  await mergeYAML(
45
- path.join(this.projectPath, 'chart', 'Chart.yaml'),
46
- path.join(__dirname, 'files', 'Chart.yaml.hbs'),
47
- projectDescriptor, { forceOverwrite: true }
46
+ join(this.projectPath, 'chart', 'Chart.yaml'),
47
+ join(__dirname, 'files', 'Chart.yaml.hbs'),
48
+ projectDescriptor
48
49
  )
49
50
 
50
51
  await mergeYAML(
51
- path.join(this.projectPath, 'chart', 'values.yaml'),
52
- path.join(__dirname, 'files', 'values.yaml.hbs'),
53
- projectDescriptor, { forceOverwrite: true }
52
+ join(this.projectPath, 'chart', 'values.yaml'),
53
+ join(__dirname, 'files', 'values.yaml.hbs'),
54
+ projectDescriptor
54
55
  )
55
56
  await this.runDependentMerging();
57
+ await writeMd5File(join(this.projectPath, 'chart', '.cds-add-helm-files.md5'), this.newTrackingData);
56
58
  }
57
59
 
58
60
  async runDependentMerging() {
59
61
  // Re-applying the dependent merging part of other facets if necessary.
60
- const dependentFacets = ['hana', 'xsuaa', 'auditlog', 'enterprise-messaging', 'destinations' , 'multitenancy', 'extensibility']
62
+ const dependentFacets = ['hana', 'xsuaa', 'auditlog', 'enterprise-messaging', 'destinations' , 'multitenancy', 'extensibility', 'approuter']
61
63
  for (const facet of dependentFacets) {
62
64
  const Template = require('../'+facet)
63
65
  const template = new Template(this.projectPath, this.generator)
64
- if (Template.hasFacet(await this.getEnv(), this.projectPath, this.options)) await template.runDependentMerging()
66
+ if (Template.hasFacet(await this.getEnv(), this.projectPath, this.options)) await template.runDependentMerging(this)
65
67
  }
66
68
  }
67
69
  };
@@ -202,4 +202,33 @@ If release name contains chart name it will be used as service insatnce name.
202
202
  {{- end }}
203
203
  {{- $_ := set $result "vars" $variables }}
204
204
  {{- $result | mustToJson }}
205
+ {{- end }}
206
+
207
+ {{- define "web-application.processEnvFrom" -}}
208
+ {{- $ := . -}}
209
+ {{- $result := dict }}
210
+ {{- $variables := list }}
211
+ {{- range $secretName := .Values.envSecretNames }}
212
+ {{- $variable := dict }}
213
+ {{- $_ := set $variable "name" $secretName -}}
214
+ {{- $variables = append $variables (dict "secretRef" $variable)}}
215
+ {{- end }}
216
+ {{- range $envFrom := .Values.envFrom }}
217
+ {{- if hasKey $envFrom "configMapRef" }}
218
+ {{- if and (hasKey $envFrom.configMapRef "tpl") ($envFrom.configMapRef.tpl) }}
219
+ {{- $name := (tpl $envFrom.configMapRef.name $) }}
220
+ {{- $_ := set $envFrom.configMapRef "name" $name }}
221
+ {{- end }}
222
+ {{- $_ := unset $envFrom.configMapRef "tpl" }}
223
+ {{- else }}
224
+ {{- if and (hasKey $envFrom.secretRef "tpl") ($envFrom.secretRef.tpl) }}
225
+ {{- $name := (tpl $envFrom.secretRef.name $) }}
226
+ {{- $_ := set $envFrom.secretRef "name" $name }}
227
+ {{- end }}
228
+ {{- $_ := unset $envFrom.secretRef "tpl" }}
229
+ {{- end }}
230
+ {{- $variables = append $variables $envFrom }}
231
+ {{- end }}
232
+ {{- $_ := set $result "vars" $variables }}
233
+ {{- $result | mustToJson }}
205
234
  {{- end }}
@@ -1,11 +1,15 @@
1
1
  {{ if .Values.expose.enabled}}
2
- apiVersion: gateway.kyma-project.io/v1alpha1
2
+ apiVersion: gateway.kyma-project.io/v1beta1
3
3
  kind: APIRule
4
4
  metadata:
5
5
  name: {{ include "web-application.fullname" . }}
6
6
  labels: {{- include "web-application.labels" . | nindent 4 }}
7
7
  spec:
8
8
  gateway: kyma-gateway.kyma-system.svc.cluster.local
9
+ host: {{ include "web-application.exposeHost" . }}
10
+ service:
11
+ name: {{ include "web-application.fullname" . }}
12
+ port: {{ .Values.port }}
9
13
  rules:
10
14
  - accessStrategies:
11
15
  - handler: allow
@@ -17,8 +21,4 @@ spec:
17
21
  - DELETE
18
22
  - HEAD
19
23
  path: /.*
20
- service:
21
- host: {{ include "web-application.exposeHost" . }}
22
- name: {{ include "web-application.fullname" . }}
23
- port: {{ .Values.port }}
24
24
  {{ end }}
@@ -25,9 +25,9 @@ spec:
25
25
  containerPort: {{ .Values.port }}
26
26
  protocol: TCP
27
27
  envFrom:
28
- {{- range $secretName := .Values.envSecretNames }}
29
- - secretRef:
30
- name: {{ $secretName }}
28
+ {{- $envFromVars := (include "web-application.processEnvFrom" . | fromJson) }}
29
+ {{- if not (eq (len $envFromVars.vars) 0) }}
30
+ {{- $envFromVars.vars | toYaml | nindent 8}}
31
31
  {{- end }}
32
32
  env:
33
33
  {{- if .Values.bindings }}
@@ -50,28 +50,29 @@ spec:
50
50
  - name: APPLICATION_URI
51
51
  value: {{ include "web-application.applicationUri" . }}
52
52
  {{- end }}
53
+ {{- $health := .Values.health_check | default .Values.health }}
53
54
  livenessProbe:
54
- {{- if .Values.health_check.liveness.path }}
55
+ {{- if $health.liveness.path }}
55
56
  httpGet:
56
- path: {{ .Values.health_check.liveness.path }}
57
+ path: {{ $health.liveness.path }}
57
58
  port: http
58
59
  {{- else }}
59
60
  tcpSocket:
60
61
  port: {{ .Values.port }}
61
62
  {{- end }}
62
63
  readinessProbe:
63
- {{- if .Values.health_check.readiness.path }}
64
+ {{- if $health.readiness.path }}
64
65
  httpGet:
65
- path: {{ .Values.health_check.readiness.path }}
66
+ path: {{ $health.readiness.path }}
66
67
  port: http
67
68
  {{- else }}
68
69
  tcpSocket:
69
70
  port: {{ .Values.port }}
70
71
  {{- end }}
71
72
  startupProbe:
72
- {{- if .Values.health_check.liveness.path }}
73
+ {{- if $health.liveness.path }}
73
74
  httpGet:
74
- path: {{ .Values.health_check.liveness.path }}
75
+ path: {{ $health.liveness.path }}
75
76
  port: http
76
77
  {{- else }}
77
78
  tcpSocket:
@@ -96,6 +97,8 @@ spec:
96
97
  - ALL
97
98
  privileged: false
98
99
  readOnlyRootFilesystem: false
100
+ seccompProfile:
101
+ type: RuntimeDefault
99
102
  restartPolicy: Always
100
103
  securityContext:
101
104
  runAsNonRoot: true