@sap-ux/deploy-tooling 0.2.12 → 0.3.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/README.md +4 -2
- package/dist/base/config.js +0 -2
- package/dist/base/deploy.js +4 -3
- package/dist/cli/config.js +40 -2
- package/dist/cli/index.js +4 -1
- package/dist/types/index.d.ts +3 -2
- package/package.json +3 -3
package/README.md
CHANGED
|
@@ -53,13 +53,14 @@ Usage: deploy [options]
|
|
|
53
53
|
Options:
|
|
54
54
|
-c, --config <path-to-yaml> Path to config yaml file
|
|
55
55
|
-y, --yes yes to all questions (default: false)
|
|
56
|
-
-n, --no-retry do not retry if deploy fails for any reason
|
|
56
|
+
-n, --no-retry do not retry if deploy fails for any reason, for CI/CD pipeline flows this option needs to be included (default: false)
|
|
57
57
|
--verbose verbose log output (default: false)
|
|
58
58
|
--destination <destination> Destination in SAP BTP pointing to an ABAP system
|
|
59
59
|
--url <target-url> URL of target ABAP system
|
|
60
60
|
--client <sap-client> Client number of target ABAP system
|
|
61
61
|
--cloud target is an ABAP Cloud system
|
|
62
62
|
--cloud-service-key <file-location> JSON file location with the ABAP cloud service key.
|
|
63
|
+
--cloud-service-env Load ABAP cloud service properties from either a .env file or your environment variables. Secrets in your .env should not be committed to source control.
|
|
63
64
|
--transport <transport-request> Transport number to record the change in the ABAP system
|
|
64
65
|
--name <bsp-name> Project name of the app
|
|
65
66
|
--strict-ssl Perform certificate validation (use --no-strict-ssl to deactivate it)
|
|
@@ -84,13 +85,14 @@ Usage: undeploy [options]
|
|
|
84
85
|
Options:
|
|
85
86
|
-c, --config <path-to-yaml> Path to config yaml file
|
|
86
87
|
-y, --yes yes to all questions (default: false)
|
|
87
|
-
-n, --no-retry do not retry if undeploy fails for any reason
|
|
88
|
+
-n, --no-retry do not retry if undeploy fails for any reason, for CI/CD pipeline flows this option needs to be included (default: false)
|
|
88
89
|
--verbose verbose log output (default: false)
|
|
89
90
|
--destination <destination> Destination in SAP BTP pointing to an ABAP system
|
|
90
91
|
--url <target-url> URL of target ABAP system
|
|
91
92
|
--client <sap-client> Client number of target ABAP system
|
|
92
93
|
--cloud target is an ABAP Cloud system
|
|
93
94
|
--cloud-service-key <file-location> JSON file location with the ABAP cloud service key.
|
|
95
|
+
--cloud-service-env Load ABAP cloud service properties from either a .env file or your environment variables
|
|
94
96
|
--transport <transport-request> Transport number to record the change in the ABAP system
|
|
95
97
|
--name <bsp-name> Project name of the app
|
|
96
98
|
--strict-ssl Perform certificate validation (use --no-strict-ssl to deactivate it)
|
package/dist/base/config.js
CHANGED
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.validateConfig = exports.replaceEnvVariables = exports.getConfigForLogging = exports.isUrlTarget = void 0;
|
|
4
|
-
const dotenv_1 = require("dotenv");
|
|
5
4
|
const btp_utils_1 = require("@sap-ux/btp-utils");
|
|
6
5
|
/**
|
|
7
6
|
* Check if it is a url or destination target.
|
|
@@ -35,7 +34,6 @@ exports.getConfigForLogging = getConfigForLogging;
|
|
|
35
34
|
* @param obj - any object structure
|
|
36
35
|
*/
|
|
37
36
|
function replaceEnvVariables(obj) {
|
|
38
|
-
(0, dotenv_1.config)();
|
|
39
37
|
for (const key in obj) {
|
|
40
38
|
const value = obj[key];
|
|
41
39
|
if (typeof value === 'object') {
|
package/dist/base/deploy.js
CHANGED
|
@@ -127,7 +127,7 @@ function createDeployService(config, logger) {
|
|
|
127
127
|
}
|
|
128
128
|
else if ((0, config_1.isUrlTarget)(config.target)) {
|
|
129
129
|
if (config.target.cloud) {
|
|
130
|
-
provider = yield createAbapCloudServiceProvider(options, config.target, config.
|
|
130
|
+
provider = yield createAbapCloudServiceProvider(options, config.target, config.retry, logger);
|
|
131
131
|
}
|
|
132
132
|
else {
|
|
133
133
|
provider = yield createAbapServiceProvider(options, config.target);
|
|
@@ -151,7 +151,8 @@ function createDeployService(config, logger) {
|
|
|
151
151
|
*/
|
|
152
152
|
function handleError(command, error, service, config, logger, archive) {
|
|
153
153
|
return __awaiter(this, void 0, void 0, function* () {
|
|
154
|
-
|
|
154
|
+
const retry = config.retry === undefined ? true : config.retry;
|
|
155
|
+
if (retry && (0, axios_extension_1.isAxiosError)(error)) {
|
|
155
156
|
const success = yield handleAxiosError(command, error.response, service, config, logger, archive);
|
|
156
157
|
if (success) {
|
|
157
158
|
return;
|
|
@@ -196,7 +197,7 @@ function handleAxiosError(command, response, service, config, logger, archive) {
|
|
|
196
197
|
case 412:
|
|
197
198
|
logger.warn('An app in the same repository with different sap app id found.');
|
|
198
199
|
if (config.yes || (yield (0, prompt_1.promptConfirmation)('Do you want to overwrite (Y/n)?'))) {
|
|
199
|
-
yield deploymentCommands[command](service, Object.assign(Object.assign({}, config), { safe: false,
|
|
200
|
+
yield deploymentCommands[command](service, Object.assign(Object.assign({}, config), { safe: false, retry: false }), logger, archive);
|
|
200
201
|
return true;
|
|
201
202
|
}
|
|
202
203
|
else {
|
package/dist/cli/config.js
CHANGED
|
@@ -62,6 +62,25 @@ function readServiceKeyFromFile(path) {
|
|
|
62
62
|
throw new Error(`Unable to read service key from from ${path}`);
|
|
63
63
|
}
|
|
64
64
|
}
|
|
65
|
+
/**
|
|
66
|
+
* Read the environment variables to generate a service object.
|
|
67
|
+
*
|
|
68
|
+
* @param targetUrl target endpoint where app is being deployed to
|
|
69
|
+
* @returns service key as js object
|
|
70
|
+
*/
|
|
71
|
+
function getServiceFromEnv(targetUrl) {
|
|
72
|
+
return {
|
|
73
|
+
uaa: {
|
|
74
|
+
clientid: process.env.SERVICE_CLIENT_ID,
|
|
75
|
+
clientsecret: process.env.SERVICE_CLIENT_SECRET,
|
|
76
|
+
url: process.env.SERVICE_UAA_URL,
|
|
77
|
+
username: process.env.SERVICE_USERNAME,
|
|
78
|
+
password: process.env.SERVICE_PASSWORD
|
|
79
|
+
},
|
|
80
|
+
url: targetUrl !== null && targetUrl !== void 0 ? targetUrl : process.env.SERVICE_URL,
|
|
81
|
+
systemid: process.env.SERVICE_SYSTEM_ID
|
|
82
|
+
};
|
|
83
|
+
}
|
|
65
84
|
/**
|
|
66
85
|
* Boolean merger.
|
|
67
86
|
*
|
|
@@ -89,6 +108,23 @@ function parseQueryParams(query) {
|
|
|
89
108
|
});
|
|
90
109
|
return params;
|
|
91
110
|
}
|
|
111
|
+
/**
|
|
112
|
+
* Generate the service object using either a service.json file or environment variables.
|
|
113
|
+
*
|
|
114
|
+
* @param options additional options
|
|
115
|
+
* @param targetUrl target endpoint where app is being deployed to
|
|
116
|
+
* @returns service key as js object
|
|
117
|
+
*/
|
|
118
|
+
function getServiceKey(options, targetUrl) {
|
|
119
|
+
let serviceKey;
|
|
120
|
+
if (options.cloudServiceKey) {
|
|
121
|
+
serviceKey = readServiceKeyFromFile(options.cloudServiceKey);
|
|
122
|
+
}
|
|
123
|
+
else if (options.cloudServiceEnv) {
|
|
124
|
+
serviceKey = getServiceFromEnv(targetUrl);
|
|
125
|
+
}
|
|
126
|
+
return serviceKey;
|
|
127
|
+
}
|
|
92
128
|
/**
|
|
93
129
|
* Merge CLI options into a base target configuration.
|
|
94
130
|
*
|
|
@@ -98,12 +134,13 @@ function parseQueryParams(query) {
|
|
|
98
134
|
*/
|
|
99
135
|
function mergeTarget(baseTarget, options) {
|
|
100
136
|
var _a, _b, _c;
|
|
137
|
+
const targetUrl = (_a = options.url) !== null && _a !== void 0 ? _a : baseTarget === null || baseTarget === void 0 ? void 0 : baseTarget.url;
|
|
101
138
|
return {
|
|
102
|
-
url:
|
|
139
|
+
url: targetUrl,
|
|
103
140
|
client: (_b = options.client) !== null && _b !== void 0 ? _b : baseTarget === null || baseTarget === void 0 ? void 0 : baseTarget.client,
|
|
104
141
|
cloud: options.cloud !== undefined ? options.cloud : baseTarget === null || baseTarget === void 0 ? void 0 : baseTarget.cloud,
|
|
105
142
|
destination: (_c = options.destination) !== null && _c !== void 0 ? _c : baseTarget === null || baseTarget === void 0 ? void 0 : baseTarget.destination,
|
|
106
|
-
serviceKey: options
|
|
143
|
+
serviceKey: getServiceKey(options, targetUrl),
|
|
107
144
|
params: options.queryParams ? parseQueryParams(options.queryParams) : undefined
|
|
108
145
|
};
|
|
109
146
|
}
|
|
@@ -130,6 +167,7 @@ function mergeConfig(taskConfig, options) {
|
|
|
130
167
|
config.keep = mergeFlag(options.keep, taskConfig.keep);
|
|
131
168
|
config.strictSsl = mergeFlag(options.strictSsl, taskConfig.strictSsl);
|
|
132
169
|
config.yes = mergeFlag(options.yes, taskConfig.yes);
|
|
170
|
+
config.retry = process.env.NO_RETRY ? !process.env.NO_RETRY : mergeFlag(options.retry, taskConfig.retry);
|
|
133
171
|
if (!options.archiveUrl && !options.archivePath && !options.archiveFolder) {
|
|
134
172
|
options.archiveFolder = 'dist';
|
|
135
173
|
}
|
package/dist/cli/index.js
CHANGED
|
@@ -16,6 +16,7 @@ const base_1 = require("../base");
|
|
|
16
16
|
const types_1 = require("../types");
|
|
17
17
|
const archive_1 = require("./archive");
|
|
18
18
|
const config_1 = require("./config");
|
|
19
|
+
const dotenv_1 = require("dotenv");
|
|
19
20
|
/**
|
|
20
21
|
* Create an instance of a command runner for deployment.
|
|
21
22
|
*
|
|
@@ -26,7 +27,7 @@ function createCommand(name) {
|
|
|
26
27
|
const command = new commander_1.Command(name)
|
|
27
28
|
.option('-c, --config <path-to-yaml>', 'Path to config yaml file')
|
|
28
29
|
.option('-y, --yes', 'yes to all questions', false)
|
|
29
|
-
.option('-n, --no-retry', `do not retry if ${name} fails for any reason`, false
|
|
30
|
+
.option('-n, --no-retry', `do not retry if ${name} fails for any reason`, true) // retry by default when true, if passed from cli, will set to false
|
|
30
31
|
.option('--verbose', 'verbose log output', false);
|
|
31
32
|
// options to set (or overwrite) values that are otherwise read from the `ui5*.yaml`
|
|
32
33
|
command
|
|
@@ -35,6 +36,7 @@ function createCommand(name) {
|
|
|
35
36
|
.addOption(new commander_1.Option('--client <sap-client>', 'Client number of target ABAP system').conflicts('destination'))
|
|
36
37
|
.addOption(new commander_1.Option('--cloud', 'target is an ABAP Cloud system').conflicts('destination'))
|
|
37
38
|
.addOption(new commander_1.Option('--cloud-service-key <file-location>', 'JSON file location with the ABAP cloud service key.').conflicts('destination'))
|
|
39
|
+
.addOption(new commander_1.Option('--cloud-service-env', 'Read ABAP cloud service properties from environment variables or .env file').conflicts(['cloudServiceKey', 'destination']))
|
|
38
40
|
.option('--transport <transport-request>', 'Transport number to record the change in the ABAP system')
|
|
39
41
|
.option('--name <bsp-name>', 'Project name of the app')
|
|
40
42
|
.option('--strict-ssl', 'Perform certificate validation (use --no-strict-ssl to deactivate it)')
|
|
@@ -74,6 +76,7 @@ function prepareRun(cmd) {
|
|
|
74
76
|
if (process.argv.length < 3) {
|
|
75
77
|
cmd.help();
|
|
76
78
|
}
|
|
79
|
+
(0, dotenv_1.config)();
|
|
77
80
|
const options = cmd.parse().opts();
|
|
78
81
|
const logLevel = options.verbose ? logger_1.LogLevel.Silly : logger_1.LogLevel.Info;
|
|
79
82
|
const logger = new logger_1.ToolsLogger({
|
package/dist/types/index.d.ts
CHANGED
|
@@ -46,9 +46,9 @@ export interface CommonOptions {
|
|
|
46
46
|
*/
|
|
47
47
|
verbose?: boolean;
|
|
48
48
|
/**
|
|
49
|
-
*
|
|
49
|
+
* '--no-retry' cli param negates the retry value which is true by default
|
|
50
50
|
*/
|
|
51
|
-
|
|
51
|
+
retry?: boolean;
|
|
52
52
|
}
|
|
53
53
|
export interface AbapDeployConfig extends CommonOptions {
|
|
54
54
|
target: AbapTarget;
|
|
@@ -62,5 +62,6 @@ export interface CliOptions extends Partial<BspConfig>, Partial<DestinationAbapT
|
|
|
62
62
|
archiveUrl?: string;
|
|
63
63
|
cloudServiceKey?: string;
|
|
64
64
|
queryParams?: string;
|
|
65
|
+
cloudServiceEnv?: boolean;
|
|
65
66
|
}
|
|
66
67
|
//# sourceMappingURL=index.d.ts.map
|
package/package.json
CHANGED
|
@@ -9,7 +9,7 @@
|
|
|
9
9
|
"bugs": {
|
|
10
10
|
"url": "https://github.com/SAP/open-ux-tools/issues?q=is%3Aopen+is%3Aissue+label%3Abug+label%3Adeploy-tooling"
|
|
11
11
|
},
|
|
12
|
-
"version": "0.
|
|
12
|
+
"version": "0.3.1",
|
|
13
13
|
"license": "Apache-2.0",
|
|
14
14
|
"author": "@SAP/ux-tools-team",
|
|
15
15
|
"main": "dist/index.js",
|
|
@@ -31,11 +31,11 @@
|
|
|
31
31
|
"dotenv": "16.0.0",
|
|
32
32
|
"prompts": "2.4.2",
|
|
33
33
|
"yazl": "2.5.1",
|
|
34
|
-
"@sap-ux/axios-extension": "1.
|
|
34
|
+
"@sap-ux/axios-extension": "1.3.0",
|
|
35
35
|
"@sap-ux/btp-utils": "0.11.6",
|
|
36
36
|
"@sap-ux/logger": "0.3.6",
|
|
37
37
|
"@sap-ux/store": "0.3.11",
|
|
38
|
-
"@sap-ux/ui5-config": "0.
|
|
38
|
+
"@sap-ux/ui5-config": "0.18.0"
|
|
39
39
|
},
|
|
40
40
|
"devDependencies": {
|
|
41
41
|
"@types/prompts": "2.0.14",
|