azure-pipelines-task-lib 4.10.1 → 4.12.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/internal.d.ts +6 -2
- package/internal.js +20 -5
- package/package.json +1 -1
- package/toolrunner.js +68 -38
package/internal.d.ts
CHANGED
|
@@ -16,6 +16,10 @@ export declare enum IssueSource {
|
|
|
16
16
|
CustomerScript = "CustomerScript",
|
|
17
17
|
TaskInternal = "TaskInternal"
|
|
18
18
|
}
|
|
19
|
+
export declare enum IssueAuditAction {
|
|
20
|
+
Unknown = 0,
|
|
21
|
+
ShellTasksValidation = 1
|
|
22
|
+
}
|
|
19
23
|
export declare function _startsWith(str: string, start: string): boolean;
|
|
20
24
|
export declare function _endsWith(str: string, end: string): boolean;
|
|
21
25
|
export declare function _truncateBeforeSensitiveKeyword(str: string, sensitiveKeywordsPattern: RegExp): string;
|
|
@@ -56,8 +60,8 @@ export interface _KnownVariableInfo {
|
|
|
56
60
|
secret: boolean;
|
|
57
61
|
}
|
|
58
62
|
export declare function _command(command: string, properties: any, message: string): void;
|
|
59
|
-
export declare function _warning(message: string, source?: IssueSource): void;
|
|
60
|
-
export declare function _error(message: string, source?: IssueSource): void;
|
|
63
|
+
export declare function _warning(message: string, source?: IssueSource, auditAction?: IssueAuditAction): void;
|
|
64
|
+
export declare function _error(message: string, source?: IssueSource, auditAction?: IssueAuditAction): void;
|
|
61
65
|
export declare function _debug(message: string): void;
|
|
62
66
|
/**
|
|
63
67
|
* Returns whether a path exists.
|
package/internal.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
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._truncateBeforeSensitiveKeyword = exports._endsWith = exports._startsWith = exports.IssueSource = exports._vault = exports._knownVariableMap = void 0;
|
|
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._truncateBeforeSensitiveKeyword = exports._endsWith = exports._startsWith = exports.IssueAuditAction = exports.IssueSource = exports._vault = exports._knownVariableMap = void 0;
|
|
4
4
|
var fs = require("fs");
|
|
5
5
|
var path = require("path");
|
|
6
6
|
var os = require("os");
|
|
@@ -29,6 +29,11 @@ var IssueSource;
|
|
|
29
29
|
IssueSource["CustomerScript"] = "CustomerScript";
|
|
30
30
|
IssueSource["TaskInternal"] = "TaskInternal";
|
|
31
31
|
})(IssueSource = exports.IssueSource || (exports.IssueSource = {}));
|
|
32
|
+
var IssueAuditAction;
|
|
33
|
+
(function (IssueAuditAction) {
|
|
34
|
+
IssueAuditAction[IssueAuditAction["Unknown"] = 0] = "Unknown";
|
|
35
|
+
IssueAuditAction[IssueAuditAction["ShellTasksValidation"] = 1] = "ShellTasksValidation";
|
|
36
|
+
})(IssueAuditAction = exports.IssueAuditAction || (exports.IssueAuditAction = {}));
|
|
32
37
|
//-----------------------------------------------------
|
|
33
38
|
// Validation Checks
|
|
34
39
|
//-----------------------------------------------------
|
|
@@ -268,14 +273,24 @@ function _command(command, properties, message) {
|
|
|
268
273
|
_writeLine(taskCmd.toString());
|
|
269
274
|
}
|
|
270
275
|
exports._command = _command;
|
|
271
|
-
function _warning(message, source) {
|
|
276
|
+
function _warning(message, source, auditAction) {
|
|
272
277
|
if (source === void 0) { source = IssueSource.TaskInternal; }
|
|
273
|
-
_command('task.issue', {
|
|
278
|
+
_command('task.issue', {
|
|
279
|
+
'type': 'warning',
|
|
280
|
+
'source': source,
|
|
281
|
+
'correlationId': _commandCorrelationId,
|
|
282
|
+
'auditAction': auditAction
|
|
283
|
+
}, message);
|
|
274
284
|
}
|
|
275
285
|
exports._warning = _warning;
|
|
276
|
-
function _error(message, source) {
|
|
286
|
+
function _error(message, source, auditAction) {
|
|
277
287
|
if (source === void 0) { source = IssueSource.TaskInternal; }
|
|
278
|
-
_command('task.issue', {
|
|
288
|
+
_command('task.issue', {
|
|
289
|
+
'type': 'error',
|
|
290
|
+
'source': source,
|
|
291
|
+
'correlationId': _commandCorrelationId,
|
|
292
|
+
'auditAction': auditAction
|
|
293
|
+
}, message);
|
|
279
294
|
}
|
|
280
295
|
exports._error = _error;
|
|
281
296
|
function _debug(message) {
|
package/package.json
CHANGED
package/toolrunner.js
CHANGED
|
@@ -964,7 +964,42 @@ var ToolRunner = /** @class */ (function (_super) {
|
|
|
964
964
|
state.on('debug', function (message) {
|
|
965
965
|
_this._debug(message);
|
|
966
966
|
});
|
|
967
|
-
var
|
|
967
|
+
var stdbuffer = '';
|
|
968
|
+
var errbuffer = '';
|
|
969
|
+
var emitDoneEvent = function (resolve, reject) {
|
|
970
|
+
var _this = this;
|
|
971
|
+
state.on('done', function (error, exitCode) {
|
|
972
|
+
if (stdbuffer.length > 0) {
|
|
973
|
+
_this.emit('stdline', stdbuffer);
|
|
974
|
+
}
|
|
975
|
+
if (errbuffer.length > 0) {
|
|
976
|
+
_this.emit('errline', errbuffer);
|
|
977
|
+
}
|
|
978
|
+
if (cp) {
|
|
979
|
+
cp.removeAllListeners();
|
|
980
|
+
}
|
|
981
|
+
if (error) {
|
|
982
|
+
reject(error);
|
|
983
|
+
}
|
|
984
|
+
else {
|
|
985
|
+
resolve(exitCode);
|
|
986
|
+
}
|
|
987
|
+
});
|
|
988
|
+
};
|
|
989
|
+
// Edge case when the node itself cant's spawn and emit event
|
|
990
|
+
var cp;
|
|
991
|
+
try {
|
|
992
|
+
cp = child.spawn(this._getSpawnFileName(options), this._getSpawnArgs(optionsNonNull), this._getSpawnOptions(options));
|
|
993
|
+
}
|
|
994
|
+
catch (error) {
|
|
995
|
+
return new Promise(function (resolve, reject) {
|
|
996
|
+
emitDoneEvent(resolve, reject);
|
|
997
|
+
state.processError = error.message;
|
|
998
|
+
state.processExited = true;
|
|
999
|
+
state.processClosed = true;
|
|
1000
|
+
state.CheckComplete();
|
|
1001
|
+
});
|
|
1002
|
+
}
|
|
968
1003
|
this.childProcess = cp;
|
|
969
1004
|
// it is possible for the child process to end its last line without a new line.
|
|
970
1005
|
// because stdout is buffered, this causes the last line to not get sent to the parent
|
|
@@ -974,7 +1009,6 @@ var ToolRunner = /** @class */ (function (_super) {
|
|
|
974
1009
|
optionsNonNull.outStream.write(os.EOL);
|
|
975
1010
|
}
|
|
976
1011
|
});
|
|
977
|
-
var stdbuffer = '';
|
|
978
1012
|
(_b = cp.stdout) === null || _b === void 0 ? void 0 : _b.on('data', function (data) {
|
|
979
1013
|
_this.emit('stdout', data);
|
|
980
1014
|
if (!optionsNonNull.silent) {
|
|
@@ -984,7 +1018,6 @@ var ToolRunner = /** @class */ (function (_super) {
|
|
|
984
1018
|
_this.emit('stdline', line);
|
|
985
1019
|
});
|
|
986
1020
|
});
|
|
987
|
-
var errbuffer = '';
|
|
988
1021
|
(_c = cp.stderr) === null || _c === void 0 ? void 0 : _c.on('data', function (data) {
|
|
989
1022
|
state.processStderr = true;
|
|
990
1023
|
_this.emit('stderr', data);
|
|
@@ -1015,23 +1048,7 @@ var ToolRunner = /** @class */ (function (_super) {
|
|
|
1015
1048
|
_this._debug("STDIO streams have closed for tool '" + _this.toolPath + "'");
|
|
1016
1049
|
state.CheckComplete();
|
|
1017
1050
|
});
|
|
1018
|
-
return new Promise(
|
|
1019
|
-
state.on('done', function (error, exitCode) {
|
|
1020
|
-
if (stdbuffer.length > 0) {
|
|
1021
|
-
_this.emit('stdline', stdbuffer);
|
|
1022
|
-
}
|
|
1023
|
-
if (errbuffer.length > 0) {
|
|
1024
|
-
_this.emit('errline', errbuffer);
|
|
1025
|
-
}
|
|
1026
|
-
cp.removeAllListeners();
|
|
1027
|
-
if (error) {
|
|
1028
|
-
reject(error);
|
|
1029
|
-
}
|
|
1030
|
-
else {
|
|
1031
|
-
resolve(exitCode);
|
|
1032
|
-
}
|
|
1033
|
-
});
|
|
1034
|
-
});
|
|
1051
|
+
return new Promise(emitDoneEvent);
|
|
1035
1052
|
};
|
|
1036
1053
|
/**
|
|
1037
1054
|
* Exec a tool.
|
|
@@ -1063,7 +1080,37 @@ var ToolRunner = /** @class */ (function (_super) {
|
|
|
1063
1080
|
state.on('debug', function (message) {
|
|
1064
1081
|
_this._debug(message);
|
|
1065
1082
|
});
|
|
1066
|
-
var
|
|
1083
|
+
var stdbuffer = '';
|
|
1084
|
+
var errbuffer = '';
|
|
1085
|
+
state.on('done', function (error, exitCode) {
|
|
1086
|
+
if (stdbuffer.length > 0) {
|
|
1087
|
+
_this.emit('stdline', stdbuffer);
|
|
1088
|
+
}
|
|
1089
|
+
if (errbuffer.length > 0) {
|
|
1090
|
+
_this.emit('errline', errbuffer);
|
|
1091
|
+
}
|
|
1092
|
+
if (cp) {
|
|
1093
|
+
cp.removeAllListeners();
|
|
1094
|
+
}
|
|
1095
|
+
if (error) {
|
|
1096
|
+
defer.reject(error);
|
|
1097
|
+
}
|
|
1098
|
+
else {
|
|
1099
|
+
defer.resolve(exitCode);
|
|
1100
|
+
}
|
|
1101
|
+
});
|
|
1102
|
+
// Edge case when the node itself cant's spawn and emit event
|
|
1103
|
+
var cp;
|
|
1104
|
+
try {
|
|
1105
|
+
cp = child.spawn(this._getSpawnFileName(options), this._getSpawnArgs(optionsNonNull), this._getSpawnOptions(options));
|
|
1106
|
+
}
|
|
1107
|
+
catch (error) {
|
|
1108
|
+
state.processError = error.message;
|
|
1109
|
+
state.processExited = true;
|
|
1110
|
+
state.processClosed = true;
|
|
1111
|
+
state.CheckComplete();
|
|
1112
|
+
return defer.promise;
|
|
1113
|
+
}
|
|
1067
1114
|
this.childProcess = cp;
|
|
1068
1115
|
// it is possible for the child process to end its last line without a new line.
|
|
1069
1116
|
// because stdout is buffered, this causes the last line to not get sent to the parent
|
|
@@ -1073,7 +1120,6 @@ var ToolRunner = /** @class */ (function (_super) {
|
|
|
1073
1120
|
optionsNonNull.outStream.write(os.EOL);
|
|
1074
1121
|
}
|
|
1075
1122
|
});
|
|
1076
|
-
var stdbuffer = '';
|
|
1077
1123
|
(_b = cp.stdout) === null || _b === void 0 ? void 0 : _b.on('data', function (data) {
|
|
1078
1124
|
_this.emit('stdout', data);
|
|
1079
1125
|
if (!optionsNonNull.silent) {
|
|
@@ -1083,7 +1129,6 @@ var ToolRunner = /** @class */ (function (_super) {
|
|
|
1083
1129
|
_this.emit('stdline', line);
|
|
1084
1130
|
});
|
|
1085
1131
|
});
|
|
1086
|
-
var errbuffer = '';
|
|
1087
1132
|
(_c = cp.stderr) === null || _c === void 0 ? void 0 : _c.on('data', function (data) {
|
|
1088
1133
|
state.processStderr = true;
|
|
1089
1134
|
_this.emit('stderr', data);
|
|
@@ -1114,21 +1159,6 @@ var ToolRunner = /** @class */ (function (_super) {
|
|
|
1114
1159
|
_this._debug("STDIO streams have closed for tool '" + _this.toolPath + "'");
|
|
1115
1160
|
state.CheckComplete();
|
|
1116
1161
|
});
|
|
1117
|
-
state.on('done', function (error, exitCode) {
|
|
1118
|
-
if (stdbuffer.length > 0) {
|
|
1119
|
-
_this.emit('stdline', stdbuffer);
|
|
1120
|
-
}
|
|
1121
|
-
if (errbuffer.length > 0) {
|
|
1122
|
-
_this.emit('errline', errbuffer);
|
|
1123
|
-
}
|
|
1124
|
-
cp.removeAllListeners();
|
|
1125
|
-
if (error) {
|
|
1126
|
-
defer.reject(error);
|
|
1127
|
-
}
|
|
1128
|
-
else {
|
|
1129
|
-
defer.resolve(exitCode);
|
|
1130
|
-
}
|
|
1131
|
-
});
|
|
1132
1162
|
return defer.promise;
|
|
1133
1163
|
};
|
|
1134
1164
|
/**
|