@teamscale/coverage-collector 0.0.1-beta.48 → 0.0.1-beta.49
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/dist/package.json +1 -1
- package/dist/src/upload/ArtifactoryUpload.js +6 -2
- package/dist/src/upload/ProxyUpload.d.ts +6 -0
- package/dist/src/upload/ProxyUpload.js +30 -0
- package/dist/src/upload/TeamscaleUpload.js +3 -1
- package/dist/src/utils/ConfigParameters.d.ts +1 -0
- package/dist/src/utils/ConfigParameters.js +4 -0
- package/package.json +1 -1
package/dist/package.json
CHANGED
|
@@ -6,6 +6,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
6
6
|
exports.uploadToArtifactory = void 0;
|
|
7
7
|
const CommonUpload_1 = require("./CommonUpload");
|
|
8
8
|
const axios_1 = __importDefault(require("axios"));
|
|
9
|
+
const ProxyUpload_1 = require("./ProxyUpload");
|
|
9
10
|
/**
|
|
10
11
|
* Uploads a coverage file to artifactory with the provided configuration.
|
|
11
12
|
*/
|
|
@@ -40,13 +41,15 @@ async function performArtifactoryUpload(config, form, logger) {
|
|
|
40
41
|
}
|
|
41
42
|
function prepareArtifactoryConfig(config, form) {
|
|
42
43
|
var _a, _b;
|
|
44
|
+
const proxyConfig = (0, ProxyUpload_1.extractProxyOptions)(config);
|
|
43
45
|
if (config.artifactory_access_token) {
|
|
44
46
|
return {
|
|
45
47
|
headers: {
|
|
46
48
|
Accept: '*/*',
|
|
47
49
|
'X-JFrog-Art-Api': config.artifactory_access_token,
|
|
48
50
|
'Content-Type': `multipart/form-data; boundary=${form.getBoundary()}`
|
|
49
|
-
}
|
|
51
|
+
},
|
|
52
|
+
proxy: proxyConfig
|
|
50
53
|
};
|
|
51
54
|
}
|
|
52
55
|
return {
|
|
@@ -57,6 +60,7 @@ function prepareArtifactoryConfig(config, form) {
|
|
|
57
60
|
headers: {
|
|
58
61
|
Accept: '*/*',
|
|
59
62
|
'Content-Type': `multipart/form-data; boundary=${form.getBoundary()}`
|
|
60
|
-
}
|
|
63
|
+
},
|
|
64
|
+
proxy: proxyConfig
|
|
61
65
|
};
|
|
62
66
|
}
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import { ConfigParameters } from "../utils/ConfigParameters";
|
|
2
|
+
import { AxiosProxyConfig } from "axios";
|
|
3
|
+
/**
|
|
4
|
+
* Creates an AxiosProxyConfig object if proxy variables are provided.
|
|
5
|
+
*/
|
|
6
|
+
export declare function extractProxyOptions(config: ConfigParameters): AxiosProxyConfig | undefined;
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
exports.extractProxyOptions = void 0;
|
|
7
|
+
const url_1 = __importDefault(require("url"));
|
|
8
|
+
/**
|
|
9
|
+
* Creates an AxiosProxyConfig object if proxy variables are provided.
|
|
10
|
+
*/
|
|
11
|
+
function extractProxyOptions(config) {
|
|
12
|
+
if (config.http_proxy) {
|
|
13
|
+
// Expected format: http://username:password@host:port/
|
|
14
|
+
// See https://nodejs.org/api/url.html#url-strings-and-url-objects for URL parsing
|
|
15
|
+
const proxyAddress = new url_1.default.URL(config.http_proxy);
|
|
16
|
+
const proxyConfig = {
|
|
17
|
+
protocol: proxyAddress.protocol.replace(':', ''),
|
|
18
|
+
host: proxyAddress.hostname,
|
|
19
|
+
port: +proxyAddress.port,
|
|
20
|
+
};
|
|
21
|
+
if (proxyAddress.username && proxyAddress.password) {
|
|
22
|
+
proxyConfig.auth = {
|
|
23
|
+
username: proxyAddress.username,
|
|
24
|
+
password: proxyAddress.password
|
|
25
|
+
};
|
|
26
|
+
}
|
|
27
|
+
return proxyConfig;
|
|
28
|
+
}
|
|
29
|
+
}
|
|
30
|
+
exports.extractProxyOptions = extractProxyOptions;
|
|
@@ -7,6 +7,7 @@ exports.uploadToTeamscale = void 0;
|
|
|
7
7
|
const QueryParameters_1 = __importDefault(require("../utils/QueryParameters"));
|
|
8
8
|
const CommonUpload_1 = require("./CommonUpload");
|
|
9
9
|
const axios_1 = __importDefault(require("axios"));
|
|
10
|
+
const ProxyUpload_1 = require("./ProxyUpload");
|
|
10
11
|
/**
|
|
11
12
|
* Uploads a coverage file to Teamscale with the provided configuration.
|
|
12
13
|
*/
|
|
@@ -47,6 +48,7 @@ function prepareTeamscaleConfig(config, form) {
|
|
|
47
48
|
headers: {
|
|
48
49
|
Accept: '*/*',
|
|
49
50
|
'Content-Type': `multipart/form-data; boundary=${form.getBoundary()}`
|
|
50
|
-
}
|
|
51
|
+
},
|
|
52
|
+
proxy: (0, ProxyUpload_1.extractProxyOptions)(config)
|
|
51
53
|
};
|
|
52
54
|
}
|
|
@@ -98,6 +98,10 @@ function buildParameterParser() {
|
|
|
98
98
|
help: '(optional): The path within the storage location between the default path and the uploaded artifact.',
|
|
99
99
|
default: process.env.ARTIFACTORY_PATH_SUFFIX
|
|
100
100
|
});
|
|
101
|
+
parser.add_argument('--http-proxy', {
|
|
102
|
+
help: '(optional): The HTTP/HTTPS proxy address that should be used in the format: http://host:port/ or http://username:password@host:port/.',
|
|
103
|
+
default: process.env.HTTP_PROXY
|
|
104
|
+
});
|
|
101
105
|
return parser;
|
|
102
106
|
}
|
|
103
107
|
exports.buildParameterParser = buildParameterParser;
|