@sap/cds-dk 6.3.2 → 6.4.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +38 -7
- package/bin/cds.js +2 -0
- package/bin/compile/index.js +2 -1
- package/bin/deploy/index.js +5 -3
- package/bin/deploy/to-sqlite.js +17 -15
- package/bin/help.js +7 -4
- package/bin/init.js +1 -1
- package/bin/login.js +3 -4
- package/bin/migrate.js +33 -0
- package/bin/pull.js +4 -4
- package/bin/push.js +1 -1
- package/bin/subscribe.js +58 -66
- package/bin/unsubscribe.js +67 -0
- package/bin/watch.js +4 -3
- package/lib/bind/bindingUtil.js +2 -0
- package/lib/bind/cfKeyProvider.js +5 -1
- package/lib/client/activate.js +3 -3
- package/lib/client/auth_manager.js +2 -2
- package/lib/client/base_command.js +7 -6
- package/lib/client/extend.js +2 -2
- package/lib/client/helper/errors.js +8 -2
- package/lib/client/helper/logging.js +13 -11
- package/lib/client/params.js +3 -0
- package/lib/client/pull.js +1 -1
- package/lib/client/push.js +4 -4
- package/lib/client/settings_manager.js +13 -6
- package/lib/client/subscription.js +81 -0
- package/lib/compile/to-xsuaa.js +25 -19
- package/lib/import/odata/metadataconverter/MetadataConverter.js +3 -3
- package/lib/import/odata/v2parser.js +37 -24
- package/lib/import/odata/v4parser.js +111 -37
- package/lib/init/constants.js +1 -1
- package/lib/init/index.js +2 -2
- package/lib/init/template/_merging/registry-mta.js +0 -3
- package/lib/init/template/approuter/files/approuter-configmap.yaml +10 -0
- package/lib/init/template/approuter/files/approuter-mtxs-configmap.yaml +15 -0
- package/lib/init/template/approuter/files/chart.yaml +4 -0
- package/lib/init/template/approuter/files/package.json +1 -1
- package/lib/init/template/approuter/files/values.yaml.hbs +31 -0
- package/lib/init/template/approuter/index.js +60 -12
- package/lib/init/template/auditlog/index.js +16 -8
- package/lib/init/template/cf-manifest/index.js +3 -3
- package/lib/init/template/connectivity/index.js +19 -10
- package/lib/init/template/destinations/index.js +23 -7
- package/lib/init/template/enterprise-messaging/files/cds.package.json +1 -2
- package/lib/init/template/enterprise-messaging/files/cds.profile.package.json.hbs +1 -2
- package/lib/init/template/enterprise-messaging/files/cdsrc.json +1 -2
- package/lib/init/template/enterprise-messaging/files/cdsrc.json.hbs +1 -2
- package/lib/init/template/enterprise-messaging/files/event-mesh.json.hbs +31 -0
- package/lib/init/template/enterprise-messaging/files/mta.yaml.hbs +1 -0
- package/lib/init/template/enterprise-messaging/index.js +26 -13
- package/lib/init/template/extensibility/index.js +19 -10
- package/lib/init/template/hana/files/mta.yaml.hbs +0 -4
- package/lib/init/template/hana/index.js +58 -22
- package/lib/init/template/helm/chart/templates/NOTES.txt +4 -3
- package/lib/init/template/helm/chart/templates/_deployment_helpers.tpl +25 -2
- package/lib/init/template/helm/chart/values.root.schema.json +5 -0
- package/lib/init/template/helm/chart/values.schema.json +27 -0
- package/lib/init/template/helm/files/values.yaml.hbs +1 -1
- package/lib/init/template/helm/index.js +25 -23
- package/lib/init/template/helm/subchart/templates/_helpers.tpl +29 -0
- package/lib/init/template/helm/subchart/templates/api-rule.yaml +5 -5
- package/lib/init/template/helm/subchart/templates/deployment.yaml +12 -9
- package/lib/init/template/helm/subchart/values.md +258 -88
- package/lib/init/template/helm/subchart/values.schema.json +96 -13
- package/lib/init/template/helm/subchart/values.yaml +6 -2
- package/lib/init/template/html5-repo/index.js +28 -11
- package/lib/init/template/java/index.js +5 -5
- package/lib/init/template/kibana-logging/index.js +5 -4
- package/lib/init/template/mta/index.js +2 -2
- package/lib/init/template/mtx/index.js +1 -1
- package/lib/init/template/multitenancy/files/chart.yaml +4 -0
- package/lib/init/template/multitenancy/files/java/mtxs-configmap.yaml +20 -0
- package/lib/init/template/multitenancy/files/java/package.json +6 -9
- package/lib/init/template/multitenancy/files/mtxs-configmap.yaml +15 -0
- package/lib/init/template/multitenancy/files/saas-registry.yaml +17 -19
- package/lib/init/template/multitenancy/files/values.yaml.hbs +47 -0
- package/lib/init/template/multitenancy/files/xs-security.json.hbs +0 -7
- package/lib/init/template/multitenancy/index.js +83 -37
- package/lib/init/template/nodejs/files/.eslintrc +26 -0
- package/lib/init/template/nodejs/files/package.json.hbs +0 -28
- package/lib/init/template/nodejs/index.js +7 -10
- package/lib/init/template/pipeline/index.js +4 -4
- package/lib/init/template/samples/index.js +5 -5
- package/lib/init/template/templateBase.js +1 -4
- package/lib/init/template/toggles/index.js +5 -5
- package/lib/init/template/xsuaa/files/values.yaml.hbs +21 -0
- package/lib/init/template/xsuaa/index.js +34 -24
- package/lib/init/util/md5Tracking.js +113 -0
- package/lib/init/util/merge.js +19 -2
- package/lib/init/util/projectReader.js +15 -12
- package/npm-shrinkwrap.json +211 -686
- package/package.json +3 -3
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
const
|
|
1
|
+
const { join } = require('path')
|
|
2
2
|
const ProjectReader = require('../../util/projectReader')
|
|
3
3
|
const { mergeYAML } = require('../../util/merge')
|
|
4
|
-
const
|
|
4
|
+
const { copyAndTrack, parseMd5File, writeMd5File } = require('../../util/md5Tracking')
|
|
5
5
|
|
|
6
6
|
module.exports = class ConnectivityTemplate extends require('../templateBase') {
|
|
7
7
|
constructor(projectPath, generator) {
|
|
@@ -13,14 +13,22 @@ module.exports = class ConnectivityTemplate extends require('../templateBase') {
|
|
|
13
13
|
await this.runDependentMerging()
|
|
14
14
|
}
|
|
15
15
|
|
|
16
|
-
async runDependentMerging() {
|
|
16
|
+
async runDependentMerging(context = {}) {
|
|
17
17
|
const projectDescriptor = await this.projectReader.read(this.options)
|
|
18
18
|
const { hasHelm } = projectDescriptor.cap
|
|
19
19
|
|
|
20
20
|
if (hasHelm) {
|
|
21
|
+
//in case facet is being added to the already exisiting charts folder
|
|
22
|
+
let isIndependentCommand = false
|
|
23
|
+
if(Object.keys(context).length == 0){
|
|
24
|
+
isIndependentCommand = true
|
|
25
|
+
context.projectPath = this.projectPath
|
|
26
|
+
context.oldTrackingData = context.newTrackingData = await parseMd5File(join(this.projectPath, 'chart', '.cds-add-helm-files.md5'))
|
|
27
|
+
}
|
|
28
|
+
|
|
21
29
|
await mergeYAML(
|
|
22
|
-
|
|
23
|
-
|
|
30
|
+
join(this.projectPath, 'chart', 'values.yaml'),
|
|
31
|
+
join(__dirname, 'files', 'values.yaml.hbs'),
|
|
24
32
|
projectDescriptor,
|
|
25
33
|
{ additions: [{
|
|
26
34
|
ref: `srv-additional-volumes`,
|
|
@@ -31,11 +39,12 @@ module.exports = class ConnectivityTemplate extends require('../templateBase') {
|
|
|
31
39
|
}]
|
|
32
40
|
}]}
|
|
33
41
|
)
|
|
34
|
-
const filesPath =
|
|
35
|
-
const templatesPath =
|
|
36
|
-
await
|
|
37
|
-
await
|
|
38
|
-
await
|
|
42
|
+
const filesPath = join(__dirname, 'files')
|
|
43
|
+
const templatesPath = join(this.projectPath, 'chart', 'templates')
|
|
44
|
+
await copyAndTrack(join(filesPath, 'connectivity-binding.yaml'), join(templatesPath, 'connectivity-binding.yaml'), context)
|
|
45
|
+
await copyAndTrack(join(filesPath, 'connectivity-proxy-info.yaml'), join(templatesPath, 'connectivity-proxy-info.yaml'), context)
|
|
46
|
+
await copyAndTrack(join(filesPath, 'connectivity.yaml'), join(templatesPath, 'connectivity.yaml'), context)
|
|
47
|
+
if(isIndependentCommand) await writeMd5File(join(this.projectPath, 'chart', '.cds-add-helm-files.md5'), context.newTrackingData)
|
|
39
48
|
}
|
|
40
49
|
}
|
|
41
50
|
}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
const
|
|
1
|
+
const { join } = require('path')
|
|
2
2
|
const ProjectReader = require('../../util/projectReader')
|
|
3
3
|
const { mergeYAML } = require('../../util/merge')
|
|
4
|
-
const {
|
|
4
|
+
const { copyAndTrack, parseMd5File, writeMd5File } = require('../../util/md5Tracking')
|
|
5
5
|
|
|
6
6
|
module.exports = class DestinationsTemplate extends require('../templateBase') {
|
|
7
7
|
constructor(projectPath, generator) {
|
|
@@ -9,6 +9,15 @@ module.exports = class DestinationsTemplate extends require('../templateBase') {
|
|
|
9
9
|
this.projectReader = new ProjectReader(projectPath)
|
|
10
10
|
}
|
|
11
11
|
|
|
12
|
+
async canRun() {
|
|
13
|
+
const projectDescriptor = await this.projectReader.read(this.options)
|
|
14
|
+
const { hasMta, hasHelm } = projectDescriptor.cap
|
|
15
|
+
if (!hasHelm && hasMta) {
|
|
16
|
+
throw `'cds add destinations' is not available for Cloud Foundry yet`
|
|
17
|
+
}
|
|
18
|
+
return true
|
|
19
|
+
}
|
|
20
|
+
|
|
12
21
|
static hasFacet(env) {
|
|
13
22
|
const kinds = { odata: 1, 'odata-v2': 1, 'odata-v4': 1, rest: 1 }
|
|
14
23
|
return Object.entries(env.requires).some(([service, require]) => !kinds[service] && kinds[require.kind])
|
|
@@ -18,7 +27,7 @@ module.exports = class DestinationsTemplate extends require('../templateBase') {
|
|
|
18
27
|
await this.runDependentMerging()
|
|
19
28
|
}
|
|
20
29
|
|
|
21
|
-
async runDependentMerging() {
|
|
30
|
+
async runDependentMerging(context = {}) {
|
|
22
31
|
const projectDescriptor = await this.projectReader.read(this.options)
|
|
23
32
|
const { hasHelm, hasDestination, hasHtml5Repo } = projectDescriptor.cap
|
|
24
33
|
|
|
@@ -27,8 +36,15 @@ module.exports = class DestinationsTemplate extends require('../templateBase') {
|
|
|
27
36
|
const binding = hasDestination && { srv: { bindings: { destination: { serviceInstanceName: 'destinations' }}}}
|
|
28
37
|
const html5Binding = hasHtml5Repo && { html5_apps_deployer: { bindings: { destination: { serviceInstanceName: 'destination' }}}}
|
|
29
38
|
|
|
39
|
+
//in case facet is being added to the already exisiting charts folder
|
|
40
|
+
let isIndependentCommand = false
|
|
41
|
+
if(Object.keys(context).length == 0){
|
|
42
|
+
isIndependentCommand = true
|
|
43
|
+
context.projectPath = this.projectPath
|
|
44
|
+
context.oldTrackingData = context.newTrackingData = await parseMd5File(join(this.projectPath, 'chart', '.cds-add-helm-files.md5'))
|
|
45
|
+
}
|
|
30
46
|
await mergeYAML(
|
|
31
|
-
|
|
47
|
+
join(this.projectPath, 'chart', 'values.yaml'),
|
|
32
48
|
{
|
|
33
49
|
...binding,
|
|
34
50
|
...html5Binding,
|
|
@@ -40,10 +56,10 @@ module.exports = class DestinationsTemplate extends require('../templateBase') {
|
|
|
40
56
|
...(hasHtml5Repo) && { HTML5Runtime_enabled: true }
|
|
41
57
|
}
|
|
42
58
|
}
|
|
43
|
-
}
|
|
44
|
-
null, { forceOverwrite: true }
|
|
59
|
+
}
|
|
45
60
|
)
|
|
46
|
-
await
|
|
61
|
+
await copyAndTrack(join(__dirname, 'files', 'destination.yaml'), join(this.projectPath, 'chart', 'templates', 'destination.yaml'), context)
|
|
62
|
+
if(isIndependentCommand) await writeMd5File(join(this.projectPath, 'chart', '.cds-add-helm-files.md5'), context.newTrackingData)
|
|
47
63
|
}
|
|
48
64
|
}
|
|
49
65
|
}
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
{
|
|
2
|
+
"emname": "{{cap.appName}}-emname",
|
|
3
|
+
"version": "1.1.0",
|
|
4
|
+
"namespace": "default/sap.myapp/1",
|
|
5
|
+
"options": {
|
|
6
|
+
"management": true,
|
|
7
|
+
"messagingrest": true,
|
|
8
|
+
"messaging": true
|
|
9
|
+
},
|
|
10
|
+
"rules": {
|
|
11
|
+
"topicRules": {
|
|
12
|
+
"publishFilter": [
|
|
13
|
+
"${namespace}/sample"
|
|
14
|
+
],
|
|
15
|
+
"subscribeFilter": [
|
|
16
|
+
"*"
|
|
17
|
+
]
|
|
18
|
+
},
|
|
19
|
+
"queueRules": {
|
|
20
|
+
"publishFilter": [
|
|
21
|
+
"${namespace}/*"
|
|
22
|
+
],
|
|
23
|
+
"subscribeFilter": [
|
|
24
|
+
"${namespace}/*"
|
|
25
|
+
]
|
|
26
|
+
}
|
|
27
|
+
},
|
|
28
|
+
"authorities": [
|
|
29
|
+
"$ACCEPT_GRANTED_AUTHORITIES"
|
|
30
|
+
]
|
|
31
|
+
}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
const
|
|
2
|
-
const { copy } = require('../../../cds').utils
|
|
1
|
+
const { join } = require('path')
|
|
3
2
|
const ProjectReader = require('../../util/projectReader')
|
|
4
3
|
const { mergeJSON, mergeYAML } = require('../../util/merge')
|
|
4
|
+
const { copyAndTrack, parseMd5File, writeMd5File } = require('../../util/md5Tracking')
|
|
5
5
|
const { srvNode, srvJava, enterpriseMessaging } = require('../_merging/registry-mta')
|
|
6
6
|
|
|
7
7
|
module.exports = class EnterpriseMessagingTemplate extends require('../templateBase') {
|
|
@@ -17,20 +17,20 @@ module.exports = class EnterpriseMessagingTemplate extends require('../templateB
|
|
|
17
17
|
async run() {
|
|
18
18
|
const projectDescriptor = await this.projectReader.read(this.options)
|
|
19
19
|
const { for: forProfile, isNodejs } = projectDescriptor.cap
|
|
20
|
-
const templatePath =
|
|
20
|
+
const templatePath = join(__dirname, 'files')
|
|
21
21
|
const cdsTemplateFile = (isNodejs ? 'cds.package.json' : 'cdsrc.json') + (forProfile ? '.hbs' : '')
|
|
22
|
-
const cdsTemplatePath =
|
|
23
|
-
const configPath =
|
|
22
|
+
const cdsTemplatePath = join(templatePath, cdsTemplateFile)
|
|
23
|
+
const configPath = join(this.projectPath, isNodejs ? 'package.json' : '.cdsrc.json')
|
|
24
24
|
await mergeJSON(configPath, cdsTemplatePath, projectDescriptor)
|
|
25
25
|
await this.runDependentMerging()
|
|
26
26
|
}
|
|
27
27
|
|
|
28
|
-
async runDependentMerging() {
|
|
28
|
+
async runDependentMerging(context = {}) {
|
|
29
29
|
const projectDescriptor = await this.projectReader.read(this.options)
|
|
30
30
|
const { hasHelm, hasMta, isNodejs } = projectDescriptor.cap
|
|
31
31
|
|
|
32
32
|
if (hasMta) {
|
|
33
|
-
const mtaYAMLPath =
|
|
33
|
+
const mtaYAMLPath = join(this.projectPath, 'mta.yaml')
|
|
34
34
|
const srv = isNodejs ? srvNode : srvJava
|
|
35
35
|
await mergeYAML(
|
|
36
36
|
mtaYAMLPath,
|
|
@@ -44,18 +44,31 @@ module.exports = class EnterpriseMessagingTemplate extends require('../templateB
|
|
|
44
44
|
}]
|
|
45
45
|
}
|
|
46
46
|
)
|
|
47
|
+
await mergeJSON(
|
|
48
|
+
join(this.projectPath, 'event-mesh.json'),
|
|
49
|
+
join(__dirname, 'files', 'event-mesh.json.hbs'),
|
|
50
|
+
projectDescriptor
|
|
51
|
+
)
|
|
47
52
|
}
|
|
48
53
|
|
|
49
54
|
if (hasHelm) {
|
|
55
|
+
//in case facet is being added to the already exisiting charts folder
|
|
56
|
+
let isIndependentCommand = false
|
|
57
|
+
if(Object.keys(context).length == 0){
|
|
58
|
+
isIndependentCommand = true
|
|
59
|
+
context.projectPath = this.projectPath
|
|
60
|
+
context.oldTrackingData = context.newTrackingData = await parseMd5File(join(this.projectPath, 'chart', '.cds-add-helm-files.md5'))
|
|
61
|
+
}
|
|
50
62
|
await mergeYAML(
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
null, { forceOverwrite: true }
|
|
63
|
+
join(this.projectPath, 'chart', 'values.yaml'),
|
|
64
|
+
join(__dirname, 'files', 'values.yaml')
|
|
54
65
|
)
|
|
55
|
-
await
|
|
56
|
-
|
|
57
|
-
|
|
66
|
+
await copyAndTrack(
|
|
67
|
+
join(__dirname, 'files', 'event-mesh.yaml'),
|
|
68
|
+
join(this.projectPath, 'chart', 'templates', 'event-mesh.yaml'),
|
|
69
|
+
context
|
|
58
70
|
)
|
|
71
|
+
if(isIndependentCommand) await writeMd5File(join(this.projectPath, 'chart', '.cds-add-helm-files.md5'), context.newTrackingData)
|
|
59
72
|
}
|
|
60
73
|
}
|
|
61
74
|
}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
const
|
|
2
|
-
const { copy, path } = cds.utils
|
|
1
|
+
const { join } = require('path')
|
|
3
2
|
const ProjectReader = require('../../util/projectReader')
|
|
4
3
|
const { mergeJSON } = require('../../util/merge')
|
|
4
|
+
const { copyAndTrack, parseMd5File, writeMd5File } = require('../../util/md5Tracking')
|
|
5
5
|
|
|
6
6
|
module.exports = class ExtensibilityTemplate extends require('../templateBase') {
|
|
7
7
|
constructor(projectPath, generator) {
|
|
@@ -16,19 +16,19 @@ module.exports = class ExtensibilityTemplate extends require('../templateBase')
|
|
|
16
16
|
async run() {
|
|
17
17
|
const projectDescriptor = await this.projectReader.read(this.options)
|
|
18
18
|
const { for: forProfile, isJava } = projectDescriptor.cap
|
|
19
|
-
const cdsConfigPath =
|
|
19
|
+
const cdsConfigPath = join(this.projectPath, isJava ? '.cdsrc.json' : 'package.json')
|
|
20
20
|
const cdsTemplateFile = forProfile ? (isJava ? 'cdsrc.json.hbs' : 'cds.package.json.hbs') : (isJava ? 'cdsrc.json' : 'cds.package.json')
|
|
21
|
-
await mergeJSON(cdsConfigPath,
|
|
21
|
+
await mergeJSON(cdsConfigPath, join(__dirname, 'files', cdsTemplateFile), projectDescriptor)
|
|
22
22
|
await this.runDependentMerging()
|
|
23
23
|
}
|
|
24
24
|
|
|
25
|
-
async runDependentMerging() {
|
|
25
|
+
async runDependentMerging(context = {}) {
|
|
26
26
|
const projectDescriptor = await this.projectReader.read()
|
|
27
27
|
const { hasXsuaa, hasHelm } = projectDescriptor.cap
|
|
28
28
|
if (hasXsuaa) {
|
|
29
29
|
await mergeJSON(
|
|
30
|
-
|
|
31
|
-
|
|
30
|
+
join(this.projectPath, 'xs-security.json'),
|
|
31
|
+
join(__dirname, 'files', 'xs-security.json.hbs'),
|
|
32
32
|
projectDescriptor,
|
|
33
33
|
{
|
|
34
34
|
additions: [{
|
|
@@ -48,11 +48,20 @@ module.exports = class ExtensibilityTemplate extends require('../templateBase')
|
|
|
48
48
|
)
|
|
49
49
|
}
|
|
50
50
|
if (hasXsuaa && hasHelm) {
|
|
51
|
+
//in case facet is being added to the already exisiting charts folder
|
|
52
|
+
let isIndependentCommand = false
|
|
53
|
+
if(Object.keys(context).length == 0){
|
|
54
|
+
isIndependentCommand = true
|
|
55
|
+
context.projectPath = this.projectPath
|
|
56
|
+
context.oldTrackingData = context.newTrackingData = await parseMd5File(join(this.projectPath, 'chart', '.cds-add-helm-files.md5'))
|
|
57
|
+
}
|
|
51
58
|
// REVISIT: Shared xs-security.json location for Helm and MTA?
|
|
52
|
-
await
|
|
53
|
-
|
|
54
|
-
|
|
59
|
+
await copyAndTrack(
|
|
60
|
+
join(this.projectPath, 'xs-security.json'),
|
|
61
|
+
join(this.projectPath, 'chart', 'xs-security.json'),
|
|
62
|
+
context
|
|
55
63
|
)
|
|
64
|
+
if(isIndependentCommand) await writeMd5File(join(this.projectPath, 'chart', '.cds-add-helm-files.md5'), context.newTrackingData)
|
|
56
65
|
}
|
|
57
66
|
}
|
|
58
67
|
}
|
|
@@ -1,10 +1,11 @@
|
|
|
1
|
-
const
|
|
1
|
+
const { join } = require('path');
|
|
2
2
|
const cds = require('../../../cds')
|
|
3
|
-
const {
|
|
3
|
+
const { read, write, exists, rm } = cds.utils
|
|
4
4
|
const commandUtil = require('../../util/commandUtil');
|
|
5
5
|
const mvnArchetypes = require('../../util/mvnArchetypeUtil');
|
|
6
6
|
const term = require('../../../util/term');
|
|
7
|
-
const { mergeJSON, mergeYAML } = require('../../util/merge')
|
|
7
|
+
const { mergeJSON, mergeYAML, removeFromYAML } = require('../../util/merge')
|
|
8
|
+
const { copyAndTrack, parseMd5File, writeMd5File } = require('../../util/md5Tracking')
|
|
8
9
|
const { copyFiles } = require('../../util/templateUtil')
|
|
9
10
|
const ProjectReader = require('../../util/projectReader');
|
|
10
11
|
const versionCompare = require('../../util/versionCompare');
|
|
@@ -34,18 +35,18 @@ module.exports = class HanaTemplate extends require('../templateBase') {
|
|
|
34
35
|
async run() {
|
|
35
36
|
const env = await this.getEnv();
|
|
36
37
|
|
|
37
|
-
const hdiConfigPath =
|
|
38
|
-
const hdiConfigTemplatePath =
|
|
38
|
+
const hdiConfigPath = join(this.projectPath, env.folders.db, 'src', '.hdiconfig');
|
|
39
|
+
const hdiConfigTemplatePath = join(__dirname, 'files', 'common', 'src', '.hdiconfig');
|
|
39
40
|
await mergeJSON(hdiConfigPath, hdiConfigTemplatePath);
|
|
40
41
|
|
|
41
|
-
const undeployJSONPath =
|
|
42
|
-
const undeployJSONTemplatePath =
|
|
42
|
+
const undeployJSONPath = join(this.projectPath, env.folders.db, 'undeploy.json');
|
|
43
|
+
const undeployJSONTemplatePath = join(__dirname, 'files', 'common', 'undeploy.json');
|
|
43
44
|
await mergeJSON(undeployJSONPath, undeployJSONTemplatePath);
|
|
44
45
|
|
|
45
46
|
const projectType = await this.getProjectType();
|
|
46
47
|
switch (projectType) {
|
|
47
48
|
case PROJECT_TYPE.java: {
|
|
48
|
-
await copyFiles(
|
|
49
|
+
await copyFiles(join(__dirname, 'files', 'java', 'db'), join(this.projectPath, env.folders.db), {}, this.options.force);
|
|
49
50
|
await this._updatePomXml();
|
|
50
51
|
await this._updateCdsConfiguration();
|
|
51
52
|
break;
|
|
@@ -60,7 +61,7 @@ module.exports = class HanaTemplate extends require('../templateBase') {
|
|
|
60
61
|
}
|
|
61
62
|
|
|
62
63
|
|
|
63
|
-
async runDependentMerging() {
|
|
64
|
+
async runDependentMerging(context = {}) {
|
|
64
65
|
const projectDescriptor = await this.projectReader.read(this.options)
|
|
65
66
|
const { hasMta, hasHelm, isNodejs, isJava, isMultitenant } = projectDescriptor.cap
|
|
66
67
|
|
|
@@ -85,7 +86,7 @@ module.exports = class HanaTemplate extends require('../templateBase') {
|
|
|
85
86
|
}]
|
|
86
87
|
}] : []
|
|
87
88
|
|
|
88
|
-
const mtaYAMLPath =
|
|
89
|
+
const mtaYAMLPath = join(this.projectPath, 'mta.yaml')
|
|
89
90
|
|
|
90
91
|
const relationships = [{
|
|
91
92
|
insert: [db, 'name'],
|
|
@@ -117,14 +118,49 @@ module.exports = class HanaTemplate extends require('../templateBase') {
|
|
|
117
118
|
}
|
|
118
119
|
|
|
119
120
|
if (hasHelm) {
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
121
|
+
//in case facet is being added to the already exisiting charts folder
|
|
122
|
+
let shouldUpdateTrackingFile = false;
|
|
123
|
+
if(Object.keys(context).length == 0){
|
|
124
|
+
shouldUpdateTrackingFile = true;
|
|
125
|
+
context.projectPath = this.projectPath;
|
|
126
|
+
context.oldTrackingData = context.newTrackingData = await parseMd5File(join(this.projectPath, 'chart', '.cds-add-helm-files.md5'));
|
|
127
|
+
}
|
|
128
|
+
|
|
129
|
+
if(isMultitenant){
|
|
130
|
+
shouldUpdateTrackingFile = true;
|
|
131
|
+
const key = "templates/hana-deployer-job.yaml";
|
|
132
|
+
|
|
133
|
+
// remove entry from oldTrackingData
|
|
134
|
+
if(context.oldTrackingData !== undefined && context.oldTrackingData[key] !== undefined) {
|
|
135
|
+
delete context.oldTrackingData[key];
|
|
136
|
+
}
|
|
137
|
+
|
|
138
|
+
// remove entry from newTrackingData
|
|
139
|
+
if(context.newTrackingData !== undefined && context.newTrackingData[key] !== undefined) {
|
|
140
|
+
delete context.newTrackingData[key];
|
|
141
|
+
}
|
|
142
|
+
|
|
143
|
+
// remove hana entries from values.yaml
|
|
144
|
+
await removeFromYAML(join(this.projectPath, 'chart', 'values.yaml'), ['hana_deployer', 'srv.bindings.db']);
|
|
145
|
+
|
|
146
|
+
const hanaDeployerPath = join(this.projectPath, 'chart', 'templates', 'hana-deployer-job.yaml');
|
|
147
|
+
if(exists(hanaDeployerPath)) {
|
|
148
|
+
await rm(hanaDeployerPath, { force: true });
|
|
149
|
+
}
|
|
150
|
+
}
|
|
151
|
+
else{
|
|
152
|
+
await mergeYAML(
|
|
153
|
+
join(this.projectPath, 'chart', 'values.yaml'),
|
|
154
|
+
join(__dirname, 'files', 'values.yaml.hbs'),
|
|
155
|
+
projectDescriptor
|
|
156
|
+
)
|
|
157
|
+
await copyAndTrack(
|
|
158
|
+
join(__dirname, 'files', 'hana-deployer-job.yaml'),
|
|
159
|
+
join(this.projectPath, 'chart', 'templates', 'hana-deployer-job.yaml'),
|
|
160
|
+
context
|
|
161
|
+
)
|
|
162
|
+
}
|
|
163
|
+
if(shouldUpdateTrackingFile) await writeMd5File(join(this.projectPath, 'chart', '.cds-add-helm-files.md5'), context.newTrackingData);
|
|
128
164
|
}
|
|
129
165
|
}
|
|
130
166
|
|
|
@@ -146,8 +182,8 @@ module.exports = class HanaTemplate extends require('../templateBase') {
|
|
|
146
182
|
}
|
|
147
183
|
|
|
148
184
|
async _updatePackageJson() {
|
|
149
|
-
const packageJsonPath =
|
|
150
|
-
const dependenciesTemplatePath =
|
|
185
|
+
const packageJsonPath = join(this.projectPath, 'package.json')
|
|
186
|
+
const dependenciesTemplatePath = join(__dirname, 'files', 'nodejs', 'dependencies.package.json');
|
|
151
187
|
await mergeJSON(packageJsonPath, dependenciesTemplatePath);
|
|
152
188
|
|
|
153
189
|
const packageJson = await read(packageJsonPath);
|
|
@@ -162,7 +198,7 @@ module.exports = class HanaTemplate extends require('../templateBase') {
|
|
|
162
198
|
async _updateCdsConfiguration(configPath) {
|
|
163
199
|
const projectType = await this.getProjectType();
|
|
164
200
|
const configFile = projectType === PROJECT_TYPE.nodejs ? 'package.json' : '.cdsrc.json';
|
|
165
|
-
configPath = configPath ??
|
|
201
|
+
configPath = configPath ?? join(this.projectPath, configFile)
|
|
166
202
|
const projectDescriptor = await this.projectReader.read(this.options);
|
|
167
203
|
const { for: forProfile } = projectDescriptor.cap;
|
|
168
204
|
let json; try { json = await read(configPath, 'utf8') } catch { /* ignore */ }
|
|
@@ -171,7 +207,7 @@ module.exports = class HanaTemplate extends require('../templateBase') {
|
|
|
171
207
|
const profile = forProfile ? 'profile.' : '';
|
|
172
208
|
const cdsTemplateFile = `cds.${shortcut}${profile}json.hbs`
|
|
173
209
|
const { pLanguage } = projectDescriptor.cap;
|
|
174
|
-
const cdsTemplatePath =
|
|
210
|
+
const cdsTemplatePath = join(__dirname, 'files', pLanguage, cdsTemplateFile);
|
|
175
211
|
await mergeJSON(configPath, cdsTemplatePath, projectDescriptor, { forceOverwrite: true })
|
|
176
212
|
}
|
|
177
213
|
}
|
|
@@ -1,11 +1,12 @@
|
|
|
1
|
-
Thank you for installing
|
|
1
|
+
{{- printf "Thank you for installing %s version %s." .Chart.Name .Chart.Version }}
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
{{ printf "The release %s is installed in namespace %s." .Release.Name .Release.Namespace }}
|
|
4
4
|
|
|
5
5
|
Your services are available at:
|
|
6
6
|
{{- $root := . }}
|
|
7
7
|
{{- range $name := include "cap.deploymentNames" . | split ";" }}
|
|
8
8
|
{{- $deployment := (get $root.Values $name) }}
|
|
9
9
|
{{- $ := merge (dict "name" $name "deployment" $deployment) $root }}
|
|
10
|
-
|
|
10
|
+
{{- $url := include "cap.deploymentHostFull" $ }}
|
|
11
|
+
{{ printf "%s - https://%s" $name $url }}
|
|
11
12
|
{{- end }}
|
|
@@ -14,9 +14,13 @@ Add custom env variables
|
|
|
14
14
|
Get list of deployment names
|
|
15
15
|
*/}}
|
|
16
16
|
{{- define "cap.deploymentNames" -}}
|
|
17
|
+
{{- $ := . -}}
|
|
17
18
|
{{- $defaultDeployments := (list "srv") -}}
|
|
18
|
-
{{- if .
|
|
19
|
-
{{- $
|
|
19
|
+
{{- if $.Values.sidecar -}}
|
|
20
|
+
{{- $defaultDeployments = (append $defaultDeployments "sidecar") -}}
|
|
21
|
+
{{- end -}}
|
|
22
|
+
{{- if $.Values.approuter -}}
|
|
23
|
+
{{- $defaultDeployments = (append $defaultDeployments "approuter") -}}
|
|
20
24
|
{{- end -}}
|
|
21
25
|
{{ .deploymentNames | default $defaultDeployments | join ";" }}
|
|
22
26
|
{{- end -}}
|
|
@@ -60,4 +64,23 @@ Get FQDN of a deployment
|
|
|
60
64
|
*/}}
|
|
61
65
|
{{- define "cap.deploymentHostFull" -}}
|
|
62
66
|
{{ include "cap.deploymentHost" $ }}.{{ $.Values.global.domain }}
|
|
67
|
+
{{- end -}}
|
|
68
|
+
|
|
69
|
+
{{/*
|
|
70
|
+
Backend Destinations
|
|
71
|
+
*/}}
|
|
72
|
+
{{- define "cap.approuterDestinations" -}}
|
|
73
|
+
{{- $ := . -}}
|
|
74
|
+
{{- if $.Values.approuterDestinations }}
|
|
75
|
+
{{- $destinations := list -}}
|
|
76
|
+
{{- range $destinationName, $destination := $.Values.approuterDestinations -}}
|
|
77
|
+
{{- $destination := merge (dict "name" $destinationName) $destination -}}
|
|
78
|
+
{{- $deployment := (get $.Values $destination.service) -}}
|
|
79
|
+
{{- $srv := merge (dict "name" $destination.service "destination" $destination "deployment" $deployment) $ -}}
|
|
80
|
+
{{- $destinationHost := include "cap.deploymentHostFull" $srv -}}
|
|
81
|
+
{{- $currentDestination := dict "name" $destination.name "forwardAuthToken" true "url" (print "https://" $destinationHost ) -}}
|
|
82
|
+
{{- $destinations = (append $destinations $currentDestination) -}}
|
|
83
|
+
{{- end -}}
|
|
84
|
+
{{- $destinations | toJson }}
|
|
85
|
+
{{- end -}}
|
|
63
86
|
{{- end -}}
|
|
@@ -6,6 +6,11 @@
|
|
|
6
6
|
"$id": "#/properties/srv",
|
|
7
7
|
"description": "Deployment",
|
|
8
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"
|
|
9
14
|
}
|
|
10
15
|
}
|
|
11
16
|
}
|
|
@@ -42,6 +42,33 @@
|
|
|
42
42
|
"$id": "#/properties/srv",
|
|
43
43
|
"description": "Deployment"
|
|
44
44
|
},
|
|
45
|
+
"approuter": {
|
|
46
|
+
"$id": "#/properties/approuter",
|
|
47
|
+
"description": "Deployment"
|
|
48
|
+
},
|
|
49
|
+
"approuterDestinations": {
|
|
50
|
+
"$id": "#/properties/approuterDestinations",
|
|
51
|
+
"title": "Backend Destinations for Approuter",
|
|
52
|
+
"type": "object",
|
|
53
|
+
"patternProperties": {
|
|
54
|
+
"^[-._a-zA-Z][-._a-zA-Z0-9]*$": {
|
|
55
|
+
"description": "Name of the backend Destination",
|
|
56
|
+
"required": [
|
|
57
|
+
"service"
|
|
58
|
+
],
|
|
59
|
+
"properties": {
|
|
60
|
+
"service": {
|
|
61
|
+
"type": "string",
|
|
62
|
+
"description": "Target Kubernetes service"
|
|
63
|
+
},
|
|
64
|
+
"path": {
|
|
65
|
+
"type": "string",
|
|
66
|
+
"description": "This path will be appended to the URL"
|
|
67
|
+
}
|
|
68
|
+
}
|
|
69
|
+
}
|
|
70
|
+
}
|
|
71
|
+
},
|
|
45
72
|
"auditlog": {
|
|
46
73
|
"$id": "#/properties/auditlog",
|
|
47
74
|
"$ref": "#/definitions/ServiceInstance"
|