@sap/cds-dk 7.4.1 → 7.5.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/activate.js +1 -1
- package/bin/add.js +6 -4
- package/bin/build.js +4 -6
- package/bin/cds.js +4 -1
- package/bin/deploy/index.js +5 -2
- package/bin/eval.js +1 -1
- package/bin/extend.js +3 -3
- package/bin/login.js +2 -2
- package/bin/logout.js +1 -1
- package/bin/pull.js +1 -1
- package/bin/push.js +2 -2
- package/bin/subscribe.js +2 -2
- package/bin/unsubscribe.js +2 -2
- package/bin/upgrade.js +2 -2
- package/bin/version.js +2 -2
- package/bin/watch.js +1 -1
- package/lib/bind/bindingUtil.js +2 -1
- package/lib/bind/cfKeyProvider.js +1 -1
- package/lib/bind/userCdsrcJsonStorageProvider.js +1 -1
- package/lib/build/buildPlugin.js +6 -12
- package/lib/build/buildTaskEngine.js +24 -19
- package/lib/build/buildTaskFactory.js +27 -33
- package/lib/build/buildTaskProvider.js +1 -1
- package/lib/build/buildTaskProviderFactory.js +26 -41
- package/lib/build/constants.js +0 -1
- package/lib/build/index.js +3 -3
- package/lib/build/plugins.js +15 -15
- package/lib/build/provider/edmxBuildPlugin.js +6 -7
- package/lib/build/provider/fiori/index.js +8 -8
- package/lib/build/provider/hana/2migration.js +12 -16
- package/lib/build/provider/hana/index.js +5 -7
- package/lib/build/provider/hana/template/package.json +1 -1
- package/lib/build/provider/internalBuildPlugin.js +0 -8
- package/lib/build/provider/internalBuildTaskProvider.js +17 -21
- package/lib/build/provider/java/index.js +2 -1
- package/lib/build/provider/mtx-extension/index.js +3 -3
- package/lib/build/provider/mtx-sidecar/index.js +2 -1
- package/lib/build/provider/nodejs/index.js +6 -5
- package/lib/compile/openapi/csdl2openapi.js +29 -15
- package/lib/compile/openapi/index.js +6 -6
- package/lib/deploy/to-hana/hana.js +2 -2
- package/lib/env/schema.js +2 -3
- package/lib/index.js +68 -28
- package/lib/init/add.js +17 -0
- package/lib/init/constants.js +5 -3
- package/lib/init/index.js +39 -25
- package/lib/init/{util/merge.js → merge.js} +32 -20
- package/lib/init/{util/mvn.js → mvn.js} +5 -5
- package/lib/init/plugin.js +85 -0
- package/lib/init/projectReader.js +145 -0
- package/lib/init/registries/mta.js +151 -0
- package/lib/init/template/{kibana → application-logging}/files/mta.yaml.hbs +3 -3
- package/lib/init/template/application-logging/index.js +49 -0
- package/lib/init/template/approuter/files/mta.yaml.hbs +11 -11
- package/lib/init/template/approuter/files/xs-app.json.hbs +2 -2
- package/lib/init/template/approuter/index.js +36 -81
- package/lib/init/template/cf-manifest/files/manifest.yml.hbs +3 -3
- package/lib/init/template/cf-manifest/files/services-manifest.yml.hbs +4 -4
- package/lib/init/template/cf-manifest/index.js +4 -4
- package/lib/init/template/connectivity/index.js +22 -35
- package/lib/init/template/data/index.js +3 -2
- package/lib/init/template/destination/files/values.yaml +9 -0
- package/lib/init/template/destination/index.js +15 -47
- package/lib/init/template/enterprise-messaging/index.js +26 -58
- package/lib/init/template/enterprise-messaging-shared/index.js +23 -39
- package/lib/init/template/extensibility/index.js +16 -30
- package/lib/init/template/file-based-messaging/index.js +7 -8
- package/lib/init/template/h2/index.js +4 -4
- package/lib/init/template/hana/files/mta.yaml.hbs +8 -8
- package/lib/init/template/hana/index.js +29 -115
- package/lib/init/template/helm/files/chart/templates/NOTES.txt +12 -0
- package/lib/init/template/helm/files/chart/templates/_deployment_helpers.tpl +82 -0
- package/lib/init/template/helm/files/chart/templates/_helpers.tpl +28 -0
- package/lib/init/template/helm/files/chart/values.root.schema.json +61 -0
- package/lib/init/template/helm/files/chart/values.schema.json +366 -0
- package/lib/init/template/helm/{subcharts → files}/web-application/Chart.yaml +1 -1
- package/lib/init/template/helm/{subcharts → files}/web-application/templates/_api.tpl +1 -1
- package/lib/init/template/helm/{subcharts → files}/web-application/values.yaml +1 -1
- package/lib/init/template/helm/index.js +84 -85
- package/lib/init/template/helm-unified-runtime/files/Chart.yaml.hbs +10 -0
- package/lib/init/template/helm-unified-runtime/files/values.yaml.hbs +26 -0
- package/lib/init/template/helm-unified-runtime/index.js +91 -0
- package/lib/init/template/helm-unified-runtime/lib/build.js +0 -0
- package/lib/init/template/helm-unified-runtime/package.json +4 -0
- package/lib/init/template/html5-repo/files/values.yaml.hbs +28 -0
- package/lib/init/template/html5-repo/index.js +23 -97
- package/lib/init/template/java/index.js +3 -3
- package/lib/init/template/lint/index.js +2 -2
- package/lib/init/template/liquibase/index.js +16 -0
- package/lib/init/template/local-messaging/index.js +7 -8
- package/lib/init/template/mta/index.js +7 -19
- package/lib/init/template/mtx/index.js +2 -2
- package/lib/init/template/multitenancy/index.js +38 -89
- package/lib/init/template/nodejs/index.js +5 -4
- package/lib/init/template/notebook/index.js +1 -1
- package/lib/init/template/notifications/index.js +16 -19
- package/lib/init/template/pipeline/index.js +1 -1
- package/lib/init/template/postgres/index.js +25 -31
- package/lib/init/template/redis-messaging/index.js +23 -27
- package/lib/init/template/sample/index.js +4 -4
- package/lib/init/template/samples/index.js +2 -2
- package/lib/init/template/sqlite/files/{package.json.hbs → package.json} +0 -2
- package/lib/init/template/sqlite/index.js +6 -10
- package/lib/init/template/tiny-sample/index.js +6 -6
- package/lib/init/template/toggles/index.js +7 -8
- package/lib/init/template/typer/index.js +6 -6
- package/lib/init/template/xsuaa/files/mta.yaml.hbs +3 -3
- package/lib/init/template/xsuaa/files/values.yaml.hbs +3 -3
- package/lib/init/template/xsuaa/index.js +27 -52
- package/lib/init/{util/template.js → template.js} +1 -1
- package/lib/{client → mtx}/activate.js +15 -11
- package/lib/{client → mtx}/auth_manager.js +5 -4
- package/lib/{client → mtx}/download_legacy.js +6 -4
- package/lib/{client → mtx}/extend.js +14 -9
- package/lib/{client → mtx}/index.js +1 -1
- package/lib/{client → mtx}/params.js +3 -1
- package/lib/{client → mtx}/pull.js +6 -4
- package/lib/{client → mtx}/push.js +10 -9
- package/lib/{client → mtx}/settings_manager.js +8 -6
- package/lib/{client → mtx}/tenant_action.js +9 -8
- package/lib/{client/helper/cf_helper.js → mtx/util/cf.js} +4 -3
- package/lib/{client/helper/dependency_helper.js → mtx/util/dependencies.js} +1 -0
- package/lib/mtx/util/errors.js +27 -0
- package/lib/mtx/util/legacy_ext.js +16 -0
- package/lib/{client/helper/url_helper.js → mtx/util/urls.js} +12 -1
- package/lib/util/fs.js +5 -1
- package/lib/util/pruneAxiosErrors.js +35 -18
- package/lib/util/write.js +1 -1
- package/npm-shrinkwrap.json +310 -270
- package/package.json +1 -1
- package/lib/client/base_command.js +0 -54
- package/lib/init/template/_merging/registry-mta.js +0 -304
- package/lib/init/template/helm/Model.d.ts +0 -53
- package/lib/init/template/kibana/files/package.json.hbs +0 -17
- package/lib/init/template/kibana/index.js +0 -54
- package/lib/init/template/templateBase.js +0 -100
- package/lib/init/util/md5.js +0 -86
- package/lib/init/util/projectReader.js +0 -94
- /package/lib/init/{util/indent.js → indent.js} +0 -0
- /package/lib/init/template/helm/{subcharts → files}/content-deployment/Chart.yaml +0 -0
- /package/lib/init/template/helm/{subcharts → files}/content-deployment/templates/_helpers.tpl +0 -0
- /package/lib/init/template/helm/{subcharts → files}/content-deployment/templates/job.yaml +0 -0
- /package/lib/init/template/helm/{subcharts → files}/content-deployment/templates/secret.yaml +0 -0
- /package/lib/init/template/helm/{subcharts → files}/content-deployment/templates/service-account.yaml +0 -0
- /package/lib/init/template/helm/{subcharts → files}/content-deployment/templates/service-binding.yaml +0 -0
- /package/lib/init/template/helm/{subcharts → files}/content-deployment/values.schema.json +0 -0
- /package/lib/init/template/helm/{subcharts → files}/content-deployment/values.yaml +0 -0
- /package/lib/init/template/helm/{subcharts → files}/service-instance/Chart.yaml +0 -0
- /package/lib/init/template/helm/{subcharts → files}/service-instance/templates/_helpers.tpl +0 -0
- /package/lib/init/template/helm/{subcharts → files}/service-instance/templates/serviceinstance.yaml +0 -0
- /package/lib/init/template/helm/{subcharts → files}/service-instance/values.schema.json +0 -0
- /package/lib/init/template/helm/{subcharts → files}/service-instance/values.yaml +0 -0
- /package/lib/init/template/helm/{subcharts → files}/web-application/templates/NOTES.txt +0 -0
- /package/lib/init/template/helm/{subcharts → files}/web-application/templates/_helpers.tpl +0 -0
- /package/lib/init/template/helm/{subcharts → files}/web-application/templates/api-rule.yaml +0 -0
- /package/lib/init/template/helm/{subcharts → files}/web-application/templates/deployment.yaml +0 -0
- /package/lib/init/template/helm/{subcharts → files}/web-application/templates/network-policy.yaml +0 -0
- /package/lib/init/template/helm/{subcharts → files}/web-application/templates/pod-disruption-budget.yaml +0 -0
- /package/lib/init/template/helm/{subcharts → files}/web-application/templates/rbac.yaml +0 -0
- /package/lib/init/template/helm/{subcharts → files}/web-application/templates/secret.yaml +0 -0
- /package/lib/init/template/helm/{subcharts → files}/web-application/templates/service-account.yaml +0 -0
- /package/lib/init/template/helm/{subcharts → files}/web-application/templates/service-binding.yaml +0 -0
- /package/lib/init/template/helm/{subcharts → files}/web-application/templates/service.yaml +0 -0
- /package/lib/init/template/helm/{subcharts → files}/web-application/templates/virtual-service.yaml +0 -0
- /package/lib/init/template/helm/{subcharts → files}/web-application/values.schema.json +0 -0
- /package/lib/init/template/{helm/chart → helm-unified-runtime/files}/templates/NOTES.txt +0 -0
- /package/lib/init/template/{helm/chart → helm-unified-runtime/files}/templates/_deployment_helpers.tpl +0 -0
- /package/lib/init/template/{helm/chart → helm-unified-runtime/files}/templates/_helpers.tpl +0 -0
- /package/lib/init/template/{helm/chart → helm-unified-runtime/files}/values.root.schema.json +0 -0
- /package/lib/init/template/{helm/chart → helm-unified-runtime/files}/values.schema.json +0 -0
- /package/lib/init/template/postgres/files/{mta.yaml.hbs → mta.yml.hbs} +0 -0
- /package/lib/init/{util/xml.js → xml.js} +0 -0
- /package/lib/{client/helper/env_helper.js → mtx/util/env.js} +0 -0
- /package/lib/{client/helper/fs_helper.js → mtx/util/fs.js} +0 -0
- /package/lib/{client/helper → mtx/util}/logging.js +0 -0
- /package/lib/{client/helper → mtx/util}/question.js +0 -0
- /package/lib/{client/helper/string_helper.js → mtx/util/strings.js} +0 -0
- /package/lib/util/{cfUtil.js → cf.js} +0 -0
- /package/lib/util/{gitUtil.js → git.js} +0 -0
|
@@ -1,63 +1,47 @@
|
|
|
1
|
-
const { join } = require('path')
|
|
2
1
|
const cds = require('../../../cds')
|
|
3
2
|
const { read } = cds.utils
|
|
4
|
-
const { readProject } = require('../../
|
|
5
|
-
const {
|
|
6
|
-
const {
|
|
7
|
-
const { srvNode4, srvJava4, enterpriseMessaging } = require('../_merging/registry-mta')
|
|
3
|
+
const { readProject } = require('../../projectReader')
|
|
4
|
+
const { merge } = require('../../merge')
|
|
5
|
+
const { srv4, enterpriseMessaging } = require('../../registries/mta')
|
|
8
6
|
|
|
9
|
-
module.exports = class EnterpriseMessagingSharedTemplate extends require('
|
|
7
|
+
module.exports = class EnterpriseMessagingSharedTemplate extends require('../../plugin') {
|
|
10
8
|
|
|
11
9
|
async canRun() {
|
|
12
|
-
const { isJava } =
|
|
10
|
+
const { isJava } = readProject()
|
|
13
11
|
if (isJava) throw `'cds add enterprise-messaging-shared' is not available for Java yet`
|
|
14
12
|
return true
|
|
15
13
|
}
|
|
16
14
|
|
|
17
|
-
static
|
|
15
|
+
static hasInProduction(env) {
|
|
18
16
|
return env.requires?.messaging?.kind === 'enterprise-messaging-amqp'
|
|
19
17
|
}
|
|
20
18
|
|
|
21
19
|
async run() {
|
|
22
|
-
const project =
|
|
20
|
+
const project = readProject()
|
|
23
21
|
const { configFile } = project
|
|
24
22
|
project.shortcut = !(await read(configFile)).cds?.requires?.messaging?.kind
|
|
25
|
-
await
|
|
26
|
-
await
|
|
23
|
+
await merge(__dirname, 'files/package.json.hbs').into(configFile, { project })
|
|
24
|
+
await merge(__dirname, 'files/event-mesh.json.hbs').into('event-mesh.json', { project })
|
|
27
25
|
}
|
|
28
26
|
|
|
29
|
-
async
|
|
30
|
-
const project =
|
|
31
|
-
const { hasMta, hasHelm,
|
|
27
|
+
async combine() {
|
|
28
|
+
const project = readProject()
|
|
29
|
+
const { hasMta, hasHelm, hasHelmUnifiedRuntime, srvPath } = project
|
|
32
30
|
|
|
33
31
|
if (hasMta) {
|
|
34
|
-
const srv = (
|
|
35
|
-
await
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
into: [srv, 'requires', 'name']
|
|
44
|
-
}]
|
|
45
|
-
}
|
|
46
|
-
)
|
|
32
|
+
const srv = srv4(srvPath)
|
|
33
|
+
await merge(__dirname, 'files', 'mta.yaml.hbs').into('mta.yaml', {
|
|
34
|
+
project,
|
|
35
|
+
additions: [srv, enterpriseMessaging],
|
|
36
|
+
relationships: [{
|
|
37
|
+
insert: [enterpriseMessaging, 'name'],
|
|
38
|
+
into: [srv, 'requires', 'name']
|
|
39
|
+
}]
|
|
40
|
+
})
|
|
47
41
|
}
|
|
48
42
|
|
|
49
|
-
if (hasHelm) {
|
|
50
|
-
|
|
51
|
-
if (Object.keys(context).length == 0){
|
|
52
|
-
isIndependentCommand = true
|
|
53
|
-
context.oldTrackingData = context.newTrackingData = await parseMd5File(join('chart', '.cds-add-helm-files.md5'))
|
|
54
|
-
}
|
|
55
|
-
await mergeYAML(join('chart', 'values.yaml'), join(__dirname, 'files', 'values.yaml'))
|
|
56
|
-
const HelmTemplate = require(`../helm`);
|
|
57
|
-
const helmTemplate = new HelmTemplate(context.oldTrackingData, context.newTrackingData);
|
|
58
|
-
isIndependentCommand = isIndependentCommand | await helmTemplate.addSubChart('service-instance');
|
|
59
|
-
await helmTemplate.addDependency('service-instance', 'event-mesh');
|
|
60
|
-
if (isIndependentCommand) await writeMd5File(join('chart', '.cds-add-helm-files.md5'), context.newTrackingData)
|
|
43
|
+
if (hasHelm || hasHelmUnifiedRuntime) {
|
|
44
|
+
await merge(__dirname, 'files/values.yaml').into('chart/values.yaml')
|
|
61
45
|
}
|
|
62
46
|
}
|
|
63
47
|
}
|
|
@@ -1,52 +1,38 @@
|
|
|
1
1
|
const cds = require('../../../cds')
|
|
2
2
|
const { exists } = cds.utils
|
|
3
|
-
const {
|
|
4
|
-
const {
|
|
5
|
-
const { mergeJSON } = require('../../util/merge')
|
|
3
|
+
const { readProject } = require('../../projectReader')
|
|
4
|
+
const { merge } = require('../../merge')
|
|
6
5
|
const { MULTITENANCY } = require('../../constants').OPTIONS
|
|
7
6
|
|
|
8
|
-
module.exports = class ExtensibilityTemplate extends require('
|
|
7
|
+
module.exports = class ExtensibilityTemplate extends require('../../plugin') {
|
|
9
8
|
|
|
10
9
|
|
|
11
|
-
|
|
10
|
+
requires() {
|
|
12
11
|
return exists('pom.xml') ? [MULTITENANCY] : [] // REVISIT: Remove this dependency
|
|
13
12
|
}
|
|
14
13
|
|
|
15
|
-
|
|
16
|
-
return ['approuter']
|
|
17
|
-
}
|
|
18
|
-
|
|
19
|
-
static hasFacet(env) {
|
|
14
|
+
static hasInProduction(env) {
|
|
20
15
|
return !!env.requires?.extensibility
|
|
21
16
|
}
|
|
22
17
|
|
|
23
18
|
async run() {
|
|
24
|
-
const project =
|
|
19
|
+
const project = readProject()
|
|
25
20
|
const { configFile } = project
|
|
26
|
-
await
|
|
21
|
+
await merge(__dirname, 'files/package.json.hbs').into(configFile, { project })
|
|
27
22
|
}
|
|
28
23
|
|
|
29
|
-
async
|
|
30
|
-
const project =
|
|
24
|
+
async combine() {
|
|
25
|
+
const project = readProject()
|
|
31
26
|
const { hasXsuaa } = project
|
|
32
27
|
if (hasXsuaa) {
|
|
33
|
-
await
|
|
34
|
-
'xs-security.json',
|
|
35
|
-
join(__dirname, 'files', 'xs-security.json.hbs'),
|
|
28
|
+
await merge(__dirname, 'files', 'xs-security.json.hbs').into('xs-security.json', {
|
|
36
29
|
project,
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
where: [{ property: 'name', isEqualTo: '$XSAPPNAME.cds.UIFlexDeveloper' }],
|
|
44
|
-
}, {
|
|
45
|
-
in: 'role-templates',
|
|
46
|
-
where: [{ property: 'name', isEqualTo: 'ExtensionDeveloper' }],
|
|
47
|
-
}]
|
|
48
|
-
}
|
|
49
|
-
)
|
|
30
|
+
additions: [
|
|
31
|
+
{ in: 'scopes', where: { name: '$XSAPPNAME.cds.ExtensionDeveloper' }},
|
|
32
|
+
{ in: 'scopes', where: { name: '$XSAPPNAME.cds.UIFlexDeveloper' }},
|
|
33
|
+
{ in: 'role-templates', where: { name: 'ExtensionDeveloper' }}
|
|
34
|
+
]
|
|
35
|
+
})
|
|
50
36
|
}
|
|
51
37
|
}
|
|
52
38
|
}
|
|
@@ -1,24 +1,23 @@
|
|
|
1
|
-
const { join } = require('path')
|
|
2
1
|
const cds = require('../../../cds'), { read } = cds.utils
|
|
3
|
-
const { readProject } = require('../../
|
|
4
|
-
const {
|
|
2
|
+
const { readProject } = require('../../projectReader')
|
|
3
|
+
const { merge } = require('../../merge')
|
|
5
4
|
|
|
6
|
-
module.exports = class FileBasedMessagingTemplate extends require('
|
|
5
|
+
module.exports = class FileBasedMessagingTemplate extends require('../../plugin') {
|
|
7
6
|
|
|
8
7
|
async canRun() {
|
|
9
|
-
const { isJava } =
|
|
8
|
+
const { isJava } = readProject()
|
|
10
9
|
if (isJava) throw `'cds add file-based-messaging' is not available for Java yet`
|
|
11
10
|
return true
|
|
12
11
|
}
|
|
13
12
|
|
|
14
|
-
static
|
|
13
|
+
static hasInProduction(env) {
|
|
15
14
|
return env.requires?.messaging?.kind === 'file-based-messaging'
|
|
16
15
|
}
|
|
17
16
|
|
|
18
17
|
async run() {
|
|
19
|
-
const project =
|
|
18
|
+
const project = readProject()
|
|
20
19
|
const { configFile } = project
|
|
21
20
|
project.shortcut = !(await read(configFile)).cds?.requires?.messaging?.kind
|
|
22
|
-
await
|
|
21
|
+
await merge(__dirname, 'files/package.json.hbs').into(configFile, { with: project })
|
|
23
22
|
}
|
|
24
23
|
}
|
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
const mvn = require('../../
|
|
2
|
-
const { readProject } = require('../../
|
|
1
|
+
const mvn = require('../../mvn')
|
|
2
|
+
const { readProject } = require('../../projectReader')
|
|
3
3
|
const { H2 } = require('../../constants').OPTIONS
|
|
4
4
|
|
|
5
|
-
module.exports = class H2Template extends require('
|
|
5
|
+
module.exports = class H2Template extends require('../../plugin') {
|
|
6
6
|
|
|
7
7
|
async canRun() {
|
|
8
|
-
const { isNodejs } =
|
|
8
|
+
const { isNodejs } = readProject()
|
|
9
9
|
if (isNodejs) throw `'cds add ${H2}' is not available for Node.js`
|
|
10
10
|
return true
|
|
11
11
|
}
|
|
@@ -6,7 +6,7 @@ modules:
|
|
|
6
6
|
requires:
|
|
7
7
|
- name: {{appName}}-db
|
|
8
8
|
|
|
9
|
-
{{^
|
|
9
|
+
{{^hasMultitenancy}}
|
|
10
10
|
- name: {{appName}}-db-deployer
|
|
11
11
|
type: hdb
|
|
12
12
|
path: {{& db.path}}
|
|
@@ -20,27 +20,27 @@ modules:
|
|
|
20
20
|
{{/isJava}}
|
|
21
21
|
requires:
|
|
22
22
|
- name: {{appName}}-db
|
|
23
|
-
{{/
|
|
23
|
+
{{/hasMultitenancy}}
|
|
24
24
|
|
|
25
|
-
{{#
|
|
25
|
+
{{#hasMultitenancy}}
|
|
26
26
|
- name: {{appName}}-mtx
|
|
27
27
|
type: nodejs
|
|
28
28
|
path: {{#isNodejs}}gen/{{/isNodejs}}mtx/sidecar
|
|
29
29
|
requires:
|
|
30
30
|
- name: {{appName}}-db
|
|
31
|
-
{{/
|
|
31
|
+
{{/hasMultitenancy}}
|
|
32
32
|
|
|
33
33
|
resources:
|
|
34
34
|
- name: {{appName}}-db
|
|
35
|
-
{{^
|
|
35
|
+
{{^hasMultitenancy}}
|
|
36
36
|
type: com.sap.xs.hdi-container
|
|
37
37
|
parameters:
|
|
38
38
|
service: hana
|
|
39
39
|
service-plan: hdi-shared
|
|
40
|
-
{{/
|
|
41
|
-
{{#
|
|
40
|
+
{{/hasMultitenancy}}
|
|
41
|
+
{{#hasMultitenancy}}
|
|
42
42
|
type: org.cloudfoundry.managed-service
|
|
43
43
|
parameters:
|
|
44
44
|
service: service-manager
|
|
45
45
|
service-plan: container
|
|
46
|
-
{{/
|
|
46
|
+
{{/hasMultitenancy}}
|
|
@@ -1,35 +1,28 @@
|
|
|
1
1
|
const { join } = require('path')
|
|
2
2
|
const cds = require('../../../cds')
|
|
3
|
-
const { read, write, exists,
|
|
4
|
-
const { readProject } = require('../../
|
|
5
|
-
const {
|
|
6
|
-
const mvn = require('../../
|
|
7
|
-
const { parseMd5File, writeMd5File } = require('../../util/md5')
|
|
3
|
+
const { read, write, exists, copy, rimraf } = cds.utils
|
|
4
|
+
const { readProject } = require('../../projectReader')
|
|
5
|
+
const { merge, removeFromYAML, removeFromYAMLArray } = require('../../merge')
|
|
6
|
+
const mvn = require('../../mvn')
|
|
8
7
|
|
|
9
8
|
const { OPTIONS: { JAVA } } = require('../../constants')
|
|
10
9
|
|
|
11
|
-
const {
|
|
10
|
+
const { srv4, hdbDeployer, serviceManager, hdiContainer, mtxSidecar4 } = require('../../registries/mta')
|
|
12
11
|
|
|
13
|
-
module.exports = class HanaTemplate extends require('
|
|
12
|
+
module.exports = class HanaTemplate extends require('../../plugin') {
|
|
14
13
|
|
|
15
|
-
static
|
|
14
|
+
static hasInProduction(env) {
|
|
16
15
|
return env.requires?.db?.kind === 'hana'
|
|
17
16
|
}
|
|
18
17
|
|
|
19
18
|
async run() {
|
|
20
|
-
const project =
|
|
19
|
+
const project = readProject()
|
|
21
20
|
const { isJava, configFile, db } = project
|
|
22
21
|
project.shortcut = !(await read(configFile)).cds?.requires?.db?.kind
|
|
23
22
|
|
|
24
|
-
// REVISIT: Let cds build generate by default
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
await mergeJSON(hdiConfigPath, hdiConfigTemplatePath)
|
|
28
|
-
|
|
29
|
-
// REVISIT: Let csd build generate by default
|
|
30
|
-
const undeployJSONPath = join(db.folder, 'undeploy.json')
|
|
31
|
-
const undeployJSONTemplatePath = join(__dirname, 'files', 'undeploy.json')
|
|
32
|
-
await mergeJSON(undeployJSONPath, undeployJSONTemplatePath)
|
|
23
|
+
// REVISIT: Let cds build generate those by default
|
|
24
|
+
await merge(__dirname, 'files/src/.hdiconfig').into(join(db.folder, 'src/.hdiconfig'))
|
|
25
|
+
await merge(__dirname, 'files/undeploy.json').into(join(db.folder, 'undeploy.json'))
|
|
33
26
|
|
|
34
27
|
if (isJava) {
|
|
35
28
|
await copy(join(__dirname, 'files', 'db')).to(db.folder)
|
|
@@ -38,7 +31,7 @@ module.exports = class HanaTemplate extends require('../templateBase') {
|
|
|
38
31
|
if (!cds.cli.options.add.has(JAVA)) await mvn.execMvn(mvn.getAddHanaCmdArgs())
|
|
39
32
|
}
|
|
40
33
|
|
|
41
|
-
await
|
|
34
|
+
await merge(__dirname, 'files/package.json.hbs').into(configFile, { with: project, forceOverwrite: true }) // REVISIT: forceOverwrite: true as default?
|
|
42
35
|
|
|
43
36
|
const packageJson = exists('package.json') ? await read('package.json') : null
|
|
44
37
|
if (packageJson?.dependencies) {
|
|
@@ -47,14 +40,14 @@ module.exports = class HanaTemplate extends require('../templateBase') {
|
|
|
47
40
|
}
|
|
48
41
|
}
|
|
49
42
|
|
|
50
|
-
async
|
|
51
|
-
const project =
|
|
52
|
-
const { hasMta, hasHelm, hasHtml5Repo, isJava,
|
|
43
|
+
async combine() {
|
|
44
|
+
const project = readProject()
|
|
45
|
+
const { hasMta, hasHelm, hasHelmUnifiedRuntime, hasHtml5Repo, isJava, hasMultitenancy, srvPath } = project
|
|
53
46
|
|
|
54
47
|
if (hasMta) {
|
|
55
|
-
const srv = (
|
|
56
|
-
const db =
|
|
57
|
-
const deletions =
|
|
48
|
+
const srv = srv4(srvPath)
|
|
49
|
+
const db = hasMultitenancy ? serviceManager : hdiContainer
|
|
50
|
+
const deletions = hasMultitenancy ? [{
|
|
58
51
|
item: hdbDeployer,
|
|
59
52
|
relationships: [{
|
|
60
53
|
removeProperty: 'name',
|
|
@@ -73,7 +66,7 @@ module.exports = class HanaTemplate extends require('../templateBase') {
|
|
|
73
66
|
into: [srv, 'requires', 'name']
|
|
74
67
|
}]
|
|
75
68
|
|
|
76
|
-
if (
|
|
69
|
+
if (hasMultitenancy) {
|
|
77
70
|
relationships.push({
|
|
78
71
|
insert: [serviceManager, 'name'],
|
|
79
72
|
into: [mtxSidecar4(isJava ? 'mtx/sidecar' : 'gen/mtx/sidecar'), 'requires', 'name']
|
|
@@ -85,104 +78,25 @@ module.exports = class HanaTemplate extends require('../templateBase') {
|
|
|
85
78
|
})
|
|
86
79
|
}
|
|
87
80
|
|
|
88
|
-
const modules =
|
|
81
|
+
const modules = hasMultitenancy ? [srv] : [srv, hdbDeployer]
|
|
89
82
|
|
|
90
|
-
await
|
|
83
|
+
await merge(__dirname, 'files/mta.yaml.hbs').into('mta.yaml', { with: project,
|
|
91
84
|
additions: [...modules, db].filter(a => a), deletions, relationships
|
|
92
85
|
})
|
|
93
86
|
}
|
|
94
87
|
|
|
95
|
-
if (hasHelm) {
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
context.oldTrackingData = context.newTrackingData = await parseMd5File(join('chart', '.cds-add-helm-files.md5'));
|
|
101
|
-
}
|
|
102
|
-
|
|
103
|
-
const HelmTemplate = require(`../helm`);
|
|
104
|
-
const helmTemplate = new HelmTemplate(context.oldTrackingData, context.newTrackingData);
|
|
105
|
-
|
|
106
|
-
if(isMultitenant){
|
|
107
|
-
shouldUpdateTrackingFile = true;
|
|
108
|
-
|
|
109
|
-
// remove hana entries from values.yaml
|
|
110
|
-
await removeFromYAML(join('chart', 'values.yaml'), ['hana-deployer', 'srv.bindings.db', 'hana']);
|
|
88
|
+
if (hasHelm || hasHelmUnifiedRuntime) {
|
|
89
|
+
if (hasMultitenancy) {
|
|
90
|
+
await removeFromYAML(join('chart', 'values.yaml'), ['hana-deployer', 'srv.bindings.db', 'hana'])
|
|
91
|
+
await removeFromYAMLArray(join('chart', 'Chart.yaml'), 'dependencies', 'hana')
|
|
92
|
+
await removeFromYAMLArray(join('chart', 'Chart.yaml'), 'dependencies', 'hana-deployer')
|
|
111
93
|
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
// remove content-deployment subchart if html5Repo doesn't exist
|
|
116
|
-
if(!hasHtml5Repo) {
|
|
117
|
-
const contentDeploymentEntriesPattern = "charts/content-deployment/"
|
|
118
|
-
this.removeEntriesFromContext(context, contentDeploymentEntriesPattern);
|
|
119
|
-
|
|
120
|
-
const contentDeploymentSubchartPath = join('chart', 'charts', 'content-deployment');
|
|
121
|
-
if(exists(contentDeploymentSubchartPath)) {
|
|
122
|
-
await rmdir(contentDeploymentSubchartPath);
|
|
123
|
-
}
|
|
94
|
+
if (!hasHtml5Repo) {
|
|
95
|
+
await rimraf('chart/charts/content-deployment') // REVISIT: Move to build task
|
|
124
96
|
}
|
|
125
|
-
|
|
126
|
-
//remove dependency since mtx plugin is added
|
|
127
|
-
const isInternal = await helmTemplate.isInternal();
|
|
128
|
-
await mergeYAML(
|
|
129
|
-
join('chart', 'Chart.yaml'),
|
|
130
|
-
{
|
|
131
|
-
dependencies: [
|
|
132
|
-
{
|
|
133
|
-
name: 'service-instance',
|
|
134
|
-
alias: 'hana',
|
|
135
|
-
version: '>0.0.0',
|
|
136
|
-
...(isInternal) && { repository: 'https://int.repositories.cloud.sap/artifactory/virtual-unified-runtime-helm-dmz' }
|
|
137
|
-
}
|
|
138
|
-
]
|
|
139
|
-
},
|
|
140
|
-
project,
|
|
141
|
-
{ deletions: [{
|
|
142
|
-
item: {
|
|
143
|
-
in: `dependencies`,
|
|
144
|
-
where: [{
|
|
145
|
-
property: 'alias',
|
|
146
|
-
isEqualTo: 'hana'
|
|
147
|
-
}]
|
|
148
|
-
}
|
|
149
|
-
}]}
|
|
150
|
-
)
|
|
151
97
|
} else {
|
|
152
|
-
await
|
|
153
|
-
join('chart', 'values.yaml'),
|
|
154
|
-
join(__dirname, 'files', 'values.yaml.hbs'),
|
|
155
|
-
project
|
|
156
|
-
)
|
|
157
|
-
|
|
158
|
-
// copy content deployment chart if it is not present
|
|
159
|
-
shouldUpdateTrackingFile = shouldUpdateTrackingFile | await helmTemplate.addSubChart('content-deployment');
|
|
160
|
-
|
|
161
|
-
// add dependency entry in chart.yaml
|
|
162
|
-
await helmTemplate.addDependency('content-deployment', 'hana-deployer');
|
|
163
|
-
|
|
164
|
-
// add service instance chart if it is not present
|
|
165
|
-
shouldUpdateTrackingFile = shouldUpdateTrackingFile | await helmTemplate.addSubChart('service-instance');
|
|
166
|
-
|
|
167
|
-
// add dependency entry in chart.yaml
|
|
168
|
-
await helmTemplate.addDependency('service-instance', 'hana');
|
|
98
|
+
await merge(__dirname, 'files', 'values.yaml.hbs').into('chart/values.yaml', { with: project })
|
|
169
99
|
}
|
|
170
|
-
if(shouldUpdateTrackingFile) await writeMd5File(join('chart', '.cds-add-helm-files.md5'), context.newTrackingData);
|
|
171
100
|
}
|
|
172
101
|
}
|
|
173
|
-
|
|
174
|
-
// REVISIT: tracking data massaging is getting too much -> revisit md5 tracking
|
|
175
|
-
removeEntriesFromContext(context, key) {
|
|
176
|
-
Object.keys(context.oldTrackingData).forEach(fileName => {
|
|
177
|
-
if (fileName.startsWith(key)) {
|
|
178
|
-
delete context.oldTrackingData[fileName]
|
|
179
|
-
}
|
|
180
|
-
})
|
|
181
|
-
|
|
182
|
-
Object.keys(context.newTrackingData).forEach(fileName => {
|
|
183
|
-
if (fileName.startsWith(key)) {
|
|
184
|
-
delete context.newTrackingData[fileName]
|
|
185
|
-
}
|
|
186
|
-
})
|
|
187
|
-
}
|
|
188
102
|
}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
{{- printf "Thank you for installing %s version %s." .Chart.Name .Chart.Version }}
|
|
2
|
+
|
|
3
|
+
{{ printf "The release %s is installed in namespace %s." .Release.Name .Release.Namespace }}
|
|
4
|
+
|
|
5
|
+
Your services are available at:
|
|
6
|
+
{{- $root := . }}
|
|
7
|
+
{{- range $name := include "cap.deploymentNames" . | split ";" }}
|
|
8
|
+
{{- $deployment := (get $root.Values $name) }}
|
|
9
|
+
{{- $ := merge (dict "name" $name "deployment" $deployment) $root }}
|
|
10
|
+
{{- $url := include "cap.deploymentHostFull" $ }}
|
|
11
|
+
{{ printf "%s - https://%s" $name $url }}
|
|
12
|
+
{{- end }}
|
|
@@ -0,0 +1,82 @@
|
|
|
1
|
+
{{/*
|
|
2
|
+
Get list of deployment names
|
|
3
|
+
*/}}
|
|
4
|
+
{{- define "cap.deploymentNames" -}}
|
|
5
|
+
{{- $ := . -}}
|
|
6
|
+
{{- $defaultDeployments := (list "srv") -}}
|
|
7
|
+
{{- if $.Values.sidecar -}}
|
|
8
|
+
{{- $defaultDeployments = (append $defaultDeployments "sidecar") -}}
|
|
9
|
+
{{- end -}}
|
|
10
|
+
{{- if $.Values.approuter -}}
|
|
11
|
+
{{- $defaultDeployments = (append $defaultDeployments "approuter") -}}
|
|
12
|
+
{{- end -}}
|
|
13
|
+
{{ .deploymentNames | default $defaultDeployments | join ";" }}
|
|
14
|
+
{{- end -}}
|
|
15
|
+
|
|
16
|
+
{{/*
|
|
17
|
+
Create a default fully qualified app name.
|
|
18
|
+
We truncate at 63 chars because some Kubernetes name fields are limited to this (by the DNS naming spec).
|
|
19
|
+
If release name contains chart name it will be used as a full name.
|
|
20
|
+
|
|
21
|
+
copied from web-application: web-application.fullname
|
|
22
|
+
|
|
23
|
+
*/}}
|
|
24
|
+
{{- define "cap.deploymentHost" -}}
|
|
25
|
+
{{- if .deployment.expose.host }}
|
|
26
|
+
{{- .deployment.expose.host }}
|
|
27
|
+
{{- else }}
|
|
28
|
+
{{- $name := (include "cap.web-application.fullname" .) }}
|
|
29
|
+
{{- if hasPrefix $name .Release.Namespace }}
|
|
30
|
+
{{- .Release.Namespace }}
|
|
31
|
+
{{- else }}
|
|
32
|
+
{{- printf "%s-%s" $name .Release.Namespace | trunc 63 | trimSuffix "-" }}
|
|
33
|
+
{{- end }}
|
|
34
|
+
{{- end }}
|
|
35
|
+
{{- end }}
|
|
36
|
+
|
|
37
|
+
{{- define "cap.web-application.fullname" -}}
|
|
38
|
+
{{- if .deployment.fullnameOverride }}
|
|
39
|
+
{{- .deployment.fullnameOverride | trunc 63 | trimSuffix "-" }}
|
|
40
|
+
{{- else }}
|
|
41
|
+
{{- $name := default .name .deployment.nameOverride }}
|
|
42
|
+
{{- if contains $name .Release.Name }}
|
|
43
|
+
{{- .Release.Name | trunc 63 | trimSuffix "-" }}
|
|
44
|
+
{{- else }}
|
|
45
|
+
{{- printf "%s-%s" .Release.Name $name | trunc 63 | trimSuffix "-" }}
|
|
46
|
+
{{- end }}
|
|
47
|
+
{{- end }}
|
|
48
|
+
{{- end }}
|
|
49
|
+
|
|
50
|
+
{{/*
|
|
51
|
+
Get FQDN of a deployment
|
|
52
|
+
*/}}
|
|
53
|
+
{{- define "cap.deploymentHostFull" -}}
|
|
54
|
+
{{ include "cap.deploymentHost" $ }}.{{ $.Values.global.domain }}
|
|
55
|
+
{{- end -}}
|
|
56
|
+
|
|
57
|
+
{{/*
|
|
58
|
+
Backend Destinations
|
|
59
|
+
*/}}
|
|
60
|
+
{{- define "cap.backendDestinations" -}}
|
|
61
|
+
{{- $ := . -}}
|
|
62
|
+
{{- $root := $.root -}}
|
|
63
|
+
{{- $nameKey := "name" -}}
|
|
64
|
+
{{- $urlKey := "url" -}}
|
|
65
|
+
{{- if $root.Values.backendDestinations }}
|
|
66
|
+
{{- $destinations := list -}}
|
|
67
|
+
{{- if $.html5 }}
|
|
68
|
+
{{- $nameKey = "Name" -}}
|
|
69
|
+
{{- $urlKey = "URL" -}}
|
|
70
|
+
{{- end -}}
|
|
71
|
+
{{- range $destinationName, $destination := $root.Values.backendDestinations -}}
|
|
72
|
+
{{- $destination := merge (dict "name" $destinationName) $destination -}}
|
|
73
|
+
{{- $deployment := (get $root.Values $destination.service) -}}
|
|
74
|
+
{{- $srv := merge (dict "name" $destination.service "destination" $destination "deployment" $deployment) $root -}}
|
|
75
|
+
{{- $destinationHost := include "cap.deploymentHostFull" $srv -}}
|
|
76
|
+
{{- $currentDestination := dict $nameKey $destination.name $urlKey (print "https://" $destinationHost ) -}}
|
|
77
|
+
{{- $currentDestination := merge $currentDestination $.defaultParameters -}}
|
|
78
|
+
{{- $destinations = (append $destinations $currentDestination) -}}
|
|
79
|
+
{{- end -}}
|
|
80
|
+
{{- $destinations | toJson }}
|
|
81
|
+
{{- end -}}
|
|
82
|
+
{{- end -}}
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
{{/*
|
|
2
|
+
Labels for a component
|
|
3
|
+
*/}}
|
|
4
|
+
{{- define "cap.labels" -}}
|
|
5
|
+
helm.sh/revision: {{ .Release.Revision | quote }}
|
|
6
|
+
helm.sh/chart: {{ printf "%s-%s" .Chart.Name .Chart.Version | replace "+" "_" | trunc 63 | trimSuffix "-" }}
|
|
7
|
+
app.kubernetes.io/name: {{ .name }}
|
|
8
|
+
app.kubernetes.io/managed-by: {{ .Release.Service }}
|
|
9
|
+
app.kubernetes.io/instance: {{ .Release.Name }}
|
|
10
|
+
{{- if .Chart.AppVersion }}
|
|
11
|
+
app.kubernetes.io/version: {{ .Chart.AppVersion }}
|
|
12
|
+
{{- end }}
|
|
13
|
+
{{- end -}}
|
|
14
|
+
|
|
15
|
+
{{/*
|
|
16
|
+
Saas Registry Parameters
|
|
17
|
+
*/}}
|
|
18
|
+
{{- define "cap.service-instance.saasRegistryParameters" -}}
|
|
19
|
+
{{- $srvHostFull := include "cap.deploymentHostFull" (merge (dict "name" "srv" "deployment" .Values.srv) . ) }}
|
|
20
|
+
{{- if .Values.saasRegistryParameters.bindSidecar }}
|
|
21
|
+
{{- $srvHostFull = include "cap.deploymentHostFull" (merge (dict "name" "sidecar" "deployment" .Values.sidecar) . ) }}
|
|
22
|
+
{{- end}}
|
|
23
|
+
{{- $parameters := .Values.saasRegistryParameters }}
|
|
24
|
+
{{- $appUrls := $parameters.appUrls }}
|
|
25
|
+
{{- $_ := set $appUrls "getDependencies" (printf "https://%s%s" $srvHostFull $appUrls.getDependencies) }}
|
|
26
|
+
{{- $_ := set $appUrls "onSubscription" (printf "https://%s%s" $srvHostFull $appUrls.onSubscription) }}
|
|
27
|
+
{{- $parameters | mustToJson }}
|
|
28
|
+
{{- end }}
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
{
|
|
2
|
+
"$schema": "http://json-schema.org/draft-07/schema",
|
|
3
|
+
"allOf": [{ "$ref": "./values.schema.json" }],
|
|
4
|
+
"properties": {
|
|
5
|
+
"srv": {
|
|
6
|
+
"$id": "#/properties/srv",
|
|
7
|
+
"description": "Deployment",
|
|
8
|
+
"$ref": "./charts/web-application/values.schema.json"
|
|
9
|
+
},
|
|
10
|
+
"approuter": {
|
|
11
|
+
"$id": "#/properties/approuter",
|
|
12
|
+
"description": "Deployment",
|
|
13
|
+
"$ref": "./charts/web-application/values.schema.json"
|
|
14
|
+
},
|
|
15
|
+
"hana-deployer": {
|
|
16
|
+
"$id": "#/properties/hana-deployer",
|
|
17
|
+
"description": "Content Deployment",
|
|
18
|
+
"$ref": "./charts/content-deployment/values.schema.json"
|
|
19
|
+
},
|
|
20
|
+
"html5-apps-deployer": {
|
|
21
|
+
"$id": "#/properties/html5-apps-deployer",
|
|
22
|
+
"description": "Content Deployment",
|
|
23
|
+
"$ref": "./charts/content-deployment/values.schema.json"
|
|
24
|
+
},
|
|
25
|
+
"event-mesh": {
|
|
26
|
+
"$id": "#/properties/event-mesh",
|
|
27
|
+
"description": "Service Instance",
|
|
28
|
+
"$ref": "./charts/service-instance/values.schema.json"
|
|
29
|
+
},
|
|
30
|
+
"html5-apps-repo-host": {
|
|
31
|
+
"$id": "#/properties/html5-apps-repo-host",
|
|
32
|
+
"description": "Service Instance",
|
|
33
|
+
"$ref": "./charts/service-instance/values.schema.json"
|
|
34
|
+
},
|
|
35
|
+
"xsuaa": {
|
|
36
|
+
"$id": "#/properties/xsuaa",
|
|
37
|
+
"description": "Service Instance",
|
|
38
|
+
"$ref": "./charts/service-instance/values.schema.json"
|
|
39
|
+
},
|
|
40
|
+
"destination": {
|
|
41
|
+
"$id": "#/properties/destination",
|
|
42
|
+
"description": "Service Instance",
|
|
43
|
+
"$ref": "./charts/service-instance/values.schema.json"
|
|
44
|
+
},
|
|
45
|
+
"hana": {
|
|
46
|
+
"$id": "#/properties/hana",
|
|
47
|
+
"description": "Service Instance",
|
|
48
|
+
"$ref": "./charts/service-instance/values.schema.json"
|
|
49
|
+
},
|
|
50
|
+
"saas-registry": {
|
|
51
|
+
"$id": "#/properties/saas-registry",
|
|
52
|
+
"description": "Service Instance",
|
|
53
|
+
"$ref": "./charts/service-instance/values.schema.json"
|
|
54
|
+
},
|
|
55
|
+
"service-manager": {
|
|
56
|
+
"$id": "#/properties/service-manager",
|
|
57
|
+
"description": "Service Instance",
|
|
58
|
+
"$ref": "./charts/service-instance/values.schema.json"
|
|
59
|
+
}
|
|
60
|
+
}
|
|
61
|
+
}
|