@sap/cds-dk 6.6.2 → 6.7.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/CHANGELOG.md +24 -1
- package/bin/add.js +5 -3
- package/bin/build/all.js +1 -1
- package/bin/cds.js +10 -8
- package/bin/env.js +4 -6
- package/bin/login.js +6 -4
- package/bin/migrate.js +0 -1
- package/bin/repl.js +1 -1
- package/bin/serve.js +7 -0
- package/bin/subscribe.js +5 -5
- package/bin/unsubscribe.js +4 -5
- package/bin/upgrade.js +67 -0
- package/bin/watch.js +8 -5
- package/lib/bind/bindingManager.js +3 -2
- package/lib/bind/cfKeyProvider.js +7 -6
- package/lib/bind/userCdsrcJsonStorageProvider.js +5 -4
- package/lib/client/activate.js +4 -3
- package/lib/client/auth_manager.js +4 -3
- package/lib/client/base_command.js +7 -2
- package/lib/client/helper/cf_helper.js +12 -11
- package/lib/client/helper/dependency_helper.js +3 -2
- package/lib/client/helper/logging.js +0 -7
- package/lib/client/params.js +4 -2
- package/lib/client/settings_manager.js +35 -34
- package/lib/client/tenant_action.js +78 -0
- package/lib/init/constants.js +1 -1
- package/lib/init/index.js +4 -4
- package/lib/init/template/_merging/registry-mta.js +31 -46
- package/lib/init/template/approuter/files/mta.yaml.hbs +12 -8
- package/lib/init/template/approuter/files/xs-app.json.hbs +0 -3
- package/lib/init/template/approuter/index.js +26 -34
- package/lib/init/template/auditlog/files/mta.yaml.hbs +2 -1
- package/lib/init/template/auditlog/index.js +8 -21
- package/lib/init/template/cf-manifest/files/manifest.yml.hbs +4 -4
- package/lib/init/template/cf-manifest/index.js +2 -1
- package/lib/init/template/connectivity/index.js +4 -5
- package/lib/init/template/data/index.js +19 -22
- package/lib/init/template/destinations/index.js +5 -17
- package/lib/init/template/enterprise-messaging/files/mta.yaml.hbs +2 -1
- package/lib/init/template/enterprise-messaging/index.js +7 -19
- package/lib/init/template/extensibility/index.js +3 -1
- package/lib/init/template/hana/files/mta.yaml.hbs +4 -5
- package/lib/init/template/hana/index.js +49 -84
- package/lib/init/template/helm/chart/templates/_helpers.tpl +4 -1
- package/lib/init/template/helm/files/Chart.yaml.hbs +1 -4
- package/lib/init/template/helm/index.js +45 -13
- package/lib/init/template/html5-repo/index.js +6 -29
- package/lib/init/template/java/index.js +1 -1
- package/lib/init/template/kibana-logging/files/mta.yaml.hbs +2 -1
- package/lib/init/template/kibana-logging/index.js +5 -8
- package/lib/init/template/lint/index.js +8 -8
- package/lib/init/template/mta/files/mta.yaml.hbs +3 -2
- package/lib/init/template/mta/index.js +3 -2
- package/lib/init/template/multitenancy/files/mta.yaml.hbs +25 -31
- package/lib/init/template/multitenancy/files/{java/mtxs-configmap.yaml → mtxs-configmap-java.yaml} +1 -1
- package/lib/init/template/multitenancy/files/{mtxs-configmap.yaml → mtxs-configmap-nodejs.yaml} +5 -1
- package/lib/init/template/multitenancy/files/package.json.hbs +28 -0
- package/lib/init/template/multitenancy/files/package.sidecar.json.hbs +21 -0
- package/lib/init/template/multitenancy/files/values.yaml.hbs +15 -8
- package/lib/init/template/multitenancy/index.js +51 -99
- package/lib/init/template/nodejs/files/.vscode/extensions.json +1 -2
- package/lib/init/template/nodejs/files/.vscode/launch.json +2 -2
- package/lib/init/template/nodejs/files/.vscode/tasks.json +2 -2
- package/lib/init/template/nodejs/files/package.json.hbs +2 -2
- package/lib/init/template/nodejs/index.js +4 -3
- package/lib/init/template/pipeline/index.js +3 -2
- package/lib/init/template/samples/index.js +5 -4
- package/lib/init/template/sqlite/files/package.json.hbs +19 -0
- package/lib/init/template/sqlite/index.js +11 -0
- package/lib/init/template/toggles/index.js +3 -5
- package/lib/init/template/xsuaa/files/mta.yaml.hbs +4 -5
- package/lib/init/template/xsuaa/files/values.yaml.hbs +0 -2
- package/lib/init/template/xsuaa/index.js +14 -35
- package/lib/init/util/commandUtil.js +3 -2
- package/lib/init/util/fsUtil.js +19 -2
- package/lib/init/util/md5Tracking.js +36 -63
- package/lib/init/util/projectReader.js +12 -26
- package/lib/lint/Linter.js +0 -3
- package/lib/util/exec.js +2 -1
- package/lib/util/term.js +1 -1
- package/lib/watch/livereload-connect.js +5 -4
- package/lib/watch/livereload-server.js +3 -6
- package/lib/watch/node-watch.js +1 -1
- package/npm-shrinkwrap.json +553 -466
- package/package.json +4 -4
- package/readme.md +1 -1
- package/lib/client/subscription.js +0 -84
- package/lib/init/template/approuter/files/chart.yaml +0 -4
- package/lib/init/template/auditlog/files/auditlog.yaml +0 -4
- package/lib/init/template/destinations/files/destination.yaml +0 -4
- package/lib/init/template/enterprise-messaging/files/event-mesh.yaml +0 -4
- package/lib/init/template/hana/files/hana-deployer.yaml +0 -4
- package/lib/init/template/hana/files/hana.yaml +0 -4
- package/lib/init/template/html5-repo/files/html5-apps-deployer.yaml +0 -4
- package/lib/init/template/html5-repo/files/html5-apps-repo-host.yaml +0 -4
- package/lib/init/template/multitenancy/files/cds.package.json +0 -7
- package/lib/init/template/multitenancy/files/cds.package.json.hbs +0 -9
- package/lib/init/template/multitenancy/files/dependencies.package.json +0 -5
- package/lib/init/template/multitenancy/files/java/.cdsrc.json +0 -22
- package/lib/init/template/multitenancy/files/java/package.json +0 -33
- package/lib/init/template/multitenancy/files/saas-registry.yaml +0 -4
- package/lib/init/template/multitenancy/files/service-manager.yaml +0 -4
- package/lib/init/template/multitenancy/files/sidecar.yaml +0 -4
- package/lib/init/template/xsuaa/files/xsuaa.yaml +0 -4
|
@@ -17,7 +17,7 @@ module.exports = class EnterpriseMessagingTemplate extends require('../templateB
|
|
|
17
17
|
const templatePath = join(__dirname, 'files')
|
|
18
18
|
const cdsTemplateFile = (isNodejs ? 'cds.package.json' : 'cdsrc.json') + (forProfile ? '.hbs' : '')
|
|
19
19
|
const cdsTemplatePath = join(templatePath, cdsTemplateFile)
|
|
20
|
-
const configPath =
|
|
20
|
+
const configPath = isNodejs ? 'package.json' : '.cdsrc.json'
|
|
21
21
|
await mergeJSON(configPath, cdsTemplatePath, projectDescriptor)
|
|
22
22
|
await mergeJSON('event-mesh.json', join(__dirname, 'files', 'event-mesh.json.hbs'), projectDescriptor)
|
|
23
23
|
await this.runDependentMerging()
|
|
@@ -25,10 +25,10 @@ module.exports = class EnterpriseMessagingTemplate extends require('../templateB
|
|
|
25
25
|
|
|
26
26
|
async runDependentMerging(context = {}) {
|
|
27
27
|
const projectDescriptor = await readProject(this.options)
|
|
28
|
-
const { hasHelm, hasMta, isNodejs } = projectDescriptor.cap
|
|
28
|
+
const { hasHelm, hasMta, isNodejs, srvPath } = projectDescriptor.cap
|
|
29
29
|
|
|
30
30
|
if (hasMta) {
|
|
31
|
-
const srv = isNodejs ? srvNode : srvJava
|
|
31
|
+
const srv = (isNodejs ? srvNode : srvJava)(srvPath)
|
|
32
32
|
await mergeYAML(
|
|
33
33
|
'mta.yaml',
|
|
34
34
|
join(__dirname, 'files', 'mta.yaml.hbs'),
|
|
@@ -48,12 +48,11 @@ module.exports = class EnterpriseMessagingTemplate extends require('../templateB
|
|
|
48
48
|
let isIndependentCommand = false
|
|
49
49
|
if(Object.keys(context).length == 0){
|
|
50
50
|
isIndependentCommand = true
|
|
51
|
-
context.
|
|
52
|
-
context.oldTrackingData = context.newTrackingData = await parseMd5File(join(this.projectPath, 'chart', '.cds-add-helm-files.md5'))
|
|
51
|
+
context.oldTrackingData = context.newTrackingData = await parseMd5File(join('chart', '.cds-add-helm-files.md5'))
|
|
53
52
|
}
|
|
54
53
|
|
|
55
54
|
await mergeYAML(
|
|
56
|
-
join(
|
|
55
|
+
join('chart', 'values.yaml'),
|
|
57
56
|
join(__dirname, 'files', 'values.yaml')
|
|
58
57
|
)
|
|
59
58
|
|
|
@@ -63,20 +62,9 @@ module.exports = class EnterpriseMessagingTemplate extends require('../templateB
|
|
|
63
62
|
isIndependentCommand = isIndependentCommand | await helmTemplate.addSubChart('service-instance');
|
|
64
63
|
|
|
65
64
|
// add dependency entry in chart.yaml
|
|
66
|
-
await
|
|
67
|
-
join(this.projectPath, 'chart', 'Chart.yaml'),
|
|
68
|
-
join(__dirname, 'files', 'event-mesh.yaml'),
|
|
69
|
-
projectDescriptor,
|
|
70
|
-
{ additions: [{
|
|
71
|
-
in: `dependencies`,
|
|
72
|
-
where: [{
|
|
73
|
-
property: 'alias',
|
|
74
|
-
isEqualTo: 'event-mesh'
|
|
75
|
-
}]
|
|
76
|
-
}]}
|
|
77
|
-
)
|
|
65
|
+
await helmTemplate.addDependency('service-instance', 'event-mesh');
|
|
78
66
|
|
|
79
|
-
if(isIndependentCommand) await writeMd5File(join(
|
|
67
|
+
if(isIndependentCommand) await writeMd5File(join('chart', '.cds-add-helm-files.md5'), context.newTrackingData)
|
|
80
68
|
}
|
|
81
69
|
}
|
|
82
70
|
}
|
|
@@ -19,12 +19,14 @@ module.exports = class ExtensibilityTemplate extends require('../templateBase')
|
|
|
19
19
|
async run() {
|
|
20
20
|
const projectDescriptor = await readProject(this.options)
|
|
21
21
|
const { for: forProfile, isJava, hasSidecar } = projectDescriptor.cap
|
|
22
|
-
const cdsConfigPath =
|
|
22
|
+
const cdsConfigPath = isJava ? '.cdsrc.json' : 'package.json'
|
|
23
23
|
const cdsTemplateFile = forProfile ? (isJava ? 'cdsrc.json.hbs' : 'cds.package.json.hbs') : (isJava ? 'cdsrc.json' : 'cds.package.json')
|
|
24
24
|
await mergeJSON(cdsConfigPath, join(__dirname, 'files', cdsTemplateFile), projectDescriptor)
|
|
25
25
|
if (hasSidecar) {
|
|
26
26
|
const out = join('mtx', 'sidecar', 'package.json')
|
|
27
27
|
const config = await read(out)
|
|
28
|
+
if (!config.cds) config.cds = {}
|
|
29
|
+
if (!config.cds.requires) config.cds.requires = {}
|
|
28
30
|
if (!('cds.xt.ExtensibilityService' in config.cds.requires)) {
|
|
29
31
|
config.cds.requires['cds.xt.ExtensibilityService'] = true
|
|
30
32
|
await write(out, config, { spaces: 2 })
|
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
---
|
|
2
2
|
modules:
|
|
3
3
|
- name: {{cap.appName}}-srv
|
|
4
|
-
type: {{cap.
|
|
4
|
+
type: {{cap.language}}
|
|
5
|
+
path: {{& cap.srvPath}}
|
|
5
6
|
requires:
|
|
6
7
|
- name: {{cap.appName}}-db
|
|
7
8
|
|
|
@@ -21,15 +22,13 @@ modules:
|
|
|
21
22
|
- name: {{cap.appName}}-db
|
|
22
23
|
{{/cap.isMultitenant}}
|
|
23
24
|
|
|
24
|
-
{{#cap.isJava}}
|
|
25
25
|
{{#cap.isMultitenant}}
|
|
26
|
-
- name: {{cap.appName}}-mtx
|
|
26
|
+
- name: {{cap.appName}}-mtx
|
|
27
27
|
type: nodejs
|
|
28
|
-
path: mtx/sidecar
|
|
28
|
+
path: {{#cap.isNodejs}}gen/{{/cap.isNodejs}}mtx/sidecar
|
|
29
29
|
requires:
|
|
30
30
|
- name: {{cap.appName}}-db
|
|
31
31
|
{{/cap.isMultitenant}}
|
|
32
|
-
{{/cap.isJava}}
|
|
33
32
|
|
|
34
33
|
resources:
|
|
35
34
|
- name: {{cap.appName}}-db
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
const { join } = require('path');
|
|
2
2
|
const cds = require('../../../cds')
|
|
3
|
-
const { read, write, exists,
|
|
3
|
+
const { read, write, exists, rmdir } = cds.utils
|
|
4
4
|
const commandUtil = require('../../util/commandUtil');
|
|
5
5
|
const mvnArchetypes = require('../../util/mvnArchetypeUtil');
|
|
6
6
|
const term = require('../../../util/term');
|
|
@@ -12,7 +12,7 @@ const versionCompare = require('../../util/versionCompare');
|
|
|
12
12
|
|
|
13
13
|
const { PROJECT_TYPE, OPTION_JAVA, URLS } = require('../../constants');
|
|
14
14
|
|
|
15
|
-
const { srvNode, srvJava, hdbDeployer, serviceManager, hdiContainer,
|
|
15
|
+
const { srvNode, srvJava, hdbDeployer, serviceManager, hdiContainer, mtxSidecar4 } = require('../_merging/registry-mta');
|
|
16
16
|
|
|
17
17
|
module.exports = class HanaTemplate extends require('../templateBase') {
|
|
18
18
|
|
|
@@ -31,18 +31,18 @@ module.exports = class HanaTemplate extends require('../templateBase') {
|
|
|
31
31
|
async run() {
|
|
32
32
|
const env = await this.getEnv();
|
|
33
33
|
|
|
34
|
-
const hdiConfigPath = join(
|
|
34
|
+
const hdiConfigPath = join(env.folders.db, 'src', '.hdiconfig');
|
|
35
35
|
const hdiConfigTemplatePath = join(__dirname, 'files', 'common', 'src', '.hdiconfig');
|
|
36
36
|
await mergeJSON(hdiConfigPath, hdiConfigTemplatePath);
|
|
37
37
|
|
|
38
|
-
const undeployJSONPath = join(
|
|
38
|
+
const undeployJSONPath = join(env.folders.db, 'undeploy.json');
|
|
39
39
|
const undeployJSONTemplatePath = join(__dirname, 'files', 'common', 'undeploy.json');
|
|
40
40
|
await mergeJSON(undeployJSONPath, undeployJSONTemplatePath);
|
|
41
41
|
|
|
42
42
|
const projectType = this.getProjectType();
|
|
43
43
|
switch (projectType) {
|
|
44
44
|
case PROJECT_TYPE.java: {
|
|
45
|
-
await copyFiles(join(__dirname, 'files', 'java', 'db'), join(
|
|
45
|
+
await copyFiles(join(__dirname, 'files', 'java', 'db'), join(env.folders.db), {}, this.options.force);
|
|
46
46
|
await this._updatePomXml();
|
|
47
47
|
await this._updateCdsConfiguration();
|
|
48
48
|
break;
|
|
@@ -56,42 +56,30 @@ module.exports = class HanaTemplate extends require('../templateBase') {
|
|
|
56
56
|
await this.runDependentMerging()
|
|
57
57
|
}
|
|
58
58
|
|
|
59
|
-
async removeEntriesFromContext(context, key
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
delete context.oldTrackingData[fileName];
|
|
64
|
-
}
|
|
65
|
-
});
|
|
66
|
-
|
|
67
|
-
Object.keys(context.newTrackingData).forEach(fileName => {
|
|
68
|
-
if (fileName.startsWith(key)) {
|
|
69
|
-
delete context.newTrackingData[fileName];
|
|
70
|
-
}
|
|
71
|
-
});
|
|
72
|
-
} else {
|
|
73
|
-
// remove entry from oldTrackingData
|
|
74
|
-
if(context.oldTrackingData !== undefined && context.oldTrackingData[key] !== undefined) {
|
|
75
|
-
delete context.oldTrackingData[key];
|
|
59
|
+
async removeEntriesFromContext(context, key) {
|
|
60
|
+
Object.keys(context.oldTrackingData).forEach(fileName => {
|
|
61
|
+
if (fileName.startsWith(key)) {
|
|
62
|
+
delete context.oldTrackingData[fileName];
|
|
76
63
|
}
|
|
64
|
+
});
|
|
77
65
|
|
|
78
|
-
|
|
79
|
-
if(
|
|
80
|
-
|
|
66
|
+
Object.keys(context.newTrackingData).forEach(fileName => {
|
|
67
|
+
if (fileName.startsWith(key)) {
|
|
68
|
+
delete context.newTrackingData[fileName];
|
|
81
69
|
}
|
|
82
|
-
}
|
|
70
|
+
});
|
|
83
71
|
}
|
|
84
72
|
|
|
85
73
|
async runDependentMerging(context = {}) {
|
|
86
74
|
const projectDescriptor = await readProject(this.options)
|
|
87
|
-
const { hasMta, hasHelm, hasHtml5Repo,
|
|
75
|
+
const { hasMta, hasHelm, hasHtml5Repo, isJava, isMultitenant, srvPath } = projectDescriptor.cap
|
|
88
76
|
|
|
89
77
|
if (isMultitenant) {
|
|
90
78
|
await this._updateCdsConfiguration()
|
|
91
79
|
}
|
|
92
80
|
|
|
93
81
|
if (hasMta) {
|
|
94
|
-
const srv =
|
|
82
|
+
const srv = (isJava ? srvJava : srvNode)(srvPath)
|
|
95
83
|
const db = isMultitenant ? serviceManager : hdiContainer
|
|
96
84
|
const deletions = isMultitenant ? [{
|
|
97
85
|
item: hdbDeployer,
|
|
@@ -107,8 +95,6 @@ module.exports = class HanaTemplate extends require('../templateBase') {
|
|
|
107
95
|
}]
|
|
108
96
|
}] : []
|
|
109
97
|
|
|
110
|
-
const mtaYAMLPath = join(this.projectPath, 'mta.yaml')
|
|
111
|
-
|
|
112
98
|
const relationships = [{
|
|
113
99
|
insert: [db, 'name'],
|
|
114
100
|
into: [srv, 'requires', 'name']
|
|
@@ -119,19 +105,17 @@ module.exports = class HanaTemplate extends require('../templateBase') {
|
|
|
119
105
|
insert: [hdiContainer, 'name'],
|
|
120
106
|
into: [hdbDeployer, 'requires', 'name']
|
|
121
107
|
})
|
|
122
|
-
}
|
|
123
|
-
|
|
124
|
-
if (isJava && isMultitenant) {
|
|
108
|
+
} else {
|
|
125
109
|
relationships.push({
|
|
126
110
|
insert: [serviceManager, 'name'],
|
|
127
|
-
into: [
|
|
111
|
+
into: [mtxSidecar4(isJava ? 'mtx/sidecar' : 'gen/mtx/sidecar'), 'requires', 'name']
|
|
128
112
|
})
|
|
129
113
|
}
|
|
130
114
|
|
|
131
115
|
const modules = !isMultitenant ? [srv, hdbDeployer] : [srv]
|
|
132
116
|
|
|
133
117
|
await mergeYAML(
|
|
134
|
-
|
|
118
|
+
'mta.yaml',
|
|
135
119
|
join(__dirname, 'files', 'mta.yaml.hbs'),
|
|
136
120
|
projectDescriptor,
|
|
137
121
|
{ additions: [...modules, db].filter(a => a), deletions, relationships }
|
|
@@ -143,41 +127,46 @@ module.exports = class HanaTemplate extends require('../templateBase') {
|
|
|
143
127
|
let shouldUpdateTrackingFile = false;
|
|
144
128
|
if(Object.keys(context).length == 0){
|
|
145
129
|
shouldUpdateTrackingFile = true;
|
|
146
|
-
context.
|
|
147
|
-
context.oldTrackingData = context.newTrackingData = await parseMd5File(join(this.projectPath, 'chart', '.cds-add-helm-files.md5'));
|
|
130
|
+
context.oldTrackingData = context.newTrackingData = await parseMd5File(join('chart', '.cds-add-helm-files.md5'));
|
|
148
131
|
}
|
|
149
132
|
|
|
133
|
+
const HelmTemplate = require(`../helm`);
|
|
134
|
+
const helmTemplate = new HelmTemplate(this.generator, context.oldTrackingData, context.newTrackingData);
|
|
135
|
+
|
|
150
136
|
if(isMultitenant){
|
|
151
137
|
shouldUpdateTrackingFile = true;
|
|
152
138
|
|
|
153
|
-
const instanceTemplateKey = "templates/hana.yaml";
|
|
154
|
-
await this.removeEntriesFromContext(context, instanceTemplateKey);
|
|
155
|
-
|
|
156
139
|
// remove hana entries from values.yaml
|
|
157
|
-
await removeFromYAML(join(
|
|
140
|
+
await removeFromYAML(join('chart', 'values.yaml'), ['hana-deployer', 'srv.bindings.db', 'hana']);
|
|
158
141
|
|
|
159
142
|
// remove hana entries from Chart.yaml
|
|
160
|
-
await removeFromYAMLArray(join(
|
|
143
|
+
await removeFromYAMLArray(join('chart', 'Chart.yaml'), 'dependencies', 'hana-deployer');
|
|
161
144
|
|
|
162
145
|
// remove content-deployment subchart if html5Repo doesn't exist
|
|
163
146
|
if(!hasHtml5Repo) {
|
|
164
147
|
const contentDeploymentEntriesPattern = "charts/content-deployment/"
|
|
165
|
-
await this.removeEntriesFromContext(context, contentDeploymentEntriesPattern
|
|
148
|
+
await this.removeEntriesFromContext(context, contentDeploymentEntriesPattern);
|
|
166
149
|
|
|
167
|
-
const contentDeploymentSubchartPath = join(
|
|
150
|
+
const contentDeploymentSubchartPath = join('chart', 'charts', 'content-deployment');
|
|
168
151
|
if(exists(contentDeploymentSubchartPath)) {
|
|
169
152
|
await rmdir(contentDeploymentSubchartPath);
|
|
170
153
|
}
|
|
171
154
|
}
|
|
172
155
|
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
await rm(hanaInstanceTemplatePath);
|
|
176
|
-
}
|
|
177
|
-
|
|
156
|
+
//remove dependency since mtx plugin is added
|
|
157
|
+
const isInternal = await helmTemplate.isInternal();
|
|
178
158
|
await mergeYAML(
|
|
179
|
-
join(
|
|
180
|
-
|
|
159
|
+
join('chart', 'Chart.yaml'),
|
|
160
|
+
{
|
|
161
|
+
dependencies: [
|
|
162
|
+
{
|
|
163
|
+
name: 'service-instance',
|
|
164
|
+
alias: 'hana',
|
|
165
|
+
version: '>0.0.0',
|
|
166
|
+
...(isInternal) && { repository: 'https://int.repositories.cloud.sap/artifactory/virtual-unified-runtime-helm-dmz' }
|
|
167
|
+
}
|
|
168
|
+
]
|
|
169
|
+
},
|
|
181
170
|
projectDescriptor,
|
|
182
171
|
{ deletions: [{
|
|
183
172
|
item: {
|
|
@@ -191,48 +180,24 @@ module.exports = class HanaTemplate extends require('../templateBase') {
|
|
|
191
180
|
)
|
|
192
181
|
} else {
|
|
193
182
|
await mergeYAML(
|
|
194
|
-
join(
|
|
183
|
+
join('chart', 'values.yaml'),
|
|
195
184
|
join(__dirname, 'files', 'values.yaml.hbs'),
|
|
196
185
|
projectDescriptor
|
|
197
186
|
)
|
|
198
187
|
|
|
199
188
|
// copy content deployment chart if it is not present
|
|
200
|
-
const HelmTemplate = require(`../helm`);
|
|
201
|
-
const helmTemplate = new HelmTemplate(this.generator, context.oldTrackingData, context.newTrackingData);
|
|
202
189
|
shouldUpdateTrackingFile = shouldUpdateTrackingFile | await helmTemplate.addSubChart('content-deployment');
|
|
203
190
|
|
|
204
191
|
// add dependency entry in chart.yaml
|
|
205
|
-
await
|
|
206
|
-
join(this.projectPath, 'chart', 'Chart.yaml'),
|
|
207
|
-
join(__dirname, 'files', 'hana-deployer.yaml'),
|
|
208
|
-
projectDescriptor,
|
|
209
|
-
{ additions: [{
|
|
210
|
-
in: `dependencies`,
|
|
211
|
-
where: [{
|
|
212
|
-
property: 'alias',
|
|
213
|
-
isEqualTo: 'hana-deployer'
|
|
214
|
-
}]
|
|
215
|
-
}]}
|
|
216
|
-
)
|
|
192
|
+
await helmTemplate.addDependency('content-deployment', 'hana-deployer');
|
|
217
193
|
|
|
218
194
|
// add service instance chart if it is not present
|
|
219
195
|
shouldUpdateTrackingFile = shouldUpdateTrackingFile | await helmTemplate.addSubChart('service-instance');
|
|
220
196
|
|
|
221
197
|
// add dependency entry in chart.yaml
|
|
222
|
-
await
|
|
223
|
-
join(this.projectPath, 'chart', 'Chart.yaml'),
|
|
224
|
-
join(__dirname, 'files', 'hana.yaml'),
|
|
225
|
-
projectDescriptor,
|
|
226
|
-
{ additions: [{
|
|
227
|
-
in: `dependencies`,
|
|
228
|
-
where: [{
|
|
229
|
-
property: 'alias',
|
|
230
|
-
isEqualTo: 'hana'
|
|
231
|
-
}]
|
|
232
|
-
}]}
|
|
233
|
-
)
|
|
198
|
+
await helmTemplate.addDependency('service-instance', 'hana');
|
|
234
199
|
}
|
|
235
|
-
if(shouldUpdateTrackingFile) await writeMd5File(join(
|
|
200
|
+
if(shouldUpdateTrackingFile) await writeMd5File(join('chart', '.cds-add-helm-files.md5'), context.newTrackingData);
|
|
236
201
|
}
|
|
237
202
|
}
|
|
238
203
|
|
|
@@ -242,7 +207,7 @@ module.exports = class HanaTemplate extends require('../templateBase') {
|
|
|
242
207
|
const mvnAddHanaArgs = mvnArchetypes.getAddHanaCmdArgs(this.options);
|
|
243
208
|
try {
|
|
244
209
|
await commandUtil.spawnCommand('mvn', mvnAddHanaArgs, {
|
|
245
|
-
cwd:
|
|
210
|
+
cwd: cds.root
|
|
246
211
|
});
|
|
247
212
|
} catch (err) {
|
|
248
213
|
if (err.code === 'ENOENT' && err.path === 'mvn') {
|
|
@@ -254,7 +219,7 @@ module.exports = class HanaTemplate extends require('../templateBase') {
|
|
|
254
219
|
}
|
|
255
220
|
|
|
256
221
|
async _updatePackageJson() {
|
|
257
|
-
const packageJsonPath = join(
|
|
222
|
+
const packageJsonPath = join('package.json')
|
|
258
223
|
const dependenciesTemplatePath = join(__dirname, 'files', 'nodejs', 'dependencies.package.json');
|
|
259
224
|
await mergeJSON(packageJsonPath, dependenciesTemplatePath);
|
|
260
225
|
|
|
@@ -270,7 +235,7 @@ module.exports = class HanaTemplate extends require('../templateBase') {
|
|
|
270
235
|
async _updateCdsConfiguration(configPath) {
|
|
271
236
|
const projectType = this.getProjectType();
|
|
272
237
|
const configFile = projectType === PROJECT_TYPE.nodejs ? 'package.json' : '.cdsrc.json';
|
|
273
|
-
configPath = configPath ??
|
|
238
|
+
configPath = configPath ?? configFile
|
|
274
239
|
const projectDescriptor = await readProject(this.options);
|
|
275
240
|
const { for: forProfile } = projectDescriptor.cap;
|
|
276
241
|
let json; try { json = await read(configPath, 'utf8') } catch { /* ignore */ }
|
|
@@ -278,8 +243,8 @@ module.exports = class HanaTemplate extends require('../templateBase') {
|
|
|
278
243
|
const shortcut = typeof _cds?.requires?.db === 'string' || !json ? 'shortcut.' : '';
|
|
279
244
|
const profile = forProfile ? 'profile.' : '';
|
|
280
245
|
const cdsTemplateFile = `cds.${shortcut}${profile}json.hbs`
|
|
281
|
-
const {
|
|
282
|
-
const cdsTemplatePath = join(__dirname, 'files',
|
|
246
|
+
const { language } = projectDescriptor.cap;
|
|
247
|
+
const cdsTemplatePath = join(__dirname, 'files', language, cdsTemplateFile);
|
|
283
248
|
await mergeJSON(configPath, cdsTemplatePath, projectDescriptor, { forceOverwrite: true })
|
|
284
249
|
}
|
|
285
250
|
}
|
|
@@ -137,9 +137,12 @@ spec:
|
|
|
137
137
|
*/}}
|
|
138
138
|
{{- define "cap.service-instance.saasRegistryParameters" -}}
|
|
139
139
|
{{- $srvHostFull := include "cap.deploymentHostFull" (merge (dict "name" "srv" "deployment" .Values.srv) . ) }}
|
|
140
|
+
{{- if .Values.saasRegistryParameters.bindSidecar }}
|
|
141
|
+
{{- $srvHostFull = include "cap.deploymentHostFull" (merge (dict "name" "sidecar" "deployment" .Values.sidecar) . ) }}
|
|
142
|
+
{{- end}}
|
|
140
143
|
{{- $parameters := .Values.saasRegistryParameters }}
|
|
141
144
|
{{- $appUrls := $parameters.appUrls }}
|
|
142
145
|
{{- $_ := set $appUrls "getDependencies" (printf "https://%s%s" $srvHostFull $appUrls.getDependencies) }}
|
|
143
146
|
{{- $_ := set $appUrls "onSubscription" (printf "https://%s%s" $srvHostFull $appUrls.onSubscription) }}
|
|
144
147
|
{{- $parameters | mustToJson }}
|
|
145
|
-
{{- end }}
|
|
148
|
+
{{- end }}
|
|
@@ -3,7 +3,6 @@ const { exists, rimraf } = require('../../../cds').utils;
|
|
|
3
3
|
const { readProject } = require('../../util/projectReader');
|
|
4
4
|
const { mergeYAML } = require('../../util/merge')
|
|
5
5
|
const { parseMd5File, writeMd5File, copyAndTrack } = require('../../util/md5Tracking')
|
|
6
|
-
//const { yaml } = require('@sap/cds-foss')
|
|
7
6
|
|
|
8
7
|
module.exports = class HelmTemplate extends require('../templateBase') {
|
|
9
8
|
constructor(generator, oldTrackingData = undefined, newTrackingData = {}) {
|
|
@@ -20,15 +19,16 @@ module.exports = class HelmTemplate extends require('../templateBase') {
|
|
|
20
19
|
|
|
21
20
|
async canRun() {
|
|
22
21
|
if (this.options.force) {
|
|
23
|
-
await rimraf(join(
|
|
22
|
+
await rimraf(join('chart'))
|
|
24
23
|
return true;
|
|
25
24
|
}
|
|
26
25
|
return true;
|
|
27
26
|
}
|
|
28
27
|
|
|
29
|
-
async addSubChart(subchart) {
|
|
30
|
-
const subchartPath = join(
|
|
31
|
-
|
|
28
|
+
async addSubChart(subchart, force = false) {
|
|
29
|
+
const subchartPath = join('chart', 'charts', subchart);
|
|
30
|
+
const isInternal = !force && await this.isInternal();
|
|
31
|
+
if(!exists(subchartPath) && !isInternal) {
|
|
32
32
|
await copyAndTrack(
|
|
33
33
|
join(__dirname, 'subcharts', subchart),
|
|
34
34
|
subchartPath,
|
|
@@ -37,34 +37,66 @@ module.exports = class HelmTemplate extends require('../templateBase') {
|
|
|
37
37
|
|
|
38
38
|
return true;
|
|
39
39
|
}
|
|
40
|
-
|
|
40
|
+
|
|
41
41
|
return false;
|
|
42
42
|
}
|
|
43
43
|
|
|
44
|
+
async isInternal() {
|
|
45
|
+
return !exists(join('chart', 'charts', 'web-application')) || this.options['internal-unified-runtime-charts'];
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
async addDependency(name, alias){
|
|
49
|
+
const projectDescriptor = await readProject(this.options);
|
|
50
|
+
const isInternal = await this.isInternal();
|
|
51
|
+
await mergeYAML(
|
|
52
|
+
join('chart', 'Chart.yaml'),
|
|
53
|
+
{
|
|
54
|
+
dependencies: [
|
|
55
|
+
{
|
|
56
|
+
name,
|
|
57
|
+
alias,
|
|
58
|
+
version: '>0.0.0',
|
|
59
|
+
...(isInternal) && { repository: 'https://int.repositories.cloud.sap/artifactory/virtual-unified-runtime-helm-dmz' }
|
|
60
|
+
}
|
|
61
|
+
]
|
|
62
|
+
},
|
|
63
|
+
projectDescriptor,
|
|
64
|
+
{ additions: [{
|
|
65
|
+
in: `dependencies`,
|
|
66
|
+
where: [{
|
|
67
|
+
property: 'alias',
|
|
68
|
+
isEqualTo: alias
|
|
69
|
+
}]
|
|
70
|
+
}]}
|
|
71
|
+
)
|
|
72
|
+
}
|
|
73
|
+
|
|
44
74
|
async run() {
|
|
45
75
|
const projectDescriptor = await readProject(this.options)
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
await this.addSubChart('web-application');
|
|
76
|
+
const isInternal = this.options['internal-unified-runtime-charts'] !== undefined && this.options['internal-unified-runtime-charts'];
|
|
77
|
+
this.oldTrackingData = await parseMd5File(join('chart', '.cds-add-helm-files.md5'));
|
|
78
|
+
await this.addSubChart('web-application', !isInternal);
|
|
49
79
|
await copyAndTrack(
|
|
50
80
|
join(__dirname, 'chart'),
|
|
51
|
-
join(
|
|
81
|
+
join('chart'),
|
|
52
82
|
this
|
|
53
83
|
)
|
|
54
84
|
|
|
55
85
|
await mergeYAML(
|
|
56
|
-
join(
|
|
86
|
+
join('chart', 'Chart.yaml'),
|
|
57
87
|
join(__dirname, 'files', 'Chart.yaml.hbs'),
|
|
58
88
|
projectDescriptor
|
|
59
89
|
)
|
|
60
90
|
|
|
91
|
+
await this.addDependency('web-application', 'srv');
|
|
92
|
+
|
|
61
93
|
await mergeYAML(
|
|
62
|
-
join(
|
|
94
|
+
join('chart', 'values.yaml'),
|
|
63
95
|
join(__dirname, 'files', 'values.yaml.hbs'),
|
|
64
96
|
projectDescriptor
|
|
65
97
|
)
|
|
66
98
|
await this.runDependentMerging();
|
|
67
|
-
await writeMd5File(join(
|
|
99
|
+
await writeMd5File(join('chart', '.cds-add-helm-files.md5'), this.newTrackingData);
|
|
68
100
|
}
|
|
69
101
|
|
|
70
102
|
async runDependentMerging() {
|
|
@@ -39,11 +39,10 @@ module.exports = class Html5RepoTemplate extends require('../templateBase') {
|
|
|
39
39
|
let isIndependentCommand = false
|
|
40
40
|
if(Object.keys(context).length == 0){
|
|
41
41
|
isIndependentCommand = true
|
|
42
|
-
context.
|
|
43
|
-
context.oldTrackingData = context.newTrackingData = await parseMd5File(join(this.projectPath, 'chart', '.cds-add-helm-files.md5'))
|
|
42
|
+
context.oldTrackingData = context.newTrackingData = await parseMd5File(join('chart', '.cds-add-helm-files.md5'))
|
|
44
43
|
}
|
|
45
44
|
await mergeYAML(
|
|
46
|
-
join(
|
|
45
|
+
join('chart', 'values.yaml'),
|
|
47
46
|
{
|
|
48
47
|
'html5-apps-repo-host': {
|
|
49
48
|
serviceOfferingName: 'html5-apps-repo',
|
|
@@ -84,38 +83,16 @@ module.exports = class Html5RepoTemplate extends require('../templateBase') {
|
|
|
84
83
|
isIndependentCommand = isIndependentCommand | await helmTemplate.addSubChart('content-deployment');
|
|
85
84
|
|
|
86
85
|
// add dependency entry in chart.yaml
|
|
87
|
-
await
|
|
88
|
-
join(this.projectPath, 'chart', 'Chart.yaml'),
|
|
89
|
-
join(__dirname, 'files', 'html5-apps-deployer.yaml'),
|
|
90
|
-
projectDescriptor,
|
|
91
|
-
{ additions: [{
|
|
92
|
-
in: `dependencies`,
|
|
93
|
-
where: [{
|
|
94
|
-
property: 'alias',
|
|
95
|
-
isEqualTo: 'html5-apps-deployer'
|
|
96
|
-
}]
|
|
97
|
-
}]}
|
|
98
|
-
)
|
|
86
|
+
await helmTemplate.addDependency('content-deployment', 'html5-apps-deployer');
|
|
99
87
|
|
|
100
88
|
// copy service-instance chart
|
|
101
89
|
isIndependentCommand = isIndependentCommand | await helmTemplate.addSubChart('service-instance');
|
|
102
90
|
|
|
103
91
|
// add dependency entry in chart.yaml
|
|
104
|
-
await
|
|
105
|
-
join(this.projectPath, 'chart', 'Chart.yaml'),
|
|
106
|
-
join(__dirname, 'files', 'html5-apps-repo-host.yaml'),
|
|
107
|
-
projectDescriptor,
|
|
108
|
-
{ additions: [{
|
|
109
|
-
in: `dependencies`,
|
|
110
|
-
where: [{
|
|
111
|
-
property: 'alias',
|
|
112
|
-
isEqualTo: 'html5-apps-repo-host'
|
|
113
|
-
}]
|
|
114
|
-
}]}
|
|
115
|
-
)
|
|
92
|
+
await helmTemplate.addDependency('service-instance', 'html5-apps-repo-host');
|
|
116
93
|
|
|
117
|
-
await copyAndTrack(join(__dirname, 'files', 'html5-apps-deployer-configmap.yaml'), join(
|
|
118
|
-
if(isIndependentCommand) await writeMd5File(join(
|
|
94
|
+
await copyAndTrack(join(__dirname, 'files', 'html5-apps-deployer-configmap.yaml'), join('chart', 'templates', 'html5-apps-deployer-configmap.yaml'), context)
|
|
95
|
+
if(isIndependentCommand) await writeMd5File(join('chart', '.cds-add-helm-files.md5'), context.newTrackingData)
|
|
119
96
|
}
|
|
120
97
|
}
|
|
121
98
|
}
|
|
@@ -53,7 +53,7 @@ module.exports = class JavaTemplate extends require('../templateBase') {
|
|
|
53
53
|
}
|
|
54
54
|
|
|
55
55
|
async finalize() {
|
|
56
|
-
const relativeProjectPath = relative(this.cwd,
|
|
56
|
+
const relativeProjectPath = relative(this.cwd, cds.root);
|
|
57
57
|
if (relativeProjectPath && relativeProjectPath !== '.') {
|
|
58
58
|
LOG.info(`Continue with 'cd ${relativeProjectPath}'`);
|
|
59
59
|
}
|
|
@@ -2,12 +2,11 @@ const { join } = require('path')
|
|
|
2
2
|
const cds = require('../../../cds')
|
|
3
3
|
const { readProject } = require('../../util/projectReader')
|
|
4
4
|
const { mergeJSON, mergeYAML } = require('../../util/merge')
|
|
5
|
-
const { PROJECT_TYPE
|
|
5
|
+
const { PROJECT_TYPE } = require('../../constants')
|
|
6
6
|
const { srvNode, srvJava, kibanaLogging } = require('../_merging/registry-mta')
|
|
7
7
|
|
|
8
8
|
module.exports = class KibanaLoggingTemplate extends require('../templateBase') {
|
|
9
9
|
|
|
10
|
-
|
|
11
10
|
async canRun() {
|
|
12
11
|
const projectDescriptor = await readProject(this.options)
|
|
13
12
|
const { hasMta, hasHelm } = projectDescriptor.cap
|
|
@@ -31,7 +30,7 @@ module.exports = class KibanaLoggingTemplate extends require('../templateBase')
|
|
|
31
30
|
const { for: forProfile } = projectDescriptor.cap
|
|
32
31
|
const cdsTemplateFile = forProfile ? 'cds.profile.package.json.hbs' : 'cds.package.json'
|
|
33
32
|
const cdsTemplatePath = join(__dirname, 'files', cdsTemplateFile)
|
|
34
|
-
await mergeJSON(
|
|
33
|
+
await mergeJSON('package.json', cdsTemplatePath, projectDescriptor)
|
|
35
34
|
}
|
|
36
35
|
}
|
|
37
36
|
await this.runDependentMerging()
|
|
@@ -39,14 +38,12 @@ module.exports = class KibanaLoggingTemplate extends require('../templateBase')
|
|
|
39
38
|
|
|
40
39
|
async runDependentMerging() {
|
|
41
40
|
const projectDescriptor = await readProject(this.options)
|
|
42
|
-
const { hasMta, isNodejs } = projectDescriptor.cap
|
|
41
|
+
const { hasMta, isNodejs, srvPath } = projectDescriptor.cap
|
|
43
42
|
|
|
44
43
|
if (hasMta) {
|
|
45
|
-
const srv = isNodejs ? srvNode : srvJava
|
|
46
|
-
|
|
47
|
-
const mtaYAMLPath = join(this.projectPath, 'mta.yaml')
|
|
44
|
+
const srv = (isNodejs ? srvNode : srvJava)(srvPath)
|
|
48
45
|
await mergeYAML(
|
|
49
|
-
|
|
46
|
+
'mta.yaml',
|
|
50
47
|
join(__dirname, 'files', 'mta.yaml.hbs'),
|
|
51
48
|
projectDescriptor,
|
|
52
49
|
{
|