@sap/cds-dk 7.5.0 → 7.6.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.
- package/bin/add.js +28 -24
- package/bin/bind.js +59 -32
- package/bin/build.js +1 -1
- package/bin/cds.js +1 -1
- package/bin/env.js +1 -6
- package/bin/init.js +7 -3
- package/bin/logout.js +2 -2
- package/bin/migrate.js +1 -1
- package/bin/version.js +1 -0
- package/bin/watch.js +8 -1
- package/lib/bind/bindingUtil.js +14 -20
- package/lib/bind/cfKeyProvider.js +9 -11
- package/lib/bind/index.js +4 -2
- package/lib/build/buildTaskFactory.js +31 -20
- package/lib/build/constants.js +9 -8
- package/lib/build/provider/featureToggleBuildPlugin.js +1 -7
- package/lib/build/provider/hana/index.js +44 -9
- package/lib/build/provider/internalBuildTaskProvider.js +7 -5
- package/lib/build/provider/java/index.js +0 -6
- package/lib/build/provider/mtx-extension/index.js +2 -1
- package/lib/build/provider/mtx-sidecar/index.js +5 -0
- package/lib/build/provider/nodejs/index.js +32 -47
- package/lib/build/util.js +134 -33
- package/lib/compile/openapi/csdl2openapi.js +1 -1
- package/lib/deploy/to-hana/hana.js +1 -1
- package/lib/env/schema.js +157 -17
- package/lib/env/schemas/cds-rc.js +118 -0
- package/lib/init/constants.js +1 -1
- package/lib/init/merge.js +2 -1
- package/lib/init/template/application-logging/index.js +1 -2
- package/lib/init/template/approuter/files/mta.yaml.hbs +2 -0
- package/lib/init/template/approuter/files/package.json +1 -1
- package/lib/init/template/approuter/files/values.yaml.hbs +8 -1
- package/lib/init/template/hana/files/undeploy.json +3 -2
- package/lib/init/template/helm/files/chart/templates/NOTES.txt +2 -0
- package/lib/init/template/helm/files/chart/templates/_deployment_helpers.tpl +10 -2
- package/lib/init/template/helm/files/content-deployment/Chart.yaml +1 -1
- package/lib/init/template/helm/files/content-deployment/templates/_helpers.tpl +6 -5
- package/lib/init/template/helm/files/content-deployment/values.yaml +1 -1
- package/lib/init/template/helm/files/service-instance/Chart.yaml +1 -1
- package/lib/init/template/helm/files/service-instance/templates/_helpers.tpl +6 -5
- package/lib/init/template/helm/files/service-instance/values.yaml +1 -1
- package/lib/init/template/helm/files/web-application/Chart.yaml +1 -1
- package/lib/init/template/helm/files/web-application/templates/_api.tpl +6 -5
- package/lib/init/template/helm/files/web-application/values.yaml +1 -1
- package/lib/init/template/helm/index.js +1 -12
- package/lib/init/template/helm-unified-runtime/index.js +3 -2
- package/lib/init/template/html5-repo/files/values.yaml.hbs +9 -0
- package/lib/init/template/multitenancy/files/package.sidecar.json.hbs +1 -2
- package/lib/init/template/multitenancy/index.js +3 -2
- package/lib/init/template/xsuaa/files/package.json.hbs +1 -2
- package/lib/mtx/activate.js +1 -1
- package/lib/mtx/auth_manager.js +4 -2
- package/lib/mtx/download_legacy.js +1 -1
- package/lib/mtx/extend.js +2 -2
- package/lib/mtx/pull.js +1 -1
- package/lib/mtx/push.js +1 -1
- package/lib/mtx/settings_manager.js +77 -26
- package/lib/mtx/tenant_action.js +1 -1
- package/lib/mtx/util/legacy_ext.js +0 -1
- package/lib/util/axios.js +66 -0
- package/lib/util/cf.js +15 -10
- package/npm-shrinkwrap.json +361 -167
- package/package.json +1 -1
- package/lib/env/schemas/cds-rc.json +0 -101
- package/lib/init/template/helm-unified-runtime/lib/build.js +0 -0
- package/lib/util/pruneAxiosErrors.js +0 -56
package/lib/env/schema.js
CHANGED
|
@@ -1,35 +1,175 @@
|
|
|
1
|
-
const { merge } = require('../init/merge')
|
|
2
|
-
const { readJSON } = require('../util/fs')
|
|
3
1
|
|
|
4
|
-
|
|
2
|
+
function _local(id) {
|
|
3
|
+
return require.resolve(id, {
|
|
4
|
+
paths: [
|
|
5
|
+
process.cwd(), // project-local module is preferred
|
|
6
|
+
__dirname // otherwise from our own dependencies
|
|
7
|
+
]
|
|
8
|
+
})
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
function _robustRequire(file) {
|
|
12
|
+
const fs = require('fs')
|
|
13
|
+
const path = require('path')
|
|
14
|
+
|
|
15
|
+
file = path.normalize(file)
|
|
16
|
+
let content
|
|
17
|
+
try {
|
|
18
|
+
content = fs.readFileSync(file, 'utf8')
|
|
19
|
+
} catch (e) {
|
|
20
|
+
// file is not readable -> nothing to do
|
|
21
|
+
return
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
try {
|
|
25
|
+
return JSON.parse(content)
|
|
26
|
+
} catch (e) {
|
|
27
|
+
// invalid json -> ignore and try regex
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
const result = {}
|
|
31
|
+
try {
|
|
32
|
+
const deps = JSON.parse(content.match(/"dependencies"\s*:\s*({[^}]*})/)[1])
|
|
33
|
+
result.dependencies = deps
|
|
34
|
+
} catch (e) { /* ignore */ }
|
|
35
|
+
|
|
36
|
+
try {
|
|
37
|
+
const devDeps = JSON.parse(content.match(/"devDependencies"\s*:\s*({[^}]*})/)[1])
|
|
38
|
+
result.devDependencies = devDeps
|
|
39
|
+
} catch (e) { /* ignore */ }
|
|
40
|
+
|
|
41
|
+
return result
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
_robustRequire.resolve = function (id, options = {}) {
|
|
45
|
+
const fs = require('fs')
|
|
46
|
+
const path = require('path')
|
|
47
|
+
|
|
48
|
+
try {
|
|
49
|
+
return require.resolve(id, options)
|
|
50
|
+
} catch (err) {
|
|
51
|
+
// ignore
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
const [, mod, file] = /(.+)\/([^/]+)$/.exec(id)
|
|
55
|
+
let modPath = path.join(process.cwd(), 'node_modules', mod, file)
|
|
56
|
+
const ext = path.extname(modPath)
|
|
57
|
+
if (!ext) {
|
|
58
|
+
modPath = modPath + '.js'
|
|
59
|
+
}
|
|
60
|
+
if (fs.existsSync(modPath)) {
|
|
61
|
+
return modPath
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
throw new Error('not found')
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
function mergePluginSchema(pluginSchema) {
|
|
68
|
+
return {
|
|
69
|
+
into: async (targetSchema) => {
|
|
70
|
+
if (pluginSchema.buildTaskType) {
|
|
71
|
+
targetSchema.$defs?.buildTaskType?.enum?.push(pluginSchema.buildTaskType.name);
|
|
72
|
+
targetSchema.$defs?.buildTaskType?.enumDescriptions?.push(pluginSchema.buildTaskType.description);
|
|
73
|
+
targetSchema._cds_schema_overlays.push('buildTaskType')
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
if (pluginSchema.databaseType) {
|
|
77
|
+
targetSchema.$defs?.databaseType?.enum?.push(pluginSchema.databaseType.name);
|
|
78
|
+
targetSchema.$defs?.databaseType?.enumDescriptions?.push(pluginSchema.databaseType.description);
|
|
79
|
+
targetSchema._cds_schema_overlays.push('databaseType')
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
if (pluginSchema.cds) {
|
|
83
|
+
if (targetSchema.$defs?.cdsRoot?.properties) {
|
|
84
|
+
Object.assign(targetSchema.$defs.cdsRoot.properties, pluginSchema.cds)
|
|
85
|
+
targetSchema._cds_schema_overlays.push('cdsRoot')
|
|
86
|
+
}
|
|
87
|
+
|
|
88
|
+
// backwards compatibility
|
|
89
|
+
if (targetSchema.properties) {
|
|
90
|
+
Object.assign(targetSchema.properties, pluginSchema.cds)
|
|
91
|
+
targetSchema._cds_schema_overlays.push('root')
|
|
92
|
+
}
|
|
93
|
+
}
|
|
94
|
+
}
|
|
95
|
+
}
|
|
96
|
+
}
|
|
97
|
+
|
|
98
|
+
module.exports = async function overlay4(schemaName) {
|
|
99
|
+
const path = require('path')
|
|
100
|
+
const { merge } = require('../init/merge')
|
|
5
101
|
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
const cds = require(require.resolve('@sap/cds', {
|
|
9
|
-
paths: [cwd, __dirname]
|
|
10
|
-
}))
|
|
102
|
+
const cds = require('../cds')
|
|
103
|
+
cds.root = process.cwd()
|
|
11
104
|
|
|
12
|
-
|
|
13
|
-
cds.root = cwd
|
|
105
|
+
const { readJSON } = require('../util/fs')
|
|
14
106
|
|
|
15
|
-
// load defaults, throw err if schema not found
|
|
16
107
|
let result;
|
|
17
108
|
if (typeof cds.schema?.default4 === 'function') {
|
|
18
109
|
result = await cds.schema.default4(schemaName)
|
|
19
110
|
} else if (cds.env?.schemas?.[schemaName]) {
|
|
20
|
-
// backwards compatibility
|
|
111
|
+
// backwards compatibility, fails for invalid json files
|
|
21
112
|
result = await readJSON(cds.env.schemas[schemaName])
|
|
22
113
|
} else {
|
|
23
|
-
throw new Error(`cds ${cds.version} in ${
|
|
114
|
+
throw new Error(`cds ${cds.version} in ${cds.root} does not support schema retrieval.`)
|
|
115
|
+
}
|
|
116
|
+
|
|
117
|
+
if (schemaName !== 'cds-rc.json') {
|
|
118
|
+
return result
|
|
119
|
+
}
|
|
120
|
+
|
|
121
|
+
const oldTitle = result.title
|
|
122
|
+
const oldDescription = result.description
|
|
123
|
+
result._cds_schema_overlays = []
|
|
124
|
+
|
|
125
|
+
try {
|
|
126
|
+
const scheamFile = path.join(__dirname, 'schemas', schemaName.replace(/\.json$/, '.js'))
|
|
127
|
+
const schema = require(scheamFile)
|
|
128
|
+
|
|
129
|
+
await merge(schema).into(result)
|
|
130
|
+
result._cds_schema_overlays.push('cdsRoot')
|
|
131
|
+
|
|
132
|
+
if (result.properties) {
|
|
133
|
+
// backwards compatibility
|
|
134
|
+
await merge(schema.$defs.cdsRoot.properties).into(result.properties)
|
|
135
|
+
result._cds_schema_overlays.push('root')
|
|
136
|
+
}
|
|
137
|
+
} catch (err) {
|
|
138
|
+
console.error(err.message)
|
|
24
139
|
}
|
|
25
140
|
|
|
26
|
-
// optional, don't throw if file not found
|
|
27
141
|
try {
|
|
28
|
-
|
|
29
|
-
|
|
142
|
+
const pluginsLib = require(_local('@sap/cds/lib/plugins.js'))
|
|
143
|
+
if (pluginsLib) {
|
|
144
|
+
const oldRequire = pluginsLib.require
|
|
145
|
+
try {
|
|
146
|
+
pluginsLib.require = _robustRequire
|
|
147
|
+
const plugins = pluginsLib.fetch?.()
|
|
148
|
+
if (plugins) {
|
|
149
|
+
for (const [key, { impl, packageJson }] of Object.entries(plugins)) {
|
|
150
|
+
const pluginPackageJsonFile = packageJson || path.join(path.dirname(impl), 'package.json')
|
|
151
|
+
try {
|
|
152
|
+
const pluginPackageJson = require(pluginPackageJsonFile)
|
|
153
|
+
if (pluginPackageJson.cds?.schema) {
|
|
154
|
+
await mergePluginSchema(pluginPackageJson.cds.schema).into(result);
|
|
155
|
+
}
|
|
156
|
+
} catch (err) {
|
|
157
|
+
if (err.code !== 'ENOENT') {
|
|
158
|
+
console.error(`Error loading schema from plugin ${key}: ${err.message}`)
|
|
159
|
+
}
|
|
160
|
+
}
|
|
161
|
+
}
|
|
162
|
+
}
|
|
163
|
+
} finally {
|
|
164
|
+
pluginsLib.require = oldRequire
|
|
165
|
+
}
|
|
166
|
+
}
|
|
30
167
|
} catch (err) {
|
|
31
|
-
|
|
168
|
+
console.error(err.message)
|
|
32
169
|
}
|
|
33
170
|
|
|
171
|
+
|
|
172
|
+
result.title = oldTitle
|
|
173
|
+
result.description = oldDescription
|
|
34
174
|
return result
|
|
35
175
|
}
|
|
@@ -0,0 +1,118 @@
|
|
|
1
|
+
module.exports = {
|
|
2
|
+
title: "JSON schema for CDS-DK configuration",
|
|
3
|
+
$schema: "https://json-schema.org/draft/2020-12/schema",
|
|
4
|
+
description: "Build overlay",
|
|
5
|
+
$defs: {
|
|
6
|
+
cdsRoot: {
|
|
7
|
+
properties: {
|
|
8
|
+
// build specific schema
|
|
9
|
+
build: {
|
|
10
|
+
type: "object",
|
|
11
|
+
description: "Customize CDS build settings.",
|
|
12
|
+
additionalProperties: true,
|
|
13
|
+
properties: {
|
|
14
|
+
target: {
|
|
15
|
+
type: "string",
|
|
16
|
+
description: "Specify the folder which contains generated build results. Defaults to './gen'.",
|
|
17
|
+
format: "uri-reference"
|
|
18
|
+
},
|
|
19
|
+
tasks: {
|
|
20
|
+
type: "array",
|
|
21
|
+
description: "Control which tasks 'cds build' will execute on your project modules. This is a typical task configuration: '\"tasks\": [{ \"for\": \"hana\"}];",
|
|
22
|
+
uniqueItems: true,
|
|
23
|
+
default: [
|
|
24
|
+
{}
|
|
25
|
+
],
|
|
26
|
+
items: {
|
|
27
|
+
type: "object",
|
|
28
|
+
additionalProperties: true,
|
|
29
|
+
properties: {
|
|
30
|
+
dest: {
|
|
31
|
+
type: "string",
|
|
32
|
+
description: "Optional: Define the destination folder for this build task, relative to build target folder. \nFor example: Destination defined as 'custom' results in an output written to 'gen/custom'.",
|
|
33
|
+
format: "uri-reference"
|
|
34
|
+
},
|
|
35
|
+
src: {
|
|
36
|
+
type: "string",
|
|
37
|
+
description: "Optional: Prefer defining 'cds.folders'. Use 'src' if you want it only to be valid for this specific build task, which excludes, for example, 'cds watch'.",
|
|
38
|
+
format: "uri-reference"
|
|
39
|
+
},
|
|
40
|
+
for: {
|
|
41
|
+
type: "string",
|
|
42
|
+
description: "Define the target technology for this build task.",
|
|
43
|
+
minLength: 1,
|
|
44
|
+
$ref: "#/$defs/buildTaskType"
|
|
45
|
+
},
|
|
46
|
+
options: {
|
|
47
|
+
type: "object",
|
|
48
|
+
description: "Optional: Set target technology specific options for this build task.",
|
|
49
|
+
additionalProperties: true,
|
|
50
|
+
properties: {
|
|
51
|
+
model: {
|
|
52
|
+
$ref: "#/$defs/foldersStringArray"
|
|
53
|
+
}
|
|
54
|
+
}
|
|
55
|
+
}
|
|
56
|
+
}
|
|
57
|
+
}
|
|
58
|
+
}
|
|
59
|
+
}
|
|
60
|
+
},
|
|
61
|
+
|
|
62
|
+
// deploy specific schema
|
|
63
|
+
deploy: {
|
|
64
|
+
type: "object",
|
|
65
|
+
description: "Customize 'cds deploy' settings.",
|
|
66
|
+
additionalProperties: true,
|
|
67
|
+
properties: {
|
|
68
|
+
no_save: {
|
|
69
|
+
type: "boolean",
|
|
70
|
+
description: "Do / don't update configuration in package.json.",
|
|
71
|
+
default: true
|
|
72
|
+
}
|
|
73
|
+
}
|
|
74
|
+
}
|
|
75
|
+
}
|
|
76
|
+
},
|
|
77
|
+
|
|
78
|
+
buildTaskType: {
|
|
79
|
+
enum: [
|
|
80
|
+
"nodejs",
|
|
81
|
+
"java",
|
|
82
|
+
"hana",
|
|
83
|
+
"mtx-sidecar",
|
|
84
|
+
"mtx-extension",
|
|
85
|
+
"mtx",
|
|
86
|
+
"node-cf",
|
|
87
|
+
"java-cf"
|
|
88
|
+
],
|
|
89
|
+
enumDescriptions: [
|
|
90
|
+
"Node.js build plugin",
|
|
91
|
+
"Java build plugin",
|
|
92
|
+
"SAP HANA build plugin",
|
|
93
|
+
"MTX sidecar build plugin",
|
|
94
|
+
"MTX extension build plugin",
|
|
95
|
+
"MTX build plugin",
|
|
96
|
+
"Node.js Cloud Foundry build plugin",
|
|
97
|
+
"Java Cloud Foundry build plugin"
|
|
98
|
+
]
|
|
99
|
+
},
|
|
100
|
+
|
|
101
|
+
foldersStringArray: {
|
|
102
|
+
oneOf: [
|
|
103
|
+
{
|
|
104
|
+
type: "string",
|
|
105
|
+
format: "uri-reference"
|
|
106
|
+
},
|
|
107
|
+
{
|
|
108
|
+
type: "array",
|
|
109
|
+
uniqueItems: true,
|
|
110
|
+
items: {
|
|
111
|
+
type: "string",
|
|
112
|
+
format: "uri-reference"
|
|
113
|
+
}
|
|
114
|
+
}
|
|
115
|
+
]
|
|
116
|
+
}
|
|
117
|
+
}
|
|
118
|
+
}
|
package/lib/init/constants.js
CHANGED
package/lib/init/merge.js
CHANGED
|
@@ -234,7 +234,7 @@ async function _mergeYAML(into, from, project, semantics = {}) {
|
|
|
234
234
|
if (!templateCollection) _traverseYAMLNode(node, i, actions)
|
|
235
235
|
})
|
|
236
236
|
|
|
237
|
-
if (!templateCollection) return
|
|
237
|
+
if (!templateCollection?.items) return
|
|
238
238
|
|
|
239
239
|
templateCollection.items.forEach((templateNode, templateIndex) => {
|
|
240
240
|
if (YAML.isScalar(templateNode)) {
|
|
@@ -381,6 +381,7 @@ async function removeFromYAML(name, keyPaths) {
|
|
|
381
381
|
node.delete(key)
|
|
382
382
|
} else {
|
|
383
383
|
node = node.get(key)
|
|
384
|
+
if(node === undefined) break;
|
|
384
385
|
}
|
|
385
386
|
}
|
|
386
387
|
}
|
|
@@ -9,9 +9,8 @@ module.exports = class ApplicationLoggingTemplate extends require('../../plugin'
|
|
|
9
9
|
}
|
|
10
10
|
|
|
11
11
|
async canRun() {
|
|
12
|
-
const { hasMta, hasHelm, hasHelmUnifiedRuntime
|
|
12
|
+
const { hasMta, hasHelm, hasHelmUnifiedRuntime } = readProject()
|
|
13
13
|
if ((hasHelmUnifiedRuntime || hasHelm) && !hasMta) throw `'cds add application-logging' is not available for Kyma yet`
|
|
14
|
-
if (isJava) throw `'cds add application-logging' is not available for Java yet`
|
|
15
14
|
return true
|
|
16
15
|
}
|
|
17
16
|
|
|
@@ -62,10 +62,12 @@ modules:
|
|
|
62
62
|
- name: {{appName}}-mtx
|
|
63
63
|
type: nodejs
|
|
64
64
|
path: {{#isNodejs}}gen/{{/isNodejs}}mtx/sidecar
|
|
65
|
+
{{#isNodejs}}
|
|
65
66
|
requires:
|
|
66
67
|
- name: app-api
|
|
67
68
|
properties:
|
|
68
69
|
SUBSCRIPTION_URL: ~{app-protocol}://\${tenant_subdomain}-~{app-uri}
|
|
70
|
+
{{/isNodejs}}
|
|
69
71
|
{{/hasMultitenancy}}
|
|
70
72
|
|
|
71
73
|
resources:
|
|
@@ -6,7 +6,9 @@ Your services are available at:
|
|
|
6
6
|
{{- $root := . }}
|
|
7
7
|
{{- range $name := include "cap.deploymentNames" . | split ";" }}
|
|
8
8
|
{{- $deployment := (get $root.Values $name) }}
|
|
9
|
+
{{- if $deployment.expose.enabled }}
|
|
9
10
|
{{- $ := merge (dict "name" $name "deployment" $deployment) $root }}
|
|
10
11
|
{{- $url := include "cap.deploymentHostFull" $ }}
|
|
11
12
|
{{ printf "%s - https://%s" $name $url }}
|
|
13
|
+
{{- end -}}
|
|
12
14
|
{{- end }}
|
|
@@ -51,7 +51,11 @@ copied from web-application: web-application.fullname
|
|
|
51
51
|
Get FQDN of a deployment
|
|
52
52
|
*/}}
|
|
53
53
|
{{- define "cap.deploymentHostFull" -}}
|
|
54
|
-
{{
|
|
54
|
+
{{- if not .deployment.expose.enabled }}
|
|
55
|
+
{{- printf "%s-%s.%s.svc.cluster.local:8080" .Release.Name .name .Release.Namespace }}
|
|
56
|
+
{{- else }}
|
|
57
|
+
{{- include "cap.deploymentHost" $ }}.{{ $.Values.global.domain }}
|
|
58
|
+
{{- end -}}
|
|
55
59
|
{{- end -}}
|
|
56
60
|
|
|
57
61
|
{{/*
|
|
@@ -73,7 +77,11 @@ Backend Destinations
|
|
|
73
77
|
{{- $deployment := (get $root.Values $destination.service) -}}
|
|
74
78
|
{{- $srv := merge (dict "name" $destination.service "destination" $destination "deployment" $deployment) $root -}}
|
|
75
79
|
{{- $destinationHost := include "cap.deploymentHostFull" $srv -}}
|
|
76
|
-
{{- $
|
|
80
|
+
{{- $protocol := "https" -}}
|
|
81
|
+
{{- if not $deployment.expose.enabled }}
|
|
82
|
+
{{- $protocol = "http" -}}
|
|
83
|
+
{{- end -}}
|
|
84
|
+
{{- $currentDestination := dict $nameKey $destination.name $urlKey (print $protocol "://" $destinationHost ) -}}
|
|
77
85
|
{{- $currentDestination := merge $currentDestination $.defaultParameters -}}
|
|
78
86
|
{{- $destinations = (append $destinations $currentDestination) -}}
|
|
79
87
|
{{- end -}}
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
Expand the name of the chart.
|
|
3
3
|
*/}}
|
|
4
4
|
{{- define "content-deployment.internal.name" -}}
|
|
5
|
-
{{- default .Chart.Name .Values.nameOverride | trunc 63 | trimSuffix "-" }}
|
|
5
|
+
{{- tpl (default .Chart.Name .Values.nameOverride) . | trunc 63 | trimSuffix "-" }}
|
|
6
6
|
{{- end }}
|
|
7
7
|
|
|
8
8
|
{{/*
|
|
@@ -12,12 +12,13 @@ If release name contains chart name it will be used as a full name.
|
|
|
12
12
|
*/}}
|
|
13
13
|
{{- define "content-deployment.internal.fullname" -}}
|
|
14
14
|
{{- if .Values.fullnameOverride }}
|
|
15
|
-
{{-
|
|
16
|
-
|
|
15
|
+
{{- $name := tpl .Values.fullnameOverride . }}
|
|
16
|
+
{{- if gt (len $name) 63 }}
|
|
17
|
+
{{- fail (printf "name exceeds 63 characters: '%s'" $name) }}
|
|
17
18
|
{{- end }}
|
|
18
|
-
{{-
|
|
19
|
+
{{- $name }}
|
|
19
20
|
{{- else }}
|
|
20
|
-
{{- $name := default .Chart.Name .Values.nameOverride }}
|
|
21
|
+
{{- $name := tpl (default .Chart.Name .Values.nameOverride) . }}
|
|
21
22
|
{{- if not (eq .Release.Name $name)}}
|
|
22
23
|
{{- $name = printf "%s-%s" .Release.Name $name }}
|
|
23
24
|
{{- end }}
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
Expand the name of the chart.
|
|
3
3
|
*/}}
|
|
4
4
|
{{- define "service-instance.internal.name" -}}
|
|
5
|
-
{{- default .Chart.Name .Values.nameOverride | trunc 63 | trimSuffix "-" }}
|
|
5
|
+
{{- tpl (default .Chart.Name .Values.nameOverride) . | trunc 63 | trimSuffix "-" }}
|
|
6
6
|
{{- end }}
|
|
7
7
|
|
|
8
8
|
{{/*
|
|
@@ -12,12 +12,13 @@ If release name contains chart name it will be used as a full name.
|
|
|
12
12
|
*/}}
|
|
13
13
|
{{- define "service-instance.internal.fullname" -}}
|
|
14
14
|
{{- if .Values.fullnameOverride }}
|
|
15
|
-
{{-
|
|
16
|
-
|
|
15
|
+
{{- $name := tpl .Values.fullnameOverride . }}
|
|
16
|
+
{{- if gt (len $name) 63 }}
|
|
17
|
+
{{- fail (printf "name exceeds 63 characters: '%s'" $name) }}
|
|
17
18
|
{{- end }}
|
|
18
|
-
{{-
|
|
19
|
+
{{- $name }}
|
|
19
20
|
{{- else }}
|
|
20
|
-
{{- $name := default .Chart.Name .Values.nameOverride }}
|
|
21
|
+
{{- $name := tpl (default .Chart.Name .Values.nameOverride) . }}
|
|
21
22
|
{{- if not (eq .Release.Name $name)}}
|
|
22
23
|
{{- $name = printf "%s-%s" .Release.Name $name }}
|
|
23
24
|
{{- end }}
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
Expand the name of the chart.
|
|
3
3
|
*/}}
|
|
4
4
|
{{- define "web-application.name" -}}
|
|
5
|
-
{{- default .Chart.Name .Values.nameOverride | trunc 63 | trimSuffix "-" }}
|
|
5
|
+
{{- tpl (default .Chart.Name .Values.nameOverride) . | trunc 63 | trimSuffix "-" }}
|
|
6
6
|
{{- end }}
|
|
7
7
|
|
|
8
8
|
{{/*
|
|
@@ -12,12 +12,13 @@ If release name contains chart name it will be used as a full name.
|
|
|
12
12
|
*/}}
|
|
13
13
|
{{- define "web-application.fullname" -}}
|
|
14
14
|
{{- if .Values.fullnameOverride }}
|
|
15
|
-
{{-
|
|
16
|
-
|
|
15
|
+
{{- $name := tpl .Values.fullnameOverride . }}
|
|
16
|
+
{{- if gt (len $name) 63 }}
|
|
17
|
+
{{- fail (printf "name exceeds 63 characters: '%s'" $name) }}
|
|
17
18
|
{{- end }}
|
|
18
|
-
{{-
|
|
19
|
+
{{- $name }}
|
|
19
20
|
{{- else }}
|
|
20
|
-
{{- $name := default .Chart.Name .Values.nameOverride }}
|
|
21
|
+
{{- $name := tpl (default .Chart.Name .Values.nameOverride) . }}
|
|
21
22
|
{{- if not (eq .Release.Name $name)}}
|
|
22
23
|
{{- $name = printf "%s-%s" .Release.Name $name }}
|
|
23
24
|
{{- end }}
|
|
@@ -14,6 +14,7 @@ module.exports = class HelmTemplate extends require('../../plugin') {
|
|
|
14
14
|
return true
|
|
15
15
|
}
|
|
16
16
|
|
|
17
|
+
// Won't need this any more with plugin approach: package not there -> plugin not pulled
|
|
17
18
|
static hasInProduction() {
|
|
18
19
|
const { add } = cds.cli.options
|
|
19
20
|
return exists(join('chart', 'charts', 'web-application')) && exists(join('chart', 'values.yaml') || add.has('helm'))
|
|
@@ -44,20 +45,8 @@ module.exports = class HelmTemplate extends require('../../plugin') {
|
|
|
44
45
|
hasContentDeployment = true
|
|
45
46
|
await this._mergeDependency('service-instance', 'html5-apps-repo-host')
|
|
46
47
|
await this._mergeDependency('content-deployment', 'html5-apps-deployer')
|
|
47
|
-
|
|
48
48
|
if (hasApprouter) {
|
|
49
49
|
await this._mergeDependency('service-instance', 'html5-apps-repo-runtime')
|
|
50
|
-
await merge({
|
|
51
|
-
'html5-apps-repo-runtime': {
|
|
52
|
-
serviceOfferingName: 'html5-apps-repo',
|
|
53
|
-
servicePlanName: 'app-runtime'
|
|
54
|
-
},
|
|
55
|
-
approuter: {
|
|
56
|
-
bindings: {
|
|
57
|
-
'html5-apps-repo-runtime': { serviceInstanceName: 'html5-apps-repo-runtime' }
|
|
58
|
-
}
|
|
59
|
-
},
|
|
60
|
-
}).into('chart/values.yaml')
|
|
61
50
|
}
|
|
62
51
|
}
|
|
63
52
|
if (hasMultitenancy) {
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
const cds = require('../../..')
|
|
2
|
-
const { copy, rimraf, exists } = cds.utils
|
|
2
|
+
const { copy, rimraf, exists, fs } = cds.utils
|
|
3
3
|
const { join } = require('path')
|
|
4
4
|
|
|
5
5
|
// cds.build?.register('helm-unified-runtime', {
|
|
@@ -19,7 +19,8 @@ module.exports = class HelmUnifiedRuntimeTemplate extends cds.add.Plugin {
|
|
|
19
19
|
}
|
|
20
20
|
|
|
21
21
|
static hasInProduction() {
|
|
22
|
-
|
|
22
|
+
const chart = exists(join('chart/Chart.yaml')) ? fs.readFileSync(join(cds.root, 'chart/Chart.yaml'), 'utf8') : ''
|
|
23
|
+
return chart.includes('https://int.repositories.cloud.sap/artifactory/virtual-unified-runtime-helm-dmz') || cds.cli.options.add.has('helm-unified-runtime')
|
|
23
24
|
}
|
|
24
25
|
|
|
25
26
|
async run() {
|
|
@@ -26,3 +26,12 @@ backendDestinations: {}
|
|
|
26
26
|
destination:
|
|
27
27
|
parameters:
|
|
28
28
|
HTML5Runtime_enabled: true
|
|
29
|
+
{{#hasApprouter}}
|
|
30
|
+
html5-apps-repo-runtime:
|
|
31
|
+
serviceOfferingName: html5-apps-repo
|
|
32
|
+
servicePlanName: app-runtime
|
|
33
|
+
approuter:
|
|
34
|
+
bindings:
|
|
35
|
+
html5-apps-repo-runtime:
|
|
36
|
+
serviceInstanceName: 'html5-apps-repo-runtime'
|
|
37
|
+
{{/hasApprouter}}
|
|
@@ -3,7 +3,7 @@ const cds = require('../../../cds')
|
|
|
3
3
|
const { read, write, copy } = cds.utils
|
|
4
4
|
const mvn = require('../../mvn')
|
|
5
5
|
const { readProject } = require('../../projectReader')
|
|
6
|
-
const { merge, sort } = require('../../merge')
|
|
6
|
+
const { merge, sort, removeFromYAML } = require('../../merge')
|
|
7
7
|
const { copyRenderedJSON } = require('../../../util/fs')
|
|
8
8
|
const {
|
|
9
9
|
srv4, // Server
|
|
@@ -102,7 +102,8 @@ module.exports = class MultitenancyTemplate extends require('../../plugin') {
|
|
|
102
102
|
]
|
|
103
103
|
}}).into('chart/values.yaml', { with: project })
|
|
104
104
|
|
|
105
|
-
|
|
105
|
+
await removeFromYAML(join('chart', 'values.yaml'), ['srv.expose', 'srv.networkSecurity'])
|
|
106
|
+
await copy(join(__dirname, 'files', `mtxs-configmap-${isJava ? 'java' : 'nodejs'}.yaml`)).to('chart', 'templates', 'mtxs-configmap.yaml') // REVISIT: Move to build task
|
|
106
107
|
await copy(join(__dirname, 'files', 'saas-registry-secret.yaml')).to('chart', 'templates', 'saas-registry-secret.yaml') // REVISIT: Move to build task
|
|
107
108
|
}
|
|
108
109
|
|