azure-pipelines-task-lib 5.0.0-preview.0 → 5.0.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/Strings/resources.resjson/de-DE/resources.resjson +35 -34
- package/Strings/resources.resjson/en-US/resources.resjson +24 -20
- package/Strings/resources.resjson/es-ES/resources.resjson +35 -34
- package/Strings/resources.resjson/fr-FR/resources.resjson +35 -34
- package/Strings/resources.resjson/it-IT/resources.resjson +2 -1
- package/Strings/resources.resjson/ja-JP/resources.resjson +35 -34
- package/Strings/resources.resjson/ko-KR/resources.resjson +2 -1
- package/Strings/resources.resjson/ru-RU/resources.resjson +2 -1
- package/Strings/resources.resjson/zh-CN/resources.resjson +2 -1
- package/Strings/resources.resjson/zh-TW/resources.resjson +2 -1
- package/ThirdPartyNotice.txt +5 -3
- package/internal.d.ts +13 -2
- package/internal.js +73 -20
- package/lib.json +26 -22
- package/mock-answer.d.ts +4 -1
- package/mock-answer.js +2 -2
- package/mock-task.d.ts +3 -0
- package/mock-task.js +20 -2
- package/mock-test.d.ts +3 -2
- package/mock-test.js +296 -166
- package/mock-toolrunner.d.ts +7 -0
- package/mock-toolrunner.js +95 -1
- package/package.json +4 -3
- package/task.d.ts +121 -33
- package/task.js +565 -262
- package/toolrunner.d.ts +15 -1
- package/toolrunner.js +360 -43
package/internal.js
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
+
var _a, _b;
|
|
2
3
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports._exposeCertSettings = exports._exposeProxySettings = exports._normalizeSeparators = exports._isRooted = exports._getDirectoryName = exports._ensureRooted = exports._isUncPath = exports._loadData = exports._ensurePatternRooted = exports._getFindInfoFromPattern = exports._cloneMatchOptions = exports._legacyFindFiles_convertPatternToRegExp = exports._which = exports._checkPath = exports._exist = exports._debug = exports._error = exports._warning = exports._command = exports._getVariableKey = exports._getVariable = exports._loc = exports._setResourcePath = exports._setErrStream = exports._setStdStream = exports._writeLine = exports._endsWith = exports._startsWith = exports._vault = exports._knownVariableMap = void 0;
|
|
4
|
+
exports.isSigPipeError = exports._exposeCertSettings = exports._exposeProxySettings = exports._normalizeSeparators = exports._isRooted = exports._getDirectoryName = exports._ensureRooted = exports._isUncPath = exports._loadData = exports._ensurePatternRooted = exports._getFindInfoFromPattern = exports._cloneMatchOptions = exports._legacyFindFiles_convertPatternToRegExp = exports._which = exports._checkPath = exports._exist = exports._debug = exports._error = exports._warning = exports._command = exports._getVariableKey = exports._getVariable = exports._loc = exports._setResourcePath = exports._setErrStream = exports._setStdStream = exports._writeLine = exports._truncateBeforeSensitiveKeyword = exports._endsWith = exports._startsWith = exports.IssueAuditAction = exports.IssueSource = exports._vault = exports._knownVariableMap = void 0;
|
|
4
5
|
var fs = require("fs");
|
|
5
6
|
var path = require("path");
|
|
6
7
|
var os = require("os");
|
|
@@ -20,12 +21,26 @@ var crypto = require("crypto");
|
|
|
20
21
|
* 3) to know the real variable name and not just the formatted env var name.
|
|
21
22
|
*/
|
|
22
23
|
exports._knownVariableMap = {};
|
|
24
|
+
var _commandCorrelationId;
|
|
25
|
+
//-----------------------------------------------------
|
|
26
|
+
// Enums
|
|
27
|
+
//-----------------------------------------------------
|
|
28
|
+
var IssueSource;
|
|
29
|
+
(function (IssueSource) {
|
|
30
|
+
IssueSource["CustomerScript"] = "CustomerScript";
|
|
31
|
+
IssueSource["TaskInternal"] = "TaskInternal";
|
|
32
|
+
})(IssueSource = exports.IssueSource || (exports.IssueSource = {}));
|
|
33
|
+
var IssueAuditAction;
|
|
34
|
+
(function (IssueAuditAction) {
|
|
35
|
+
IssueAuditAction[IssueAuditAction["Unknown"] = 0] = "Unknown";
|
|
36
|
+
IssueAuditAction[IssueAuditAction["ShellTasksValidation"] = 1] = "ShellTasksValidation";
|
|
37
|
+
})(IssueAuditAction = exports.IssueAuditAction || (exports.IssueAuditAction = {}));
|
|
23
38
|
//-----------------------------------------------------
|
|
24
39
|
// Validation Checks
|
|
25
40
|
//-----------------------------------------------------
|
|
26
41
|
// async await needs generators in node 4.x+
|
|
27
42
|
if (semver.lt(process.versions.node, '4.2.0')) {
|
|
28
|
-
_warning('Tasks require a new agent. Upgrade your agent or node to 4.2.0 or later');
|
|
43
|
+
_warning('Tasks require a new agent. Upgrade your agent or node to 4.2.0 or later', IssueSource.TaskInternal);
|
|
29
44
|
}
|
|
30
45
|
//-----------------------------------------------------
|
|
31
46
|
// String convenience
|
|
@@ -38,6 +53,17 @@ function _endsWith(str, end) {
|
|
|
38
53
|
return str.slice(-end.length) == end;
|
|
39
54
|
}
|
|
40
55
|
exports._endsWith = _endsWith;
|
|
56
|
+
function _truncateBeforeSensitiveKeyword(str, sensitiveKeywordsPattern) {
|
|
57
|
+
if (!str) {
|
|
58
|
+
return str;
|
|
59
|
+
}
|
|
60
|
+
var index = str.search(sensitiveKeywordsPattern);
|
|
61
|
+
if (index <= 0) {
|
|
62
|
+
return str;
|
|
63
|
+
}
|
|
64
|
+
return "".concat(str.substring(0, index), "...");
|
|
65
|
+
}
|
|
66
|
+
exports._truncateBeforeSensitiveKeyword = _truncateBeforeSensitiveKeyword;
|
|
41
67
|
//-----------------------------------------------------
|
|
42
68
|
// General Helpers
|
|
43
69
|
//-----------------------------------------------------
|
|
@@ -116,7 +142,7 @@ function _loadLocStrings(resourceFile, culture) {
|
|
|
116
142
|
}
|
|
117
143
|
}
|
|
118
144
|
else {
|
|
119
|
-
_warning('LIB_ResourceFile does not exist');
|
|
145
|
+
_warning('LIB_ResourceFile does not exist', IssueSource.TaskInternal);
|
|
120
146
|
}
|
|
121
147
|
return locStrings;
|
|
122
148
|
}
|
|
@@ -148,10 +174,9 @@ function _setResourcePath(path, ignoreWarnings) {
|
|
|
148
174
|
}
|
|
149
175
|
else {
|
|
150
176
|
if (ignoreWarnings) {
|
|
151
|
-
_debug(_loc('LIB_ResourceFileAlreadySet', path));
|
|
152
177
|
}
|
|
153
178
|
else {
|
|
154
|
-
_warning(_loc('LIB_ResourceFileAlreadySet', path));
|
|
179
|
+
_warning(_loc('LIB_ResourceFileAlreadySet', path), IssueSource.TaskInternal);
|
|
155
180
|
}
|
|
156
181
|
}
|
|
157
182
|
}
|
|
@@ -185,10 +210,10 @@ function _loc(key) {
|
|
|
185
210
|
}
|
|
186
211
|
else {
|
|
187
212
|
if (Object.keys(_resourceFiles).length <= 0) {
|
|
188
|
-
_warning("Resource file haven't been set, can't find loc string for key: "
|
|
213
|
+
_warning("Resource file haven't been set, can't find loc string for key: ".concat(key), IssueSource.TaskInternal);
|
|
189
214
|
}
|
|
190
215
|
else {
|
|
191
|
-
_warning("Can't find loc string for key: "
|
|
216
|
+
_warning("Can't find loc string for key: ".concat(key));
|
|
192
217
|
}
|
|
193
218
|
locString = key;
|
|
194
219
|
}
|
|
@@ -248,16 +273,33 @@ function _command(command, properties, message) {
|
|
|
248
273
|
_writeLine(taskCmd.toString());
|
|
249
274
|
}
|
|
250
275
|
exports._command = _command;
|
|
251
|
-
function _warning(message) {
|
|
252
|
-
|
|
276
|
+
function _warning(message, source, auditAction) {
|
|
277
|
+
if (source === void 0) { source = IssueSource.TaskInternal; }
|
|
278
|
+
_command('task.issue', {
|
|
279
|
+
'type': 'warning',
|
|
280
|
+
'source': source,
|
|
281
|
+
'correlationId': _commandCorrelationId,
|
|
282
|
+
'auditAction': auditAction
|
|
283
|
+
}, message);
|
|
253
284
|
}
|
|
254
285
|
exports._warning = _warning;
|
|
255
|
-
function _error(message) {
|
|
256
|
-
|
|
286
|
+
function _error(message, source, auditAction) {
|
|
287
|
+
if (source === void 0) { source = IssueSource.TaskInternal; }
|
|
288
|
+
_command('task.issue', {
|
|
289
|
+
'type': 'error',
|
|
290
|
+
'source': source,
|
|
291
|
+
'correlationId': _commandCorrelationId,
|
|
292
|
+
'auditAction': auditAction
|
|
293
|
+
}, message);
|
|
257
294
|
}
|
|
258
295
|
exports._error = _error;
|
|
296
|
+
var debugMode = ((_a = _getVariable('system.debug')) === null || _a === void 0 ? void 0 : _a.toLowerCase()) === 'true';
|
|
297
|
+
var shouldCheckDebugMode = ((_b = _getVariable('DistributedTask.Tasks.Node.SkipDebugLogsWhenDebugModeOff')) === null || _b === void 0 ? void 0 : _b.toLowerCase()) === 'true';
|
|
259
298
|
function _debug(message) {
|
|
260
|
-
|
|
299
|
+
if (!shouldCheckDebugMode
|
|
300
|
+
|| (shouldCheckDebugMode && debugMode)) {
|
|
301
|
+
_command('task.debug', null, message);
|
|
302
|
+
}
|
|
261
303
|
}
|
|
262
304
|
exports._debug = _debug;
|
|
263
305
|
// //-----------------------------------------------------
|
|
@@ -327,7 +369,7 @@ function _which(tool, check) {
|
|
|
327
369
|
}
|
|
328
370
|
}
|
|
329
371
|
}
|
|
330
|
-
_debug("which '"
|
|
372
|
+
_debug("which '".concat(tool, "'"));
|
|
331
373
|
try {
|
|
332
374
|
// build the list of extensions to try
|
|
333
375
|
var extensions = [];
|
|
@@ -343,7 +385,7 @@ function _which(tool, check) {
|
|
|
343
385
|
if (_isRooted(tool)) {
|
|
344
386
|
var filePath = _tryGetExecutablePath(tool, extensions);
|
|
345
387
|
if (filePath) {
|
|
346
|
-
_debug("found: '"
|
|
388
|
+
_debug("found: '".concat(filePath, "'"));
|
|
347
389
|
return filePath;
|
|
348
390
|
}
|
|
349
391
|
_debug('not found');
|
|
@@ -374,7 +416,7 @@ function _which(tool, check) {
|
|
|
374
416
|
var directory = directories_1[_d];
|
|
375
417
|
var filePath = _tryGetExecutablePath(directory + path.sep + tool, extensions);
|
|
376
418
|
if (filePath) {
|
|
377
|
-
_debug("found: '"
|
|
419
|
+
_debug("found: '".concat(filePath, "'"));
|
|
378
420
|
return filePath;
|
|
379
421
|
}
|
|
380
422
|
}
|
|
@@ -418,7 +460,7 @@ function _tryGetExecutablePath(filePath, extensions) {
|
|
|
418
460
|
}
|
|
419
461
|
catch (err) {
|
|
420
462
|
if (err.code != 'ENOENT') {
|
|
421
|
-
_debug("Unexpected error attempting to determine if executable file exists '"
|
|
463
|
+
_debug("Unexpected error attempting to determine if executable file exists '".concat(filePath, "': ").concat(err));
|
|
422
464
|
}
|
|
423
465
|
}
|
|
424
466
|
// try each extension
|
|
@@ -444,7 +486,7 @@ function _tryGetExecutablePath(filePath, extensions) {
|
|
|
444
486
|
}
|
|
445
487
|
}
|
|
446
488
|
catch (err) {
|
|
447
|
-
_debug("Unexpected error attempting to determine the actual case of the file '"
|
|
489
|
+
_debug("Unexpected error attempting to determine the actual case of the file '".concat(filePath_1, "': ").concat(err));
|
|
448
490
|
}
|
|
449
491
|
return filePath_1;
|
|
450
492
|
}
|
|
@@ -457,7 +499,7 @@ function _tryGetExecutablePath(filePath, extensions) {
|
|
|
457
499
|
}
|
|
458
500
|
catch (err) {
|
|
459
501
|
if (err.code != 'ENOENT') {
|
|
460
|
-
_debug("Unexpected error attempting to determine if executable file exists '"
|
|
502
|
+
_debug("Unexpected error attempting to determine if executable file exists '".concat(filePath_1, "': ").concat(err));
|
|
461
503
|
}
|
|
462
504
|
}
|
|
463
505
|
}
|
|
@@ -476,7 +518,7 @@ function _legacyFindFiles_convertPatternToRegExp(pattern) {
|
|
|
476
518
|
.replace(/\\\*\\\*/g, '.*') // replace remaining globstars with a wildcard that can span directory separators, e.g. /hello/**dll
|
|
477
519
|
.replace(/\\\*/g, '[^\/]*') // replace asterisks with a wildcard that cannot span directory separators, e.g. /hello/*.dll
|
|
478
520
|
.replace(/\\\?/g, '[^\/]'); // replace single character wildcards, e.g. /hello/log?.dll
|
|
479
|
-
pattern = "^"
|
|
521
|
+
pattern = "^".concat(pattern, "$");
|
|
480
522
|
var flags = process.platform == 'win32' ? 'i' : '';
|
|
481
523
|
return new RegExp(pattern, flags);
|
|
482
524
|
}
|
|
@@ -642,6 +684,9 @@ function _loadData() {
|
|
|
642
684
|
}
|
|
643
685
|
}
|
|
644
686
|
_debug('loaded ' + loaded);
|
|
687
|
+
var correlationId = process.env["COMMAND_CORRELATION_ID"];
|
|
688
|
+
delete process.env["COMMAND_CORRELATION_ID"];
|
|
689
|
+
_commandCorrelationId = correlationId ? String(correlationId) : "";
|
|
645
690
|
// store public variable metadata
|
|
646
691
|
var names;
|
|
647
692
|
try {
|
|
@@ -876,10 +921,18 @@ function _exposeTaskLibSecret(keyFile, secret) {
|
|
|
876
921
|
if (secret) {
|
|
877
922
|
var encryptKey = crypto.randomBytes(256);
|
|
878
923
|
var cipher = crypto.createCipher("aes-256-ctr", encryptKey);
|
|
879
|
-
var encryptedContent = cipher.update(secret, "utf8", "hex");
|
|
924
|
+
var encryptedContent = cipher.update(secret, "utf8", "hex"); // CodeQL [SM01511] agent need to retrieve password later to connect to proxy server
|
|
880
925
|
encryptedContent += cipher.final("hex");
|
|
881
926
|
var storageFile = path.join(_getVariable('Agent.TempDirectory') || _getVariable("agent.workFolder") || process.cwd(), keyFile);
|
|
882
927
|
fs.writeFileSync(storageFile, encryptKey.toString('base64'), { encoding: 'utf8' });
|
|
883
928
|
return new Buffer(storageFile).toString('base64') + ':' + new Buffer(encryptedContent).toString('base64');
|
|
884
929
|
}
|
|
885
930
|
}
|
|
931
|
+
function isSigPipeError(e) {
|
|
932
|
+
var _a;
|
|
933
|
+
if (!e || typeof e !== 'object') {
|
|
934
|
+
return false;
|
|
935
|
+
}
|
|
936
|
+
return e.code === 'EPIPE' && ((_a = e.syscall) === null || _a === void 0 ? void 0 : _a.toUpperCase()) === 'WRITE';
|
|
937
|
+
}
|
|
938
|
+
exports.isSigPipeError = isSigPipeError;
|
package/lib.json
CHANGED
|
@@ -1,37 +1,41 @@
|
|
|
1
1
|
{
|
|
2
2
|
"messages": {
|
|
3
|
-
"
|
|
3
|
+
"LIB_CopyFileFailed": "Error while copying the file. Attempts left: %s",
|
|
4
|
+
"LIB_DirectoryStackEmpty": "Directory stack is empty",
|
|
5
|
+
"LIB_EndpointAuthNotExist": "Endpoint auth data not present: %s",
|
|
6
|
+
"LIB_EndpointDataNotExist": "Endpoint data parameter %s not present: %s",
|
|
7
|
+
"LIB_EndpointNotExist": "Endpoint not present: %s",
|
|
4
8
|
"LIB_FailOnCode": "Failure return code: %d",
|
|
9
|
+
"LIB_InputRequired": "Input required: %s",
|
|
10
|
+
"LIB_InvalidEndpointAuth": "Invalid endpoint auth: %s",
|
|
11
|
+
"LIB_InvalidPattern": "Invalid pattern: '%s'",
|
|
12
|
+
"LIB_InvalidSecureFilesInput": "Invalid secure file input: %s",
|
|
13
|
+
"LIB_LocStringNotFound": "Can\\'t find loc string for key: %s",
|
|
14
|
+
"LIB_MergeTestResultNotSupported": "Merging test results from multiple files to one test run is not supported on this version of build agent for OSX/Linux, each test result file will be published as a separate test run in VSO/TFS.",
|
|
5
15
|
"LIB_MkdirFailed": "Unable to create directory '%s'. %s",
|
|
6
16
|
"LIB_MkdirFailedFileExists": "Unable to create directory '%s'. Conflicting file exists: '%s'",
|
|
7
17
|
"LIB_MkdirFailedInvalidDriveRoot": "Unable to create directory '%s'. Root directory does not exist: '%s'",
|
|
8
18
|
"LIB_MkdirFailedInvalidShare": "Unable to create directory '%s'. Unable to verify the directory exists: '%s'. If directory is a file share, please verify the share name is correct, the share is online, and the current process has permission to access the share.",
|
|
9
19
|
"LIB_MultilineSecret": "Secrets cannot contain multiple lines",
|
|
20
|
+
"LIB_NotFoundPreviousDirectory": "Could not find previous directory",
|
|
21
|
+
"LIB_OperationFailed": "Failed %s: %s",
|
|
22
|
+
"LIB_ParameterIsRequired": "%s not supplied",
|
|
23
|
+
"LIB_PathHasNullByte": "Path cannot contain null bytes",
|
|
24
|
+
"LIB_PathIsNotADirectory": "Path is not a directory: %s",
|
|
25
|
+
"LIB_PathNotFound": "Not found %s: %s",
|
|
26
|
+
"LIB_PlatformNotSupported": "Platform not supported: %s",
|
|
10
27
|
"LIB_ProcessError": "There was an error when attempting to execute the process '%s'. This may indicate the process failed to start. Error: %s",
|
|
11
28
|
"LIB_ProcessExitCode": "The process '%s' failed with exit code %s",
|
|
12
29
|
"LIB_ProcessStderr": "The process '%s' failed because one or more lines were written to the STDERR stream",
|
|
13
|
-
"LIB_ReturnCode": "Return code: %d",
|
|
14
|
-
"LIB_ResourceFileNotExist": "Resource file doesn\\'t exist: %s",
|
|
15
30
|
"LIB_ResourceFileAlreadySet": "Resource file has already set to: %s",
|
|
31
|
+
"LIB_ResourceFileNotExist": "Resource file doesn\\'t exist: %s",
|
|
16
32
|
"LIB_ResourceFileNotSet": "Resource file haven\\'t set, can\\'t find loc string for key: %s",
|
|
33
|
+
"LIB_ReturnCode": "Return code: %d",
|
|
17
34
|
"LIB_StdioNotClosed": "The STDIO streams did not close within %s seconds of the exit event from process '%s'. This may indicate a child process inherited the STDIO streams and has not yet exited.",
|
|
18
|
-
"
|
|
19
|
-
"
|
|
20
|
-
"LIB_LocStringNotFound": "Can\\'t find loc string for key: %s",
|
|
21
|
-
"LIB_ParameterIsRequired": "%s not supplied",
|
|
22
|
-
"LIB_InputRequired": "Input required: %s",
|
|
23
|
-
"LIB_InvalidPattern": "Invalid pattern: '%s'",
|
|
24
|
-
"LIB_EndpointNotExist": "Endpoint not present: %s",
|
|
25
|
-
"LIB_EndpointDataNotExist": "Endpoint data parameter %s not present: %s",
|
|
26
|
-
"LIB_EndpointAuthNotExist": "Endpoint auth data not present: %s",
|
|
27
|
-
"LIB_InvalidEndpointAuth": "Invalid endpoint auth: %s",
|
|
28
|
-
"LIB_InvalidSecureFilesInput": "Invalid secure file input: %s",
|
|
29
|
-
"LIB_PathNotFound": "Not found %s: %s",
|
|
30
|
-
"LIB_PathHasNullByte": "Path cannot contain null bytes",
|
|
31
|
-
"LIB_OperationFailed": "Failed %s: %s",
|
|
35
|
+
"LIB_UndefinedNodeVersion": "Node version is undefined.",
|
|
36
|
+
"LIB_UnhandledEx": "Unhandled: %s",
|
|
32
37
|
"LIB_UseFirstGlobMatch": "Multiple workspace matches. using first.",
|
|
33
|
-
"
|
|
34
|
-
"
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
}
|
|
38
|
+
"LIB_WhichNotFound_Linux": "Unable to locate executable file: '%s'. Please verify either the file path exists or the file can be found within a directory specified by the PATH environment variable. Also check the file mode to verify the file is executable.",
|
|
39
|
+
"LIB_WhichNotFound_Win": "Unable to locate executable file: '%s'. Please verify either the file path exists or the file can be found within a directory specified by the PATH environment variable. Also verify the file has a valid extension for an executable file."
|
|
40
|
+
}
|
|
41
|
+
}
|
package/mock-answer.d.ts
CHANGED
|
@@ -26,6 +26,9 @@ export interface TaskLibAnswers {
|
|
|
26
26
|
getPlatform?: {
|
|
27
27
|
[key: string]: task.Platform;
|
|
28
28
|
};
|
|
29
|
+
getNodeMajorVersion?: {
|
|
30
|
+
[key: string]: Number;
|
|
31
|
+
};
|
|
29
32
|
getAgentMode?: {
|
|
30
33
|
[key: string]: task.AgentHostedMode;
|
|
31
34
|
};
|
|
@@ -50,7 +53,7 @@ export interface TaskLibAnswers {
|
|
|
50
53
|
[key: string]: string;
|
|
51
54
|
};
|
|
52
55
|
}
|
|
53
|
-
export
|
|
56
|
+
export type MockedCommand = keyof TaskLibAnswers;
|
|
54
57
|
export declare class MockAnswers {
|
|
55
58
|
private _answers;
|
|
56
59
|
initialize(answers: TaskLibAnswers): void;
|
package/mock-answer.js
CHANGED
|
@@ -11,12 +11,12 @@ var MockAnswers = /** @class */ (function () {
|
|
|
11
11
|
this._answers = answers;
|
|
12
12
|
};
|
|
13
13
|
MockAnswers.prototype.getResponse = function (cmd, key, debug) {
|
|
14
|
-
debug("looking up mock answers for "
|
|
14
|
+
debug("looking up mock answers for ".concat(JSON.stringify(cmd), ", key '").concat(JSON.stringify(key), "'"));
|
|
15
15
|
if (!this._answers) {
|
|
16
16
|
throw new Error('Must initialize');
|
|
17
17
|
}
|
|
18
18
|
if (!this._answers[cmd]) {
|
|
19
|
-
debug("no mock responses registered for "
|
|
19
|
+
debug("no mock responses registered for ".concat(JSON.stringify(cmd)));
|
|
20
20
|
return null;
|
|
21
21
|
}
|
|
22
22
|
var cmd_answer = this._answers[cmd];
|
package/mock-task.d.ts
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
/// <reference types="node" />
|
|
2
|
+
/// <reference types="node" />
|
|
2
3
|
import Q = require('q');
|
|
3
4
|
import fs = require('fs');
|
|
4
5
|
import task = require('./task');
|
|
@@ -58,6 +59,7 @@ export interface FsOptions {
|
|
|
58
59
|
export declare function writeFile(file: string, data: string | Buffer, options?: string | FsOptions): void;
|
|
59
60
|
export declare function osType(): string;
|
|
60
61
|
export declare function getPlatform(): task.Platform;
|
|
62
|
+
export declare function getNodeMajorVersion(): Number;
|
|
61
63
|
export declare function getAgentMode(): task.AgentHostedMode;
|
|
62
64
|
export declare function cwd(): string;
|
|
63
65
|
export declare function cd(path: string): void;
|
|
@@ -74,6 +76,7 @@ export declare function find(findPath: string): string[];
|
|
|
74
76
|
export declare function rmRF(path: string): void;
|
|
75
77
|
export declare function mv(source: string, dest: string, force: boolean, continueOnError?: boolean): boolean;
|
|
76
78
|
export declare function exec(tool: string, args: any, options?: trm.IExecOptions): Q.Promise<number>;
|
|
79
|
+
export declare function execAsync(tool: string, args: any, options?: trm.IExecOptions): Promise<number>;
|
|
77
80
|
export declare function execSync(tool: string, args: any, options?: trm.IExecSyncOptions): trm.IExecSyncResult;
|
|
78
81
|
export declare function tool(tool: string): trm.ToolRunner;
|
|
79
82
|
export interface MatchOptions {
|
package/mock-task.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.getHttpCertConfiguration = exports.getHttpProxyConfiguration = exports.CodeCoverageEnabler = exports.CodeCoveragePublisher = exports.TestPublisher = exports.legacyFindFiles = exports.findMatch = exports.tool = exports.execSync = exports.exec = exports.mv = exports.rmRF = exports.find = exports.retry = exports.cp = exports.ls = exports.which = exports.resolve = exports.mkdirP = exports.checkPath = exports.popd = exports.pushd = exports.cd = exports.cwd = exports.getAgentMode = exports.getPlatform = exports.osType = exports.writeFile = exports.exist = exports.stats = exports.FsStats = exports.loc = exports.setResourcePath = exports.setAnswers = void 0;
|
|
3
|
+
exports.getHttpCertConfiguration = exports.getHttpProxyConfiguration = exports.CodeCoverageEnabler = exports.CodeCoveragePublisher = exports.TestPublisher = exports.legacyFindFiles = exports.findMatch = exports.tool = exports.execSync = exports.execAsync = exports.exec = exports.mv = exports.rmRF = exports.find = exports.retry = exports.cp = exports.ls = exports.which = exports.resolve = exports.mkdirP = exports.checkPath = exports.popd = exports.pushd = exports.cd = exports.cwd = exports.getAgentMode = exports.getNodeMajorVersion = exports.getPlatform = exports.osType = exports.writeFile = exports.exist = exports.stats = exports.FsStats = exports.loc = exports.setResourcePath = exports.setAnswers = void 0;
|
|
4
4
|
var path = require("path");
|
|
5
5
|
var task = require("./task");
|
|
6
6
|
var tcm = require("./taskcommand");
|
|
@@ -27,6 +27,7 @@ module.exports.Platform = task.Platform;
|
|
|
27
27
|
module.exports.setStdStream = task.setStdStream;
|
|
28
28
|
module.exports.setErrStream = task.setErrStream;
|
|
29
29
|
module.exports.setResult = task.setResult;
|
|
30
|
+
module.exports.setSanitizedResult = task.setSanitizedResult;
|
|
30
31
|
//-----------------------------------------------------
|
|
31
32
|
// Loc Helpers
|
|
32
33
|
//-----------------------------------------------------
|
|
@@ -60,6 +61,7 @@ module.exports.getInput = task.getInput;
|
|
|
60
61
|
module.exports.getInputRequired = task.getInputRequired;
|
|
61
62
|
module.exports.getBoolInput = task.getBoolInput;
|
|
62
63
|
module.exports.getBoolFeatureFlag = task.getBoolFeatureFlag;
|
|
64
|
+
module.exports.getPipelineFeature = task.getPipelineFeature;
|
|
63
65
|
module.exports.getDelimitedInput = task.getDelimitedInput;
|
|
64
66
|
module.exports.filePathSupplied = task.filePathSupplied;
|
|
65
67
|
function getPathInput(name, required, check) {
|
|
@@ -189,6 +191,10 @@ function getPlatform() {
|
|
|
189
191
|
return mock.getResponse('getPlatform', 'getPlatform', module.exports.debug);
|
|
190
192
|
}
|
|
191
193
|
exports.getPlatform = getPlatform;
|
|
194
|
+
function getNodeMajorVersion() {
|
|
195
|
+
return mock.getResponse('getNodeMajorVersion', 'getNodeMajorVersion', module.exports.debug);
|
|
196
|
+
}
|
|
197
|
+
exports.getNodeMajorVersion = getNodeMajorVersion;
|
|
192
198
|
function getAgentMode() {
|
|
193
199
|
return mock.getResponse('getAgentMode', 'getAgentMode', module.exports.debug);
|
|
194
200
|
}
|
|
@@ -267,7 +273,7 @@ function cp(source, dest) {
|
|
|
267
273
|
}
|
|
268
274
|
exports.cp = cp;
|
|
269
275
|
function retry(func, args, retryOptions) {
|
|
270
|
-
module.exports.debug("trying to execute "
|
|
276
|
+
module.exports.debug("trying to execute ".concat(func === null || func === void 0 ? void 0 : func.name, "(").concat(args.toString(), ") with ").concat(retryOptions.retryCount, " retries"));
|
|
271
277
|
}
|
|
272
278
|
exports.retry = retry;
|
|
273
279
|
function find(findPath) {
|
|
@@ -299,6 +305,18 @@ function exec(tool, args, options) {
|
|
|
299
305
|
return tr.exec(options);
|
|
300
306
|
}
|
|
301
307
|
exports.exec = exec;
|
|
308
|
+
//-----------------------------------------------------
|
|
309
|
+
// Exec convenience wrapper
|
|
310
|
+
//-----------------------------------------------------
|
|
311
|
+
function execAsync(tool, args, options) {
|
|
312
|
+
var toolPath = which(tool, true);
|
|
313
|
+
var tr = this.tool(toolPath);
|
|
314
|
+
if (args) {
|
|
315
|
+
tr.arg(args);
|
|
316
|
+
}
|
|
317
|
+
return tr.execAsync(options);
|
|
318
|
+
}
|
|
319
|
+
exports.execAsync = execAsync;
|
|
302
320
|
function execSync(tool, args, options) {
|
|
303
321
|
var toolPath = which(tool, true);
|
|
304
322
|
var tr = this.tool(toolPath);
|
package/mock-test.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
export declare class MockTestRunner {
|
|
2
|
-
constructor(testPath
|
|
2
|
+
constructor(testPath?: string, taskJsonPath?: string);
|
|
3
3
|
private _testPath;
|
|
4
4
|
private _taskJsonPath;
|
|
5
5
|
nodePath: string;
|
|
@@ -10,13 +10,14 @@ export declare class MockTestRunner {
|
|
|
10
10
|
succeeded: boolean;
|
|
11
11
|
errorIssues: string[];
|
|
12
12
|
warningIssues: string[];
|
|
13
|
+
LoadAsync(testPath?: string, taskJsonPath?: string): Promise<MockTestRunner>;
|
|
13
14
|
get failed(): boolean;
|
|
14
15
|
ran(cmdline: string): boolean;
|
|
15
16
|
createdErrorIssue(message: string): boolean;
|
|
16
17
|
createdWarningIssue(message: string): boolean;
|
|
17
18
|
stdOutContained(message: string): boolean;
|
|
18
19
|
stdErrContained(message: string): boolean;
|
|
19
|
-
|
|
20
|
+
runAsync(nodeVersion?: number): Promise<void>;
|
|
20
21
|
private getNodePath;
|
|
21
22
|
private getNodeVersion;
|
|
22
23
|
private getTaskJsonPath;
|