@sap/cds-dk 9.4.2 → 9.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/CHANGELOG.md +94 -0
- package/bin/compile/index.js +1 -1
- package/bin/data-products/index.js +10 -2
- package/bin/data-products/prepare-csn.js +63 -26
- package/bin/export.js +1 -1
- package/bin/help.js +2 -3
- package/bin/import.js +13 -3
- package/bin/repl.js +7 -11
- package/bin/up.js +164 -13
- package/bin/util/containerize.js +183 -0
- package/bin/version.js +4 -4
- package/lib/bind/k8s.js +1 -1
- package/lib/build/buildTaskEngine.js +5 -2
- package/lib/build/plugin.js +1 -1
- package/lib/build/plugins/helm/files/templates/_deployment_helpers.tpl +1 -1
- package/lib/build/plugins/helm/index.js +7 -7
- package/lib/build/provider/hana/2migration.js +16 -24
- package/lib/build/provider/hana/index.js +11 -3
- package/lib/build/provider/hana/template/.hdiconfig-all +7 -1
- package/lib/build/provider/hana/template/package.json +1 -1
- package/lib/build/provider/internalBuildPlugin.js +15 -1
- package/lib/build/provider/java/index.js +12 -1
- package/lib/build/provider/mtx-sidecar/index.js +2 -1
- package/lib/build/provider/nodejs/index.js +2 -1
- package/lib/build/util.js +3 -3
- package/lib/compile/to_openapi.js +1 -5
- package/lib/import/common.js +5 -4
- package/lib/import/message.js +1 -1
- package/lib/import/odata/ParserContext.js +1 -0
- package/lib/import/odata/v4parser.js +48 -3
- package/lib/import/openapi/importOpenAPI.js +6 -1
- package/lib/init/constants.js +1 -1
- package/lib/init/index.js +15 -6
- package/lib/init/merge.js +16 -0
- package/lib/init/projectReader.js +54 -24
- package/lib/init/registries/mta.js +5 -2
- package/lib/init/registries/xs-app.js +7 -1
- package/lib/init/template/ams/index.js +1 -1
- package/lib/init/template/app-frontend/files/app-package.json.hbs +1 -7
- package/lib/init/template/app-frontend/files/ui5.yaml.hbs +20 -1
- package/lib/init/template/app-frontend/index.js +0 -4
- package/lib/init/template/application-logging/index.js +9 -14
- package/lib/init/template/approuter/files/mta.yaml.hbs +7 -2
- package/lib/init/template/approuter/index.js +21 -16
- package/lib/init/template/audit-logging/index.js +2 -2
- package/lib/init/template/cloud-logging/index.js +2 -3
- package/lib/init/template/containerize/files/containerize.yaml.hbs +17 -3
- package/lib/init/template/containerize/index.js +0 -4
- package/lib/init/template/data/as-json.js +18 -20
- package/lib/init/template/destination/index.js +0 -4
- package/lib/init/template/dynatrace/index.js +0 -2
- package/lib/init/template/github-actions/files/kyma-setup/action.yaml +0 -2
- package/lib/init/template/github-actions/files/workflows/cf.yaml.hbs +16 -1
- package/lib/init/template/github-actions/files/workflows/test.yaml.hbs +20 -0
- package/lib/init/template/github-actions/index.js +5 -8
- package/lib/init/template/hana/files/db/package.json +2 -2
- package/lib/init/template/hana/files/mta.yaml.hbs +0 -4
- package/lib/init/template/hana/index.js +5 -7
- package/lib/init/template/helm/index.js +16 -33
- package/lib/init/template/helm-unified-runtime/index.js +0 -4
- package/lib/init/template/html5-repo/files/app-package.json.hbs +1 -7
- package/lib/init/template/html5-repo/files/containerize.yaml.hbs +0 -9
- package/lib/init/template/html5-repo/files/mta.yaml.hbs +0 -7
- package/lib/init/template/html5-repo/files/ui5.yaml.hbs +20 -1
- package/lib/init/template/html5-repo/files/values.yaml.hbs +6 -0
- package/lib/init/template/html5-repo/files/xs-app.json.hbs +5 -3
- package/lib/init/template/html5-repo/index.js +8 -14
- package/lib/init/template/ias/files/values.yaml.hbs +6 -6
- package/lib/init/template/ias/index.js +14 -23
- package/lib/init/template/kyma/index.js +14 -1
- package/lib/init/template/malware-scanner/files/mta.yaml.hbs +3 -1
- package/lib/init/template/malware-scanner/files/values.yaml +3 -1
- package/lib/init/template/multitenancy/files/mta.yaml.hbs +1 -3
- package/lib/init/template/multitenancy/files/values.yaml.hbs +8 -0
- package/lib/init/template/multitenancy/index.js +10 -5
- package/lib/init/template/nodejs/files/package.json.hbs +1 -1
- package/lib/init/template/pipeline/files/app-package.json.hbs +1 -7
- package/lib/init/template/pipeline/files/ui5.yaml.hbs +20 -1
- package/lib/init/template/pipeline/index.js +6 -3
- package/lib/init/template/portal/files/mta.yaml.hbs +5 -3
- package/lib/init/template/portal/index.js +3 -6
- package/lib/init/template/sample/files/_i18n/i18n_de.properties +12 -0
- package/lib/init/template/sample/files/_i18n/i18n_en.properties +21 -0
- package/lib/init/template/sample/files/_i18n/i18n_fr.properties +20 -0
- package/lib/init/template/sample/files/_i18n/messages_de.properties +34 -0
- package/lib/init/template/sample/files/_i18n/messages_en.properties +34 -0
- package/lib/init/template/sample/files/_i18n/messages_fr.properties +34 -0
- package/lib/init/template/sample/files/app/_i18n/i18n_de.properties +0 -26
- package/lib/init/template/sample/files/app/_i18n/i18n_en.properties +8 -0
- package/lib/init/template/sample/files/app/admin-authors/fiori-service.cds +52 -0
- package/lib/init/template/sample/files/app/admin-authors/webapp/Component.js.hbs +3 -0
- package/lib/init/template/sample/files/app/admin-authors/webapp/i18n/i18n.properties +11 -0
- package/lib/init/template/sample/files/app/admin-authors/webapp/manifest.json +130 -0
- package/lib/init/template/sample/files/app/admin-books/fiori-service.cds +81 -88
- package/lib/init/template/sample/files/app/admin-books/webapp/Component.js.hbs +3 -0
- package/lib/init/template/sample/files/app/admin-books/webapp/i18n/i18n.properties +10 -2
- package/lib/init/template/sample/files/app/admin-books/webapp/manifest.json +24 -48
- package/lib/init/template/sample/files/app/appconfig/fioriSandboxConfig.json +54 -3
- package/lib/init/template/sample/files/app/browse/fiori-service.cds +30 -30
- package/lib/init/template/sample/files/app/browse/webapp/Component.js.hbs +3 -0
- package/lib/init/template/sample/files/app/browse/webapp/i18n/i18n.properties +10 -3
- package/lib/init/template/sample/files/app/browse/webapp/manifest.json +18 -23
- package/lib/init/template/sample/files/app/common.cds +126 -158
- package/lib/init/template/sample/files/app/fiori-apps.html +30 -0
- package/lib/init/template/sample/files/app/genres/fiori-service.cds +33 -0
- package/lib/init/template/sample/files/app/genres/tree-view.cds +42 -0
- package/lib/init/template/sample/files/app/genres/value-help.cds +6 -0
- package/lib/init/template/sample/files/app/genres/webapp/Component.js.hbs +3 -0
- package/lib/init/template/sample/files/app/genres/webapp/i18n/i18n.properties +4 -0
- package/lib/init/template/sample/files/app/genres/webapp/i18n/i18n_de.properties +2 -0
- package/lib/init/template/sample/files/app/genres/webapp/manifest.json +126 -0
- package/lib/init/template/sample/files/app/services.cds +6 -2
- package/lib/init/template/sample/files/db/currencies.cds +13 -0
- package/lib/init/template/sample/files/db/data/sap.capire.bookshop-Books.csv +5 -5
- package/lib/init/template/sample/files/db/data/{sap.capire.bookshop-Books_texts.csv → sap.capire.bookshop-Books.texts.csv} +4 -4
- package/lib/init/template/sample/files/db/data/sap.capire.bookshop-Genres.csv +42 -15
- package/lib/init/template/sample/files/db/data/sap.common-Currencies.csv +12 -0
- package/lib/init/template/sample/files/db/data/sap.common-Currencies.texts.csv +15 -0
- package/lib/init/template/sample/files/db/hana/index.cds +10 -0
- package/lib/init/template/sample/files/db/schema.cds +35 -22
- package/lib/init/template/sample/files/db/sqlite/index.cds +10 -0
- package/lib/init/template/sample/files/package.json.hbs +14 -1
- package/lib/init/template/sample/files/srv/access-control.cds +3 -0
- package/lib/init/template/sample/files/srv/admin-service.cds +3 -2
- package/lib/init/template/sample/files/srv/cat-service.cds +7 -11
- package/lib/init/template/sample/index.js +26 -17
- package/lib/init/template/telemetry/index.js +1 -3
- package/lib/init/template/typescript/files/package.json +1 -1
- package/lib/init/template/workzone-standard/files/mta.yaml.hbs +0 -5
- package/lib/init/template/workzone-standard/index.js +0 -1
- package/lib/init/template/xsuaa/files/mta.yaml.hbs +4 -0
- package/lib/init/template/xsuaa/index.js +5 -7
- package/lib/lint/Linter.js +10 -4
- package/lib/lint/eslintHelp.json +1 -1
- package/lib/mtx/tenant_action.js +12 -4
- package/lib/util/checksum.js +32 -0
- package/lib/util/question.js +60 -7
- package/npm-shrinkwrap.json +61 -37
- package/package.json +2 -2
- package/lib/init/template/app-frontend/files/ui5-deploy.yaml.hbs +0 -25
- package/lib/init/template/github-actions/files/cf-setup/action.yaml +0 -53
- package/lib/init/template/html5-repo/files/ui5-deploy.yaml.hbs +0 -25
- package/lib/init/template/pipeline/files/ui5-deploy.yaml.hbs +0 -25
- package/lib/init/template/sample/files/app/_i18n/i18n.properties +0 -29
- package/lib/init/template/sample/files/app/admin-books/webapp/Component.js +0 -8
- package/lib/init/template/sample/files/app/admin-books/webapp/i18n/i18n_de.properties +0 -3
- package/lib/init/template/sample/files/app/admin-books/webapp/i18n/i18n_en.properties +0 -3
- package/lib/init/template/sample/files/app/browse/webapp/Component.js +0 -7
- package/lib/init/template/sample/files/app/browse/webapp/i18n/i18n_de.properties +0 -3
- package/lib/init/template/sample/files/app/browse/webapp/i18n/i18n_en.properties +0 -4
- package/lib/init/template/sample/files/app/index.html +0 -32
|
@@ -2,11 +2,25 @@
|
|
|
2
2
|
_schema-version: '1.0'
|
|
3
3
|
repository: {{& imageRegistry}}
|
|
4
4
|
tag: latest
|
|
5
|
+
{{#hasHelmUnifiedRuntime}}
|
|
6
|
+
{{#isJava}}
|
|
5
7
|
before-all:
|
|
6
|
-
-
|
|
7
|
-
{{#isJava}}
|
|
8
|
+
- helm dependency update ./gen/chart
|
|
8
9
|
- mvn clean package -DskipTests=true --batch-mode
|
|
9
|
-
|
|
10
|
+
{{/isJava}}
|
|
11
|
+
{{/hasHelmUnifiedRuntime}}
|
|
12
|
+
{{^hasJava}}
|
|
13
|
+
{{#hasHelmUnifiedRuntime}}
|
|
14
|
+
before-all:
|
|
15
|
+
- helm dependency update ./gen/chart
|
|
16
|
+
{{/hasHelmUnifiedRuntime}}
|
|
17
|
+
{{/hasJava}}
|
|
18
|
+
{{^hasHelmUnifiedRuntime}}
|
|
19
|
+
{{#hasJava}}
|
|
20
|
+
before-all:
|
|
21
|
+
- mvn clean package -DskipTests=true --batch-mode
|
|
22
|
+
{{/hasJava}}
|
|
23
|
+
{{/hasHelmUnifiedRuntime}}
|
|
10
24
|
modules:
|
|
11
25
|
- name: {{appName}}-srv
|
|
12
26
|
build-parameters:
|
|
@@ -5,10 +5,6 @@ const { merge } = require('../../merge')
|
|
|
5
5
|
|
|
6
6
|
module.exports = class ContainerizeTemplate extends require('../../plugin') {
|
|
7
7
|
|
|
8
|
-
static help() {
|
|
9
|
-
return 'containerization using ctz CLI'
|
|
10
|
-
}
|
|
11
|
-
|
|
12
8
|
static hasInProduction () {
|
|
13
9
|
return exists('containerize.yaml')
|
|
14
10
|
}
|
|
@@ -12,7 +12,7 @@ const MAX_ASSOC_DEPTH = 5
|
|
|
12
12
|
* @param {object} csn the model
|
|
13
13
|
* @param {Number} numRecords the number of records to be created for each artifact
|
|
14
14
|
* @param {{referenceData? : Record<string, string}} options misc. options
|
|
15
|
-
* @returns {Record<string, object[]
|
|
15
|
+
* @returns {Promise<Record<string, object[]>>} the filled data
|
|
16
16
|
*/
|
|
17
17
|
const asJson = module.exports = async (data, csn, numRecords=1, options={}) => {
|
|
18
18
|
let { referenceData, contentType, artifact='entity' } = options
|
|
@@ -66,10 +66,10 @@ const asJson = module.exports = async (data, csn, numRecords=1, options={}) => {
|
|
|
66
66
|
data[name] = uniqRecords(data[name], artifact)
|
|
67
67
|
}
|
|
68
68
|
for (let [key, d] of Object.entries(data)) {
|
|
69
|
-
if (contentType === 'json' && d.deleteReference && !d.
|
|
69
|
+
if (contentType === 'json' && d.deleteReference && !d.keepReference) {
|
|
70
70
|
delete data[key]
|
|
71
71
|
}
|
|
72
|
-
delete d.
|
|
72
|
+
delete d.keepReference
|
|
73
73
|
delete d.deleteReference
|
|
74
74
|
uniqRecords(d, csn.definitions[key])
|
|
75
75
|
}
|
|
@@ -235,7 +235,10 @@ function dataForField(element, artifact, csn, record, data, parent, depth, refer
|
|
|
235
235
|
const prec = element.precision ? Math.min(Math.pow(10, element.precision - scale) - 1, Number.MAX_SAFE_INTEGER) : 100
|
|
236
236
|
const range = { from: 0, to: prec }
|
|
237
237
|
annotatedIntRange(element, range)
|
|
238
|
-
return
|
|
238
|
+
if (scale === 0) return randomIntInRange(range)
|
|
239
|
+
const intPart = randomIntInRange(range)
|
|
240
|
+
const frac = Math.floor(randomUnit() * Math.pow(10, scale))
|
|
241
|
+
return +(intPart + frac / Math.pow(10, scale)).toFixed(scale)
|
|
239
242
|
}
|
|
240
243
|
case 'cds.Double': {
|
|
241
244
|
const range = {from: 0, to: 100}
|
|
@@ -287,7 +290,7 @@ function dataForField(element, artifact, csn, record, data, parent, depth, refer
|
|
|
287
290
|
else if (!targetRecords) // target entity is not in the list of entities to be created
|
|
288
291
|
return
|
|
289
292
|
|
|
290
|
-
if (targetRecords.length > 0) { // use record generated by following
|
|
293
|
+
if (targetRecords.length > 0) { // use record generated by following association
|
|
291
294
|
targetRecord = targetRecords.at(-1) // make sure the localized record references the newly generated texts
|
|
292
295
|
} else {
|
|
293
296
|
targetRecord = fillRecord({}, randomNumber(), target, csn, data, artifact, depth+1, referenceData)
|
|
@@ -295,7 +298,7 @@ function dataForField(element, artifact, csn, record, data, parent, depth, refer
|
|
|
295
298
|
targetRecords.push(targetRecord)
|
|
296
299
|
uniqRecords(targetRecords, target)
|
|
297
300
|
}
|
|
298
|
-
if (parent && (parent.name != artifact.name)) data[target.name].
|
|
301
|
+
if (parent && (parent.name != artifact.name)) data[target.name].keepReference = true
|
|
299
302
|
}
|
|
300
303
|
}
|
|
301
304
|
|
|
@@ -371,7 +374,7 @@ asJson.randomFromReferenceData = function(entity, csn, referenceData) {
|
|
|
371
374
|
/* whether the given name matches the entity or one of its projections */
|
|
372
375
|
function matchesEntityOrProjection(name, entity, csn) {
|
|
373
376
|
if (name === entity?.name) return true
|
|
374
|
-
// follow
|
|
377
|
+
// follow simple projections
|
|
375
378
|
const p = entity?.query?.SELECT || entity?.projection
|
|
376
379
|
if (p?.from?.ref?.length === 1) {
|
|
377
380
|
if (p.from.ref[0] === name) return true
|
|
@@ -551,21 +554,13 @@ function randomDateInRange(dateRange) {
|
|
|
551
554
|
return returnDate
|
|
552
555
|
}
|
|
553
556
|
|
|
554
|
-
function randomDecimalInRange(
|
|
555
|
-
|
|
556
|
-
const min = decimalRange.from
|
|
557
|
-
const num = max === 0 ? 0 : min + (randomNumber() % (max - min))
|
|
558
|
-
let dec = randomNumber()
|
|
559
|
-
const divider = Math.pow(10, dec.toString().length)
|
|
560
|
-
dec = dec / divider
|
|
561
|
-
const returnValue = num + dec
|
|
562
|
-
return returnValue
|
|
557
|
+
function randomDecimalInRange({ from: min, to: max }) {
|
|
558
|
+
return min + randomUnit() * (max - min)
|
|
563
559
|
}
|
|
564
560
|
|
|
565
|
-
function randomIntInRange(
|
|
566
|
-
const
|
|
567
|
-
|
|
568
|
-
return min + (randomNumber() % max)
|
|
561
|
+
function randomIntInRange({ from: min, to: max }) {
|
|
562
|
+
const span = Math.max(0, max - min + 1)
|
|
563
|
+
return min + Math.floor(randomUnit() * span)
|
|
569
564
|
}
|
|
570
565
|
|
|
571
566
|
const p = 5651;
|
|
@@ -575,3 +570,6 @@ function randomNumber() {
|
|
|
575
570
|
counter = (counter * counter) % M
|
|
576
571
|
return counter;
|
|
577
572
|
}
|
|
573
|
+
function randomUnit() {
|
|
574
|
+
return randomNumber() / (M - 1) // ~[0,1]
|
|
575
|
+
}
|
|
@@ -26,10 +26,6 @@ module.exports = class DestinationTemplate extends require('../../plugin') {
|
|
|
26
26
|
const project = readProject()
|
|
27
27
|
const { addHelm, addApprouter, addMultitenancy, addHelmUnifiedRuntime, addMta, hasMta, srvPath, isJava } = project
|
|
28
28
|
|
|
29
|
-
if (addMultitenancy) {
|
|
30
|
-
await merge({ cds: { requires: { destinations:true } } }).into('mtx/sidecar/package.json')
|
|
31
|
-
}
|
|
32
|
-
|
|
33
29
|
if (addMta || (addApprouter || addMultitenancy) && hasMta) {
|
|
34
30
|
const srv = srv4(srvPath)
|
|
35
31
|
const additions = [srv, destination]
|
|
@@ -37,7 +37,6 @@ module.exports = class extends require('../../plugin') {
|
|
|
37
37
|
const additions = [dynatrace], relationships = []
|
|
38
38
|
if (addMta) {
|
|
39
39
|
const srv = srv4(srvPath)
|
|
40
|
-
additions.push(srv)
|
|
41
40
|
relationships.push({
|
|
42
41
|
insert: [dynatrace, 'name'],
|
|
43
42
|
into: [srv, 'requires', 'name']
|
|
@@ -45,7 +44,6 @@ module.exports = class extends require('../../plugin') {
|
|
|
45
44
|
}
|
|
46
45
|
if (addMultitenancy) {
|
|
47
46
|
const mtxSidecar = mtxSidecar4(isJava ? 'mtx/sidecar' : 'gen/mtx/sidecar')
|
|
48
|
-
additions.push(mtxSidecar)
|
|
49
47
|
relationships.push({
|
|
50
48
|
insert: [dynatrace, 'name'],
|
|
51
49
|
into: [mtxSidecar, 'requires', 'name']
|
|
@@ -29,7 +29,22 @@ jobs:
|
|
|
29
29
|
- uses: actions/setup-node@v5
|
|
30
30
|
with:
|
|
31
31
|
node-version: 22
|
|
32
|
-
|
|
32
|
+
{{#isJava}}
|
|
33
|
+
- uses: actions/setup-java@v5
|
|
34
|
+
with:
|
|
35
|
+
distribution: sapmachine
|
|
36
|
+
java-version: 21
|
|
37
|
+
cache: maven
|
|
38
|
+
{{#sap}}
|
|
39
|
+
- name: Install Maven
|
|
40
|
+
run: |
|
|
41
|
+
MAVEN_VERSION=3.9.6
|
|
42
|
+
curl -fsSL "https://archive.apache.org/dist/maven/maven-3/${MAVEN_VERSION}/binaries/apache-maven-${MAVEN_VERSION}-bin.tar.gz" -o maven.tgz
|
|
43
|
+
tar -xzf maven.tgz
|
|
44
|
+
echo "${PWD}/apache-maven-${MAVEN_VERSION}/bin" >> "$GITHUB_PATH"
|
|
45
|
+
{{/sap}}
|
|
46
|
+
{{/isJava}}
|
|
47
|
+
- uses: cap-js/cf-setup@v1
|
|
33
48
|
with:
|
|
34
49
|
cf-api: {{#literal}}${{ vars.CF_API }}{{/literal}}
|
|
35
50
|
cf-org: {{#literal}}${{ vars.CF_ORG }}{{/literal}}
|
|
@@ -21,4 +21,24 @@ jobs:
|
|
|
21
21
|
node-version: 22
|
|
22
22
|
- uses: actions/checkout@v5
|
|
23
23
|
- run: npm install
|
|
24
|
+
{{#isJava}}
|
|
25
|
+
- uses: actions/setup-java@v5
|
|
26
|
+
with:
|
|
27
|
+
distribution: sapmachine
|
|
28
|
+
java-version: 21
|
|
29
|
+
cache: maven
|
|
30
|
+
{{#sap}}
|
|
31
|
+
- name: Install Maven
|
|
32
|
+
run: |
|
|
33
|
+
MAVEN_VERSION=3.9.6
|
|
34
|
+
curl -fsSL "https://archive.apache.org/dist/maven/maven-3/${MAVEN_VERSION}/binaries/apache-maven-${MAVEN_VERSION}-bin.tar.gz" -o maven.tgz
|
|
35
|
+
tar -xzf maven.tgz
|
|
36
|
+
echo "${PWD}/apache-maven-${MAVEN_VERSION}/bin" >> "$GITHUB_PATH"
|
|
37
|
+
{{/sap}}
|
|
38
|
+
{{/isJava}}
|
|
39
|
+
{{#isNodejs}}
|
|
24
40
|
- run: npm test
|
|
41
|
+
{{/isNodejs}}
|
|
42
|
+
{{#isJava}}
|
|
43
|
+
- run: mvn test -B
|
|
44
|
+
{{/isJava}}
|
|
@@ -24,9 +24,11 @@ module.exports = class GitHubActionTemplate extends require('../../plugin') {
|
|
|
24
24
|
}
|
|
25
25
|
|
|
26
26
|
async run() {
|
|
27
|
+
const { hasMta, hasHelm, isJava } = readProject()
|
|
27
28
|
const test = `.github/workflows/test.yaml`
|
|
28
|
-
|
|
29
|
-
|
|
29
|
+
const { force, sap } = cds.cli.options
|
|
30
|
+
if (!exists(test) || force) {
|
|
31
|
+
await renderAndCopy(path.join(__dirname, 'files/workflows/test.yaml.hbs'), test, { sap, isJava })
|
|
30
32
|
} else {
|
|
31
33
|
console.log('> skipping ' + test)
|
|
32
34
|
}
|
|
@@ -41,8 +43,7 @@ module.exports = class GitHubActionTemplate extends require('../../plugin') {
|
|
|
41
43
|
githubSlug = '<org/repo>'
|
|
42
44
|
// console.log(`\ncould not determine GitHub URL for the project – replace '<org/repo>' in ${release}`, DEBUG ? error : '')
|
|
43
45
|
}
|
|
44
|
-
|
|
45
|
-
await renderAndCopy(path.join(__dirname, 'files/workflows/release.yaml.hbs'), release, { sap: cds.cli.options.sap, githubSlug, hasMta, hasHelm })
|
|
46
|
+
await renderAndCopy(path.join(__dirname, 'files/workflows/release.yaml.hbs'), release, { isJava, sap: cds.cli.options.sap, githubSlug, hasMta, hasHelm })
|
|
46
47
|
} else {
|
|
47
48
|
console.log('> skipping ' + release)
|
|
48
49
|
}
|
|
@@ -57,10 +58,6 @@ module.exports = class GitHubActionTemplate extends require('../../plugin') {
|
|
|
57
58
|
if (force || !exists(cf)) {
|
|
58
59
|
await renderAndCopy(path.join(__dirname, 'files/workflows/cf.yaml.hbs'), cf, project)
|
|
59
60
|
}
|
|
60
|
-
const cfSetup = '.github/actions/cf-setup'
|
|
61
|
-
if (force || !exists(cfSetup)) {
|
|
62
|
-
await copy(path.join(__dirname, 'files/cf-setup'), cfSetup)
|
|
63
|
-
}
|
|
64
61
|
}
|
|
65
62
|
if (addHelm) {
|
|
66
63
|
const kyma = '.github/workflows/kyma.yaml'
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "deploy",
|
|
3
3
|
"dependencies": {
|
|
4
|
-
"hdb": "^0",
|
|
4
|
+
"hdb": "^2.0.0",
|
|
5
5
|
"@sap/hdi-deploy": "^5"
|
|
6
6
|
},
|
|
7
7
|
"engines": {
|
|
8
|
-
"node": "^
|
|
8
|
+
"node": "^24.0.0"
|
|
9
9
|
},
|
|
10
10
|
"scripts": {
|
|
11
11
|
"start": "node node_modules/@sap/hdi-deploy/deploy.js --use-hdb --parameter com.sap.hana.di.table/try_fast_table_migration=true",
|
|
@@ -6,7 +6,6 @@ modules:
|
|
|
6
6
|
requires:
|
|
7
7
|
- name: {{appName}}-db
|
|
8
8
|
|
|
9
|
-
{{^hasMultitenancy}}
|
|
10
9
|
- name: {{appName}}-db-deployer
|
|
11
10
|
type: hdb
|
|
12
11
|
path: {{& db.path}}
|
|
@@ -20,15 +19,12 @@ modules:
|
|
|
20
19
|
{{/isJava}}
|
|
21
20
|
requires:
|
|
22
21
|
- name: {{appName}}-db
|
|
23
|
-
{{/hasMultitenancy}}
|
|
24
22
|
|
|
25
|
-
{{#hasMultitenancy}}
|
|
26
23
|
- name: {{appName}}-mtx
|
|
27
24
|
type: nodejs
|
|
28
25
|
path: {{#isNodejs}}gen/{{/isNodejs}}mtx/sidecar
|
|
29
26
|
requires:
|
|
30
27
|
- name: {{appName}}-db
|
|
31
|
-
{{/hasMultitenancy}}
|
|
32
28
|
|
|
33
29
|
resources:
|
|
34
30
|
- name: {{appName}}-db
|
|
@@ -23,8 +23,7 @@ module.exports = class HanaTemplate extends require('../../plugin') {
|
|
|
23
23
|
const { isJava, configFile, db } = project
|
|
24
24
|
project.shortcut = !exists(configFile) || typeof (await read(configFile)).cds?.requires?.db !== 'object'
|
|
25
25
|
|
|
26
|
-
//
|
|
27
|
-
await merge(__dirname, 'files/src/.hdiconfig').into(join(db.folder, 'src/.hdiconfig'))
|
|
26
|
+
// cds10: Let cds build generate this by default
|
|
28
27
|
await merge(__dirname, 'files/undeploy.json').into(join(db.folder, 'undeploy.json'))
|
|
29
28
|
|
|
30
29
|
if (isJava) {
|
|
@@ -44,9 +43,9 @@ module.exports = class HanaTemplate extends require('../../plugin') {
|
|
|
44
43
|
|
|
45
44
|
async combine() {
|
|
46
45
|
const project = readProject()
|
|
47
|
-
const { addMta, addHelm, addHelmUnifiedRuntime, addMultitenancy, addContainerize, isJava, hasHelm, hasMultitenancy, srvPath } = project
|
|
46
|
+
const { addMta, hasMta, addHelm, addHelmUnifiedRuntime, addMultitenancy, addContainerize, isJava, hasHelm, hasHelmUnifiedRuntime, hasMultitenancy, srvPath } = project
|
|
48
47
|
|
|
49
|
-
if (addMta || addMultitenancy) {
|
|
48
|
+
if (addMta || addMultitenancy && hasMta) {
|
|
50
49
|
const srv = srv4(srvPath)
|
|
51
50
|
const db = hasMultitenancy ? serviceManager : hdiContainer
|
|
52
51
|
const deletions = hasMultitenancy ? [{
|
|
@@ -82,16 +81,15 @@ module.exports = class HanaTemplate extends require('../../plugin') {
|
|
|
82
81
|
|
|
83
82
|
const modules = hasMultitenancy ? [srv] : [srv, hdbDeployer]
|
|
84
83
|
await merge(__dirname, 'files/mta.yaml.hbs').into('mta.yaml', {
|
|
85
|
-
with: project, additions: [...modules, db]
|
|
84
|
+
with: project, additions: [...modules, db], deletions, relationships
|
|
86
85
|
})
|
|
87
86
|
}
|
|
88
87
|
|
|
89
88
|
if (!hasMultitenancy && (addHelm || addHelmUnifiedRuntime)) {
|
|
90
89
|
await merge(__dirname, 'files', 'values.yaml.hbs').into('chart/values.yaml', { with: project })
|
|
91
|
-
|
|
92
90
|
}
|
|
93
91
|
|
|
94
|
-
if (addMultitenancy && hasHelm) {
|
|
92
|
+
if (addMultitenancy && (hasHelm || hasHelmUnifiedRuntime)) {
|
|
95
93
|
await merge('chart/values.yaml')
|
|
96
94
|
.remove(['hana-deployer', 'srv.bindings.db', 'hana'])
|
|
97
95
|
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
const { join } = require('path')
|
|
2
|
-
const yaml = require('yaml')
|
|
3
2
|
const cds = require('../../../cds')
|
|
4
|
-
const { exists, rimraf, copy,
|
|
3
|
+
const { readFileSync, exists, rimraf, copy, yaml } = cds.utils
|
|
5
4
|
const { readProject } = require('../../projectReader')
|
|
6
5
|
const { merge } = require('../../merge')
|
|
7
6
|
const { ask4 } = require('../../../util/question')
|
|
@@ -10,15 +9,10 @@ const { mvn } = require('../../add')
|
|
|
10
9
|
|
|
11
10
|
module.exports = class HelmTemplate extends require('../../plugin') {
|
|
12
11
|
|
|
13
|
-
static help() {
|
|
14
|
-
return 'Kyma deployment using Helm charts'
|
|
15
|
-
}
|
|
16
|
-
|
|
17
12
|
options() {
|
|
18
13
|
return {
|
|
19
14
|
'y': {
|
|
20
15
|
type: 'boolean',
|
|
21
|
-
help: 'If provided, the default values will be used for all prompts.'
|
|
22
16
|
}
|
|
23
17
|
}
|
|
24
18
|
}
|
|
@@ -37,47 +31,36 @@ module.exports = class HelmTemplate extends require('../../plugin') {
|
|
|
37
31
|
// Won't need this any more with plugin approach: package not there -> plugin not pulled
|
|
38
32
|
static hasInProduction() {
|
|
39
33
|
if (exists('chart/Chart.yaml')) {
|
|
40
|
-
const
|
|
41
|
-
const chartYaml = yaml.parseDocument(chartFile).toJS()
|
|
34
|
+
const chartYaml = yaml.parse(readFileSync(join(cds.root, 'chart', 'Chart.yaml'), 'utf8'))
|
|
42
35
|
return chartYaml.annotations?.["app.kubernetes.io/managed-by"] === 'cds-dk/helm'
|
|
43
|
-
|
|
44
|
-
|
|
36
|
+
}
|
|
37
|
+
return false
|
|
45
38
|
}
|
|
46
39
|
|
|
47
40
|
async run() {
|
|
48
41
|
const project = readProject()
|
|
49
|
-
|
|
50
|
-
project.
|
|
51
|
-
project.imagePullSecret = 'docker-registry'
|
|
52
|
-
project.tag = 'latest'
|
|
53
|
-
|
|
54
|
-
if (cds.cli.command === 'add' && !HelmTemplate.hasInProduction()) {
|
|
55
|
-
let registry = 'registry-server', tag = 'latest', domain = 'abc.com'
|
|
56
|
-
|
|
42
|
+
let imagePullSecret, registry, domain, tag
|
|
43
|
+
if (!HelmTemplate.hasInProduction() && !project.isBas /* don't run this for the BAS Yeoman generator */) {
|
|
57
44
|
try {
|
|
58
45
|
const domainGuess = execSync(`kubectl config view --minify --output jsonpath="{.clusters[*].cluster.server}"`, { stdio: "pipe" }).toString()
|
|
59
46
|
const domainStartIndex = domainGuess.indexOf('api.')
|
|
60
47
|
if (domainStartIndex !== -1) domain = domainGuess.substring(domainStartIndex + 4)
|
|
61
48
|
} catch (error) { /* ignore */ }
|
|
62
49
|
|
|
63
|
-
// read project.registry
|
|
64
50
|
if (exists('containerize.yaml')) {
|
|
65
|
-
const
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
tag = containerizeYaml.tag
|
|
51
|
+
const { repository: r, tag: t } = yaml.parse(join(cds.root, 'containerize.yaml'))
|
|
52
|
+
if (r) registry = r
|
|
53
|
+
if (t) tag = t
|
|
69
54
|
}
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
registry = registryAns || registry
|
|
55
|
+
if (!cds.cli.options.y && !cds.cli.options.force) {
|
|
56
|
+
registry ??= await ask4([`registry server: `])
|
|
57
|
+
domain ??= await ask4([`cluster domain: `])
|
|
74
58
|
}
|
|
75
|
-
|
|
76
|
-
project.domain = domain
|
|
77
|
-
project.registry = registry
|
|
78
|
-
project.tag = tag
|
|
79
59
|
}
|
|
80
|
-
|
|
60
|
+
project.registry = registry ?? '<registry-server>'
|
|
61
|
+
project.domain = domain ?? '<cluster-domain>'
|
|
62
|
+
project.imagePullSecret = imagePullSecret ?? 'docker-registry'
|
|
63
|
+
project.tag = tag ?? 'latest'
|
|
81
64
|
await copy(join(__dirname, 'files', 'values.schema.json')).to('chart/values.schema.json')
|
|
82
65
|
await merge(__dirname, 'files/Chart.yaml.hbs').into('chart/Chart.yaml', { with: project })
|
|
83
66
|
await merge(__dirname, 'files/values.yaml.hbs').into('chart/values.yaml', { with: project })
|
|
@@ -8,10 +8,6 @@ const { merge } = require('../../merge')
|
|
|
8
8
|
|
|
9
9
|
module.exports = class HelmUnifiedRuntimeTemplate extends require('../helm') {
|
|
10
10
|
|
|
11
|
-
static help() {
|
|
12
|
-
return 'Kyma deployment using Unified Runtime Helm charts'
|
|
13
|
-
}
|
|
14
|
-
|
|
15
11
|
options() {
|
|
16
12
|
return {
|
|
17
13
|
'internal-unified-runtime-charts': {
|
|
@@ -3,18 +3,12 @@
|
|
|
3
3
|
"version": "1.0.0",
|
|
4
4
|
"main": "webapp/index.html",
|
|
5
5
|
"scripts": {
|
|
6
|
-
"build": "ui5 build preload --clean-dest
|
|
7
|
-
"build-local": "ui5 build preload --clean-dest",
|
|
6
|
+
"build": "ui5 build preload --clean-dest",
|
|
8
7
|
"start": "ui5 serve"
|
|
9
8
|
},
|
|
10
9
|
"devDependencies": {
|
|
11
10
|
"@ui5/cli": "^4",
|
|
12
11
|
"ui5-task-zipper": "^3"
|
|
13
|
-
},
|
|
14
|
-
"ui5": {
|
|
15
|
-
"dependencies": [
|
|
16
|
-
"ui5-task-zipper"
|
|
17
|
-
]
|
|
18
12
|
}
|
|
19
13
|
{{/hasUI5}}
|
|
20
14
|
}
|
|
@@ -1,13 +1,4 @@
|
|
|
1
1
|
---
|
|
2
|
-
before-all:
|
|
3
|
-
{{#hasUI5}}
|
|
4
|
-
- mkdir -p app/html5-deployer/resources
|
|
5
|
-
{{#apps}}
|
|
6
|
-
- npm run build --prefix app/{{app}}
|
|
7
|
-
# zip filename should match the archiveName specified in ui5-deploy.yaml
|
|
8
|
-
- cp -f app/{{app}}/dist/{{app}}.zip app/html5-deployer/resources/{{app}}.zip
|
|
9
|
-
{{/apps}}
|
|
10
|
-
{{/hasUI5}}
|
|
11
2
|
modules:
|
|
12
3
|
- name: {{appName}}-html5-deployer
|
|
13
4
|
build-parameters:
|
|
@@ -28,13 +28,6 @@ modules:
|
|
|
28
28
|
{{#hasXsuaa}}
|
|
29
29
|
- name: {{appName}}-auth
|
|
30
30
|
{{/hasXsuaa}}
|
|
31
|
-
{{#hasIas}}
|
|
32
|
-
- name: {{appName}}-ias
|
|
33
|
-
parameters:
|
|
34
|
-
config:
|
|
35
|
-
credential-type: X509_GENERATED
|
|
36
|
-
app-identifier: app-deployer
|
|
37
|
-
{{/hasIas}}
|
|
38
31
|
- name: srv-api
|
|
39
32
|
- name: {{appName}}-html5-repo-host
|
|
40
33
|
parameters:
|
|
@@ -1,6 +1,25 @@
|
|
|
1
1
|
---
|
|
2
2
|
# yaml-language-server: $schema=https://sap.github.io/ui5-tooling/schema/ui5.yaml.json
|
|
3
|
-
specVersion: '
|
|
3
|
+
specVersion: '4.0'
|
|
4
4
|
metadata:
|
|
5
5
|
name: {{app}}
|
|
6
6
|
type: application
|
|
7
|
+
resources:
|
|
8
|
+
configuration:
|
|
9
|
+
propertiesFileSourceEncoding: UTF-8
|
|
10
|
+
builder:
|
|
11
|
+
resources:
|
|
12
|
+
excludes:
|
|
13
|
+
- "/test/**"
|
|
14
|
+
- "/localService/**"
|
|
15
|
+
customTasks:
|
|
16
|
+
- name: ui5-task-zipper
|
|
17
|
+
afterTask: generateVersionInfo
|
|
18
|
+
configuration:
|
|
19
|
+
archiveName: {{app}}
|
|
20
|
+
additionalFiles:
|
|
21
|
+
- xs-app.json
|
|
22
|
+
{{#isTypescript}}
|
|
23
|
+
- name: ui5-tooling-transpile-task
|
|
24
|
+
afterTask: replaceVersion
|
|
25
|
+
{{/isTypescript}}
|
|
@@ -7,13 +7,15 @@
|
|
|
7
7
|
"target": "/odata/$1",
|
|
8
8
|
"destination": "srv-api",
|
|
9
9
|
{{#hasXsuaa}}"authenticationType": "xsuaa",{{/hasXsuaa}}
|
|
10
|
+
{{#hasIas}}"authenticationType": "ias",{{/hasIas}}
|
|
10
11
|
"csrfProtection": true
|
|
11
12
|
},
|
|
12
13
|
{
|
|
13
14
|
"source": "^(.*)$",
|
|
14
|
-
"
|
|
15
|
-
"
|
|
16
|
-
"authenticationType": "
|
|
15
|
+
"service": "html5-apps-repo-rt",
|
|
16
|
+
{{#hasXsuaa}}"authenticationType": "xsuaa",{{/hasXsuaa}}
|
|
17
|
+
{{#hasIas}}"authenticationType": "ias",{{/hasIas}}
|
|
18
|
+
"target": "$1"
|
|
17
19
|
}
|
|
18
20
|
]
|
|
19
21
|
}
|
|
@@ -2,7 +2,7 @@ const { join } = require('path')
|
|
|
2
2
|
const { readProject } = require('../../projectReader')
|
|
3
3
|
const { merge } = require('../../merge')
|
|
4
4
|
const { srv4, html5RepoHost, html5Runtime, xsuaa, appDeployer, approuter, mtxSidecar4 } = require('../../registries/mta')
|
|
5
|
-
const { odataApi } = require('../../registries/xs-app')
|
|
5
|
+
const { odataApi, html5RepoApi } = require('../../registries/xs-app')
|
|
6
6
|
const { exists } = require('../../../cds').utils
|
|
7
7
|
const { renderAndCopy } = require('../../template')
|
|
8
8
|
|
|
@@ -38,13 +38,13 @@ module.exports = class Html5RepoTemplate extends require('../../plugin') {
|
|
|
38
38
|
const {
|
|
39
39
|
isJava, srvPath, appPath, apps,
|
|
40
40
|
hasApprouter, addApprouter, addContainerize, addMultitenancy, addWorkzoneStandard,
|
|
41
|
-
addSample, hasMta, addMta, hasXsuaa, hasMultitenancy,
|
|
41
|
+
addSample, hasMta, addMta, hasXsuaa, hasMultitenancy, addHelm, addHelmUnifiedRuntime, hasUI5
|
|
42
42
|
} = project
|
|
43
43
|
|
|
44
44
|
await Promise.all(apps.map(async ({ app }) => {
|
|
45
45
|
project.app = app
|
|
46
46
|
project.hasIndexHtml = exists(join(appPath, app, 'webapp/index.html'))
|
|
47
|
-
const additions = [odataApi]
|
|
47
|
+
const additions = [odataApi, html5RepoApi]
|
|
48
48
|
await merge(__dirname, 'files/xs-app.json.hbs').into(join(appPath, app, 'xs-app.json'), { with: project, additions })
|
|
49
49
|
await merge(__dirname, 'files/app-package.json.hbs').into(join(appPath, app, 'package.json'), { project })
|
|
50
50
|
}))
|
|
@@ -59,10 +59,6 @@ module.exports = class Html5RepoTemplate extends require('../../plugin') {
|
|
|
59
59
|
project.app = app
|
|
60
60
|
await merge(__dirname, 'files/ui5.yaml.hbs').into(join(appPath, app, 'ui5.yaml'), { project })
|
|
61
61
|
}
|
|
62
|
-
for (const { app } of apps) {
|
|
63
|
-
project.app = app
|
|
64
|
-
await merge(__dirname, 'files/ui5-deploy.yaml.hbs').into(join(appPath, app, 'ui5-deploy.yaml'), { project })
|
|
65
|
-
}
|
|
66
62
|
}
|
|
67
63
|
|
|
68
64
|
if (addMultitenancy) {
|
|
@@ -79,18 +75,12 @@ module.exports = class Html5RepoTemplate extends require('../../plugin') {
|
|
|
79
75
|
const appModules = []
|
|
80
76
|
for (const { app } of project.apps) {
|
|
81
77
|
const html5App = { in: 'modules', where: { type: 'html5', path: `${appPath}${app}` } }
|
|
82
|
-
appModules.push(html5App)
|
|
83
78
|
relationships.push({
|
|
84
79
|
insert: [html5App],
|
|
85
80
|
into: [appDeployer, 'build-parameters.requires'],
|
|
86
81
|
})
|
|
87
82
|
}
|
|
88
|
-
const additions = [srv, appDeployer, html5RepoHost, ...appModules]
|
|
89
|
-
if (hasApprouter || hasWorkzoneStandard || hasMultitenancy) {
|
|
90
|
-
additions.push(html5Runtime)
|
|
91
|
-
}
|
|
92
83
|
if (hasApprouter) {
|
|
93
|
-
additions.push(approuter)
|
|
94
84
|
relationships.push({
|
|
95
85
|
insert: [html5Runtime, 'name'],
|
|
96
86
|
into: [approuter, 'requires', 'name'],
|
|
@@ -101,6 +91,10 @@ module.exports = class Html5RepoTemplate extends require('../../plugin') {
|
|
|
101
91
|
insert: [html5Runtime, 'name'],
|
|
102
92
|
into: [isJava ? srv : mtxSidecar4('gen/mtx/sidecar'), 'requires', 'name']
|
|
103
93
|
})
|
|
94
|
+
relationships.push({
|
|
95
|
+
insert: [html5RepoHost, 'name'],
|
|
96
|
+
into: [isJava ? srv : mtxSidecar4('gen/mtx/sidecar'), 'requires', 'name']
|
|
97
|
+
})
|
|
104
98
|
}
|
|
105
99
|
if (hasXsuaa) {
|
|
106
100
|
relationships.push({
|
|
@@ -110,7 +104,7 @@ module.exports = class Html5RepoTemplate extends require('../../plugin') {
|
|
|
110
104
|
}
|
|
111
105
|
await merge(__dirname, 'files/mta.yaml.hbs').into('mta.yaml', {
|
|
112
106
|
with: project,
|
|
113
|
-
additions,
|
|
107
|
+
additions: [srv, appDeployer, html5RepoHost, ...appModules],
|
|
114
108
|
relationships
|
|
115
109
|
})
|
|
116
110
|
}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{{#hasMultitenancy}}
|
|
2
2
|
sidecar:
|
|
3
3
|
expose:
|
|
4
|
-
gateway:
|
|
4
|
+
gateway: {{#literal}}"{{ .Release.Namespace }}/kyma-mtls-gateway"{{/literal}}
|
|
5
5
|
host: {{#literal}}"{{ .Release.Name }}-sidecar-{{ .Release.Namespace }}.cert"{{/literal}}
|
|
6
6
|
bindings:
|
|
7
7
|
auth:
|
|
@@ -13,18 +13,18 @@ sidecar:
|
|
|
13
13
|
{{#hasApprouter}}
|
|
14
14
|
approuter:
|
|
15
15
|
expose:
|
|
16
|
-
gateway:
|
|
16
|
+
gateway: {{#literal}}"{{ .Release.Namespace }}/kyma-mtls-gateway"{{/literal}}
|
|
17
17
|
host: {{#literal}}"{{ .Release.Name }}-approuter-{{ .Release.Namespace }}.cert"{{/literal}}
|
|
18
18
|
bindings:
|
|
19
19
|
auth:
|
|
20
20
|
serviceInstanceName: identity
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
21
|
+
parameters:
|
|
22
|
+
credential-type: X509_GENERATED
|
|
23
|
+
app-identifier: approuter
|
|
24
24
|
{{/hasApprouter}}
|
|
25
25
|
srv:
|
|
26
26
|
expose:
|
|
27
|
-
gateway:
|
|
27
|
+
gateway: {{#literal}}"{{ .Release.Namespace }}/kyma-mtls-gateway"{{/literal}}
|
|
28
28
|
host: {{#literal}}"{{ .Release.Name }}-srv-{{ .Release.Namespace }}.cert"{{/literal}}
|
|
29
29
|
bindings:
|
|
30
30
|
auth:
|