azure-pipelines-task-lib 3.1.10 → 3.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 +1 -1
- package/mock-task.js +9 -0
- package/package.json +3 -3
- package/task.d.ts +51 -0
- package/task.js +90 -2
package/README.md
CHANGED
|
@@ -20,7 +20,7 @@ Guidance: [Finding Files](docs/findingfiles.md), [Minimum agent version](docs/mi
|
|
|
20
20
|
## Node 10 Upgrade Notice
|
|
21
21
|
|
|
22
22
|
Azure DevOps is currently working to establish Node 10 as the new preferred runtime for tasks, upgrading from Node 6.
|
|
23
|
-
Relevant work is happening in the `master
|
|
23
|
+
Relevant work is happening in the `master` branch and the major version should be used with Node 10 is 3.
|
|
24
24
|
Previous major version is stored in the `releases/2.x`
|
|
25
25
|
|
|
26
26
|
### Upgrading to Node 10
|
package/mock-task.js
CHANGED
|
@@ -57,6 +57,7 @@ module.exports.setSecret = task.setSecret;
|
|
|
57
57
|
module.exports.getTaskVariable = task.getTaskVariable;
|
|
58
58
|
module.exports.setTaskVariable = task.setTaskVariable;
|
|
59
59
|
module.exports.getInput = task.getInput;
|
|
60
|
+
module.exports.getInputRequired = task.getInputRequired;
|
|
60
61
|
module.exports.getBoolInput = task.getBoolInput;
|
|
61
62
|
module.exports.getDelimitedInput = task.getDelimitedInput;
|
|
62
63
|
module.exports.filePathSupplied = task.filePathSupplied;
|
|
@@ -70,13 +71,21 @@ function getPathInput(name, required, check) {
|
|
|
70
71
|
return inval;
|
|
71
72
|
}
|
|
72
73
|
module.exports.getPathInput = getPathInput;
|
|
74
|
+
function getPathInputRequired(name, check) {
|
|
75
|
+
return getPathInput(name, true, check);
|
|
76
|
+
}
|
|
77
|
+
module.exports.getPathInputRequired = getPathInputRequired;
|
|
73
78
|
//-----------------------------------------------------
|
|
74
79
|
// Endpoint Helpers
|
|
75
80
|
//-----------------------------------------------------
|
|
76
81
|
module.exports.getEndpointUrl = task.getEndpointUrl;
|
|
82
|
+
module.exports.getEndpointUrlRequired = task.getEndpointUrlRequired;
|
|
77
83
|
module.exports.getEndpointDataParameter = task.getEndpointDataParameter;
|
|
84
|
+
module.exports.getEndpointDataParameterRequired = task.getEndpointDataParameterRequired;
|
|
78
85
|
module.exports.getEndpointAuthorizationScheme = task.getEndpointAuthorizationScheme;
|
|
86
|
+
module.exports.getEndpointAuthorizationSchemeRequired = task.getEndpointAuthorizationSchemeRequired;
|
|
79
87
|
module.exports.getEndpointAuthorizationParameter = task.getEndpointAuthorizationParameter;
|
|
88
|
+
module.exports.getEndpointAuthorizationParameterRequired = task.getEndpointAuthorizationParameterRequired;
|
|
80
89
|
module.exports.getEndpointAuthorization = task.getEndpointAuthorization;
|
|
81
90
|
//-----------------------------------------------------
|
|
82
91
|
// SecureFile Helpers
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "azure-pipelines-task-lib",
|
|
3
|
-
"version": "3.1
|
|
3
|
+
"version": "3.3.1",
|
|
4
4
|
"description": "Azure Pipelines Task SDK",
|
|
5
5
|
"main": "./task.js",
|
|
6
6
|
"typings": "./task.d.ts",
|
|
@@ -27,11 +27,11 @@
|
|
|
27
27
|
},
|
|
28
28
|
"homepage": "https://github.com/Microsoft/azure-pipelines-task-lib",
|
|
29
29
|
"dependencies": {
|
|
30
|
-
"minimatch": "3.0.
|
|
30
|
+
"minimatch": "3.0.5",
|
|
31
31
|
"mockery": "^1.7.0",
|
|
32
32
|
"q": "^1.5.1",
|
|
33
33
|
"semver": "^5.1.0",
|
|
34
|
-
"shelljs": "^0.8.
|
|
34
|
+
"shelljs": "^0.8.5",
|
|
35
35
|
"sync-request": "6.1.0",
|
|
36
36
|
"uuid": "^3.0.1"
|
|
37
37
|
},
|
package/task.d.ts
CHANGED
|
@@ -108,6 +108,14 @@ export interface VariableInfo {
|
|
|
108
108
|
* @returns string
|
|
109
109
|
*/
|
|
110
110
|
export declare function getInput(name: string, required?: boolean): string | undefined;
|
|
111
|
+
/**
|
|
112
|
+
* Gets the value of an input.
|
|
113
|
+
* If the value is not set, it will throw.
|
|
114
|
+
*
|
|
115
|
+
* @param name name of the input to get
|
|
116
|
+
* @returns string
|
|
117
|
+
*/
|
|
118
|
+
export declare function getInputRequired(name: string): string;
|
|
111
119
|
/**
|
|
112
120
|
* Gets the value of an input and converts to a bool. Convenience.
|
|
113
121
|
* If required is true and the value is not set, it will throw.
|
|
@@ -153,6 +161,17 @@ export declare function filePathSupplied(name: string): boolean;
|
|
|
153
161
|
* @returns string
|
|
154
162
|
*/
|
|
155
163
|
export declare function getPathInput(name: string, required?: boolean, check?: boolean): string | undefined;
|
|
164
|
+
/**
|
|
165
|
+
* Gets the value of a path input
|
|
166
|
+
* It will be quoted for you if it isn't already and contains spaces
|
|
167
|
+
* If the value is not set, it will throw.
|
|
168
|
+
* If check is true and the path does not exist, it will throw.
|
|
169
|
+
*
|
|
170
|
+
* @param name name of the input to get
|
|
171
|
+
* @param check whether path is checked. optional, defaults to false
|
|
172
|
+
* @returns string
|
|
173
|
+
*/
|
|
174
|
+
export declare function getPathInputRequired(name: string, check?: boolean): string;
|
|
156
175
|
/**
|
|
157
176
|
* Gets the url for a service endpoint
|
|
158
177
|
* If the url was not set and is not optional, it will throw.
|
|
@@ -162,7 +181,16 @@ export declare function getPathInput(name: string, required?: boolean, check?: b
|
|
|
162
181
|
* @returns string
|
|
163
182
|
*/
|
|
164
183
|
export declare function getEndpointUrl(id: string, optional: boolean): string | undefined;
|
|
184
|
+
/**
|
|
185
|
+
* Gets the url for a service endpoint
|
|
186
|
+
* If the url was not set, it will throw.
|
|
187
|
+
*
|
|
188
|
+
* @param id name of the service endpoint
|
|
189
|
+
* @returns string
|
|
190
|
+
*/
|
|
191
|
+
export declare function getEndpointUrlRequired(id: string): string;
|
|
165
192
|
export declare function getEndpointDataParameter(id: string, key: string, optional: boolean): string | undefined;
|
|
193
|
+
export declare function getEndpointDataParameterRequired(id: string, key: string): string;
|
|
166
194
|
/**
|
|
167
195
|
* Gets the endpoint authorization scheme for a service endpoint
|
|
168
196
|
* If the endpoint authorization scheme is not set and is not optional, it will throw.
|
|
@@ -172,6 +200,14 @@ export declare function getEndpointDataParameter(id: string, key: string, option
|
|
|
172
200
|
* @returns {string} value of the endpoint authorization scheme
|
|
173
201
|
*/
|
|
174
202
|
export declare function getEndpointAuthorizationScheme(id: string, optional: boolean): string | undefined;
|
|
203
|
+
/**
|
|
204
|
+
* Gets the endpoint authorization scheme for a service endpoint
|
|
205
|
+
* If the endpoint authorization scheme is not set, it will throw.
|
|
206
|
+
*
|
|
207
|
+
* @param id name of the service endpoint
|
|
208
|
+
* @returns {string} value of the endpoint authorization scheme
|
|
209
|
+
*/
|
|
210
|
+
export declare function getEndpointAuthorizationSchemeRequired(id: string): string;
|
|
175
211
|
/**
|
|
176
212
|
* Gets the endpoint authorization parameter value for a service endpoint with specified key
|
|
177
213
|
* If the endpoint authorization parameter is not set and is not optional, it will throw.
|
|
@@ -182,6 +218,15 @@ export declare function getEndpointAuthorizationScheme(id: string, optional: boo
|
|
|
182
218
|
* @returns {string} value of the endpoint authorization parameter value
|
|
183
219
|
*/
|
|
184
220
|
export declare function getEndpointAuthorizationParameter(id: string, key: string, optional: boolean): string | undefined;
|
|
221
|
+
/**
|
|
222
|
+
* Gets the endpoint authorization parameter value for a service endpoint with specified key
|
|
223
|
+
* If the endpoint authorization parameter is not set, it will throw.
|
|
224
|
+
*
|
|
225
|
+
* @param id name of the service endpoint
|
|
226
|
+
* @param key key to find the endpoint authorization parameter
|
|
227
|
+
* @returns {string} value of the endpoint authorization parameter value
|
|
228
|
+
*/
|
|
229
|
+
export declare function getEndpointAuthorizationParameterRequired(id: string, key: string): string;
|
|
185
230
|
/**
|
|
186
231
|
* Interface for EndpointAuthorization
|
|
187
232
|
* Contains a schema and a string/string dictionary of auth data
|
|
@@ -485,6 +530,12 @@ export declare function filter(pattern: string, options?: MatchOptions): (elemen
|
|
|
485
530
|
export declare function findMatch(defaultRoot: string, patterns: string[] | string, findOptions?: FindOptions, matchOptions?: MatchOptions): string[];
|
|
486
531
|
export interface ProxyConfiguration {
|
|
487
532
|
proxyUrl: string;
|
|
533
|
+
/**
|
|
534
|
+
* Proxy URI formated as: protocol://username:password@hostname:port
|
|
535
|
+
*
|
|
536
|
+
* For tools that require setting proxy configuration in the single environment variable
|
|
537
|
+
*/
|
|
538
|
+
proxyFormattedUrl: string;
|
|
488
539
|
proxyUsername?: string;
|
|
489
540
|
proxyPassword?: string;
|
|
490
541
|
proxyBypassHosts?: string[];
|
package/task.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.updateReleaseName = exports.addBuildTag = exports.updateBuildNumber = exports.uploadBuildLog = exports.associateArtifact = exports.uploadArtifact = exports.logIssue = exports.logDetail = exports.setProgress = exports.setEndpoint = exports.addAttachment = exports.uploadSummary = exports.prependPath = exports.uploadFile = exports.CodeCoverageEnabler = exports.CodeCoveragePublisher = exports.TestPublisher = exports.getHttpCertConfiguration = exports.getHttpProxyConfiguration = exports.findMatch = exports.filter = exports.match = exports.tool = exports.execSync = exports.exec = exports.rmRF = exports.legacyFindFiles = exports.find = exports.retry = exports.mv = exports.cp = exports.ls = exports.which = exports.resolve = exports.mkdirP = exports.popd = exports.pushd = exports.cd = exports.checkPath = exports.cwd = exports.getPlatform = exports.osType = exports.writeFile = exports.exist = exports.stats = exports.debug = exports.error = exports.warning = exports.command = exports.setTaskVariable = exports.getTaskVariable = exports.getSecureFileTicket = exports.getSecureFileName = exports.getEndpointAuthorization = exports.getEndpointAuthorizationParameter = exports.getEndpointAuthorizationScheme = exports.getEndpointDataParameter = exports.getEndpointUrl = exports.getPathInput = exports.filePathSupplied = exports.getDelimitedInput = exports.getBoolInput = exports.getInput = exports.setSecret = exports.setVariable = exports.getVariables = exports.assertAgent = exports.getVariable = exports.loc = exports.setResourcePath = exports.setResult = exports.setErrStream = exports.setStdStream = exports.Platform = exports.FieldType = exports.ArtifactType = exports.IssueType = exports.TaskState = exports.TaskResult = void 0;
|
|
3
|
+
exports.updateReleaseName = exports.addBuildTag = exports.updateBuildNumber = exports.uploadBuildLog = exports.associateArtifact = exports.uploadArtifact = exports.logIssue = exports.logDetail = exports.setProgress = exports.setEndpoint = exports.addAttachment = exports.uploadSummary = exports.prependPath = exports.uploadFile = exports.CodeCoverageEnabler = exports.CodeCoveragePublisher = exports.TestPublisher = exports.getHttpCertConfiguration = exports.getHttpProxyConfiguration = exports.findMatch = exports.filter = exports.match = exports.tool = exports.execSync = exports.exec = exports.rmRF = exports.legacyFindFiles = exports.find = exports.retry = exports.mv = exports.cp = exports.ls = exports.which = exports.resolve = exports.mkdirP = exports.popd = exports.pushd = exports.cd = exports.checkPath = exports.cwd = exports.getPlatform = exports.osType = exports.writeFile = exports.exist = exports.stats = exports.debug = exports.error = exports.warning = exports.command = exports.setTaskVariable = exports.getTaskVariable = exports.getSecureFileTicket = exports.getSecureFileName = exports.getEndpointAuthorization = exports.getEndpointAuthorizationParameterRequired = exports.getEndpointAuthorizationParameter = exports.getEndpointAuthorizationSchemeRequired = exports.getEndpointAuthorizationScheme = exports.getEndpointDataParameterRequired = exports.getEndpointDataParameter = exports.getEndpointUrlRequired = exports.getEndpointUrl = exports.getPathInputRequired = exports.getPathInput = exports.filePathSupplied = exports.getDelimitedInput = exports.getBoolInput = exports.getInputRequired = exports.getInput = exports.setSecret = exports.setVariable = exports.getVariables = exports.assertAgent = exports.getVariable = exports.loc = exports.setResourcePath = exports.setResult = exports.setErrStream = exports.setStdStream = exports.Platform = exports.FieldType = exports.ArtifactType = exports.IssueType = exports.TaskState = exports.TaskResult = void 0;
|
|
4
4
|
var shell = require("shelljs");
|
|
5
5
|
var childProcess = require("child_process");
|
|
6
6
|
var fs = require("fs");
|
|
@@ -208,6 +208,17 @@ function getInput(name, required) {
|
|
|
208
208
|
return inval;
|
|
209
209
|
}
|
|
210
210
|
exports.getInput = getInput;
|
|
211
|
+
/**
|
|
212
|
+
* Gets the value of an input.
|
|
213
|
+
* If the value is not set, it will throw.
|
|
214
|
+
*
|
|
215
|
+
* @param name name of the input to get
|
|
216
|
+
* @returns string
|
|
217
|
+
*/
|
|
218
|
+
function getInputRequired(name) {
|
|
219
|
+
return getInput(name, true);
|
|
220
|
+
}
|
|
221
|
+
exports.getInputRequired = getInputRequired;
|
|
211
222
|
/**
|
|
212
223
|
* Gets the value of an input and converts to a bool. Convenience.
|
|
213
224
|
* If required is true and the value is not set, it will throw.
|
|
@@ -286,6 +297,20 @@ function getPathInput(name, required, check) {
|
|
|
286
297
|
return inval;
|
|
287
298
|
}
|
|
288
299
|
exports.getPathInput = getPathInput;
|
|
300
|
+
/**
|
|
301
|
+
* Gets the value of a path input
|
|
302
|
+
* It will be quoted for you if it isn't already and contains spaces
|
|
303
|
+
* If the value is not set, it will throw.
|
|
304
|
+
* If check is true and the path does not exist, it will throw.
|
|
305
|
+
*
|
|
306
|
+
* @param name name of the input to get
|
|
307
|
+
* @param check whether path is checked. optional, defaults to false
|
|
308
|
+
* @returns string
|
|
309
|
+
*/
|
|
310
|
+
function getPathInputRequired(name, check) {
|
|
311
|
+
return getPathInput(name, true, check);
|
|
312
|
+
}
|
|
313
|
+
exports.getPathInputRequired = getPathInputRequired;
|
|
289
314
|
//-----------------------------------------------------
|
|
290
315
|
// Endpoint Helpers
|
|
291
316
|
//-----------------------------------------------------
|
|
@@ -306,6 +331,17 @@ function getEndpointUrl(id, optional) {
|
|
|
306
331
|
return urlval;
|
|
307
332
|
}
|
|
308
333
|
exports.getEndpointUrl = getEndpointUrl;
|
|
334
|
+
/**
|
|
335
|
+
* Gets the url for a service endpoint
|
|
336
|
+
* If the url was not set, it will throw.
|
|
337
|
+
*
|
|
338
|
+
* @param id name of the service endpoint
|
|
339
|
+
* @returns string
|
|
340
|
+
*/
|
|
341
|
+
function getEndpointUrlRequired(id) {
|
|
342
|
+
return getEndpointUrl(id, false);
|
|
343
|
+
}
|
|
344
|
+
exports.getEndpointUrlRequired = getEndpointUrlRequired;
|
|
309
345
|
/*
|
|
310
346
|
* Gets the endpoint data parameter value with specified key for a service endpoint
|
|
311
347
|
* If the endpoint data parameter was not set and is not optional, it will throw.
|
|
@@ -324,6 +360,18 @@ function getEndpointDataParameter(id, key, optional) {
|
|
|
324
360
|
return dataParamVal;
|
|
325
361
|
}
|
|
326
362
|
exports.getEndpointDataParameter = getEndpointDataParameter;
|
|
363
|
+
/*
|
|
364
|
+
* Gets the endpoint data parameter value with specified key for a service endpoint
|
|
365
|
+
* If the endpoint data parameter was not set, it will throw.
|
|
366
|
+
*
|
|
367
|
+
* @param id name of the service endpoint
|
|
368
|
+
* @param key of the parameter
|
|
369
|
+
* @returns {string} value of the endpoint data parameter
|
|
370
|
+
*/
|
|
371
|
+
function getEndpointDataParameterRequired(id, key) {
|
|
372
|
+
return getEndpointDataParameter(id, key, false);
|
|
373
|
+
}
|
|
374
|
+
exports.getEndpointDataParameterRequired = getEndpointDataParameterRequired;
|
|
327
375
|
/**
|
|
328
376
|
* Gets the endpoint authorization scheme for a service endpoint
|
|
329
377
|
* If the endpoint authorization scheme is not set and is not optional, it will throw.
|
|
@@ -341,6 +389,17 @@ function getEndpointAuthorizationScheme(id, optional) {
|
|
|
341
389
|
return authScheme;
|
|
342
390
|
}
|
|
343
391
|
exports.getEndpointAuthorizationScheme = getEndpointAuthorizationScheme;
|
|
392
|
+
/**
|
|
393
|
+
* Gets the endpoint authorization scheme for a service endpoint
|
|
394
|
+
* If the endpoint authorization scheme is not set, it will throw.
|
|
395
|
+
*
|
|
396
|
+
* @param id name of the service endpoint
|
|
397
|
+
* @returns {string} value of the endpoint authorization scheme
|
|
398
|
+
*/
|
|
399
|
+
function getEndpointAuthorizationSchemeRequired(id) {
|
|
400
|
+
return getEndpointAuthorizationScheme(id, false);
|
|
401
|
+
}
|
|
402
|
+
exports.getEndpointAuthorizationSchemeRequired = getEndpointAuthorizationSchemeRequired;
|
|
344
403
|
/**
|
|
345
404
|
* Gets the endpoint authorization parameter value for a service endpoint with specified key
|
|
346
405
|
* If the endpoint authorization parameter is not set and is not optional, it will throw.
|
|
@@ -359,6 +418,18 @@ function getEndpointAuthorizationParameter(id, key, optional) {
|
|
|
359
418
|
return authParam;
|
|
360
419
|
}
|
|
361
420
|
exports.getEndpointAuthorizationParameter = getEndpointAuthorizationParameter;
|
|
421
|
+
/**
|
|
422
|
+
* Gets the endpoint authorization parameter value for a service endpoint with specified key
|
|
423
|
+
* If the endpoint authorization parameter is not set, it will throw.
|
|
424
|
+
*
|
|
425
|
+
* @param id name of the service endpoint
|
|
426
|
+
* @param key key to find the endpoint authorization parameter
|
|
427
|
+
* @returns {string} value of the endpoint authorization parameter value
|
|
428
|
+
*/
|
|
429
|
+
function getEndpointAuthorizationParameterRequired(id, key) {
|
|
430
|
+
return getEndpointAuthorizationParameter(id, key, false);
|
|
431
|
+
}
|
|
432
|
+
exports.getEndpointAuthorizationParameterRequired = getEndpointAuthorizationParameterRequired;
|
|
362
433
|
/**
|
|
363
434
|
* Gets the authorization details for a service endpoint
|
|
364
435
|
* If the authorization was not set and is not optional, it will set the task result to Failed.
|
|
@@ -1535,6 +1606,21 @@ function findMatch(defaultRoot, patterns, findOptions, matchOptions) {
|
|
|
1535
1606
|
return finalResult;
|
|
1536
1607
|
}
|
|
1537
1608
|
exports.findMatch = findMatch;
|
|
1609
|
+
/**
|
|
1610
|
+
* Build Proxy URL in the following format: protocol://username:password@hostname:port
|
|
1611
|
+
* @param proxyUrl Url address of the proxy server (eg: http://example.com)
|
|
1612
|
+
* @param proxyUsername Proxy username (optional)
|
|
1613
|
+
* @param proxyPassword Proxy password (optional)
|
|
1614
|
+
* @returns string
|
|
1615
|
+
*/
|
|
1616
|
+
function getProxyFormattedUrl(proxyUrl, proxyUsername, proxyPassword) {
|
|
1617
|
+
var parsedUrl = new URL(proxyUrl);
|
|
1618
|
+
var proxyAddress = parsedUrl.protocol + "//" + parsedUrl.host;
|
|
1619
|
+
if (proxyUsername) {
|
|
1620
|
+
proxyAddress = parsedUrl.protocol + "//" + proxyUsername + ":" + proxyPassword + "@" + parsedUrl.host;
|
|
1621
|
+
}
|
|
1622
|
+
return proxyAddress;
|
|
1623
|
+
}
|
|
1538
1624
|
/**
|
|
1539
1625
|
* Gets http proxy configuration used by Build/Release agent
|
|
1540
1626
|
*
|
|
@@ -1558,11 +1644,13 @@ function getHttpProxyConfiguration(requestUrl) {
|
|
|
1558
1644
|
return null;
|
|
1559
1645
|
}
|
|
1560
1646
|
else {
|
|
1647
|
+
var proxyAddress = getProxyFormattedUrl(proxyUrl, proxyUsername, proxyPassword);
|
|
1561
1648
|
return {
|
|
1562
1649
|
proxyUrl: proxyUrl,
|
|
1563
1650
|
proxyUsername: proxyUsername,
|
|
1564
1651
|
proxyPassword: proxyPassword,
|
|
1565
|
-
proxyBypassHosts: proxyBypassHosts
|
|
1652
|
+
proxyBypassHosts: proxyBypassHosts,
|
|
1653
|
+
proxyFormattedUrl: proxyAddress
|
|
1566
1654
|
};
|
|
1567
1655
|
}
|
|
1568
1656
|
}
|