|
|
|
|
@@ -358,14 +358,27 @@ function prefixCompare(version, releaseVersion) {
|
|
|
|
|
|
|
|
|
|
"use strict";
|
|
|
|
|
|
|
|
|
|
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
|
|
|
if (k2 === undefined) k2 = k;
|
|
|
|
|
Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
|
|
|
|
|
}) : (function(o, m, k, k2) {
|
|
|
|
|
if (k2 === undefined) k2 = k;
|
|
|
|
|
o[k2] = m[k];
|
|
|
|
|
}));
|
|
|
|
|
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
|
|
|
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
|
|
|
}) : function(o, v) {
|
|
|
|
|
o["default"] = v;
|
|
|
|
|
});
|
|
|
|
|
var __importStar = (this && this.__importStar) || function (mod) {
|
|
|
|
|
if (mod && mod.__esModule) return mod;
|
|
|
|
|
var result = {};
|
|
|
|
|
if (mod != null) for (var k in mod) if (Object.hasOwnProperty.call(mod, k)) result[k] = mod[k];
|
|
|
|
|
result["default"] = mod;
|
|
|
|
|
if (mod != null) for (var k in mod) if (k !== "default" && Object.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
|
|
|
|
__setModuleDefault(result, mod);
|
|
|
|
|
return result;
|
|
|
|
|
};
|
|
|
|
|
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
|
|
|
|
exports.issue = exports.issueCommand = void 0;
|
|
|
|
|
const os = __importStar(__nccwpck_require__(2087));
|
|
|
|
|
const utils_1 = __nccwpck_require__(5278);
|
|
|
|
|
/**
|
|
|
|
|
@@ -444,6 +457,25 @@ function escapeProperty(s) {
|
|
|
|
|
|
|
|
|
|
"use strict";
|
|
|
|
|
|
|
|
|
|
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
|
|
|
if (k2 === undefined) k2 = k;
|
|
|
|
|
Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
|
|
|
|
|
}) : (function(o, m, k, k2) {
|
|
|
|
|
if (k2 === undefined) k2 = k;
|
|
|
|
|
o[k2] = m[k];
|
|
|
|
|
}));
|
|
|
|
|
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
|
|
|
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
|
|
|
}) : function(o, v) {
|
|
|
|
|
o["default"] = v;
|
|
|
|
|
});
|
|
|
|
|
var __importStar = (this && this.__importStar) || function (mod) {
|
|
|
|
|
if (mod && mod.__esModule) return mod;
|
|
|
|
|
var result = {};
|
|
|
|
|
if (mod != null) for (var k in mod) if (k !== "default" && Object.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
|
|
|
|
__setModuleDefault(result, mod);
|
|
|
|
|
return result;
|
|
|
|
|
};
|
|
|
|
|
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
|
|
|
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
|
|
|
return new (P || (P = Promise))(function (resolve, reject) {
|
|
|
|
|
@@ -453,14 +485,8 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
|
|
|
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
|
|
|
});
|
|
|
|
|
};
|
|
|
|
|
var __importStar = (this && this.__importStar) || function (mod) {
|
|
|
|
|
if (mod && mod.__esModule) return mod;
|
|
|
|
|
var result = {};
|
|
|
|
|
if (mod != null) for (var k in mod) if (Object.hasOwnProperty.call(mod, k)) result[k] = mod[k];
|
|
|
|
|
result["default"] = mod;
|
|
|
|
|
return result;
|
|
|
|
|
};
|
|
|
|
|
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
|
|
|
|
exports.getState = exports.saveState = exports.group = exports.endGroup = exports.startGroup = exports.info = exports.warning = exports.error = exports.debug = exports.isDebug = exports.setFailed = exports.setCommandEcho = exports.setOutput = exports.getBooleanInput = exports.getMultilineInput = exports.getInput = exports.addPath = exports.setSecret = exports.exportVariable = exports.ExitCode = void 0;
|
|
|
|
|
const command_1 = __nccwpck_require__(7351);
|
|
|
|
|
const file_command_1 = __nccwpck_require__(717);
|
|
|
|
|
const utils_1 = __nccwpck_require__(5278);
|
|
|
|
|
@@ -527,7 +553,9 @@ function addPath(inputPath) {
|
|
|
|
|
}
|
|
|
|
|
exports.addPath = addPath;
|
|
|
|
|
/**
|
|
|
|
|
* Gets the value of an input. The value is also trimmed.
|
|
|
|
|
* Gets the value of an input.
|
|
|
|
|
* Unless trimWhitespace is set to false in InputOptions, the value is also trimmed.
|
|
|
|
|
* Returns an empty string if the value is not defined.
|
|
|
|
|
*
|
|
|
|
|
* @param name name of the input to get
|
|
|
|
|
* @param options optional. See InputOptions.
|
|
|
|
|
@@ -538,9 +566,49 @@ function getInput(name, options) {
|
|
|
|
|
if (options && options.required && !val) {
|
|
|
|
|
throw new Error(`Input required and not supplied: ${name}`);
|
|
|
|
|
}
|
|
|
|
|
if (options && options.trimWhitespace === false) {
|
|
|
|
|
return val;
|
|
|
|
|
}
|
|
|
|
|
return val.trim();
|
|
|
|
|
}
|
|
|
|
|
exports.getInput = getInput;
|
|
|
|
|
/**
|
|
|
|
|
* Gets the values of an multiline input. Each value is also trimmed.
|
|
|
|
|
*
|
|
|
|
|
* @param name name of the input to get
|
|
|
|
|
* @param options optional. See InputOptions.
|
|
|
|
|
* @returns string[]
|
|
|
|
|
*
|
|
|
|
|
*/
|
|
|
|
|
function getMultilineInput(name, options) {
|
|
|
|
|
const inputs = getInput(name, options)
|
|
|
|
|
.split('\n')
|
|
|
|
|
.filter(x => x !== '');
|
|
|
|
|
return inputs;
|
|
|
|
|
}
|
|
|
|
|
exports.getMultilineInput = getMultilineInput;
|
|
|
|
|
/**
|
|
|
|
|
* Gets the input value of the boolean type in the YAML 1.2 "core schema" specification.
|
|
|
|
|
* Support boolean input list: `true | True | TRUE | false | False | FALSE` .
|
|
|
|
|
* The return value is also in boolean type.
|
|
|
|
|
* ref: https://yaml.org/spec/1.2/spec.html#id2804923
|
|
|
|
|
*
|
|
|
|
|
* @param name name of the input to get
|
|
|
|
|
* @param options optional. See InputOptions.
|
|
|
|
|
* @returns boolean
|
|
|
|
|
*/
|
|
|
|
|
function getBooleanInput(name, options) {
|
|
|
|
|
const trueValue = ['true', 'True', 'TRUE'];
|
|
|
|
|
const falseValue = ['false', 'False', 'FALSE'];
|
|
|
|
|
const val = getInput(name, options);
|
|
|
|
|
if (trueValue.includes(val))
|
|
|
|
|
return true;
|
|
|
|
|
if (falseValue.includes(val))
|
|
|
|
|
return false;
|
|
|
|
|
throw new TypeError(`Input does not meet YAML 1.2 "Core Schema" specification: ${name}\n` +
|
|
|
|
|
`Support boolean input list: \`true | True | TRUE | false | False | FALSE\``);
|
|
|
|
|
}
|
|
|
|
|
exports.getBooleanInput = getBooleanInput;
|
|
|
|
|
/**
|
|
|
|
|
* Sets the value of an output.
|
|
|
|
|
*
|
|
|
|
|
@@ -691,14 +759,27 @@ exports.getState = getState;
|
|
|
|
|
"use strict";
|
|
|
|
|
|
|
|
|
|
// For internal use, subject to change.
|
|
|
|
|
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
|
|
|
if (k2 === undefined) k2 = k;
|
|
|
|
|
Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
|
|
|
|
|
}) : (function(o, m, k, k2) {
|
|
|
|
|
if (k2 === undefined) k2 = k;
|
|
|
|
|
o[k2] = m[k];
|
|
|
|
|
}));
|
|
|
|
|
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
|
|
|
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
|
|
|
}) : function(o, v) {
|
|
|
|
|
o["default"] = v;
|
|
|
|
|
});
|
|
|
|
|
var __importStar = (this && this.__importStar) || function (mod) {
|
|
|
|
|
if (mod && mod.__esModule) return mod;
|
|
|
|
|
var result = {};
|
|
|
|
|
if (mod != null) for (var k in mod) if (Object.hasOwnProperty.call(mod, k)) result[k] = mod[k];
|
|
|
|
|
result["default"] = mod;
|
|
|
|
|
if (mod != null) for (var k in mod) if (k !== "default" && Object.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
|
|
|
|
__setModuleDefault(result, mod);
|
|
|
|
|
return result;
|
|
|
|
|
};
|
|
|
|
|
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
|
|
|
|
exports.issueCommand = void 0;
|
|
|
|
|
// We use any as a valid input type
|
|
|
|
|
/* eslint-disable @typescript-eslint/no-explicit-any */
|
|
|
|
|
const fs = __importStar(__nccwpck_require__(5747));
|
|
|
|
|
@@ -729,6 +810,7 @@ exports.issueCommand = issueCommand;
|
|
|
|
|
// We use any as a valid input type
|
|
|
|
|
/* eslint-disable @typescript-eslint/no-explicit-any */
|
|
|
|
|
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
|
|
|
|
exports.toCommandValue = void 0;
|
|
|
|
|
/**
|
|
|
|
|
* Sanitizes an input into a string so it can be passed into issueCommand safely
|
|
|
|
|
* @param input input to sanitize into a string
|
|
|
|
|
@@ -752,6 +834,25 @@ exports.toCommandValue = toCommandValue;
|
|
|
|
|
|
|
|
|
|
"use strict";
|
|
|
|
|
|
|
|
|
|
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
|
|
|
if (k2 === undefined) k2 = k;
|
|
|
|
|
Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
|
|
|
|
|
}) : (function(o, m, k, k2) {
|
|
|
|
|
if (k2 === undefined) k2 = k;
|
|
|
|
|
o[k2] = m[k];
|
|
|
|
|
}));
|
|
|
|
|
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
|
|
|
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
|
|
|
}) : function(o, v) {
|
|
|
|
|
o["default"] = v;
|
|
|
|
|
});
|
|
|
|
|
var __importStar = (this && this.__importStar) || function (mod) {
|
|
|
|
|
if (mod && mod.__esModule) return mod;
|
|
|
|
|
var result = {};
|
|
|
|
|
if (mod != null) for (var k in mod) if (k !== "default" && Object.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
|
|
|
|
__setModuleDefault(result, mod);
|
|
|
|
|
return result;
|
|
|
|
|
};
|
|
|
|
|
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
|
|
|
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
|
|
|
return new (P || (P = Promise))(function (resolve, reject) {
|
|
|
|
|
@@ -761,14 +862,9 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
|
|
|
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
|
|
|
});
|
|
|
|
|
};
|
|
|
|
|
var __importStar = (this && this.__importStar) || function (mod) {
|
|
|
|
|
if (mod && mod.__esModule) return mod;
|
|
|
|
|
var result = {};
|
|
|
|
|
if (mod != null) for (var k in mod) if (Object.hasOwnProperty.call(mod, k)) result[k] = mod[k];
|
|
|
|
|
result["default"] = mod;
|
|
|
|
|
return result;
|
|
|
|
|
};
|
|
|
|
|
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
|
|
|
|
exports.getExecOutput = exports.exec = void 0;
|
|
|
|
|
const string_decoder_1 = __nccwpck_require__(4304);
|
|
|
|
|
const tr = __importStar(__nccwpck_require__(8159));
|
|
|
|
|
/**
|
|
|
|
|
* Exec a command.
|
|
|
|
|
@@ -794,6 +890,51 @@ function exec(commandLine, args, options) {
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
exports.exec = exec;
|
|
|
|
|
/**
|
|
|
|
|
* Exec a command and get the output.
|
|
|
|
|
* Output will be streamed to the live console.
|
|
|
|
|
* Returns promise with the exit code and collected stdout and stderr
|
|
|
|
|
*
|
|
|
|
|
* @param commandLine command to execute (can include additional args). Must be correctly escaped.
|
|
|
|
|
* @param args optional arguments for tool. Escaping is handled by the lib.
|
|
|
|
|
* @param options optional exec options. See ExecOptions
|
|
|
|
|
* @returns Promise<ExecOutput> exit code, stdout, and stderr
|
|
|
|
|
*/
|
|
|
|
|
function getExecOutput(commandLine, args, options) {
|
|
|
|
|
var _a, _b;
|
|
|
|
|
return __awaiter(this, void 0, void 0, function* () {
|
|
|
|
|
let stdout = '';
|
|
|
|
|
let stderr = '';
|
|
|
|
|
//Using string decoder covers the case where a mult-byte character is split
|
|
|
|
|
const stdoutDecoder = new string_decoder_1.StringDecoder('utf8');
|
|
|
|
|
const stderrDecoder = new string_decoder_1.StringDecoder('utf8');
|
|
|
|
|
const originalStdoutListener = (_a = options === null || options === void 0 ? void 0 : options.listeners) === null || _a === void 0 ? void 0 : _a.stdout;
|
|
|
|
|
const originalStdErrListener = (_b = options === null || options === void 0 ? void 0 : options.listeners) === null || _b === void 0 ? void 0 : _b.stderr;
|
|
|
|
|
const stdErrListener = (data) => {
|
|
|
|
|
stderr += stderrDecoder.write(data);
|
|
|
|
|
if (originalStdErrListener) {
|
|
|
|
|
originalStdErrListener(data);
|
|
|
|
|
}
|
|
|
|
|
};
|
|
|
|
|
const stdOutListener = (data) => {
|
|
|
|
|
stdout += stdoutDecoder.write(data);
|
|
|
|
|
if (originalStdoutListener) {
|
|
|
|
|
originalStdoutListener(data);
|
|
|
|
|
}
|
|
|
|
|
};
|
|
|
|
|
const listeners = Object.assign(Object.assign({}, options === null || options === void 0 ? void 0 : options.listeners), { stdout: stdOutListener, stderr: stdErrListener });
|
|
|
|
|
const exitCode = yield exec(commandLine, args, Object.assign(Object.assign({}, options), { listeners }));
|
|
|
|
|
//flush any remaining characters
|
|
|
|
|
stdout += stdoutDecoder.end();
|
|
|
|
|
stderr += stderrDecoder.end();
|
|
|
|
|
return {
|
|
|
|
|
exitCode,
|
|
|
|
|
stdout,
|
|
|
|
|
stderr
|
|
|
|
|
};
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
exports.getExecOutput = getExecOutput;
|
|
|
|
|
//# sourceMappingURL=exec.js.map
|
|
|
|
|
|
|
|
|
|
/***/ }),
|
|
|
|
|
@@ -803,6 +944,25 @@ exports.exec = exec;
|
|
|
|
|
|
|
|
|
|
"use strict";
|
|
|
|
|
|
|
|
|
|
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
|
|
|
if (k2 === undefined) k2 = k;
|
|
|
|
|
Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
|
|
|
|
|
}) : (function(o, m, k, k2) {
|
|
|
|
|
if (k2 === undefined) k2 = k;
|
|
|
|
|
o[k2] = m[k];
|
|
|
|
|
}));
|
|
|
|
|
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
|
|
|
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
|
|
|
}) : function(o, v) {
|
|
|
|
|
o["default"] = v;
|
|
|
|
|
});
|
|
|
|
|
var __importStar = (this && this.__importStar) || function (mod) {
|
|
|
|
|
if (mod && mod.__esModule) return mod;
|
|
|
|
|
var result = {};
|
|
|
|
|
if (mod != null) for (var k in mod) if (k !== "default" && Object.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
|
|
|
|
__setModuleDefault(result, mod);
|
|
|
|
|
return result;
|
|
|
|
|
};
|
|
|
|
|
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
|
|
|
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
|
|
|
return new (P || (P = Promise))(function (resolve, reject) {
|
|
|
|
|
@@ -812,20 +972,15 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
|
|
|
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
|
|
|
});
|
|
|
|
|
};
|
|
|
|
|
var __importStar = (this && this.__importStar) || function (mod) {
|
|
|
|
|
if (mod && mod.__esModule) return mod;
|
|
|
|
|
var result = {};
|
|
|
|
|
if (mod != null) for (var k in mod) if (Object.hasOwnProperty.call(mod, k)) result[k] = mod[k];
|
|
|
|
|
result["default"] = mod;
|
|
|
|
|
return result;
|
|
|
|
|
};
|
|
|
|
|
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
|
|
|
|
exports.argStringToArray = exports.ToolRunner = void 0;
|
|
|
|
|
const os = __importStar(__nccwpck_require__(2087));
|
|
|
|
|
const events = __importStar(__nccwpck_require__(8614));
|
|
|
|
|
const child = __importStar(__nccwpck_require__(3129));
|
|
|
|
|
const path = __importStar(__nccwpck_require__(5622));
|
|
|
|
|
const io = __importStar(__nccwpck_require__(7436));
|
|
|
|
|
const ioUtil = __importStar(__nccwpck_require__(1962));
|
|
|
|
|
const timers_1 = __nccwpck_require__(8213);
|
|
|
|
|
/* eslint-disable @typescript-eslint/unbound-method */
|
|
|
|
|
const IS_WINDOWS = process.platform === 'win32';
|
|
|
|
|
/*
|
|
|
|
|
@@ -895,11 +1050,12 @@ class ToolRunner extends events.EventEmitter {
|
|
|
|
|
s = s.substring(n + os.EOL.length);
|
|
|
|
|
n = s.indexOf(os.EOL);
|
|
|
|
|
}
|
|
|
|
|
strBuffer = s;
|
|
|
|
|
return s;
|
|
|
|
|
}
|
|
|
|
|
catch (err) {
|
|
|
|
|
// streaming lines to console is best effort. Don't fail a build.
|
|
|
|
|
this._debug(`error processing line. Failed with error ${err}`);
|
|
|
|
|
return '';
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
_getSpawnFileName() {
|
|
|
|
|
@@ -1181,7 +1337,7 @@ class ToolRunner extends events.EventEmitter {
|
|
|
|
|
// if the tool is only a file name, then resolve it from the PATH
|
|
|
|
|
// otherwise verify it exists (add extension on Windows if necessary)
|
|
|
|
|
this.toolPath = yield io.which(this.toolPath, true);
|
|
|
|
|
return new Promise((resolve, reject) => {
|
|
|
|
|
return new Promise((resolve, reject) => __awaiter(this, void 0, void 0, function* () {
|
|
|
|
|
this._debug(`exec tool: ${this.toolPath}`);
|
|
|
|
|
this._debug('arguments:');
|
|
|
|
|
for (const arg of this.args) {
|
|
|
|
|
@@ -1195,9 +1351,12 @@ class ToolRunner extends events.EventEmitter {
|
|
|
|
|
state.on('debug', (message) => {
|
|
|
|
|
this._debug(message);
|
|
|
|
|
});
|
|
|
|
|
if (this.options.cwd && !(yield ioUtil.exists(this.options.cwd))) {
|
|
|
|
|
return reject(new Error(`The cwd: ${this.options.cwd} does not exist!`));
|
|
|
|
|
}
|
|
|
|
|
const fileName = this._getSpawnFileName();
|
|
|
|
|
const cp = child.spawn(fileName, this._getSpawnArgs(optionsNonNull), this._getSpawnOptions(this.options, fileName));
|
|
|
|
|
const stdbuffer = '';
|
|
|
|
|
let stdbuffer = '';
|
|
|
|
|
if (cp.stdout) {
|
|
|
|
|
cp.stdout.on('data', (data) => {
|
|
|
|
|
if (this.options.listeners && this.options.listeners.stdout) {
|
|
|
|
|
@@ -1206,14 +1365,14 @@ class ToolRunner extends events.EventEmitter {
|
|
|
|
|
if (!optionsNonNull.silent && optionsNonNull.outStream) {
|
|
|
|
|
optionsNonNull.outStream.write(data);
|
|
|
|
|
}
|
|
|
|
|
this._processLineBuffer(data, stdbuffer, (line) => {
|
|
|
|
|
stdbuffer = this._processLineBuffer(data, stdbuffer, (line) => {
|
|
|
|
|
if (this.options.listeners && this.options.listeners.stdline) {
|
|
|
|
|
this.options.listeners.stdline(line);
|
|
|
|
|
}
|
|
|
|
|
});
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
const errbuffer = '';
|
|
|
|
|
let errbuffer = '';
|
|
|
|
|
if (cp.stderr) {
|
|
|
|
|
cp.stderr.on('data', (data) => {
|
|
|
|
|
state.processStderr = true;
|
|
|
|
|
@@ -1228,7 +1387,7 @@ class ToolRunner extends events.EventEmitter {
|
|
|
|
|
: optionsNonNull.outStream;
|
|
|
|
|
s.write(data);
|
|
|
|
|
}
|
|
|
|
|
this._processLineBuffer(data, errbuffer, (line) => {
|
|
|
|
|
errbuffer = this._processLineBuffer(data, errbuffer, (line) => {
|
|
|
|
|
if (this.options.listeners && this.options.listeners.errline) {
|
|
|
|
|
this.options.listeners.errline(line);
|
|
|
|
|
}
|
|
|
|
|
@@ -1275,7 +1434,7 @@ class ToolRunner extends events.EventEmitter {
|
|
|
|
|
}
|
|
|
|
|
cp.stdin.end(this.options.input);
|
|
|
|
|
}
|
|
|
|
|
});
|
|
|
|
|
}));
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
@@ -1361,7 +1520,7 @@ class ExecState extends events.EventEmitter {
|
|
|
|
|
this._setResult();
|
|
|
|
|
}
|
|
|
|
|
else if (this.processExited) {
|
|
|
|
|
this.timeout = setTimeout(ExecState.HandleTimeout, this.delay, this);
|
|
|
|
|
this.timeout = timers_1.setTimeout(ExecState.HandleTimeout, this.delay, this);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
_debug(message) {
|
|
|
|
|
@@ -2020,6 +2179,25 @@ exports.checkBypass = checkBypass;
|
|
|
|
|
|
|
|
|
|
"use strict";
|
|
|
|
|
|
|
|
|
|
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
|
|
|
if (k2 === undefined) k2 = k;
|
|
|
|
|
Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
|
|
|
|
|
}) : (function(o, m, k, k2) {
|
|
|
|
|
if (k2 === undefined) k2 = k;
|
|
|
|
|
o[k2] = m[k];
|
|
|
|
|
}));
|
|
|
|
|
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
|
|
|
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
|
|
|
}) : function(o, v) {
|
|
|
|
|
o["default"] = v;
|
|
|
|
|
});
|
|
|
|
|
var __importStar = (this && this.__importStar) || function (mod) {
|
|
|
|
|
if (mod && mod.__esModule) return mod;
|
|
|
|
|
var result = {};
|
|
|
|
|
if (mod != null) for (var k in mod) if (k !== "default" && Object.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
|
|
|
|
__setModuleDefault(result, mod);
|
|
|
|
|
return result;
|
|
|
|
|
};
|
|
|
|
|
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
|
|
|
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
|
|
|
return new (P || (P = Promise))(function (resolve, reject) {
|
|
|
|
|
@@ -2029,16 +2207,9 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
|
|
|
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
|
|
|
});
|
|
|
|
|
};
|
|
|
|
|
var __importStar = (this && this.__importStar) || function (mod) {
|
|
|
|
|
if (mod && mod.__esModule) return mod;
|
|
|
|
|
var result = {};
|
|
|
|
|
if (mod != null) for (var k in mod) if (Object.hasOwnProperty.call(mod, k)) result[k] = mod[k];
|
|
|
|
|
result["default"] = mod;
|
|
|
|
|
return result;
|
|
|
|
|
};
|
|
|
|
|
var _a;
|
|
|
|
|
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
|
|
|
|
const assert_1 = __nccwpck_require__(2357);
|
|
|
|
|
exports.getCmdPath = exports.tryGetExecutablePath = exports.isRooted = exports.isDirectory = exports.exists = exports.IS_WINDOWS = exports.unlink = exports.symlink = exports.stat = exports.rmdir = exports.rename = exports.readlink = exports.readdir = exports.mkdir = exports.lstat = exports.copyFile = exports.chmod = void 0;
|
|
|
|
|
const fs = __importStar(__nccwpck_require__(5747));
|
|
|
|
|
const path = __importStar(__nccwpck_require__(5622));
|
|
|
|
|
_a = fs.promises, exports.chmod = _a.chmod, exports.copyFile = _a.copyFile, exports.lstat = _a.lstat, exports.mkdir = _a.mkdir, exports.readdir = _a.readdir, exports.readlink = _a.readlink, exports.rename = _a.rename, exports.rmdir = _a.rmdir, exports.stat = _a.stat, exports.symlink = _a.symlink, exports.unlink = _a.unlink;
|
|
|
|
|
@@ -2081,49 +2252,6 @@ function isRooted(p) {
|
|
|
|
|
return p.startsWith('/');
|
|
|
|
|
}
|
|
|
|
|
exports.isRooted = isRooted;
|
|
|
|
|
/**
|
|
|
|
|
* Recursively create a directory at `fsPath`.
|
|
|
|
|
*
|
|
|
|
|
* This implementation is optimistic, meaning it attempts to create the full
|
|
|
|
|
* path first, and backs up the path stack from there.
|
|
|
|
|
*
|
|
|
|
|
* @param fsPath The path to create
|
|
|
|
|
* @param maxDepth The maximum recursion depth
|
|
|
|
|
* @param depth The current recursion depth
|
|
|
|
|
*/
|
|
|
|
|
function mkdirP(fsPath, maxDepth = 1000, depth = 1) {
|
|
|
|
|
return __awaiter(this, void 0, void 0, function* () {
|
|
|
|
|
assert_1.ok(fsPath, 'a path argument must be provided');
|
|
|
|
|
fsPath = path.resolve(fsPath);
|
|
|
|
|
if (depth >= maxDepth)
|
|
|
|
|
return exports.mkdir(fsPath);
|
|
|
|
|
try {
|
|
|
|
|
yield exports.mkdir(fsPath);
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
catch (err) {
|
|
|
|
|
switch (err.code) {
|
|
|
|
|
case 'ENOENT': {
|
|
|
|
|
yield mkdirP(path.dirname(fsPath), maxDepth, depth + 1);
|
|
|
|
|
yield exports.mkdir(fsPath);
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
default: {
|
|
|
|
|
let stats;
|
|
|
|
|
try {
|
|
|
|
|
stats = yield exports.stat(fsPath);
|
|
|
|
|
}
|
|
|
|
|
catch (err2) {
|
|
|
|
|
throw err;
|
|
|
|
|
}
|
|
|
|
|
if (!stats.isDirectory())
|
|
|
|
|
throw err;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
exports.mkdirP = mkdirP;
|
|
|
|
|
/**
|
|
|
|
|
* Best effort attempt to determine whether a file exists and is executable.
|
|
|
|
|
* @param filePath file path to check
|
|
|
|
|
@@ -2220,6 +2348,12 @@ function isUnixExecutable(stats) {
|
|
|
|
|
((stats.mode & 8) > 0 && stats.gid === process.getgid()) ||
|
|
|
|
|
((stats.mode & 64) > 0 && stats.uid === process.getuid()));
|
|
|
|
|
}
|
|
|
|
|
// Get the path of cmd.exe in windows
|
|
|
|
|
function getCmdPath() {
|
|
|
|
|
var _a;
|
|
|
|
|
return (_a = process.env['COMSPEC']) !== null && _a !== void 0 ? _a : `cmd.exe`;
|
|
|
|
|
}
|
|
|
|
|
exports.getCmdPath = getCmdPath;
|
|
|
|
|
//# sourceMappingURL=io-util.js.map
|
|
|
|
|
|
|
|
|
|
/***/ }),
|
|
|
|
|
@@ -2229,6 +2363,25 @@ function isUnixExecutable(stats) {
|
|
|
|
|
|
|
|
|
|
"use strict";
|
|
|
|
|
|
|
|
|
|
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
|
|
|
if (k2 === undefined) k2 = k;
|
|
|
|
|
Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
|
|
|
|
|
}) : (function(o, m, k, k2) {
|
|
|
|
|
if (k2 === undefined) k2 = k;
|
|
|
|
|
o[k2] = m[k];
|
|
|
|
|
}));
|
|
|
|
|
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
|
|
|
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
|
|
|
}) : function(o, v) {
|
|
|
|
|
o["default"] = v;
|
|
|
|
|
});
|
|
|
|
|
var __importStar = (this && this.__importStar) || function (mod) {
|
|
|
|
|
if (mod && mod.__esModule) return mod;
|
|
|
|
|
var result = {};
|
|
|
|
|
if (mod != null) for (var k in mod) if (k !== "default" && Object.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
|
|
|
|
__setModuleDefault(result, mod);
|
|
|
|
|
return result;
|
|
|
|
|
};
|
|
|
|
|
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
|
|
|
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
|
|
|
return new (P || (P = Promise))(function (resolve, reject) {
|
|
|
|
|
@@ -2238,19 +2391,15 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
|
|
|
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
|
|
|
});
|
|
|
|
|
};
|
|
|
|
|
var __importStar = (this && this.__importStar) || function (mod) {
|
|
|
|
|
if (mod && mod.__esModule) return mod;
|
|
|
|
|
var result = {};
|
|
|
|
|
if (mod != null) for (var k in mod) if (Object.hasOwnProperty.call(mod, k)) result[k] = mod[k];
|
|
|
|
|
result["default"] = mod;
|
|
|
|
|
return result;
|
|
|
|
|
};
|
|
|
|
|
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
|
|
|
|
exports.findInPath = exports.which = exports.mkdirP = exports.rmRF = exports.mv = exports.cp = void 0;
|
|
|
|
|
const assert_1 = __nccwpck_require__(2357);
|
|
|
|
|
const childProcess = __importStar(__nccwpck_require__(3129));
|
|
|
|
|
const path = __importStar(__nccwpck_require__(5622));
|
|
|
|
|
const util_1 = __nccwpck_require__(1669);
|
|
|
|
|
const ioUtil = __importStar(__nccwpck_require__(1962));
|
|
|
|
|
const exec = util_1.promisify(childProcess.exec);
|
|
|
|
|
const execFile = util_1.promisify(childProcess.execFile);
|
|
|
|
|
/**
|
|
|
|
|
* Copies a file or folder.
|
|
|
|
|
* Based off of shelljs - https://github.com/shelljs/shelljs/blob/9237f66c52e5daa40458f94f9565e18e8132f5a6/src/cp.js
|
|
|
|
|
@@ -2261,14 +2410,14 @@ const exec = util_1.promisify(childProcess.exec);
|
|
|
|
|
*/
|
|
|
|
|
function cp(source, dest, options = {}) {
|
|
|
|
|
return __awaiter(this, void 0, void 0, function* () {
|
|
|
|
|
const { force, recursive } = readCopyOptions(options);
|
|
|
|
|
const { force, recursive, copySourceDirectory } = readCopyOptions(options);
|
|
|
|
|
const destStat = (yield ioUtil.exists(dest)) ? yield ioUtil.stat(dest) : null;
|
|
|
|
|
// Dest is an existing file, but not forcing
|
|
|
|
|
if (destStat && destStat.isFile() && !force) {
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
// If dest is an existing directory, should copy inside.
|
|
|
|
|
const newDest = destStat && destStat.isDirectory()
|
|
|
|
|
const newDest = destStat && destStat.isDirectory() && copySourceDirectory
|
|
|
|
|
? path.join(dest, path.basename(source))
|
|
|
|
|
: dest;
|
|
|
|
|
if (!(yield ioUtil.exists(source))) {
|
|
|
|
|
@@ -2333,12 +2482,22 @@ function rmRF(inputPath) {
|
|
|
|
|
if (ioUtil.IS_WINDOWS) {
|
|
|
|
|
// Node doesn't provide a delete operation, only an unlink function. This means that if the file is being used by another
|
|
|
|
|
// program (e.g. antivirus), it won't be deleted. To address this, we shell out the work to rd/del.
|
|
|
|
|
// Check for invalid characters
|
|
|
|
|
// https://docs.microsoft.com/en-us/windows/win32/fileio/naming-a-file
|
|
|
|
|
if (/[*"<>|]/.test(inputPath)) {
|
|
|
|
|
throw new Error('File path must not contain `*`, `"`, `<`, `>` or `|` on Windows');
|
|
|
|
|
}
|
|
|
|
|
try {
|
|
|
|
|
const cmdPath = ioUtil.getCmdPath();
|
|
|
|
|
if (yield ioUtil.isDirectory(inputPath, true)) {
|
|
|
|
|
yield exec(`rd /s /q "${inputPath}"`);
|
|
|
|
|
yield exec(`${cmdPath} /s /c "rd /s /q "%inputPath%""`, {
|
|
|
|
|
env: { inputPath }
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
else {
|
|
|
|
|
yield exec(`del /f /a "${inputPath}"`);
|
|
|
|
|
yield exec(`${cmdPath} /s /c "del /f /a "%inputPath%""`, {
|
|
|
|
|
env: { inputPath }
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
catch (err) {
|
|
|
|
|
@@ -2371,7 +2530,7 @@ function rmRF(inputPath) {
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
if (isDir) {
|
|
|
|
|
yield exec(`rm -rf "${inputPath}"`);
|
|
|
|
|
yield execFile(`rm`, [`-rf`, `${inputPath}`]);
|
|
|
|
|
}
|
|
|
|
|
else {
|
|
|
|
|
yield ioUtil.unlink(inputPath);
|
|
|
|
|
@@ -2389,7 +2548,8 @@ exports.rmRF = rmRF;
|
|
|
|
|
*/
|
|
|
|
|
function mkdirP(fsPath) {
|
|
|
|
|
return __awaiter(this, void 0, void 0, function* () {
|
|
|
|
|
yield ioUtil.mkdirP(fsPath);
|
|
|
|
|
assert_1.ok(fsPath, 'a path argument must be provided');
|
|
|
|
|
yield ioUtil.mkdir(fsPath, { recursive: true });
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
exports.mkdirP = mkdirP;
|
|
|
|
|
@@ -2487,7 +2647,10 @@ exports.findInPath = findInPath;
|
|
|
|
|
function readCopyOptions(options) {
|
|
|
|
|
const force = options.force == null ? true : options.force;
|
|
|
|
|
const recursive = Boolean(options.recursive);
|
|
|
|
|
return { force, recursive };
|
|
|
|
|
const copySourceDirectory = options.copySourceDirectory == null
|
|
|
|
|
? true
|
|
|
|
|
: Boolean(options.copySourceDirectory);
|
|
|
|
|
return { force, recursive, copySourceDirectory };
|
|
|
|
|
}
|
|
|
|
|
function cpDirRecursive(sourceDir, destDir, currentDepth, force) {
|
|
|
|
|
return __awaiter(this, void 0, void 0, function* () {
|
|
|
|
|
@@ -2548,6 +2711,25 @@ function copyFile(srcFile, destFile, force) {
|
|
|
|
|
|
|
|
|
|
"use strict";
|
|
|
|
|
|
|
|
|
|
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
|
|
|
if (k2 === undefined) k2 = k;
|
|
|
|
|
Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
|
|
|
|
|
}) : (function(o, m, k, k2) {
|
|
|
|
|
if (k2 === undefined) k2 = k;
|
|
|
|
|
o[k2] = m[k];
|
|
|
|
|
}));
|
|
|
|
|
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
|
|
|
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
|
|
|
}) : function(o, v) {
|
|
|
|
|
o["default"] = v;
|
|
|
|
|
});
|
|
|
|
|
var __importStar = (this && this.__importStar) || function (mod) {
|
|
|
|
|
if (mod && mod.__esModule) return mod;
|
|
|
|
|
var result = {};
|
|
|
|
|
if (mod != null) for (var k in mod) if (k !== "default" && Object.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
|
|
|
|
__setModuleDefault(result, mod);
|
|
|
|
|
return result;
|
|
|
|
|
};
|
|
|
|
|
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
|
|
|
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
|
|
|
return new (P || (P = Promise))(function (resolve, reject) {
|
|
|
|
|
@@ -2557,14 +2739,8 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
|
|
|
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
|
|
|
});
|
|
|
|
|
};
|
|
|
|
|
var __importStar = (this && this.__importStar) || function (mod) {
|
|
|
|
|
if (mod && mod.__esModule) return mod;
|
|
|
|
|
var result = {};
|
|
|
|
|
if (mod != null) for (var k in mod) if (Object.hasOwnProperty.call(mod, k)) result[k] = mod[k];
|
|
|
|
|
result["default"] = mod;
|
|
|
|
|
return result;
|
|
|
|
|
};
|
|
|
|
|
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
|
|
|
|
exports._readLinuxVersionFile = exports._getOsVersion = exports._findMatch = void 0;
|
|
|
|
|
const semver = __importStar(__nccwpck_require__(562));
|
|
|
|
|
const core_1 = __nccwpck_require__(2186);
|
|
|
|
|
// needs to be require for core node modules to be mocked
|
|
|
|
|
@@ -2633,8 +2809,13 @@ function _getOsVersion() {
|
|
|
|
|
const lines = lsbContents.split('\n');
|
|
|
|
|
for (const line of lines) {
|
|
|
|
|
const parts = line.split('=');
|
|
|
|
|
if (parts.length === 2 && parts[0].trim() === 'DISTRIB_RELEASE') {
|
|
|
|
|
version = parts[1].trim();
|
|
|
|
|
if (parts.length === 2 &&
|
|
|
|
|
(parts[0].trim() === 'VERSION_ID' ||
|
|
|
|
|
parts[0].trim() === 'DISTRIB_RELEASE')) {
|
|
|
|
|
version = parts[1]
|
|
|
|
|
.trim()
|
|
|
|
|
.replace(/^"/, '')
|
|
|
|
|
.replace(/"$/, '');
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
@@ -2644,10 +2825,14 @@ function _getOsVersion() {
|
|
|
|
|
}
|
|
|
|
|
exports._getOsVersion = _getOsVersion;
|
|
|
|
|
function _readLinuxVersionFile() {
|
|
|
|
|
const lsbFile = '/etc/lsb-release';
|
|
|
|
|
const lsbReleaseFile = '/etc/lsb-release';
|
|
|
|
|
const osReleaseFile = '/etc/os-release';
|
|
|
|
|
let contents = '';
|
|
|
|
|
if (fs.existsSync(lsbFile)) {
|
|
|
|
|
contents = fs.readFileSync(lsbFile).toString();
|
|
|
|
|
if (fs.existsSync(lsbReleaseFile)) {
|
|
|
|
|
contents = fs.readFileSync(lsbReleaseFile).toString();
|
|
|
|
|
}
|
|
|
|
|
else if (fs.existsSync(osReleaseFile)) {
|
|
|
|
|
contents = fs.readFileSync(osReleaseFile).toString();
|
|
|
|
|
}
|
|
|
|
|
return contents;
|
|
|
|
|
}
|
|
|
|
|
@@ -2661,6 +2846,25 @@ exports._readLinuxVersionFile = _readLinuxVersionFile;
|
|
|
|
|
|
|
|
|
|
"use strict";
|
|
|
|
|
|
|
|
|
|
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
|
|
|
if (k2 === undefined) k2 = k;
|
|
|
|
|
Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
|
|
|
|
|
}) : (function(o, m, k, k2) {
|
|
|
|
|
if (k2 === undefined) k2 = k;
|
|
|
|
|
o[k2] = m[k];
|
|
|
|
|
}));
|
|
|
|
|
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
|
|
|
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
|
|
|
}) : function(o, v) {
|
|
|
|
|
o["default"] = v;
|
|
|
|
|
});
|
|
|
|
|
var __importStar = (this && this.__importStar) || function (mod) {
|
|
|
|
|
if (mod && mod.__esModule) return mod;
|
|
|
|
|
var result = {};
|
|
|
|
|
if (mod != null) for (var k in mod) if (k !== "default" && Object.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
|
|
|
|
__setModuleDefault(result, mod);
|
|
|
|
|
return result;
|
|
|
|
|
};
|
|
|
|
|
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
|
|
|
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
|
|
|
return new (P || (P = Promise))(function (resolve, reject) {
|
|
|
|
|
@@ -2670,14 +2874,8 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
|
|
|
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
|
|
|
});
|
|
|
|
|
};
|
|
|
|
|
var __importStar = (this && this.__importStar) || function (mod) {
|
|
|
|
|
if (mod && mod.__esModule) return mod;
|
|
|
|
|
var result = {};
|
|
|
|
|
if (mod != null) for (var k in mod) if (Object.hasOwnProperty.call(mod, k)) result[k] = mod[k];
|
|
|
|
|
result["default"] = mod;
|
|
|
|
|
return result;
|
|
|
|
|
};
|
|
|
|
|
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
|
|
|
|
exports.RetryHelper = void 0;
|
|
|
|
|
const core = __importStar(__nccwpck_require__(2186));
|
|
|
|
|
/**
|
|
|
|
|
* Internal class for retries
|
|
|
|
|
@@ -2738,6 +2936,25 @@ exports.RetryHelper = RetryHelper;
|
|
|
|
|
|
|
|
|
|
"use strict";
|
|
|
|
|
|
|
|
|
|
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
|
|
|
if (k2 === undefined) k2 = k;
|
|
|
|
|
Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
|
|
|
|
|
}) : (function(o, m, k, k2) {
|
|
|
|
|
if (k2 === undefined) k2 = k;
|
|
|
|
|
o[k2] = m[k];
|
|
|
|
|
}));
|
|
|
|
|
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
|
|
|
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
|
|
|
}) : function(o, v) {
|
|
|
|
|
o["default"] = v;
|
|
|
|
|
});
|
|
|
|
|
var __importStar = (this && this.__importStar) || function (mod) {
|
|
|
|
|
if (mod && mod.__esModule) return mod;
|
|
|
|
|
var result = {};
|
|
|
|
|
if (mod != null) for (var k in mod) if (k !== "default" && Object.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
|
|
|
|
__setModuleDefault(result, mod);
|
|
|
|
|
return result;
|
|
|
|
|
};
|
|
|
|
|
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
|
|
|
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
|
|
|
return new (P || (P = Promise))(function (resolve, reject) {
|
|
|
|
|
@@ -2747,17 +2964,11 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
|
|
|
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
|
|
|
});
|
|
|
|
|
};
|
|
|
|
|
var __importStar = (this && this.__importStar) || function (mod) {
|
|
|
|
|
if (mod && mod.__esModule) return mod;
|
|
|
|
|
var result = {};
|
|
|
|
|
if (mod != null) for (var k in mod) if (Object.hasOwnProperty.call(mod, k)) result[k] = mod[k];
|
|
|
|
|
result["default"] = mod;
|
|
|
|
|
return result;
|
|
|
|
|
};
|
|
|
|
|
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
|
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
|
|
|
};
|
|
|
|
|
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
|
|
|
|
exports.evaluateVersions = exports.isExplicitVersion = exports.findFromManifest = exports.getManifestFromRepo = exports.findAllVersions = exports.find = exports.cacheFile = exports.cacheDir = exports.extractZip = exports.extractXar = exports.extractTar = exports.extract7z = exports.downloadTool = exports.HTTPError = void 0;
|
|
|
|
|
const core = __importStar(__nccwpck_require__(2186));
|
|
|
|
|
const io = __importStar(__nccwpck_require__(7436));
|
|
|
|
|
const fs = __importStar(__nccwpck_require__(5747));
|
|
|
|
|
@@ -2789,9 +3000,10 @@ const userAgent = 'actions/tool-cache';
|
|
|
|
|
* @param url url of tool to download
|
|
|
|
|
* @param dest path to download tool
|
|
|
|
|
* @param auth authorization header
|
|
|
|
|
* @param headers other headers
|
|
|
|
|
* @returns path to downloaded tool
|
|
|
|
|
*/
|
|
|
|
|
function downloadTool(url, dest, auth) {
|
|
|
|
|
function downloadTool(url, dest, auth, headers) {
|
|
|
|
|
return __awaiter(this, void 0, void 0, function* () {
|
|
|
|
|
dest = dest || path.join(_getTempDirectory(), v4_1.default());
|
|
|
|
|
yield io.mkdirP(path.dirname(dest));
|
|
|
|
|
@@ -2802,7 +3014,7 @@ function downloadTool(url, dest, auth) {
|
|
|
|
|
const maxSeconds = _getGlobal('TEST_DOWNLOAD_TOOL_RETRY_MAX_SECONDS', 20);
|
|
|
|
|
const retryHelper = new retry_helper_1.RetryHelper(maxAttempts, minSeconds, maxSeconds);
|
|
|
|
|
return yield retryHelper.execute(() => __awaiter(this, void 0, void 0, function* () {
|
|
|
|
|
return yield downloadToolAttempt(url, dest || '', auth);
|
|
|
|
|
return yield downloadToolAttempt(url, dest || '', auth, headers);
|
|
|
|
|
}), (err) => {
|
|
|
|
|
if (err instanceof HTTPError && err.httpStatusCode) {
|
|
|
|
|
// Don't retry anything less than 500, except 408 Request Timeout and 429 Too Many Requests
|
|
|
|
|
@@ -2818,7 +3030,7 @@ function downloadTool(url, dest, auth) {
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
exports.downloadTool = downloadTool;
|
|
|
|
|
function downloadToolAttempt(url, dest, auth) {
|
|
|
|
|
function downloadToolAttempt(url, dest, auth, headers) {
|
|
|
|
|
return __awaiter(this, void 0, void 0, function* () {
|
|
|
|
|
if (fs.existsSync(dest)) {
|
|
|
|
|
throw new Error(`Destination file path ${dest} already exists`);
|
|
|
|
|
@@ -2827,12 +3039,12 @@ function downloadToolAttempt(url, dest, auth) {
|
|
|
|
|
const http = new httpm.HttpClient(userAgent, [], {
|
|
|
|
|
allowRetries: false
|
|
|
|
|
});
|
|
|
|
|
let headers;
|
|
|
|
|
if (auth) {
|
|
|
|
|
core.debug('set auth');
|
|
|
|
|
headers = {
|
|
|
|
|
authorization: auth
|
|
|
|
|
};
|
|
|
|
|
if (headers === undefined) {
|
|
|
|
|
headers = {};
|
|
|
|
|
}
|
|
|
|
|
headers.authorization = auth;
|
|
|
|
|
}
|
|
|
|
|
const response = yield http.get(url, headers);
|
|
|
|
|
if (response.message.statusCode !== 200) {
|
|
|
|
|
@@ -2990,6 +3202,7 @@ function extractTar(file, dest, flags = 'xz') {
|
|
|
|
|
if (isGnuTar) {
|
|
|
|
|
// Suppress warnings when using GNU tar to extract archives created by BSD tar
|
|
|
|
|
args.push('--warning=no-unknown-keyword');
|
|
|
|
|
args.push('--overwrite');
|
|
|
|
|
}
|
|
|
|
|
args.push('-C', destArg, '-f', fileArg);
|
|
|
|
|
yield exec_1.exec(`tar`, args);
|
|
|
|
|
@@ -3055,20 +3268,50 @@ function extractZipWin(file, dest) {
|
|
|
|
|
// build the powershell command
|
|
|
|
|
const escapedFile = file.replace(/'/g, "''").replace(/"|\n|\r/g, ''); // double-up single quotes, remove double quotes and newlines
|
|
|
|
|
const escapedDest = dest.replace(/'/g, "''").replace(/"|\n|\r/g, '');
|
|
|
|
|
const command = `$ErrorActionPreference = 'Stop' ; try { Add-Type -AssemblyName System.IO.Compression.FileSystem } catch { } ; [System.IO.Compression.ZipFile]::ExtractToDirectory('${escapedFile}', '${escapedDest}')`;
|
|
|
|
|
// run powershell
|
|
|
|
|
const powershellPath = yield io.which('powershell', true);
|
|
|
|
|
const args = [
|
|
|
|
|
'-NoLogo',
|
|
|
|
|
'-Sta',
|
|
|
|
|
'-NoProfile',
|
|
|
|
|
'-NonInteractive',
|
|
|
|
|
'-ExecutionPolicy',
|
|
|
|
|
'Unrestricted',
|
|
|
|
|
'-Command',
|
|
|
|
|
command
|
|
|
|
|
];
|
|
|
|
|
yield exec_1.exec(`"${powershellPath}"`, args);
|
|
|
|
|
const pwshPath = yield io.which('pwsh', false);
|
|
|
|
|
//To match the file overwrite behavior on nix systems, we use the overwrite = true flag for ExtractToDirectory
|
|
|
|
|
//and the -Force flag for Expand-Archive as a fallback
|
|
|
|
|
if (pwshPath) {
|
|
|
|
|
//attempt to use pwsh with ExtractToDirectory, if this fails attempt Expand-Archive
|
|
|
|
|
const pwshCommand = [
|
|
|
|
|
`$ErrorActionPreference = 'Stop' ;`,
|
|
|
|
|
`try { Add-Type -AssemblyName System.IO.Compression.ZipFile } catch { } ;`,
|
|
|
|
|
`try { [System.IO.Compression.ZipFile]::ExtractToDirectory('${escapedFile}', '${escapedDest}', $true) }`,
|
|
|
|
|
`catch { if (($_.Exception.GetType().FullName -eq 'System.Management.Automation.MethodException') -or ($_.Exception.GetType().FullName -eq 'System.Management.Automation.RuntimeException') ){ Expand-Archive -LiteralPath '${escapedFile}' -DestinationPath '${escapedDest}' -Force } else { throw $_ } } ;`
|
|
|
|
|
].join(' ');
|
|
|
|
|
const args = [
|
|
|
|
|
'-NoLogo',
|
|
|
|
|
'-NoProfile',
|
|
|
|
|
'-NonInteractive',
|
|
|
|
|
'-ExecutionPolicy',
|
|
|
|
|
'Unrestricted',
|
|
|
|
|
'-Command',
|
|
|
|
|
pwshCommand
|
|
|
|
|
];
|
|
|
|
|
core.debug(`Using pwsh at path: ${pwshPath}`);
|
|
|
|
|
yield exec_1.exec(`"${pwshPath}"`, args);
|
|
|
|
|
}
|
|
|
|
|
else {
|
|
|
|
|
const powershellCommand = [
|
|
|
|
|
`$ErrorActionPreference = 'Stop' ;`,
|
|
|
|
|
`try { Add-Type -AssemblyName System.IO.Compression.FileSystem } catch { } ;`,
|
|
|
|
|
`if ((Get-Command -Name Expand-Archive -Module Microsoft.PowerShell.Archive -ErrorAction Ignore)) { Expand-Archive -LiteralPath '${escapedFile}' -DestinationPath '${escapedDest}' -Force }`,
|
|
|
|
|
`else {[System.IO.Compression.ZipFile]::ExtractToDirectory('${escapedFile}', '${escapedDest}', $true) }`
|
|
|
|
|
].join(' ');
|
|
|
|
|
const args = [
|
|
|
|
|
'-NoLogo',
|
|
|
|
|
'-Sta',
|
|
|
|
|
'-NoProfile',
|
|
|
|
|
'-NonInteractive',
|
|
|
|
|
'-ExecutionPolicy',
|
|
|
|
|
'Unrestricted',
|
|
|
|
|
'-Command',
|
|
|
|
|
powershellCommand
|
|
|
|
|
];
|
|
|
|
|
const powershellPath = yield io.which('powershell', true);
|
|
|
|
|
core.debug(`Using powershell at path: ${powershellPath}`);
|
|
|
|
|
yield exec_1.exec(`"${powershellPath}"`, args);
|
|
|
|
|
}
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
function extractZipNix(file, dest) {
|
|
|
|
|
@@ -3078,6 +3321,7 @@ function extractZipNix(file, dest) {
|
|
|
|
|
if (!core.isDebug()) {
|
|
|
|
|
args.unshift('-q');
|
|
|
|
|
}
|
|
|
|
|
args.unshift('-o'); //overwrite with -o, otherwise a prompt is shown which freezes the run
|
|
|
|
|
yield exec_1.exec(`"${unzipPath}"`, args, { cwd: dest });
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
@@ -3160,9 +3404,9 @@ function find(toolName, versionSpec, arch) {
|
|
|
|
|
}
|
|
|
|
|
arch = arch || os.arch();
|
|
|
|
|
// attempt to resolve an explicit version
|
|
|
|
|
if (!_isExplicitVersion(versionSpec)) {
|
|
|
|
|
if (!isExplicitVersion(versionSpec)) {
|
|
|
|
|
const localVersions = findAllVersions(toolName, arch);
|
|
|
|
|
const match = _evaluateVersions(localVersions, versionSpec);
|
|
|
|
|
const match = evaluateVersions(localVersions, versionSpec);
|
|
|
|
|
versionSpec = match;
|
|
|
|
|
}
|
|
|
|
|
// check for the explicit version in the cache
|
|
|
|
|
@@ -3195,7 +3439,7 @@ function findAllVersions(toolName, arch) {
|
|
|
|
|
if (fs.existsSync(toolPath)) {
|
|
|
|
|
const children = fs.readdirSync(toolPath);
|
|
|
|
|
for (const child of children) {
|
|
|
|
|
if (_isExplicitVersion(child)) {
|
|
|
|
|
if (isExplicitVersion(child)) {
|
|
|
|
|
const fullPath = path.join(toolPath, child, arch || '');
|
|
|
|
|
if (fs.existsSync(fullPath) && fs.existsSync(`${fullPath}.complete`)) {
|
|
|
|
|
versions.push(child);
|
|
|
|
|
@@ -3278,14 +3522,26 @@ function _completeToolPath(tool, version, arch) {
|
|
|
|
|
fs.writeFileSync(markerPath, '');
|
|
|
|
|
core.debug('finished caching tool');
|
|
|
|
|
}
|
|
|
|
|
function _isExplicitVersion(versionSpec) {
|
|
|
|
|
/**
|
|
|
|
|
* Check if version string is explicit
|
|
|
|
|
*
|
|
|
|
|
* @param versionSpec version string to check
|
|
|
|
|
*/
|
|
|
|
|
function isExplicitVersion(versionSpec) {
|
|
|
|
|
const c = semver.clean(versionSpec) || '';
|
|
|
|
|
core.debug(`isExplicit: ${c}`);
|
|
|
|
|
const valid = semver.valid(c) != null;
|
|
|
|
|
core.debug(`explicit? ${valid}`);
|
|
|
|
|
return valid;
|
|
|
|
|
}
|
|
|
|
|
function _evaluateVersions(versions, versionSpec) {
|
|
|
|
|
exports.isExplicitVersion = isExplicitVersion;
|
|
|
|
|
/**
|
|
|
|
|
* Get the highest satisfiying semantic version in `versions` which satisfies `versionSpec`
|
|
|
|
|
*
|
|
|
|
|
* @param versions array of versions to evaluate
|
|
|
|
|
* @param versionSpec semantic version spec to satisfy
|
|
|
|
|
*/
|
|
|
|
|
function evaluateVersions(versions, versionSpec) {
|
|
|
|
|
let version = '';
|
|
|
|
|
core.debug(`evaluating ${versions.length} versions`);
|
|
|
|
|
versions = versions.sort((a, b) => {
|
|
|
|
|
@@ -3310,6 +3566,7 @@ function _evaluateVersions(versions, versionSpec) {
|
|
|
|
|
}
|
|
|
|
|
return version;
|
|
|
|
|
}
|
|
|
|
|
exports.evaluateVersions = evaluateVersions;
|
|
|
|
|
/**
|
|
|
|
|
* Gets RUNNER_TOOL_CACHE
|
|
|
|
|
*/
|
|
|
|
|
@@ -8461,6 +8718,22 @@ module.exports = require("stream");;
|
|
|
|
|
|
|
|
|
|
/***/ }),
|
|
|
|
|
|
|
|
|
|
/***/ 4304:
|
|
|
|
|
/***/ ((module) => {
|
|
|
|
|
|
|
|
|
|
"use strict";
|
|
|
|
|
module.exports = require("string_decoder");;
|
|
|
|
|
|
|
|
|
|
/***/ }),
|
|
|
|
|
|
|
|
|
|
/***/ 8213:
|
|
|
|
|
/***/ ((module) => {
|
|
|
|
|
|
|
|
|
|
"use strict";
|
|
|
|
|
module.exports = require("timers");;
|
|
|
|
|
|
|
|
|
|
/***/ }),
|
|
|
|
|
|
|
|
|
|
/***/ 4016:
|
|
|
|
|
/***/ ((module) => {
|
|
|
|
|
|
|
|
|
|
@@ -8521,4 +8794,4 @@ module.exports = require("util");;
|
|
|
|
|
/******/ module.exports = __webpack_exports__;
|
|
|
|
|
/******/
|
|
|
|
|
/******/ })()
|
|
|
|
|
;
|
|
|
|
|
;
|