@sap/cds-dk 7.9.5 → 8.0.2
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 +2116 -0
- package/bin/add.js +18 -52
- package/bin/bind.js +2 -2
- package/bin/build.js +29 -4
- package/bin/cds.js +23 -11
- package/bin/compile/index.js +7 -6
- package/bin/completion/index.js +70 -46
- package/bin/completion/scripts/cds-bash.sh +4 -1
- package/bin/completion/scripts/cds-fish.fish +13 -0
- package/bin/completion/scripts/cds-ps.ps1 +2 -1
- package/bin/completion/scripts/cds-zsh.sh +2 -1
- package/bin/deploy/index.js +6 -5
- package/bin/deploy/to-sqlite.js +2 -2
- package/bin/extend.js +19 -50
- package/bin/help.js +2 -2
- package/bin/init.js +10 -77
- package/bin/login.js +13 -5
- package/bin/migrate.js +1 -1
- package/bin/pull.js +11 -0
- package/bin/repl.js +3 -0
- package/bin/test.js +5 -0
- package/bin/version.js +7 -7
- package/bin/watch.js +1 -10
- package/lib/bind/KubernetesApiAccessor.js +10 -9
- package/lib/build/buildTaskEngine.js +11 -7
- package/lib/build/buildTaskFactory.js +15 -43
- package/lib/build/buildTaskProviderFactory.js +16 -44
- package/lib/build/constants.js +3 -3
- package/lib/build/index.js +2 -2
- package/lib/build/{buildPlugin.js → plugin.js} +65 -46
- package/lib/{init/template/helm/files → build/plugins/helm/files/subcharts}/content-deployment/Chart.yaml +1 -1
- package/lib/{init/template/helm/files → build/plugins/helm/files/subcharts}/content-deployment/values.yaml +1 -1
- package/lib/{init/template/helm/files → build/plugins/helm/files/subcharts}/service-instance/Chart.yaml +1 -1
- package/lib/{init/template/helm/files → build/plugins/helm/files/subcharts}/service-instance/templates/_helpers.tpl +7 -0
- package/lib/build/plugins/helm/files/subcharts/service-instance/templates/servicebinding.yaml +32 -0
- package/lib/{init/template/helm/files → build/plugins/helm/files/subcharts}/service-instance/templates/serviceinstance.yaml +3 -0
- package/lib/{init/template/helm/files → build/plugins/helm/files/subcharts}/service-instance/values.schema.json +63 -0
- package/lib/{init/template/helm/files → build/plugins/helm/files/subcharts}/service-instance/values.yaml +23 -1
- package/lib/{init/template/helm/files → build/plugins/helm/files/subcharts}/web-application/Chart.yaml +1 -1
- package/lib/{init/template/helm/files → build/plugins/helm/files/subcharts}/web-application/templates/deployment.yaml +2 -0
- package/lib/build/plugins/helm/files/subcharts/web-application/templates/hpa.yaml +22 -0
- package/lib/{init/template/helm/files → build/plugins/helm/files/subcharts}/web-application/templates/pod-disruption-budget.yaml +1 -0
- package/lib/{init/template/helm/files → build/plugins/helm/files/subcharts}/web-application/values.schema.json +49 -0
- package/lib/{init/template/helm/files → build/plugins/helm/files/subcharts}/web-application/values.yaml +8 -2
- package/lib/{init/template/helm/files/chart → build/plugins/helm/files}/templates/_deployment_helpers.tpl +5 -0
- package/lib/build/plugins/helm/files/templates/_helpers.tpl +13 -0
- package/lib/build/plugins/helm/index.js +81 -0
- package/lib/build/plugins.js +12 -15
- package/lib/build/provider/featureToggleBuildPlugin.js +7 -39
- package/lib/build/provider/hana/2migration.js +168 -124
- package/lib/build/provider/hana/index.js +20 -25
- package/lib/build/provider/hana/template/package.json +4 -3
- package/lib/build/provider/internalBuildPlugin.js +32 -97
- package/lib/build/provider/internalBuildTaskProvider.js +10 -46
- package/lib/build/provider/java/index.js +2 -3
- package/lib/build/provider/mtx/index.js +5 -4
- package/lib/build/provider/mtx-extension/index.js +5 -2
- package/lib/build/provider/mtx-sidecar/index.js +2 -2
- package/lib/build/util.js +83 -12
- package/lib/compile/to-mermaid.js +108 -0
- package/lib/compile/to_asyncapi.js +7 -0
- package/lib/compile/to_openapi.js +7 -0
- package/lib/deploy/to-hana/hana.js +37 -34
- package/lib/deploy/to-hana/hdiDeployUtil.js +8 -6
- package/lib/env/schemas/cds-rc.js +1 -1
- package/lib/import/common.js +2 -2
- package/lib/import/odata/metadataconverter/MetadataConverter.js +4 -4
- package/lib/import/odata/v2parser.js +83 -197
- package/lib/import/odata/v4parser.js +1 -38
- package/lib/import/openapi/importOpenAPI.js +164 -42
- package/lib/index.js +10 -12
- package/lib/init/bas.js +91 -0
- package/lib/init/constants.js +16 -10
- package/lib/init/index.js +72 -150
- package/lib/init/merge.js +12 -20
- package/lib/init/mvn.js +103 -150
- package/lib/init/plugin.js +11 -7
- package/lib/init/projectReader.js +53 -19
- package/lib/init/registries/mta.js +51 -6
- package/lib/init/template/application-logging/files/package.json.hbs +7 -0
- package/lib/init/template/application-logging/index.js +13 -1
- package/lib/init/template/approuter/files/containerize.yaml.hbs +10 -0
- package/lib/init/template/approuter/files/mta.yaml.hbs +1 -2
- package/lib/init/template/approuter/files/values.yaml.hbs +19 -4
- package/lib/init/template/approuter/files/xs-app.json.hbs +12 -3
- package/lib/init/template/approuter/index.js +29 -25
- package/lib/init/template/attachments/files/mta.yaml.hbs +14 -0
- package/lib/init/template/attachments/files/package.json.hbs +5 -0
- package/lib/init/template/attachments/files/values.yaml +7 -0
- package/lib/init/template/attachments/index.js +53 -0
- package/lib/init/template/audit-logging/files/mta.yaml.hbs +14 -0
- package/lib/init/template/audit-logging/files/package.json.hbs +7 -0
- package/lib/init/template/audit-logging/index.js +66 -0
- package/lib/init/template/cf-manifest/index.js +4 -0
- package/lib/init/template/completion/completionSetup.js +54 -33
- package/lib/init/template/completion/index.js +7 -1
- package/lib/init/template/connectivity/index.js +4 -4
- package/lib/init/template/containerize/files/containerize.yaml.hbs +26 -0
- package/lib/init/template/containerize/index.js +24 -0
- package/lib/init/template/data/index.js +4 -0
- package/lib/init/template/destination/files/mta.yaml.hbs +25 -1
- package/lib/init/template/destination/index.js +12 -2
- package/lib/init/template/enterprise-messaging/index.js +6 -3
- package/lib/init/template/enterprise-messaging-shared/index.js +5 -1
- package/lib/init/template/extensibility/files/package.json.hbs +1 -1
- package/lib/init/template/extensibility/files/xs-security.json.hbs +2 -8
- package/lib/init/template/extensibility/index.js +3 -1
- package/lib/init/template/file-based-messaging/index.js +4 -0
- package/lib/init/template/h2/index.js +4 -0
- package/lib/init/template/hana/files/containerize.yaml.hbs +10 -0
- package/lib/init/template/hana/files/db/package.json +3 -2
- package/lib/init/template/hana/files/package.json.hbs +4 -7
- package/lib/init/template/hana/files/values.yaml.hbs +1 -2
- package/lib/init/template/hana/index.js +15 -7
- package/lib/init/template/helm/files/Chart.yaml.hbs +2 -3
- package/lib/init/template/helm/files/values.schema.json +2173 -0
- package/lib/init/template/helm/files/values.yaml.hbs +11 -6
- package/lib/init/template/helm/index.js +77 -18
- package/lib/init/template/helm-unified-runtime/index.js +19 -56
- package/lib/init/template/html5-repo/files/app-package.json.hbs +11 -7
- package/lib/init/template/html5-repo/files/manifest.json +13 -0
- package/lib/init/template/html5-repo/files/mta.yaml.hbs +41 -8
- package/lib/init/template/html5-repo/files/ui5-deploy.yaml.hbs +21 -0
- package/lib/init/template/html5-repo/files/ui5.yaml.hbs +2 -29
- package/lib/init/template/html5-repo/files/values.yaml.hbs +6 -2
- package/lib/init/template/html5-repo/files/xs-app.json.hbs +21 -8
- package/lib/init/template/html5-repo/index.js +33 -30
- package/lib/init/template/http/index.js +36 -12
- package/lib/init/template/java/index.js +18 -12
- package/lib/init/template/kafka/index.js +4 -0
- package/lib/init/template/lint/index.js +7 -2
- package/lib/init/template/liquibase/index.js +4 -0
- package/lib/init/template/local-messaging/index.js +4 -0
- package/lib/init/template/malware-scanner/files/mta.yaml.hbs +14 -0
- package/lib/init/template/malware-scanner/files/package.json.hbs +17 -0
- package/lib/init/template/malware-scanner/files/values.yaml +7 -0
- package/lib/init/template/malware-scanner/index.js +47 -0
- package/lib/init/template/mta/files/mta.yaml.hbs +3 -3
- package/lib/init/template/mta/files/package.json +1 -1
- package/lib/init/template/mta/index.js +4 -0
- package/lib/init/template/mtx/index.js +4 -0
- package/lib/init/template/multitenancy/files/containerize.yaml.hbs +10 -0
- package/lib/init/template/multitenancy/files/mta.yaml.hbs +0 -1
- package/lib/init/template/multitenancy/files/package.json.hbs +1 -1
- package/lib/init/template/multitenancy/files/package.sidecar.json.hbs +6 -5
- package/lib/init/template/multitenancy/files/values.yaml.hbs +14 -24
- package/lib/init/template/multitenancy/index.js +50 -28
- package/lib/init/template/nodejs/files/eslint.config.mjs +2 -0
- package/lib/init/template/nodejs/files/package.json.hbs +2 -3
- package/lib/init/template/nodejs/index.js +4 -0
- package/lib/init/template/notifications/files/mta.yaml.hbs +2 -2
- package/lib/init/template/notifications/index.js +4 -0
- package/lib/init/template/pipeline/files/.pipeline/config.yml +1 -1
- package/lib/init/template/pipeline/files/Jenkinsfile +1 -1
- package/lib/init/template/pipeline/index.js +4 -0
- package/lib/init/template/portal/files/mta.yaml.hbs +52 -0
- package/lib/init/template/portal/files/package.json.hbs +11 -0
- package/lib/init/template/portal/files/package.sidecar.json +7 -0
- package/lib/init/template/portal/files/portal-site/CommonDataModel.json.hbs +97 -0
- package/lib/init/template/portal/files/portal-site/i18n/catalog.properties +1 -0
- package/lib/init/template/portal/files/portal-site/i18n/catalog_de.properties +1 -0
- package/lib/init/template/portal/files/portal-site/i18n/group.properties +1 -0
- package/lib/init/template/portal/files/portal-site/i18n/group_de.properties +1 -0
- package/lib/init/template/portal/index.js +84 -0
- package/lib/init/template/postgres/index.js +5 -1
- package/lib/init/template/redis-messaging/index.js +4 -0
- package/lib/init/template/sample/files/app/admin-books/webapp/i18n/i18n_de.properties +3 -0
- package/lib/init/template/sample/files/app/admin-books/webapp/i18n/i18n_en.properties +3 -0
- package/lib/init/template/sample/files/app/admin-books/webapp/manifest.json +13 -1
- package/lib/init/template/sample/files/app/browse/webapp/i18n/i18n.properties +2 -2
- package/lib/init/template/sample/files/app/browse/webapp/i18n/i18n_de.properties +3 -0
- package/lib/init/template/sample/files/app/browse/webapp/i18n/i18n_en.properties +4 -0
- package/lib/init/template/sample/files/app/browse/webapp/manifest.json +3 -3
- package/lib/init/template/sample/files/app/index.html +1 -1
- package/lib/init/template/sample/files/db/data/sap.capire.bookshop-Authors.csv +5 -5
- package/lib/init/template/sample/files/db/data/sap.capire.bookshop-Books.csv +6 -6
- package/lib/init/template/sample/files/db/data/sap.capire.bookshop-Books_texts.csv +5 -5
- package/lib/init/template/sample/files/db/data/sap.capire.bookshop-Genres.csv +16 -16
- package/lib/init/template/sample/files/nodejs/cat-service.js +2 -2
- package/lib/init/template/sample/files/package.json.hbs +3 -0
- package/lib/init/template/sample/index.js +16 -9
- package/lib/init/template/sqlite/index.js +4 -0
- package/lib/init/template/tiny-sample/files/nodejs/db/data/my.bookshop-Books.csv +3 -3
- package/lib/init/template/tiny-sample/files/nodejs/srv/cat-service.cds.hbs +1 -1
- package/lib/init/template/tiny-sample/index.js +4 -0
- package/lib/init/template/toggles/files/package.json.hbs +1 -1
- package/lib/init/template/toggles/index.js +4 -0
- package/lib/init/template/typer/index.js +4 -0
- package/lib/init/template/typescript/files/package.json +12 -0
- package/lib/init/template/typescript/files/tsconfig.json +13 -0
- package/lib/init/template/typescript/index.js +39 -0
- package/lib/init/template/workzone/index.js +5 -0
- package/lib/init/template/workzone-standard/files/manifest.json.hbs +6 -0
- package/lib/init/template/workzone-standard/index.js +30 -0
- package/lib/init/template/xsuaa/files/package.json.hbs +1 -1
- package/lib/init/template/xsuaa/files/values.yaml.hbs +3 -2
- package/lib/init/template/xsuaa/index.js +11 -7
- package/lib/init/validate.js +27 -0
- package/lib/lint/generators.js +1 -1
- package/lib/lint/io.js +25 -7
- package/lib/mtx/auth_manager.js +64 -30
- package/lib/mtx/download_legacy.js +2 -2
- package/lib/mtx/index.js +0 -4
- package/lib/mtx/params.js +32 -38
- package/lib/mtx/pull.js +151 -43
- package/lib/mtx/push.js +3 -3
- package/lib/mtx/settings_manager.js +75 -35
- package/lib/mtx/tenant_action.js +1 -1
- package/lib/mtx/util/cf.js +1 -1
- package/lib/mtx/util/fs.js +26 -1
- package/lib/mtx/util/logging.js +7 -3
- package/lib/util/command.js +0 -2
- package/lib/util/fs.js +2 -3
- package/lib/util/question.js +28 -0
- package/lib/util/term.js +5 -3
- package/npm-shrinkwrap.json +226 -1087
- package/package.json +13 -8
- package/bin/activate.js +0 -77
- package/lib/compile/asyncapi/channels.js +0 -22
- package/lib/compile/asyncapi/components/messageTraits/index.js +0 -89
- package/lib/compile/asyncapi/components/messages/index.js +0 -173
- package/lib/compile/asyncapi/components/schemas/annotations.js +0 -33
- package/lib/compile/asyncapi/components/schemas/array.js +0 -8
- package/lib/compile/asyncapi/components/schemas/cache.js +0 -14
- package/lib/compile/asyncapi/components/schemas/definition.js +0 -187
- package/lib/compile/asyncapi/components/schemas/enum.js +0 -16
- package/lib/compile/asyncapi/components/schemas/examples.js +0 -10
- package/lib/compile/asyncapi/components/schemas/index.js +0 -14
- package/lib/compile/asyncapi/components/schemas/localized.js +0 -29
- package/lib/compile/asyncapi/components/schemas/primitiveElement.js +0 -41
- package/lib/compile/asyncapi/components/schemas/ref.js +0 -45
- package/lib/compile/asyncapi/components/schemas/utils.js +0 -108
- package/lib/compile/asyncapi/index.js +0 -247
- package/lib/compile/asyncapi/message.js +0 -13
- package/lib/compile/asyncapi/utils.js +0 -27
- package/lib/compile/openapi/csdl2openapi.js +0 -2448
- package/lib/compile/openapi/index.js +0 -68
- package/lib/init/template/helm/files/chart/templates/NOTES.txt +0 -14
- package/lib/init/template/helm/files/chart/templates/_helpers.tpl +0 -28
- package/lib/init/template/helm/files/chart/values.root.schema.json +0 -61
- package/lib/init/template/helm/files/chart/values.schema.json +0 -366
- package/lib/init/template/helm-unified-runtime/files/Chart.yaml.hbs +0 -10
- package/lib/init/template/helm-unified-runtime/files/templates/_deployment_helpers.tpl +0 -90
- package/lib/init/template/helm-unified-runtime/files/templates/_helpers.tpl +0 -28
- package/lib/init/template/helm-unified-runtime/files/values.root.schema.json +0 -61
- package/lib/init/template/helm-unified-runtime/files/values.schema.json +0 -366
- package/lib/init/template/helm-unified-runtime/files/values.yaml.hbs +0 -26
- package/lib/init/template/helm-unified-runtime/package.json +0 -4
- package/lib/init/template/multitenancy/files/mtxs-configmap-java-approuter.yaml +0 -20
- package/lib/init/template/multitenancy/files/mtxs-configmap-java.yaml +0 -18
- package/lib/init/template/multitenancy/files/mtxs-configmap-nodejs-approuter.yaml +0 -12
- package/lib/init/template/multitenancy/files/mtxs-configmap-nodejs.yaml +0 -12
- package/lib/init/template/multitenancy/files/saas-registry-secret.yaml +0 -9
- package/lib/init/template/nodejs/files/eslint.config.js +0 -13
- package/lib/init/template/notebook/index.js +0 -11
- package/lib/init/template/samples/index.js +0 -9
- package/lib/mtx/activate.js +0 -238
- package/lib/mtx/extend.js +0 -173
- package/lib/util/exec.d.ts +0 -54
- package/lib/util/exec.js +0 -211
- /package/lib/{init/template/approuter/files → build/plugins/helm/files/plugins/approuter}/approuter-configmap.yaml +0 -0
- /package/lib/{init/template/connectivity/files → build/plugins/helm/files/plugins/connectivity}/connectivity-proxy-info.yaml +0 -0
- /package/lib/{init/template/html5-repo/files → build/plugins/helm/files/plugins/html5-repo}/html5-apps-deployer-configmap.yaml +0 -0
- /package/lib/{init/template/helm/files → build/plugins/helm/files/subcharts}/content-deployment/templates/_helpers.tpl +0 -0
- /package/lib/{init/template/helm/files → build/plugins/helm/files/subcharts}/content-deployment/templates/job.yaml +0 -0
- /package/lib/{init/template/helm/files → build/plugins/helm/files/subcharts}/content-deployment/templates/secret.yaml +0 -0
- /package/lib/{init/template/helm/files → build/plugins/helm/files/subcharts}/content-deployment/templates/service-account.yaml +0 -0
- /package/lib/{init/template/helm/files → build/plugins/helm/files/subcharts}/content-deployment/templates/service-binding.yaml +0 -0
- /package/lib/{init/template/helm/files → build/plugins/helm/files/subcharts}/content-deployment/values.schema.json +0 -0
- /package/lib/{init/template/helm/files → build/plugins/helm/files/subcharts}/web-application/templates/NOTES.txt +0 -0
- /package/lib/{init/template/helm/files → build/plugins/helm/files/subcharts}/web-application/templates/_api.tpl +0 -0
- /package/lib/{init/template/helm/files → build/plugins/helm/files/subcharts}/web-application/templates/_helpers.tpl +0 -0
- /package/lib/{init/template/helm/files → build/plugins/helm/files/subcharts}/web-application/templates/api-rule.yaml +0 -0
- /package/lib/{init/template/helm/files → build/plugins/helm/files/subcharts}/web-application/templates/network-policy.yaml +0 -0
- /package/lib/{init/template/helm/files → build/plugins/helm/files/subcharts}/web-application/templates/rbac.yaml +0 -0
- /package/lib/{init/template/helm/files → build/plugins/helm/files/subcharts}/web-application/templates/secret.yaml +0 -0
- /package/lib/{init/template/helm/files → build/plugins/helm/files/subcharts}/web-application/templates/service-account.yaml +0 -0
- /package/lib/{init/template/helm/files → build/plugins/helm/files/subcharts}/web-application/templates/service-binding.yaml +0 -0
- /package/lib/{init/template/helm/files → build/plugins/helm/files/subcharts}/web-application/templates/service.yaml +0 -0
- /package/lib/{init/template/helm/files → build/plugins/helm/files/subcharts}/web-application/templates/virtual-service.yaml +0 -0
- /package/lib/{init/template/helm-unified-runtime → build/plugins/helm}/files/templates/NOTES.txt +0 -0
- /package/lib/init/template/{nodejs/files → java}/.cdsrc.json +0 -0
- /package/lib/init/template/tiny-sample/files/nodejs/db/{data-model.cds → schema.cds} +0 -0
|
@@ -1,12 +1,17 @@
|
|
|
1
1
|
---
|
|
2
|
+
# yaml-language-server: $schema=./values.schema.json
|
|
3
|
+
|
|
2
4
|
global:
|
|
3
|
-
domain:
|
|
4
|
-
imagePullSecret:
|
|
5
|
+
domain: {{{domain}}}
|
|
6
|
+
imagePullSecret:
|
|
7
|
+
name: {{{imagePullSecret}}}
|
|
8
|
+
image:
|
|
9
|
+
registry: {{{registry}}}
|
|
10
|
+
tag: {{{tag}}}
|
|
5
11
|
srv:
|
|
6
12
|
bindings: {}
|
|
7
13
|
image:
|
|
8
|
-
repository:
|
|
9
|
-
tag: latest
|
|
14
|
+
repository: {{appName}}-srv
|
|
10
15
|
{{#isJava}}
|
|
11
16
|
env:
|
|
12
17
|
SPRING_PROFILES_ACTIVE: cloud
|
|
@@ -21,6 +26,6 @@ srv:
|
|
|
21
26
|
memory: {{#isJava}}1G{{/isJava}}{{^isJava}}500M{{/isJava}}
|
|
22
27
|
health:
|
|
23
28
|
liveness:
|
|
24
|
-
path: {{#isJava}}/{{/isJava}}{{^isJava}}/health{{/isJava}}
|
|
29
|
+
path: {{#isJava}}/actuator/health{{/isJava}}{{^isJava}}/health{{/isJava}}
|
|
25
30
|
readiness:
|
|
26
|
-
path: {{#isJava}}/{{/isJava}}{{^isJava}}/health{{/isJava}}
|
|
31
|
+
path: {{#isJava}}/actuator/health{{/isJava}}{{^isJava}}/health{{/isJava}}
|
|
@@ -1,48 +1,105 @@
|
|
|
1
|
-
const { join } = require('path')
|
|
1
|
+
const { join } = require('path')
|
|
2
2
|
const cds = require('../../../cds')
|
|
3
|
-
const { exists, rimraf, copy } = cds.utils
|
|
4
|
-
const { readProject } = require('../../projectReader')
|
|
3
|
+
const { exists, rimraf, copy, readFileSync, yaml } = cds.utils
|
|
4
|
+
const { readProject } = require('../../projectReader')
|
|
5
5
|
const { merge } = require('../../merge')
|
|
6
|
+
const { ask4 } = require('../../../util/question')
|
|
7
|
+
const { execSync } = require('child_process')
|
|
6
8
|
|
|
7
9
|
module.exports = class HelmTemplate extends require('../../plugin') {
|
|
8
10
|
|
|
11
|
+
static help() {
|
|
12
|
+
return 'Kyma deployment using Helm charts'
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
options() {
|
|
16
|
+
return {
|
|
17
|
+
'y': {
|
|
18
|
+
type: 'boolean',
|
|
19
|
+
help: 'If provided, the default values will be used for all prompts.'
|
|
20
|
+
}
|
|
21
|
+
}
|
|
22
|
+
}
|
|
23
|
+
|
|
9
24
|
async canRun() {
|
|
25
|
+
const hasInProduction = HelmTemplate.hasInProduction()
|
|
10
26
|
if (cds.cli.options.force) {
|
|
11
27
|
await rimraf(join('chart'))
|
|
12
28
|
return true
|
|
29
|
+
} else if (exists(join(cds.root, 'chart')) && !hasInProduction) {
|
|
30
|
+
throw `Chart already exists. Use --force to overwrite.`
|
|
13
31
|
}
|
|
14
32
|
return true
|
|
15
33
|
}
|
|
16
34
|
|
|
17
35
|
// Won't need this any more with plugin approach: package not there -> plugin not pulled
|
|
18
36
|
static hasInProduction() {
|
|
19
|
-
|
|
20
|
-
|
|
37
|
+
if (exists('chart/Chart.yaml')) {
|
|
38
|
+
const chartFile = readFileSync(join(cds.root, 'chart', 'Chart.yaml'), 'utf8')
|
|
39
|
+
const chartYaml = yaml.parseDocument(chartFile).toJS()
|
|
40
|
+
return chartYaml.annotations?.["app.kubernetes.io/managed-by"] === 'cds-dk/helm'
|
|
41
|
+
}
|
|
42
|
+
return false
|
|
21
43
|
}
|
|
22
44
|
|
|
23
45
|
async run() {
|
|
24
46
|
const project = readProject()
|
|
25
|
-
|
|
47
|
+
project.domain = 'abc.com'
|
|
48
|
+
project.registry = 'registry-name'
|
|
49
|
+
project.imagePullSecret = 'docker-registry'
|
|
50
|
+
project.tag = 'latest'
|
|
51
|
+
|
|
52
|
+
if (cds.cli.command == 'add' && !HelmTemplate.hasInProduction()) {
|
|
53
|
+
let registry = 'registry-name', tag = 'latest', domain = 'abc.com'
|
|
54
|
+
|
|
55
|
+
// read domain using kubectl
|
|
56
|
+
try {
|
|
57
|
+
const domainCmd = execSync(`kubectl config view --minify --output jsonpath="{.clusters[*].cluster.server}"`, { stdio: "pipe" }).toString()
|
|
58
|
+
const domainStartIndex = domainCmd.indexOf('api.')
|
|
59
|
+
if (domainStartIndex !== -1) {
|
|
60
|
+
domain = domainCmd.substring(domainStartIndex + 4)
|
|
61
|
+
}
|
|
62
|
+
} catch (error) {
|
|
63
|
+
// ignore
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
// read project.registry
|
|
67
|
+
if (exists('containerize.yaml')) {
|
|
68
|
+
const containerizeYamlFile = readFileSync(join(cds.root, 'containerize.yaml'), 'utf8')
|
|
69
|
+
const containerizYaml = yaml.parseDocument(containerizeYamlFile).toJS()
|
|
70
|
+
registry = containerizYaml.repository
|
|
71
|
+
tag = containerizYaml.tag
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
let imagePullSecretInput = 'docker-registry'
|
|
75
|
+
if (!cds.cli.options['y']) {
|
|
76
|
+
const [domainAns, imagePullSecretAns, registryAns] = await ask4(`domain: (${domain}) `, 'imagePullSecret: (docker-registry) ', `registry: (${registry}) `)
|
|
77
|
+
|
|
78
|
+
domain = domainAns || domain
|
|
79
|
+
imagePullSecretInput = imagePullSecretAns || imagePullSecretInput
|
|
80
|
+
registry = registryAns || registry
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
project.domain = domain
|
|
84
|
+
project.imagePullSecret = imagePullSecretInput
|
|
85
|
+
project.registry = registry
|
|
86
|
+
project.tag = tag
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
await copy(join(__dirname, 'files', 'values.schema.json')).to('chart/values.schema.json')
|
|
26
90
|
await merge(__dirname, 'files/Chart.yaml.hbs').into('chart/Chart.yaml', { with: project })
|
|
27
91
|
await merge(__dirname, 'files/values.yaml.hbs').into('chart/values.yaml', { with: project })
|
|
28
92
|
await this._mergeDependency('web-application', 'srv')
|
|
29
|
-
|
|
30
|
-
await copy(join(__dirname, 'files', 'web-application')).to('chart/charts/web-application')
|
|
31
93
|
}
|
|
32
94
|
|
|
33
95
|
async combine() {
|
|
34
|
-
const { hasDestination, hasEnterpriseMessaging, hasHana, hasMultitenancy, hasXsuaa, hasHtml5Repo, hasApprouter, hasKafka } = readProject()
|
|
35
|
-
let hasContentDeployment = false
|
|
96
|
+
const { hasDestination, hasEnterpriseMessaging, hasEnterpriseMessagingShared, hasHana, hasMultitenancy, hasXsuaa, hasHtml5Repo, hasApprouter, hasKafka, hasAttachments, hasMalwareScanner } = readProject()
|
|
36
97
|
|
|
37
|
-
if (!exists('chart/charts/service-instance') && (hasHtml5Repo || hasMultitenancy || hasDestination || hasEnterpriseMessaging || hasXsuaa || hasHana || hasKafka)) {
|
|
38
|
-
await copy(join(__dirname, 'files', 'service-instance')).to('chart/charts/service-instance')
|
|
39
|
-
}
|
|
40
98
|
if (hasApprouter) {
|
|
41
99
|
await this._mergeDependency('web-application', 'approuter')
|
|
42
100
|
}
|
|
43
101
|
|
|
44
102
|
if (hasHtml5Repo) {
|
|
45
|
-
hasContentDeployment = true
|
|
46
103
|
await this._mergeDependency('service-instance', 'html5-apps-repo-host')
|
|
47
104
|
await this._mergeDependency('content-deployment', 'html5-apps-deployer')
|
|
48
105
|
if (hasApprouter) {
|
|
@@ -56,7 +113,10 @@ module.exports = class HelmTemplate extends require('../../plugin') {
|
|
|
56
113
|
if (hasDestination) {
|
|
57
114
|
await this._mergeDependency('service-instance', 'destination')
|
|
58
115
|
}
|
|
59
|
-
if (
|
|
116
|
+
if (hasAttachments) {
|
|
117
|
+
await this._mergeDependency('service-instance', 'attachments')
|
|
118
|
+
}
|
|
119
|
+
if (hasEnterpriseMessaging || hasEnterpriseMessagingShared) {
|
|
60
120
|
await this._mergeDependency('service-instance', 'event-mesh')
|
|
61
121
|
}
|
|
62
122
|
if (hasXsuaa) {
|
|
@@ -66,7 +126,6 @@ module.exports = class HelmTemplate extends require('../../plugin') {
|
|
|
66
126
|
if (hasMultitenancy) {
|
|
67
127
|
await this._mergeDependency('service-instance', 'service-manager')
|
|
68
128
|
} else {
|
|
69
|
-
hasContentDeployment = true
|
|
70
129
|
await this._mergeDependency('service-instance', 'hana')
|
|
71
130
|
await this._mergeDependency('content-deployment', 'hana-deployer')
|
|
72
131
|
}
|
|
@@ -74,8 +133,8 @@ module.exports = class HelmTemplate extends require('../../plugin') {
|
|
|
74
133
|
if (hasKafka) {
|
|
75
134
|
await this._mergeDependency('service-instance', 'kafka')
|
|
76
135
|
}
|
|
77
|
-
if(
|
|
78
|
-
await
|
|
136
|
+
if (hasMalwareScanner) {
|
|
137
|
+
await this._mergeDependency('service-instance', 'malware-scanner')
|
|
79
138
|
}
|
|
80
139
|
}
|
|
81
140
|
|
|
@@ -1,9 +1,13 @@
|
|
|
1
1
|
const cds = require('../../..')
|
|
2
|
-
const {
|
|
2
|
+
const { rimraf, exists, readFileSync, yaml } = cds.utils
|
|
3
3
|
const { join } = require('path')
|
|
4
4
|
const { merge, readProject } = cds.add ?? {}
|
|
5
5
|
|
|
6
|
-
module.exports = class HelmUnifiedRuntimeTemplate extends require('
|
|
6
|
+
module.exports = class HelmUnifiedRuntimeTemplate extends require('../helm') {
|
|
7
|
+
|
|
8
|
+
static help() {
|
|
9
|
+
return 'Kyma deployment using Unified Runtime Helm charts'
|
|
10
|
+
}
|
|
7
11
|
|
|
8
12
|
options() {
|
|
9
13
|
return {
|
|
@@ -14,68 +18,27 @@ module.exports = class HelmUnifiedRuntimeTemplate extends require('../../plugin'
|
|
|
14
18
|
}
|
|
15
19
|
|
|
16
20
|
async canRun() {
|
|
21
|
+
const hasInProduction = HelmUnifiedRuntimeTemplate.hasInProduction()
|
|
17
22
|
if (cds.cli.options.force) {
|
|
18
|
-
|
|
19
|
-
|
|
23
|
+
await rimraf(join('chart'))
|
|
24
|
+
return true
|
|
25
|
+
} else if (exists(join(cds.root, 'chart')) && !hasInProduction) {
|
|
26
|
+
throw `Chart already exists. Use --force to overwrite.`
|
|
20
27
|
}
|
|
21
28
|
return true
|
|
22
29
|
}
|
|
23
30
|
|
|
24
31
|
static hasInProduction() {
|
|
25
|
-
|
|
26
|
-
return chart.includes('https://int.repositories.cloud.sap/artifactory/virtual-unified-runtime-helm-dmz') || cds.cli.options.add.has('helm-unified-runtime')
|
|
27
|
-
}
|
|
28
|
-
|
|
29
|
-
async run() {
|
|
30
|
-
const project = readProject()
|
|
31
|
-
|
|
32
|
-
await merge(__dirname, 'files/Chart.yaml.hbs').into('chart/Chart.yaml', { with: project })
|
|
33
|
-
await merge(__dirname, 'files/values.yaml.hbs').into('chart/values.yaml', { with: project })
|
|
34
|
-
|
|
35
|
-
await copy(join(__dirname, 'files', 'templates')).to('chart/templates') // REVISIT: Move to build
|
|
36
|
-
await copy(join(__dirname, 'files', 'values.schema.json')).to('chart/values.schema.json') // REVISIT: Move to build (if possible)
|
|
37
|
-
await copy(join(__dirname, 'files', 'values.root.schema.json')).to('chart/values.root.schema.json') // REVISIT: Move to build (if possible)
|
|
38
|
-
|
|
39
|
-
await this._mergeDependency('web-application', 'srv')
|
|
40
|
-
}
|
|
41
|
-
|
|
42
|
-
async combine() {
|
|
43
|
-
const { hasDestination, hasEnterpriseMessaging, hasHana, hasMultitenancy, hasXsuaa, hasHtml5Repo, hasApprouter, hasKafka } = readProject()
|
|
32
|
+
if (cds.cli.options?.add?.has('helm-unified-runtime')) return true
|
|
44
33
|
|
|
45
|
-
if (
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
await this._mergeDependency('content-deployment', 'html5-apps-deployer')
|
|
51
|
-
if (hasApprouter) {
|
|
52
|
-
await this._mergeDependency('service-instance', 'html5-apps-repo-runtime')
|
|
53
|
-
}
|
|
54
|
-
}
|
|
55
|
-
if (hasMultitenancy) {
|
|
56
|
-
await this._mergeDependency('web-application', 'sidecar')
|
|
57
|
-
await this._mergeDependency('service-instance', 'saas-registry')
|
|
58
|
-
}
|
|
59
|
-
if (hasDestination) {
|
|
60
|
-
await this._mergeDependency('service-instance', 'destination')
|
|
61
|
-
}
|
|
62
|
-
if (hasEnterpriseMessaging) {
|
|
63
|
-
await this._mergeDependency('service-instance', 'event-mesh')
|
|
64
|
-
}
|
|
65
|
-
if (hasXsuaa) {
|
|
66
|
-
await this._mergeDependency('service-instance', 'xsuaa')
|
|
67
|
-
}
|
|
68
|
-
if (hasKafka) {
|
|
69
|
-
await this._mergeDependency('service-instance', 'kafka')
|
|
70
|
-
}
|
|
71
|
-
if (hasHana) {
|
|
72
|
-
if (hasMultitenancy) {
|
|
73
|
-
await this._mergeDependency('service-instance', 'service-manager')
|
|
74
|
-
} else {
|
|
75
|
-
await this._mergeDependency('service-instance', 'hana')
|
|
76
|
-
await this._mergeDependency('content-deployment', 'hana-deployer')
|
|
77
|
-
}
|
|
34
|
+
if (exists(join(cds.root, 'chart', 'Chart.yaml'))) {
|
|
35
|
+
const chartFile = readFileSync(join(cds.root, 'chart', 'Chart.yaml'), 'utf8')
|
|
36
|
+
const chartYaml = yaml.parseDocument(chartFile).toJS()
|
|
37
|
+
return chartYaml.annotations?.['app.kubernetes.io/managed-by'] === 'cds-dk/helm'
|
|
38
|
+
&& chartYaml.dependencies?.find(dep => dep.name === 'web-application')?.repository !== undefined
|
|
78
39
|
}
|
|
40
|
+
|
|
41
|
+
return false
|
|
79
42
|
}
|
|
80
43
|
|
|
81
44
|
async _mergeDependency(name, alias) {
|
|
@@ -1,16 +1,20 @@
|
|
|
1
1
|
{
|
|
2
|
-
"name": "{{app}}",
|
|
2
|
+
"name": "{{app}}"{{#hasUI5}},
|
|
3
3
|
"version": "1.0.0",
|
|
4
|
-
"private": true,
|
|
5
|
-
"description": "<description>",
|
|
6
4
|
"main": "webapp/index.html",
|
|
7
5
|
"scripts": {
|
|
8
|
-
"build": "ui5 build preload --clean-dest --
|
|
6
|
+
"build": "ui5 build preload --clean-dest --config ui5-deploy.yaml",
|
|
7
|
+
"build-local": "ui5 build preload --clean-dest",
|
|
9
8
|
"start": "ui5 serve"
|
|
10
9
|
},
|
|
11
10
|
"devDependencies": {
|
|
12
|
-
"@ui5/cli": "^3
|
|
13
|
-
"ui5-
|
|
14
|
-
|
|
11
|
+
"@ui5/cli": "^3",
|
|
12
|
+
"ui5-task-zipper": "^3"
|
|
13
|
+
},
|
|
14
|
+
"ui5": {
|
|
15
|
+
"dependencies": [
|
|
16
|
+
"ui5-task-zipper"
|
|
17
|
+
]
|
|
15
18
|
}
|
|
19
|
+
{{/hasUI5}}
|
|
16
20
|
}
|
|
@@ -1,4 +1,6 @@
|
|
|
1
1
|
---
|
|
2
|
+
parameters:
|
|
3
|
+
deploy_mode: html5-repo
|
|
2
4
|
modules:
|
|
3
5
|
- name: {{appName}}-srv
|
|
4
6
|
type: {{language}}
|
|
@@ -10,26 +12,25 @@ modules:
|
|
|
10
12
|
requires:
|
|
11
13
|
- name: {{appName}}-html5-runtime
|
|
12
14
|
|
|
13
|
-
- name: {{appName}}-app-
|
|
15
|
+
- name: {{appName}}-app-deployer
|
|
14
16
|
type: com.sap.application.content
|
|
15
|
-
path: {{
|
|
17
|
+
path: {{#isNodejs}}gen{{/isNodejs}}{{#isJava}}.{{/isJava}}
|
|
16
18
|
requires:
|
|
17
|
-
- name: {{appName}}-destination
|
|
18
19
|
- name: {{appName}}-html5-repo-host
|
|
19
20
|
parameters:
|
|
20
21
|
content-target: true
|
|
21
22
|
build-parameters:
|
|
22
|
-
build-result: resources
|
|
23
|
+
build-result: {{#isNodejs}}{{& appPath }}{{/isNodejs}}{{#isJava}}resources{{/isJava}}
|
|
23
24
|
requires:
|
|
24
25
|
{{#apps}}
|
|
25
|
-
- name: {{
|
|
26
|
+
- name: {{strippedAppName}}{{strippedApp}}
|
|
26
27
|
artifacts:
|
|
27
28
|
- {{app}}.zip
|
|
28
|
-
target-path: resources/
|
|
29
|
+
target-path: {{#isNodejs}}{{& appPath }}{{/isNodejs}}{{#isJava}}resources{{/isJava}}
|
|
29
30
|
{{/apps}}
|
|
30
31
|
|
|
31
32
|
{{#apps}}
|
|
32
|
-
- name: {{
|
|
33
|
+
- name: {{strippedAppName}}{{strippedApp}}
|
|
33
34
|
type: html5
|
|
34
35
|
path: {{& appPath}}{{app}}
|
|
35
36
|
build-parameters:
|
|
@@ -41,6 +42,38 @@ modules:
|
|
|
41
42
|
supported-platforms: []
|
|
42
43
|
{{/apps}}
|
|
43
44
|
|
|
45
|
+
- name: {{appName}}-destinations
|
|
46
|
+
type: com.sap.application.content
|
|
47
|
+
requires:
|
|
48
|
+
- name: {{appName}}-auth
|
|
49
|
+
parameters:
|
|
50
|
+
service-key:
|
|
51
|
+
name: {{appName}}-auth-key
|
|
52
|
+
- name: {{appName}}-html5-repo-host
|
|
53
|
+
parameters:
|
|
54
|
+
service-key:
|
|
55
|
+
name: {{appName}}-html5-repo-host-key
|
|
56
|
+
- name: srv-api
|
|
57
|
+
- name: {{appName}}-destination
|
|
58
|
+
parameters:
|
|
59
|
+
content-target: true
|
|
60
|
+
build-parameters:
|
|
61
|
+
no-source: true
|
|
62
|
+
parameters:
|
|
63
|
+
content:
|
|
64
|
+
instance:
|
|
65
|
+
existing_destinations_policy: update
|
|
66
|
+
destinations:
|
|
67
|
+
- Name: {{appName}}-html5-repository
|
|
68
|
+
ServiceInstanceName: {{appName}}-html5-repo-host
|
|
69
|
+
ServiceKeyName: {{appName}}-html5-repo-host-key
|
|
70
|
+
sap.cloud.service: {{appName}}.service
|
|
71
|
+
- Name: {{appName}}-auth
|
|
72
|
+
Authentication: OAuth2UserTokenExchange
|
|
73
|
+
ServiceInstanceName: {{appName}}-auth
|
|
74
|
+
ServiceKeyName: {{appName}}-auth-key
|
|
75
|
+
sap.cloud.service: {{appName}}.service
|
|
76
|
+
|
|
44
77
|
resources:
|
|
45
78
|
{{#hasApprouter}}
|
|
46
79
|
- name: {{appName}}-html5-runtime
|
|
@@ -67,7 +100,7 @@ resources:
|
|
|
67
100
|
instance:
|
|
68
101
|
existing_destinations_policy: update
|
|
69
102
|
destinations:
|
|
70
|
-
- Name: {{appName}}-srv
|
|
103
|
+
- Name: {{appName}}-srv-api
|
|
71
104
|
URL: ~{srv-api/srv-url}
|
|
72
105
|
Authentication: NoAuthentication
|
|
73
106
|
Type: HTTP
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
---
|
|
2
|
+
# yaml-language-server: $schema=https://sap.github.io/ui5-tooling/schema/ui5.yaml.json
|
|
3
|
+
specVersion: '3.1'
|
|
4
|
+
metadata:
|
|
5
|
+
name: {{app}}
|
|
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
|
|
@@ -1,33 +1,6 @@
|
|
|
1
1
|
---
|
|
2
2
|
# yaml-language-server: $schema=https://sap.github.io/ui5-tooling/schema/ui5.yaml.json
|
|
3
|
-
specVersion:
|
|
3
|
+
specVersion: '3.1'
|
|
4
4
|
metadata:
|
|
5
|
-
name:
|
|
5
|
+
name: {{app}}
|
|
6
6
|
type: application
|
|
7
|
-
|
|
8
|
-
resources:
|
|
9
|
-
configuration:
|
|
10
|
-
propertiesFileSourceEncoding: UTF-8
|
|
11
|
-
|
|
12
|
-
builder:
|
|
13
|
-
resources:
|
|
14
|
-
excludes:
|
|
15
|
-
- "/test/**"
|
|
16
|
-
- "/localService/**"
|
|
17
|
-
customTasks:
|
|
18
|
-
- name: ui5-task-zipper
|
|
19
|
-
afterTask: generateCachebusterInfo
|
|
20
|
-
configuration:
|
|
21
|
-
archiveName: {{app}}
|
|
22
|
-
additionalFiles:
|
|
23
|
-
- xs-app.json
|
|
24
|
-
|
|
25
|
-
server:
|
|
26
|
-
customMiddleware:
|
|
27
|
-
- name: ui5-middleware-simpleproxy
|
|
28
|
-
mountPath: /{{app}}
|
|
29
|
-
afterMiddleware: compression
|
|
30
|
-
configuration:
|
|
31
|
-
baseUri: http://localhost:4004/{{app}}
|
|
32
|
-
username: admin # dummy credentials for local testing
|
|
33
|
-
password: admin # dummy credentials for local testing
|
|
@@ -6,8 +6,7 @@ html5-apps-deployer:
|
|
|
6
6
|
env:
|
|
7
7
|
SAP_CLOUD_SERVICE: null
|
|
8
8
|
image:
|
|
9
|
-
repository: "
|
|
10
|
-
tag: latest
|
|
9
|
+
repository: "{{appName}}-html5-deployer"
|
|
11
10
|
bindings:
|
|
12
11
|
xsuaa:
|
|
13
12
|
serviceInstanceName: xsuaa
|
|
@@ -22,6 +21,11 @@ html5-apps-deployer:
|
|
|
22
21
|
requests:
|
|
23
22
|
cpu: 1000m
|
|
24
23
|
memory: 1G
|
|
24
|
+
{{=<% %>=}}
|
|
25
|
+
envFrom:
|
|
26
|
+
- configMapRef:
|
|
27
|
+
name: "{{ .Release.Name }}-html5-apps-deployer-configmap"
|
|
28
|
+
<%={{ }}=%>
|
|
25
29
|
backendDestinations: {}
|
|
26
30
|
destination:
|
|
27
31
|
parameters:
|
|
@@ -1,19 +1,32 @@
|
|
|
1
1
|
{
|
|
2
|
-
"welcomeFile": "/index.html",
|
|
3
2
|
"authenticationMethod": "route",
|
|
4
3
|
"routes": [
|
|
5
4
|
{
|
|
6
|
-
"source": "
|
|
7
|
-
"target": "/
|
|
8
|
-
"destination": "srv-api",
|
|
9
|
-
"authenticationType": "xsuaa",
|
|
10
|
-
"csrfProtection":
|
|
5
|
+
"source": "^/?odata/(.*)$",
|
|
6
|
+
"target": "/odata/$1",
|
|
7
|
+
"destination": "{{appName}}-srv-api",
|
|
8
|
+
{{#hasXsuaa}}"authenticationType": "xsuaa",{{/hasXsuaa}}
|
|
9
|
+
"csrfProtection": true
|
|
11
10
|
},
|
|
11
|
+
{{#hasUI5}}
|
|
12
|
+
{
|
|
13
|
+
"source": "^/resources/(.*)$",
|
|
14
|
+
"target": "/resources/$1",
|
|
15
|
+
"authenticationType": "none",
|
|
16
|
+
"destination": "ui5"
|
|
17
|
+
},
|
|
18
|
+
{
|
|
19
|
+
"source": "^/test-resources/(.*)$",
|
|
20
|
+
"target": "/test-resources/$1",
|
|
21
|
+
"authenticationType": "none",
|
|
22
|
+
"destination": "ui5"
|
|
23
|
+
},
|
|
24
|
+
{{/hasUI5}}
|
|
12
25
|
{
|
|
13
26
|
"source": "^(.*)$",
|
|
14
27
|
"target": "$1",
|
|
15
|
-
"service": "html5-apps-repo-rt",
|
|
16
|
-
"authenticationType": "xsuaa"
|
|
28
|
+
"service": "html5-apps-repo-rt"{{#hasXsuaa}},
|
|
29
|
+
"authenticationType": "xsuaa"{{/hasXsuaa}}
|
|
17
30
|
}
|
|
18
31
|
]
|
|
19
32
|
}
|
|
@@ -1,12 +1,14 @@
|
|
|
1
1
|
const { join } = require('path')
|
|
2
|
-
const cds = require('../../../cds')
|
|
3
|
-
const { copy } = cds.utils
|
|
4
2
|
const { readProject } = require('../../projectReader')
|
|
5
3
|
const { merge } = require('../../merge')
|
|
6
|
-
const { srv4, destination, html5RepoHost, html5Runtime,
|
|
4
|
+
const { srv4, destination, destinations, html5RepoHost, html5Runtime, appDeployer, approuter } = require('../../registries/mta')
|
|
7
5
|
|
|
8
6
|
module.exports = class Html5RepoTemplate extends require('../../plugin') {
|
|
9
7
|
|
|
8
|
+
static help() {
|
|
9
|
+
return 'SAP BTP HTML5 Application Repository'
|
|
10
|
+
}
|
|
11
|
+
|
|
10
12
|
requires() {
|
|
11
13
|
return ['destination']
|
|
12
14
|
}
|
|
@@ -17,29 +19,40 @@ module.exports = class Html5RepoTemplate extends require('../../plugin') {
|
|
|
17
19
|
|
|
18
20
|
async run() {
|
|
19
21
|
const project = readProject()
|
|
20
|
-
const { apps, appPath, configFile } = project
|
|
21
|
-
await merge(__dirname, 'files
|
|
22
|
+
const { appUIPaths, apps, appPath, configFile, hasUI5 } = project
|
|
23
|
+
await merge(__dirname, 'files/package.json.hbs').into(configFile, { project })
|
|
22
24
|
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
25
|
+
if (hasUI5) {
|
|
26
|
+
for (const { app } of apps) {
|
|
27
|
+
project.app = app
|
|
28
|
+
await merge(__dirname, 'files/ui5.yaml.hbs').into(join(appPath, app, 'ui5.yaml'), { project })
|
|
29
|
+
}
|
|
30
|
+
for (const { app } of apps) {
|
|
31
|
+
project.app = app
|
|
32
|
+
await merge(__dirname, 'files/ui5-deploy.yaml.hbs').into(join(appPath, app, 'ui5-deploy.yaml'), { project })
|
|
33
|
+
}
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
for (const { app } of apps) {
|
|
28
37
|
project.app = app
|
|
29
38
|
await merge(__dirname, 'files/app-package.json.hbs').into(join(appPath, app, 'package.json'), { project })
|
|
30
|
-
}
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
// app deployer requires a manifest.json
|
|
42
|
+
await Promise.all(appUIPaths.map(p =>
|
|
43
|
+
merge(__dirname, 'files/manifest.json')
|
|
44
|
+
.into(join(appPath, p, 'webapp/manifest.json'), { project })
|
|
45
|
+
))
|
|
31
46
|
}
|
|
32
47
|
|
|
33
48
|
async combine() {
|
|
34
49
|
const project = readProject()
|
|
35
50
|
const { srvPath, appPath, hasMta, hasHelm, hasHelmUnifiedRuntime, hasApprouter, apps } = project
|
|
36
51
|
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
}))
|
|
42
|
-
}
|
|
52
|
+
await Promise.all(apps.map(async ({app}) => {
|
|
53
|
+
project.app = app
|
|
54
|
+
await merge(__dirname, 'files/xs-app.json.hbs').into(join(appPath, app, 'xs-app.json'), { project })
|
|
55
|
+
}))
|
|
43
56
|
|
|
44
57
|
if (hasMta) {
|
|
45
58
|
const srv = srv4(srvPath)
|
|
@@ -48,13 +61,13 @@ module.exports = class Html5RepoTemplate extends require('../../plugin') {
|
|
|
48
61
|
in: 'modules',
|
|
49
62
|
where: { type: 'html5', path: `${appPath}${app.app}` }
|
|
50
63
|
}))
|
|
51
|
-
const additions = [srv,
|
|
64
|
+
const additions = [srv, appDeployer, destinations, destination, html5RepoHost, ...appModules]
|
|
52
65
|
const relationships = [{
|
|
53
66
|
insert: [destination, 'name'],
|
|
54
|
-
into: [
|
|
67
|
+
into: [appDeployer, 'requires', 'name'],
|
|
55
68
|
}, {
|
|
56
69
|
insert: [html5RepoHost, 'name'],
|
|
57
|
-
into: [
|
|
70
|
+
into: [appDeployer, 'requires', 'name'],
|
|
58
71
|
}]
|
|
59
72
|
if (hasApprouter) {
|
|
60
73
|
additions.push(approuter, html5Runtime)
|
|
@@ -71,16 +84,6 @@ module.exports = class Html5RepoTemplate extends require('../../plugin') {
|
|
|
71
84
|
|
|
72
85
|
if (hasHelm || hasHelmUnifiedRuntime) {
|
|
73
86
|
await merge(__dirname, 'files/values.yaml.hbs').into('chart/values.yaml', { with: project })
|
|
74
|
-
await merge({
|
|
75
|
-
'html5-apps-deployer': {
|
|
76
|
-
envFrom: [{
|
|
77
|
-
configMapRef: {
|
|
78
|
-
name: '{{ .Release.Name }}-html5-apps-deployer-configmap'
|
|
79
|
-
}
|
|
80
|
-
}]
|
|
81
|
-
}
|
|
82
|
-
}).into('chart/values.yaml')
|
|
83
|
-
await copy(join(__dirname, 'files', 'html5-apps-deployer-configmap.yaml')).to('chart', 'templates', 'html5-apps-deployer-configmap.yaml')
|
|
84
87
|
}
|
|
85
88
|
}
|
|
86
89
|
}
|