diff --git a/build/index.js b/build/index.js index f481734..a626783 100644 --- a/build/index.js +++ b/build/index.js @@ -4147,7 +4147,7 @@ async function installLinuxTools(installationPath, toolToBeUsed, usecase, output .arg("+x") .arg(path_1.default.join(extractPath, "smctl")); const syncRetCode = await setExecutableFlagForSmctl.exec(); - console.log("set executable flag for smctl " + syncRetCode); + console.log("set executable flag for smctl ", syncRetCode); let configFilePath = ""; //pkcs11 library installation if (usecase != "gpg-signing") { @@ -4215,7 +4215,7 @@ async function installMacTools(installationPath, toolToBeUsed, usecase, outputVa .arg("+x") .arg(path_1.default.join(extractPath, "smctl")); const syncRetCode = await setExecutableFlagForSmctl.exec(); - console.log("set executable flag for smctl " + syncRetCode); + console.log("set executable flag for smctl ", syncRetCode); let configFilePath = ""; //pkcs11 library installation if (usecase != "gpg-signing") { @@ -4320,10 +4320,10 @@ async function installWindowsTools(installationPath, toolToBeUsed, usecase, outp //function extracts all tools and returns the installed path const extractPath = await (0, runwintools_1.runWinToolBasedInstallationOrExtraction)(toolToBeUsed, directoryPath, usecase); if (usecase == "gpg-signing") { - console.log("path where the stm tools were installed/extracted is ", directoryPath); + console.log("GPG signing: path where the stm tools were installed/extracted is ", directoryPath); } else { - console.log("path where the stm tools were installed/extracted is ", extractPath); + console.log("Keypair signing: path where the stm tools were installed/extracted is ", extractPath); } outputVar.imp_file_paths["directoryPath"] = directoryPath; outputVar.imp_file_paths["extractPath"] = extractPath; @@ -4655,7 +4655,7 @@ exports.toolDownloaded = { }; const callApi = async (toolToBeUsed, getTempDirectoryPath) => { const urlToDownloadTool = `${exports.uiAPIPrefix}/releases/noauth/${toolToBeUsed}/download`; - console.log("Tool to be downloaded and used {} and url is {}", toolToBeUsed, urlToDownloadTool); + console.log(`Tool to be downloaded and used ${toolToBeUsed} and url is ${urlToDownloadTool}`); const toolFileData = await (0, exports.getAPICall)(urlToDownloadTool, { responseType: "arraybuffer", }); @@ -14225,567 +14225,567 @@ module.exports = v4; /***/ (function(__unused_webpack_module, exports, __nccwpck_require__) { "use strict"; - -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) { - function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } } - function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } } - function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); } - step((generator = generator.apply(thisArg, _arguments || [])).next()); - }); -}; -Object.defineProperty(exports, "__esModule", ({ value: true })); -exports.scrape = exports.extractZip = exports.extractTar = exports.extract7z = exports.cacheFile = exports.cacheDir = exports.downloadTool = exports.findLocalToolVersions = exports.findLocalTool = exports.evaluateVersions = exports.cleanVersion = exports.isExplicitVersion = exports.prependPath = exports.debug = void 0; -const httpm = __nccwpck_require__(5538); -const path = __nccwpck_require__(1017); -const os = __nccwpck_require__(2037); -const process = __nccwpck_require__(7282); -const fs = __nccwpck_require__(7147); -const semver = __nccwpck_require__(9184); -const tl = __nccwpck_require__(347); -const cmp = __nccwpck_require__(2568); -const uuidV4 = __nccwpck_require__(4758); -let pkg = __nccwpck_require__(9099); -let userAgent = 'vsts-task-installer/' + pkg.version; -let requestOptions = { - // ignoreSslError: true, - proxy: tl.getHttpProxyConfiguration(), - cert: tl.getHttpCertConfiguration(), - allowRedirects: true, - allowRetries: true, - maxRetries: 2 -}; -tl.setResourcePath(__nccwpck_require__.ab + "lib1.json"); -function debug(message) { - tl.debug(message); -} -exports.debug = debug; -function prependPath(toolPath) { - tl.assertAgent('2.115.0'); - if (!toolPath) { - throw new Error('Parameter toolPath must not be null or empty'); - } - else if (!tl.exist(toolPath) || !tl.stats(toolPath).isDirectory()) { - throw new Error('Directory does not exist: ' + toolPath); - } - // todo: add a test for path - console.log(tl.loc('TOOL_LIB_PrependPath', toolPath)); - let newPath = toolPath + path.delimiter + process.env['PATH']; - tl.debug('new Path: ' + newPath); - process.env['PATH'] = newPath; - // instruct the agent to set this path on future tasks - console.log('##vso[task.prependpath]' + toolPath); -} -exports.prependPath = prependPath; -function delay(ms) { - return new Promise(resolve => setTimeout(resolve, ms)); -} -//----------------------------- -// Version Functions -//----------------------------- -/** - * Checks if a version spec is an explicit version (e.g. 1.0.1 or v1.0.1) - * As opposed to a version spec like 1.x - * - * @param versionSpec - */ -function isExplicitVersion(versionSpec) { - let c = semver.clean(versionSpec); - tl.debug('isExplicit: ' + c); - let valid = semver.valid(c) != null; - tl.debug('explicit? ' + valid); - return valid; -} -exports.isExplicitVersion = isExplicitVersion; -/** - * Returns cleaned (removed leading/trailing whitespace, remove '=v' prefix) - * and parsed version, or null if version is invalid. - */ -function cleanVersion(version) { - tl.debug('cleaning: ' + version); - return semver.clean(version); -} -exports.cleanVersion = cleanVersion; -/** - * evaluates a list of versions and returns the latest version matching the version spec - * - * @param versions an array of versions to evaluate - * @param versionSpec a version spec (e.g. 1.x) - */ -function evaluateVersions(versions, versionSpec) { - let version; - tl.debug('evaluating ' + versions.length + ' versions'); - versions = versions.sort(cmp); - for (let i = versions.length - 1; i >= 0; i--) { - let potential = versions[i]; - let satisfied = semver.satisfies(potential, versionSpec); - if (satisfied) { - version = potential; - break; - } - } - if (version) { - tl.debug('matched: ' + version); - } - else { - tl.debug('match not found'); - } - return version; -} -exports.evaluateVersions = evaluateVersions; -//----------------------------- -// Local Tool Cache Functions -//----------------------------- -/** - * finds the path to a tool in the local installed tool cache - * - * @param toolName name of the tool - * @param versionSpec version of the tool - * @param arch optional arch. defaults to arch of computer - */ -function findLocalTool(toolName, versionSpec, arch) { - if (!toolName) { - throw new Error('toolName parameter is required'); - } - if (!versionSpec) { - throw new Error('versionSpec parameter is required'); - } - arch = arch || os.arch(); - // attempt to resolve an explicit version - if (!isExplicitVersion(versionSpec)) { - let localVersions = findLocalToolVersions(toolName, arch); - let match = evaluateVersions(localVersions, versionSpec); - versionSpec = match; - } - // check for the explicit version in the cache - let toolPath; - if (versionSpec) { - versionSpec = semver.clean(versionSpec); - let cacheRoot = _getCacheRoot(); - let cachePath = path.join(cacheRoot, toolName, versionSpec, arch); - tl.debug('checking cache: ' + cachePath); - if (tl.exist(cachePath) && tl.exist(`${cachePath}.complete`)) { - console.log(tl.loc('TOOL_LIB_FoundInCache', toolName, versionSpec, arch)); - toolPath = cachePath; - } - else { - tl.debug('not found'); - } - } - return toolPath; -} -exports.findLocalTool = findLocalTool; -/** - * Retrieves the versions of a tool that is intalled in the local tool cache - * - * @param toolName name of the tool - * @param arch optional arch. defaults to arch of computer - */ -function findLocalToolVersions(toolName, arch) { - let versions = []; - arch = arch || os.arch(); - let toolPath = path.join(_getCacheRoot(), toolName); - if (tl.exist(toolPath)) { - let children = tl.ls('', [toolPath]); - children.forEach((child) => { - if (isExplicitVersion(child)) { - let fullPath = path.join(toolPath, child, arch); - if (tl.exist(fullPath) && tl.exist(`${fullPath}.complete`)) { - versions.push(child); - } - } - }); - } - return versions; -} -exports.findLocalToolVersions = findLocalToolVersions; -//--------------------- -// Download Functions -//--------------------- -// -// TODO: keep extension intact -// -/** - * Download a tool from an url and stream it into a file - * - * @param url url of tool to download - * @param fileName optional fileName. Should typically not use (will be a guid for reliability). Can pass fileName with an absolute path. - * @param handlers optional handlers array. Auth handlers to pass to the HttpClient for the tool download. - * @param additionalHeaders optional custom HTTP headers. This is passed to the REST client that downloads the tool. - */ -function downloadTool(url, fileName, handlers, additionalHeaders) { - return __awaiter(this, void 0, void 0, function* () { - return new Promise((resolve, reject) => __awaiter(this, void 0, void 0, function* () { - try { - handlers = handlers || null; - let http = new httpm.HttpClient(userAgent, handlers, requestOptions); - tl.debug(fileName); - fileName = fileName || uuidV4(); - // check if it's an absolute path already - var destPath; - if (path.isAbsolute(fileName)) { - destPath = fileName; - } - else { - destPath = path.join(_getAgentTemp(), fileName); - } - // make sure that the folder exists - tl.mkdirP(path.dirname(destPath)); - console.log(tl.loc('TOOL_LIB_Downloading', url)); - tl.debug('destination ' + destPath); - if (fs.existsSync(destPath)) { - throw new Error("Destination file path already exists"); - } - tl.debug('downloading'); - let response = yield http.get(url, additionalHeaders); - if (response.message.statusCode != 200) { - let err = new Error('Unexpected HTTP response: ' + response.message.statusCode); - err['httpStatusCode'] = response.message.statusCode; - tl.debug(`Failed to download "${fileName}" from "${url}". Code(${response.message.statusCode}) Message(${response.message.statusMessage})`); - throw err; - } - let downloadedContentLength = _getContentLengthOfDownloadedFile(response); - if (!isNaN(downloadedContentLength)) { - tl.debug(`Content-Length of downloaded file: ${downloadedContentLength}`); - } - else { - tl.debug(`Content-Length header missing`); - } - tl.debug('creating stream'); - let file = fs.createWriteStream(destPath); - file.on('open', (fd) => __awaiter(this, void 0, void 0, function* () { - try { - let stream = response.message.pipe(file); - stream.on('close', () => { - tl.debug('download complete'); - let fileSizeInBytes; - try { - fileSizeInBytes = _getFileSizeOnDisk(destPath); - } - catch (err) { - fileSizeInBytes = NaN; - tl.warning(`Unable to check file size of ${destPath} due to error: ${err.Message}`); - } - if (!isNaN(fileSizeInBytes)) { - tl.debug(`Downloaded file size: ${fileSizeInBytes} bytes`); - } - else { - tl.debug(`File size on disk was not found`); - } - if (!isNaN(downloadedContentLength) && - !isNaN(fileSizeInBytes) && - fileSizeInBytes !== downloadedContentLength) { - tl.warning(`Content-Length (${downloadedContentLength} bytes) did not match downloaded file size (${fileSizeInBytes} bytes).`); - } - resolve(destPath); - }); - } - catch (err) { - reject(err); - } - })); - file.on('error', (err) => { - file.end(); - reject(err); - }); - } - catch (error) { - reject(error); - } - })); - }); -} -exports.downloadTool = downloadTool; -//--------------------- -// Size functions -//--------------------- -/** - * Gets size of downloaded file from "Content-Length" header - * - * @param response response for request to get the file - * @returns number if the 'content-length' is not empty, otherwise NaN - */ -function _getContentLengthOfDownloadedFile(response) { - let contentLengthHeader = response.message.headers['content-length']; - let parsedContentLength = parseInt(contentLengthHeader); - return parsedContentLength; -} -/** - * Gets size of file saved to disk - * - * @param filePath the path to the file, saved to the disk - * @returns size of file saved to disk - */ -function _getFileSizeOnDisk(filePath) { - let fileStats = fs.statSync(filePath); - let fileSizeInBytes = fileStats.size; - return fileSizeInBytes; -} -//--------------------- -// Install Functions -//--------------------- -function _createToolPath(tool, version, arch) { - // todo: add test for clean - let folderPath = path.join(_getCacheRoot(), tool, semver.clean(version), arch); - tl.debug('destination ' + folderPath); - let markerPath = `${folderPath}.complete`; - tl.rmRF(folderPath); - tl.rmRF(markerPath); - tl.mkdirP(folderPath); - return folderPath; -} -function _completeToolPath(tool, version, arch) { - let folderPath = path.join(_getCacheRoot(), tool, semver.clean(version), arch); - let markerPath = `${folderPath}.complete`; - tl.writeFile(markerPath, ''); - tl.debug('finished caching tool'); -} -/** - * Caches a directory and installs it into the tool cacheDir - * - * @param sourceDir the directory to cache into tools - * @param tool tool name - * @param version version of the tool. semver format - * @param arch architecture of the tool. Optional. Defaults to machine architecture - */ -function cacheDir(sourceDir, tool, version, arch) { - return __awaiter(this, void 0, void 0, function* () { - version = semver.clean(version); - arch = arch || os.arch(); - console.log(tl.loc('TOOL_LIB_CachingTool', tool, version, arch)); - tl.debug('source dir: ' + sourceDir); - if (!tl.stats(sourceDir).isDirectory()) { - throw new Error('sourceDir is not a directory'); - } - // create the tool dir - let destPath = _createToolPath(tool, version, arch); - // copy each child item. do not move. move can fail on Windows - // due to anti-virus software having an open handle on a file. - for (let itemName of fs.readdirSync(sourceDir)) { - let s = path.join(sourceDir, itemName); - tl.cp(s, destPath + '/', '-r'); - } - // write .complete - _completeToolPath(tool, version, arch); - return destPath; - }); -} -exports.cacheDir = cacheDir; -/** - * Caches a downloaded file (GUID) and installs it - * into the tool cache with a given targetName - * - * @param sourceFile the file to cache into tools. Typically a result of downloadTool which is a guid. - * @param targetFile the name of the file name in the tools directory - * @param tool tool name - * @param version version of the tool. semver format - * @param arch architecture of the tool. Optional. Defaults to machine architecture - */ -function cacheFile(sourceFile, targetFile, tool, version, arch) { - return __awaiter(this, void 0, void 0, function* () { - version = semver.clean(version); - arch = arch || os.arch(); - console.log(tl.loc('TOOL_LIB_CachingTool', tool, version, arch)); - tl.debug('source file:' + sourceFile); - if (!tl.stats(sourceFile).isFile()) { - throw new Error('sourceFile is not a file'); - } - // create the tool dir - let destFolder = _createToolPath(tool, version, arch); - // copy instead of move. move can fail on Windows due to - // anti-virus software having an open handle on a file. - let destPath = path.join(destFolder, targetFile); - tl.debug('destination file' + destPath); - tl.cp(sourceFile, destPath); - // write .complete - _completeToolPath(tool, version, arch); - return destFolder; - }); -} -exports.cacheFile = cacheFile; -//--------------------- -// Extract Functions -//--------------------- -/** - * Extract a .7z file - * - * @param file path to the .7z file - * @param dest destination directory. Optional. - * @param _7zPath path to 7zr.exe. Optional, for long path support. Most .7z archives do not have this - * problem. If your .7z archive contains very long paths, you can pass the path to 7zr.exe which will - * gracefully handle long paths. By default 7zdec.exe is used because it is a very small program and is - * bundled with the tool lib. However it does not support long paths. 7zr.exe is the reduced command line - * interface, it is smaller than the full command line interface, and it does support long paths. At the - * time of this writing, it is freely available from the LZMA SDK that is available on the 7zip website. - * Be sure to check the current license agreement. If 7zr.exe is bundled with your task, then the path - * to 7zr.exe can be pass to this function. - * @param overwriteDest Overwrite files in destination catalog. Optional. - * @returns path to the destination directory - */ -function extract7z(file, dest, _7zPath, overwriteDest) { - return __awaiter(this, void 0, void 0, function* () { - if (process.platform != 'win32') { - throw new Error('extract7z() not supported on current OS'); - } - if (!file) { - throw new Error("parameter 'file' is required"); - } - console.log(tl.loc('TOOL_LIB_ExtractingArchive')); - dest = _createExtractFolder(dest); - let originalCwd = process.cwd(); - try { - process.chdir(dest); - if (_7zPath) { - // extract - const _7z = tl.tool(_7zPath); - if (overwriteDest) { - _7z.arg('-aoa'); - } - _7z.arg('x') // eXtract files with full paths - .arg('-bb1') // -bb[0-3] : set output log level - .arg('-bd') // disable progress indicator - .arg('-sccUTF-8') // set charset for for console input/output - .arg(file); - yield _7z.exec(); - } - else { - // extract - let escapedScript = path.join(__dirname, 'Invoke-7zdec.ps1').replace(/'/g, "''").replace(/"|\n|\r/g, ''); // double-up single quotes, remove double quotes and newlines - let escapedFile = file.replace(/'/g, "''").replace(/"|\n|\r/g, ''); - let escapedTarget = dest.replace(/'/g, "''").replace(/"|\n|\r/g, ''); - const overrideDestDirectory = overwriteDest ? 1 : 0; - const command = `& '${escapedScript}' -Source '${escapedFile}' -Target '${escapedTarget}' -OverrideDestDirectory ${overrideDestDirectory}`; - let powershellPath = tl.which('powershell', true); - let powershell = tl.tool(powershellPath) - .line('-NoLogo -Sta -NoProfile -NonInteractive -ExecutionPolicy Unrestricted -Command') - .arg(command); - powershell.on('stdout', (buffer) => { - process.stdout.write(buffer); - }); - powershell.on('stderr', (buffer) => { - process.stderr.write(buffer); - }); - yield powershell.exec({ silent: true }); - } - } - finally { - process.chdir(originalCwd); - } - return dest; - }); -} -exports.extract7z = extract7z; -/** - * installs a tool from a tar by extracting the tar and installing it into the tool cache - * - * @param file file path of the tar - * @param tool name of tool in the tool cache - * @param version version of the tool - * @param arch arch of the tool. optional. defaults to the arch of the machine - * @param options IExtractOptions - * @param destination destination directory. optional. - */ -function extractTar(file, destination) { - return __awaiter(this, void 0, void 0, function* () { - // mkdir -p node/4.7.0/x64 - // tar xzC ./node/4.7.0/x64 -f node-v4.7.0-darwin-x64.tar.gz --strip-components 1 - console.log(tl.loc('TOOL_LIB_ExtractingArchive')); - let dest = _createExtractFolder(destination); - let tr = tl.tool('tar'); - tr.arg(['xC', dest, '-f', file]); - yield tr.exec(); - return dest; - }); -} -exports.extractTar = extractTar; -function extractZip(file, destination) { - return __awaiter(this, void 0, void 0, function* () { - if (!file) { - throw new Error("parameter 'file' is required"); - } - console.log(tl.loc('TOOL_LIB_ExtractingArchive')); - let dest = _createExtractFolder(destination); - if (process.platform == 'win32') { - // build the powershell command - let escapedFile = file.replace(/'/g, "''").replace(/"|\n|\r/g, ''); // double-up single quotes, remove double quotes and newlines - let escapedDest = dest.replace(/'/g, "''").replace(/"|\n|\r/g, ''); - let command = `$ErrorActionPreference = 'Stop' ; try { Add-Type -AssemblyName System.IO.Compression.FileSystem } catch { } ; [System.IO.Compression.ZipFile]::ExtractToDirectory('${escapedFile}', '${escapedDest}')`; - // change the console output code page to UTF-8. - // TODO: FIX WHICH: let chcpPath = tl.which('chcp.com', true); - let chcpPath = path.join(process.env.windir, "system32", "chcp.com"); - yield tl.exec(chcpPath, '65001'); - // run powershell - let powershell = tl.tool('powershell') - .line('-NoLogo -Sta -NoProfile -NonInteractive -ExecutionPolicy Unrestricted -Command') - .arg(command); - yield powershell.exec(); - } - else { - let unzip = tl.tool('unzip') - .arg(file); - yield unzip.exec({ cwd: dest }); - } - return dest; - }); -} -exports.extractZip = extractZip; -function _createExtractFolder(dest) { - if (!dest) { - // create a temp dir - dest = path.join(_getAgentTemp(), uuidV4()); - } - tl.mkdirP(dest); - return dest; -} -//--------------------- -// Query Functions -//--------------------- -// default input will be >= LTS version. drop label different than value. -// v4 (LTS) would have a value of 4.x -// option to always download? (not cache), TTL? -/** - * Scrape a web page for versions by regex - * - * @param url url to scrape - * @param regex regex to use for version matches - * @param handlers optional handlers array. Auth handlers to pass to the HttpClient for the tool download. - */ -function scrape(url, regex, handlers) { - return __awaiter(this, void 0, void 0, function* () { - handlers = handlers || null; - let http = new httpm.HttpClient(userAgent, handlers, requestOptions); - let output = yield (yield http.get(url)).readBody(); - let matches = output.match(regex); - let seen = {}; - let versions = []; - for (let i = 0; i < matches.length; i++) { - let ver = semver.clean(matches[i]); - if (!seen.hasOwnProperty(ver)) { - seen[ver] = true; - versions.push(ver); - } - } - return versions; - }); -} -exports.scrape = scrape; -function _getCacheRoot() { - tl.assertAgent('2.115.0'); - let cacheRoot = tl.getVariable('Agent.ToolsDirectory'); - if (!cacheRoot) { - throw new Error('Agent.ToolsDirectory is not set'); - } - return cacheRoot; -} -function _getAgentTemp() { - tl.assertAgent('2.115.0'); - let tempDirectory = tl.getVariable('Agent.TempDirectory'); - if (!tempDirectory) { - throw new Error('Agent.TempDirectory is not set'); - } - return tempDirectory; -} + +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) { + function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } } + function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } } + function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); } + step((generator = generator.apply(thisArg, _arguments || [])).next()); + }); +}; +Object.defineProperty(exports, "__esModule", ({ value: true })); +exports.scrape = exports.extractZip = exports.extractTar = exports.extract7z = exports.cacheFile = exports.cacheDir = exports.downloadTool = exports.findLocalToolVersions = exports.findLocalTool = exports.evaluateVersions = exports.cleanVersion = exports.isExplicitVersion = exports.prependPath = exports.debug = void 0; +const httpm = __nccwpck_require__(5538); +const path = __nccwpck_require__(1017); +const os = __nccwpck_require__(2037); +const process = __nccwpck_require__(7282); +const fs = __nccwpck_require__(7147); +const semver = __nccwpck_require__(9184); +const tl = __nccwpck_require__(347); +const cmp = __nccwpck_require__(2568); +const uuidV4 = __nccwpck_require__(4758); +let pkg = __nccwpck_require__(9099); +let userAgent = 'vsts-task-installer/' + pkg.version; +let requestOptions = { + // ignoreSslError: true, + proxy: tl.getHttpProxyConfiguration(), + cert: tl.getHttpCertConfiguration(), + allowRedirects: true, + allowRetries: true, + maxRetries: 2 +}; +tl.setResourcePath(__nccwpck_require__.ab + "lib1.json"); +function debug(message) { + tl.debug(message); +} +exports.debug = debug; +function prependPath(toolPath) { + tl.assertAgent('2.115.0'); + if (!toolPath) { + throw new Error('Parameter toolPath must not be null or empty'); + } + else if (!tl.exist(toolPath) || !tl.stats(toolPath).isDirectory()) { + throw new Error('Directory does not exist: ' + toolPath); + } + // todo: add a test for path + console.log(tl.loc('TOOL_LIB_PrependPath', toolPath)); + let newPath = toolPath + path.delimiter + process.env['PATH']; + tl.debug('new Path: ' + newPath); + process.env['PATH'] = newPath; + // instruct the agent to set this path on future tasks + console.log('##vso[task.prependpath]' + toolPath); +} +exports.prependPath = prependPath; +function delay(ms) { + return new Promise(resolve => setTimeout(resolve, ms)); +} +//----------------------------- +// Version Functions +//----------------------------- +/** + * Checks if a version spec is an explicit version (e.g. 1.0.1 or v1.0.1) + * As opposed to a version spec like 1.x + * + * @param versionSpec + */ +function isExplicitVersion(versionSpec) { + let c = semver.clean(versionSpec); + tl.debug('isExplicit: ' + c); + let valid = semver.valid(c) != null; + tl.debug('explicit? ' + valid); + return valid; +} +exports.isExplicitVersion = isExplicitVersion; +/** + * Returns cleaned (removed leading/trailing whitespace, remove '=v' prefix) + * and parsed version, or null if version is invalid. + */ +function cleanVersion(version) { + tl.debug('cleaning: ' + version); + return semver.clean(version); +} +exports.cleanVersion = cleanVersion; +/** + * evaluates a list of versions and returns the latest version matching the version spec + * + * @param versions an array of versions to evaluate + * @param versionSpec a version spec (e.g. 1.x) + */ +function evaluateVersions(versions, versionSpec) { + let version; + tl.debug('evaluating ' + versions.length + ' versions'); + versions = versions.sort(cmp); + for (let i = versions.length - 1; i >= 0; i--) { + let potential = versions[i]; + let satisfied = semver.satisfies(potential, versionSpec); + if (satisfied) { + version = potential; + break; + } + } + if (version) { + tl.debug('matched: ' + version); + } + else { + tl.debug('match not found'); + } + return version; +} +exports.evaluateVersions = evaluateVersions; +//----------------------------- +// Local Tool Cache Functions +//----------------------------- +/** + * finds the path to a tool in the local installed tool cache + * + * @param toolName name of the tool + * @param versionSpec version of the tool + * @param arch optional arch. defaults to arch of computer + */ +function findLocalTool(toolName, versionSpec, arch) { + if (!toolName) { + throw new Error('toolName parameter is required'); + } + if (!versionSpec) { + throw new Error('versionSpec parameter is required'); + } + arch = arch || os.arch(); + // attempt to resolve an explicit version + if (!isExplicitVersion(versionSpec)) { + let localVersions = findLocalToolVersions(toolName, arch); + let match = evaluateVersions(localVersions, versionSpec); + versionSpec = match; + } + // check for the explicit version in the cache + let toolPath; + if (versionSpec) { + versionSpec = semver.clean(versionSpec); + let cacheRoot = _getCacheRoot(); + let cachePath = path.join(cacheRoot, toolName, versionSpec, arch); + tl.debug('checking cache: ' + cachePath); + if (tl.exist(cachePath) && tl.exist(`${cachePath}.complete`)) { + console.log(tl.loc('TOOL_LIB_FoundInCache', toolName, versionSpec, arch)); + toolPath = cachePath; + } + else { + tl.debug('not found'); + } + } + return toolPath; +} +exports.findLocalTool = findLocalTool; +/** + * Retrieves the versions of a tool that is intalled in the local tool cache + * + * @param toolName name of the tool + * @param arch optional arch. defaults to arch of computer + */ +function findLocalToolVersions(toolName, arch) { + let versions = []; + arch = arch || os.arch(); + let toolPath = path.join(_getCacheRoot(), toolName); + if (tl.exist(toolPath)) { + let children = tl.ls('', [toolPath]); + children.forEach((child) => { + if (isExplicitVersion(child)) { + let fullPath = path.join(toolPath, child, arch); + if (tl.exist(fullPath) && tl.exist(`${fullPath}.complete`)) { + versions.push(child); + } + } + }); + } + return versions; +} +exports.findLocalToolVersions = findLocalToolVersions; +//--------------------- +// Download Functions +//--------------------- +// +// TODO: keep extension intact +// +/** + * Download a tool from an url and stream it into a file + * + * @param url url of tool to download + * @param fileName optional fileName. Should typically not use (will be a guid for reliability). Can pass fileName with an absolute path. + * @param handlers optional handlers array. Auth handlers to pass to the HttpClient for the tool download. + * @param additionalHeaders optional custom HTTP headers. This is passed to the REST client that downloads the tool. + */ +function downloadTool(url, fileName, handlers, additionalHeaders) { + return __awaiter(this, void 0, void 0, function* () { + return new Promise((resolve, reject) => __awaiter(this, void 0, void 0, function* () { + try { + handlers = handlers || null; + let http = new httpm.HttpClient(userAgent, handlers, requestOptions); + tl.debug(fileName); + fileName = fileName || uuidV4(); + // check if it's an absolute path already + var destPath; + if (path.isAbsolute(fileName)) { + destPath = fileName; + } + else { + destPath = path.join(_getAgentTemp(), fileName); + } + // make sure that the folder exists + tl.mkdirP(path.dirname(destPath)); + console.log(tl.loc('TOOL_LIB_Downloading', url)); + tl.debug('destination ' + destPath); + if (fs.existsSync(destPath)) { + throw new Error("Destination file path already exists"); + } + tl.debug('downloading'); + let response = yield http.get(url, additionalHeaders); + if (response.message.statusCode != 200) { + let err = new Error('Unexpected HTTP response: ' + response.message.statusCode); + err['httpStatusCode'] = response.message.statusCode; + tl.debug(`Failed to download "${fileName}" from "${url}". Code(${response.message.statusCode}) Message(${response.message.statusMessage})`); + throw err; + } + let downloadedContentLength = _getContentLengthOfDownloadedFile(response); + if (!isNaN(downloadedContentLength)) { + tl.debug(`Content-Length of downloaded file: ${downloadedContentLength}`); + } + else { + tl.debug(`Content-Length header missing`); + } + tl.debug('creating stream'); + let file = fs.createWriteStream(destPath); + file.on('open', (fd) => __awaiter(this, void 0, void 0, function* () { + try { + let stream = response.message.pipe(file); + stream.on('close', () => { + tl.debug('download complete'); + let fileSizeInBytes; + try { + fileSizeInBytes = _getFileSizeOnDisk(destPath); + } + catch (err) { + fileSizeInBytes = NaN; + tl.warning(`Unable to check file size of ${destPath} due to error: ${err.Message}`); + } + if (!isNaN(fileSizeInBytes)) { + tl.debug(`Downloaded file size: ${fileSizeInBytes} bytes`); + } + else { + tl.debug(`File size on disk was not found`); + } + if (!isNaN(downloadedContentLength) && + !isNaN(fileSizeInBytes) && + fileSizeInBytes !== downloadedContentLength) { + tl.warning(`Content-Length (${downloadedContentLength} bytes) did not match downloaded file size (${fileSizeInBytes} bytes).`); + } + resolve(destPath); + }); + } + catch (err) { + reject(err); + } + })); + file.on('error', (err) => { + file.end(); + reject(err); + }); + } + catch (error) { + reject(error); + } + })); + }); +} +exports.downloadTool = downloadTool; +//--------------------- +// Size functions +//--------------------- +/** + * Gets size of downloaded file from "Content-Length" header + * + * @param response response for request to get the file + * @returns number if the 'content-length' is not empty, otherwise NaN + */ +function _getContentLengthOfDownloadedFile(response) { + let contentLengthHeader = response.message.headers['content-length']; + let parsedContentLength = parseInt(contentLengthHeader); + return parsedContentLength; +} +/** + * Gets size of file saved to disk + * + * @param filePath the path to the file, saved to the disk + * @returns size of file saved to disk + */ +function _getFileSizeOnDisk(filePath) { + let fileStats = fs.statSync(filePath); + let fileSizeInBytes = fileStats.size; + return fileSizeInBytes; +} +//--------------------- +// Install Functions +//--------------------- +function _createToolPath(tool, version, arch) { + // todo: add test for clean + let folderPath = path.join(_getCacheRoot(), tool, semver.clean(version), arch); + tl.debug('destination ' + folderPath); + let markerPath = `${folderPath}.complete`; + tl.rmRF(folderPath); + tl.rmRF(markerPath); + tl.mkdirP(folderPath); + return folderPath; +} +function _completeToolPath(tool, version, arch) { + let folderPath = path.join(_getCacheRoot(), tool, semver.clean(version), arch); + let markerPath = `${folderPath}.complete`; + tl.writeFile(markerPath, ''); + tl.debug('finished caching tool'); +} +/** + * Caches a directory and installs it into the tool cacheDir + * + * @param sourceDir the directory to cache into tools + * @param tool tool name + * @param version version of the tool. semver format + * @param arch architecture of the tool. Optional. Defaults to machine architecture + */ +function cacheDir(sourceDir, tool, version, arch) { + return __awaiter(this, void 0, void 0, function* () { + version = semver.clean(version); + arch = arch || os.arch(); + console.log(tl.loc('TOOL_LIB_CachingTool', tool, version, arch)); + tl.debug('source dir: ' + sourceDir); + if (!tl.stats(sourceDir).isDirectory()) { + throw new Error('sourceDir is not a directory'); + } + // create the tool dir + let destPath = _createToolPath(tool, version, arch); + // copy each child item. do not move. move can fail on Windows + // due to anti-virus software having an open handle on a file. + for (let itemName of fs.readdirSync(sourceDir)) { + let s = path.join(sourceDir, itemName); + tl.cp(s, destPath + '/', '-r'); + } + // write .complete + _completeToolPath(tool, version, arch); + return destPath; + }); +} +exports.cacheDir = cacheDir; +/** + * Caches a downloaded file (GUID) and installs it + * into the tool cache with a given targetName + * + * @param sourceFile the file to cache into tools. Typically a result of downloadTool which is a guid. + * @param targetFile the name of the file name in the tools directory + * @param tool tool name + * @param version version of the tool. semver format + * @param arch architecture of the tool. Optional. Defaults to machine architecture + */ +function cacheFile(sourceFile, targetFile, tool, version, arch) { + return __awaiter(this, void 0, void 0, function* () { + version = semver.clean(version); + arch = arch || os.arch(); + console.log(tl.loc('TOOL_LIB_CachingTool', tool, version, arch)); + tl.debug('source file:' + sourceFile); + if (!tl.stats(sourceFile).isFile()) { + throw new Error('sourceFile is not a file'); + } + // create the tool dir + let destFolder = _createToolPath(tool, version, arch); + // copy instead of move. move can fail on Windows due to + // anti-virus software having an open handle on a file. + let destPath = path.join(destFolder, targetFile); + tl.debug('destination file' + destPath); + tl.cp(sourceFile, destPath); + // write .complete + _completeToolPath(tool, version, arch); + return destFolder; + }); +} +exports.cacheFile = cacheFile; +//--------------------- +// Extract Functions +//--------------------- +/** + * Extract a .7z file + * + * @param file path to the .7z file + * @param dest destination directory. Optional. + * @param _7zPath path to 7zr.exe. Optional, for long path support. Most .7z archives do not have this + * problem. If your .7z archive contains very long paths, you can pass the path to 7zr.exe which will + * gracefully handle long paths. By default 7zdec.exe is used because it is a very small program and is + * bundled with the tool lib. However it does not support long paths. 7zr.exe is the reduced command line + * interface, it is smaller than the full command line interface, and it does support long paths. At the + * time of this writing, it is freely available from the LZMA SDK that is available on the 7zip website. + * Be sure to check the current license agreement. If 7zr.exe is bundled with your task, then the path + * to 7zr.exe can be pass to this function. + * @param overwriteDest Overwrite files in destination catalog. Optional. + * @returns path to the destination directory + */ +function extract7z(file, dest, _7zPath, overwriteDest) { + return __awaiter(this, void 0, void 0, function* () { + if (process.platform != 'win32') { + throw new Error('extract7z() not supported on current OS'); + } + if (!file) { + throw new Error("parameter 'file' is required"); + } + console.log(tl.loc('TOOL_LIB_ExtractingArchive')); + dest = _createExtractFolder(dest); + let originalCwd = process.cwd(); + try { + process.chdir(dest); + if (_7zPath) { + // extract + const _7z = tl.tool(_7zPath); + if (overwriteDest) { + _7z.arg('-aoa'); + } + _7z.arg('x') // eXtract files with full paths + .arg('-bb1') // -bb[0-3] : set output log level + .arg('-bd') // disable progress indicator + .arg('-sccUTF-8') // set charset for for console input/output + .arg(file); + yield _7z.exec(); + } + else { + // extract + let escapedScript = path.join(__dirname, 'Invoke-7zdec.ps1').replace(/'/g, "''").replace(/"|\n|\r/g, ''); // double-up single quotes, remove double quotes and newlines + let escapedFile = file.replace(/'/g, "''").replace(/"|\n|\r/g, ''); + let escapedTarget = dest.replace(/'/g, "''").replace(/"|\n|\r/g, ''); + const overrideDestDirectory = overwriteDest ? 1 : 0; + const command = `& '${escapedScript}' -Source '${escapedFile}' -Target '${escapedTarget}' -OverrideDestDirectory ${overrideDestDirectory}`; + let powershellPath = tl.which('powershell', true); + let powershell = tl.tool(powershellPath) + .line('-NoLogo -Sta -NoProfile -NonInteractive -ExecutionPolicy Unrestricted -Command') + .arg(command); + powershell.on('stdout', (buffer) => { + process.stdout.write(buffer); + }); + powershell.on('stderr', (buffer) => { + process.stderr.write(buffer); + }); + yield powershell.exec({ silent: true }); + } + } + finally { + process.chdir(originalCwd); + } + return dest; + }); +} +exports.extract7z = extract7z; +/** + * installs a tool from a tar by extracting the tar and installing it into the tool cache + * + * @param file file path of the tar + * @param tool name of tool in the tool cache + * @param version version of the tool + * @param arch arch of the tool. optional. defaults to the arch of the machine + * @param options IExtractOptions + * @param destination destination directory. optional. + */ +function extractTar(file, destination) { + return __awaiter(this, void 0, void 0, function* () { + // mkdir -p node/4.7.0/x64 + // tar xzC ./node/4.7.0/x64 -f node-v4.7.0-darwin-x64.tar.gz --strip-components 1 + console.log(tl.loc('TOOL_LIB_ExtractingArchive')); + let dest = _createExtractFolder(destination); + let tr = tl.tool('tar'); + tr.arg(['xC', dest, '-f', file]); + yield tr.exec(); + return dest; + }); +} +exports.extractTar = extractTar; +function extractZip(file, destination) { + return __awaiter(this, void 0, void 0, function* () { + if (!file) { + throw new Error("parameter 'file' is required"); + } + console.log(tl.loc('TOOL_LIB_ExtractingArchive')); + let dest = _createExtractFolder(destination); + if (process.platform == 'win32') { + // build the powershell command + let escapedFile = file.replace(/'/g, "''").replace(/"|\n|\r/g, ''); // double-up single quotes, remove double quotes and newlines + let escapedDest = dest.replace(/'/g, "''").replace(/"|\n|\r/g, ''); + let command = `$ErrorActionPreference = 'Stop' ; try { Add-Type -AssemblyName System.IO.Compression.FileSystem } catch { } ; [System.IO.Compression.ZipFile]::ExtractToDirectory('${escapedFile}', '${escapedDest}')`; + // change the console output code page to UTF-8. + // TODO: FIX WHICH: let chcpPath = tl.which('chcp.com', true); + let chcpPath = path.join(process.env.windir, "system32", "chcp.com"); + yield tl.exec(chcpPath, '65001'); + // run powershell + let powershell = tl.tool('powershell') + .line('-NoLogo -Sta -NoProfile -NonInteractive -ExecutionPolicy Unrestricted -Command') + .arg(command); + yield powershell.exec(); + } + else { + let unzip = tl.tool('unzip') + .arg(file); + yield unzip.exec({ cwd: dest }); + } + return dest; + }); +} +exports.extractZip = extractZip; +function _createExtractFolder(dest) { + if (!dest) { + // create a temp dir + dest = path.join(_getAgentTemp(), uuidV4()); + } + tl.mkdirP(dest); + return dest; +} +//--------------------- +// Query Functions +//--------------------- +// default input will be >= LTS version. drop label different than value. +// v4 (LTS) would have a value of 4.x +// option to always download? (not cache), TTL? +/** + * Scrape a web page for versions by regex + * + * @param url url to scrape + * @param regex regex to use for version matches + * @param handlers optional handlers array. Auth handlers to pass to the HttpClient for the tool download. + */ +function scrape(url, regex, handlers) { + return __awaiter(this, void 0, void 0, function* () { + handlers = handlers || null; + let http = new httpm.HttpClient(userAgent, handlers, requestOptions); + let output = yield (yield http.get(url)).readBody(); + let matches = output.match(regex); + let seen = {}; + let versions = []; + for (let i = 0; i < matches.length; i++) { + let ver = semver.clean(matches[i]); + if (!seen.hasOwnProperty(ver)) { + seen[ver] = true; + versions.push(ver); + } + } + return versions; + }); +} +exports.scrape = scrape; +function _getCacheRoot() { + tl.assertAgent('2.115.0'); + let cacheRoot = tl.getVariable('Agent.ToolsDirectory'); + if (!cacheRoot) { + throw new Error('Agent.ToolsDirectory is not set'); + } + return cacheRoot; +} +function _getAgentTemp() { + tl.assertAgent('2.115.0'); + let tempDirectory = tl.getVariable('Agent.TempDirectory'); + if (!tempDirectory) { + throw new Error('Agent.TempDirectory is not set'); + } + return tempDirectory; +} /***/ }), @@ -31098,508 +31098,508 @@ exports.debug = debug; // for test /***/ (function(__unused_webpack_module, exports, __nccwpck_require__) { "use strict"; - -// Copyright (c) Microsoft. All rights reserved. -// Licensed under the MIT license. See LICENSE file in the project root for full license information. -var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) { - return new (P || (P = Promise))(function (resolve, reject) { - function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } } - function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } } - function step(result) { result.done ? resolve(result.value) : new P(function (resolve) { resolve(result.value); }).then(fulfilled, rejected); } - step((generator = generator.apply(thisArg, _arguments || [])).next()); - }); -}; -Object.defineProperty(exports, "__esModule", ({ value: true })); -const url = __nccwpck_require__(7310); -const http = __nccwpck_require__(3685); -const https = __nccwpck_require__(5687); -const util = __nccwpck_require__(9470); -let fs; -let tunnel; -var HttpCodes; -(function (HttpCodes) { - HttpCodes[HttpCodes["OK"] = 200] = "OK"; - HttpCodes[HttpCodes["MultipleChoices"] = 300] = "MultipleChoices"; - HttpCodes[HttpCodes["MovedPermanently"] = 301] = "MovedPermanently"; - HttpCodes[HttpCodes["ResourceMoved"] = 302] = "ResourceMoved"; - HttpCodes[HttpCodes["SeeOther"] = 303] = "SeeOther"; - HttpCodes[HttpCodes["NotModified"] = 304] = "NotModified"; - HttpCodes[HttpCodes["UseProxy"] = 305] = "UseProxy"; - HttpCodes[HttpCodes["SwitchProxy"] = 306] = "SwitchProxy"; - HttpCodes[HttpCodes["TemporaryRedirect"] = 307] = "TemporaryRedirect"; - HttpCodes[HttpCodes["PermanentRedirect"] = 308] = "PermanentRedirect"; - HttpCodes[HttpCodes["BadRequest"] = 400] = "BadRequest"; - HttpCodes[HttpCodes["Unauthorized"] = 401] = "Unauthorized"; - HttpCodes[HttpCodes["PaymentRequired"] = 402] = "PaymentRequired"; - HttpCodes[HttpCodes["Forbidden"] = 403] = "Forbidden"; - HttpCodes[HttpCodes["NotFound"] = 404] = "NotFound"; - HttpCodes[HttpCodes["MethodNotAllowed"] = 405] = "MethodNotAllowed"; - HttpCodes[HttpCodes["NotAcceptable"] = 406] = "NotAcceptable"; - HttpCodes[HttpCodes["ProxyAuthenticationRequired"] = 407] = "ProxyAuthenticationRequired"; - HttpCodes[HttpCodes["RequestTimeout"] = 408] = "RequestTimeout"; - HttpCodes[HttpCodes["Conflict"] = 409] = "Conflict"; - HttpCodes[HttpCodes["Gone"] = 410] = "Gone"; - HttpCodes[HttpCodes["TooManyRequests"] = 429] = "TooManyRequests"; - HttpCodes[HttpCodes["InternalServerError"] = 500] = "InternalServerError"; - HttpCodes[HttpCodes["NotImplemented"] = 501] = "NotImplemented"; - HttpCodes[HttpCodes["BadGateway"] = 502] = "BadGateway"; - HttpCodes[HttpCodes["ServiceUnavailable"] = 503] = "ServiceUnavailable"; - HttpCodes[HttpCodes["GatewayTimeout"] = 504] = "GatewayTimeout"; -})(HttpCodes = exports.HttpCodes || (exports.HttpCodes = {})); -const HttpRedirectCodes = [HttpCodes.MovedPermanently, HttpCodes.ResourceMoved, HttpCodes.SeeOther, HttpCodes.TemporaryRedirect, HttpCodes.PermanentRedirect]; -const HttpResponseRetryCodes = [HttpCodes.BadGateway, HttpCodes.ServiceUnavailable, HttpCodes.GatewayTimeout]; -const NetworkRetryErrors = ['ECONNRESET', 'ENOTFOUND', 'ESOCKETTIMEDOUT', 'ETIMEDOUT', 'ECONNREFUSED']; -const RetryableHttpVerbs = ['OPTIONS', 'GET', 'DELETE', 'HEAD']; -const ExponentialBackoffCeiling = 10; -const ExponentialBackoffTimeSlice = 5; -class HttpClientResponse { - constructor(message) { - this.message = message; - } - readBody() { - return new Promise((resolve, reject) => __awaiter(this, void 0, void 0, function* () { - const chunks = []; - const encodingCharset = util.obtainContentCharset(this); - // Extract Encoding from header: 'content-encoding' - // Match `gzip`, `gzip, deflate` variations of GZIP encoding - const contentEncoding = this.message.headers['content-encoding'] || ''; - const isGzippedEncoded = new RegExp('(gzip$)|(gzip, *deflate)').test(contentEncoding); - this.message.on('data', function (data) { - const chunk = (typeof data === 'string') ? Buffer.from(data, encodingCharset) : data; - chunks.push(chunk); - }).on('end', function () { - return __awaiter(this, void 0, void 0, function* () { - const buffer = Buffer.concat(chunks); - if (isGzippedEncoded) { // Process GZipped Response Body HERE - const gunzippedBody = yield util.decompressGzippedContent(buffer, encodingCharset); - resolve(gunzippedBody); - } - else { - resolve(buffer.toString(encodingCharset)); - } - }); - }).on('error', function (err) { - reject(err); - }); - })); - } -} -exports.HttpClientResponse = HttpClientResponse; -function isHttps(requestUrl) { - let parsedUrl = url.parse(requestUrl); - return parsedUrl.protocol === 'https:'; -} -exports.isHttps = isHttps; -var EnvironmentVariables; -(function (EnvironmentVariables) { - EnvironmentVariables["HTTP_PROXY"] = "HTTP_PROXY"; - EnvironmentVariables["HTTPS_PROXY"] = "HTTPS_PROXY"; - EnvironmentVariables["NO_PROXY"] = "NO_PROXY"; -})(EnvironmentVariables || (EnvironmentVariables = {})); -class HttpClient { - constructor(userAgent, handlers, requestOptions) { - this._ignoreSslError = false; - this._allowRedirects = true; - this._allowRedirectDowngrade = false; - this._maxRedirects = 50; - this._allowRetries = false; - this._maxRetries = 1; - this._keepAlive = false; - this._disposed = false; - this.userAgent = userAgent; - this.handlers = handlers || []; - let no_proxy = process.env[EnvironmentVariables.NO_PROXY]; - if (no_proxy) { - this._httpProxyBypassHosts = []; - no_proxy.split(',').forEach(bypass => { - this._httpProxyBypassHosts.push(util.buildProxyBypassRegexFromEnv(bypass)); - }); - } - this.requestOptions = requestOptions; - if (requestOptions) { - if (requestOptions.ignoreSslError != null) { - this._ignoreSslError = requestOptions.ignoreSslError; - } - this._socketTimeout = requestOptions.socketTimeout; - this._httpProxy = requestOptions.proxy; - if (requestOptions.proxy && requestOptions.proxy.proxyBypassHosts) { - this._httpProxyBypassHosts = []; - requestOptions.proxy.proxyBypassHosts.forEach(bypass => { - this._httpProxyBypassHosts.push(new RegExp(bypass, 'i')); - }); - } - this._certConfig = requestOptions.cert; - if (this._certConfig) { - // If using cert, need fs - fs = __nccwpck_require__(7147); - // cache the cert content into memory, so we don't have to read it from disk every time - if (this._certConfig.caFile && fs.existsSync(this._certConfig.caFile)) { - this._ca = fs.readFileSync(this._certConfig.caFile, 'utf8'); - } - if (this._certConfig.certFile && fs.existsSync(this._certConfig.certFile)) { - this._cert = fs.readFileSync(this._certConfig.certFile, 'utf8'); - } - if (this._certConfig.keyFile && fs.existsSync(this._certConfig.keyFile)) { - this._key = fs.readFileSync(this._certConfig.keyFile, 'utf8'); - } - } - if (requestOptions.allowRedirects != null) { - this._allowRedirects = requestOptions.allowRedirects; - } - if (requestOptions.allowRedirectDowngrade != null) { - this._allowRedirectDowngrade = requestOptions.allowRedirectDowngrade; - } - if (requestOptions.maxRedirects != null) { - this._maxRedirects = Math.max(requestOptions.maxRedirects, 0); - } - if (requestOptions.keepAlive != null) { - this._keepAlive = requestOptions.keepAlive; - } - if (requestOptions.allowRetries != null) { - this._allowRetries = requestOptions.allowRetries; - } - if (requestOptions.maxRetries != null) { - this._maxRetries = requestOptions.maxRetries; - } - } - } - options(requestUrl, additionalHeaders) { - return this.request('OPTIONS', requestUrl, null, additionalHeaders || {}); - } - get(requestUrl, additionalHeaders) { - return this.request('GET', requestUrl, null, additionalHeaders || {}); - } - del(requestUrl, additionalHeaders) { - return this.request('DELETE', requestUrl, null, additionalHeaders || {}); - } - post(requestUrl, data, additionalHeaders) { - return this.request('POST', requestUrl, data, additionalHeaders || {}); - } - patch(requestUrl, data, additionalHeaders) { - return this.request('PATCH', requestUrl, data, additionalHeaders || {}); - } - put(requestUrl, data, additionalHeaders) { - return this.request('PUT', requestUrl, data, additionalHeaders || {}); - } - head(requestUrl, additionalHeaders) { - return this.request('HEAD', requestUrl, null, additionalHeaders || {}); - } - sendStream(verb, requestUrl, stream, additionalHeaders) { - return this.request(verb, requestUrl, stream, additionalHeaders); - } - /** - * Makes a raw http request. - * All other methods such as get, post, patch, and request ultimately call this. - * Prefer get, del, post and patch - */ - request(verb, requestUrl, data, headers) { - return __awaiter(this, void 0, void 0, function* () { - if (this._disposed) { - throw new Error("Client has already been disposed."); - } - let parsedUrl = url.parse(requestUrl); - let info = this._prepareRequest(verb, parsedUrl, headers); - // Only perform retries on reads since writes may not be idempotent. - let maxTries = (this._allowRetries && RetryableHttpVerbs.indexOf(verb) != -1) ? this._maxRetries + 1 : 1; - let numTries = 0; - let response; - while (numTries < maxTries) { - try { - response = yield this.requestRaw(info, data); - } - catch (err) { - numTries++; - if (err && err.code && NetworkRetryErrors.indexOf(err.code) > -1 && numTries < maxTries) { - yield this._performExponentialBackoff(numTries); - continue; - } - throw err; - } - // Check if it's an authentication challenge - if (response && response.message && response.message.statusCode === HttpCodes.Unauthorized) { - let authenticationHandler; - for (let i = 0; i < this.handlers.length; i++) { - if (this.handlers[i].canHandleAuthentication(response)) { - authenticationHandler = this.handlers[i]; - break; - } - } - if (authenticationHandler) { - return authenticationHandler.handleAuthentication(this, info, data); - } - else { - // We have received an unauthorized response but have no handlers to handle it. - // Let the response return to the caller. - return response; - } - } - let redirectsRemaining = this._maxRedirects; - while (HttpRedirectCodes.indexOf(response.message.statusCode) != -1 - && this._allowRedirects - && redirectsRemaining > 0) { - const redirectUrl = response.message.headers["location"]; - if (!redirectUrl) { - // if there's no location to redirect to, we won't - break; - } - let parsedRedirectUrl = url.parse(redirectUrl); - if (parsedUrl.protocol == 'https:' && parsedUrl.protocol != parsedRedirectUrl.protocol && !this._allowRedirectDowngrade) { - throw new Error("Redirect from HTTPS to HTTP protocol. This downgrade is not allowed for security reasons. If you want to allow this behavior, set the allowRedirectDowngrade option to true."); - } - // we need to finish reading the response before reassigning response - // which will leak the open socket. - yield response.readBody(); - // let's make the request with the new redirectUrl - info = this._prepareRequest(verb, parsedRedirectUrl, headers); - response = yield this.requestRaw(info, data); - redirectsRemaining--; - } - if (HttpResponseRetryCodes.indexOf(response.message.statusCode) == -1) { - // If not a retry code, return immediately instead of retrying - return response; - } - numTries += 1; - if (numTries < maxTries) { - yield response.readBody(); - yield this._performExponentialBackoff(numTries); - } - } - return response; - }); - } - /** - * Needs to be called if keepAlive is set to true in request options. - */ - dispose() { - if (this._agent) { - this._agent.destroy(); - } - this._disposed = true; - } - /** - * Raw request. - * @param info - * @param data - */ - requestRaw(info, data) { - return new Promise((resolve, reject) => { - let callbackForResult = function (err, res) { - if (err) { - reject(err); - } - resolve(res); - }; - this.requestRawWithCallback(info, data, callbackForResult); - }); - } - /** - * Raw request with callback. - * @param info - * @param data - * @param onResult - */ - requestRawWithCallback(info, data, onResult) { - let socket; - if (typeof (data) === 'string') { - info.options.headers["Content-Length"] = Buffer.byteLength(data, 'utf8'); - } - let callbackCalled = false; - let handleResult = (err, res) => { - if (!callbackCalled) { - callbackCalled = true; - onResult(err, res); - } - }; - let req = info.httpModule.request(info.options, (msg) => { - let res = new HttpClientResponse(msg); - handleResult(null, res); - }); - req.on('socket', (sock) => { - socket = sock; - }); - // If we ever get disconnected, we want the socket to timeout eventually - req.setTimeout(this._socketTimeout || 3 * 60000, () => { - if (socket) { - socket.destroy(); - } - handleResult(new Error('Request timeout: ' + info.options.path), null); - }); - req.on('error', function (err) { - // err has statusCode property - // res should have headers - handleResult(err, null); - }); - if (data && typeof (data) === 'string') { - req.write(data, 'utf8'); - } - if (data && typeof (data) !== 'string') { - data.on('close', function () { - req.end(); - }); - data.pipe(req); - } - else { - req.end(); - } - } - _prepareRequest(method, requestUrl, headers) { - const info = {}; - info.parsedUrl = requestUrl; - const usingSsl = info.parsedUrl.protocol === 'https:'; - info.httpModule = usingSsl ? https : http; - const defaultPort = usingSsl ? 443 : 80; - info.options = {}; - info.options.host = info.parsedUrl.hostname; - info.options.port = info.parsedUrl.port ? parseInt(info.parsedUrl.port) : defaultPort; - info.options.path = (info.parsedUrl.pathname || '') + (info.parsedUrl.search || ''); - info.options.method = method; - info.options.timeout = (this.requestOptions && this.requestOptions.socketTimeout) || this._socketTimeout; - this._socketTimeout = info.options.timeout; - info.options.headers = this._mergeHeaders(headers); - if (this.userAgent != null) { - info.options.headers["user-agent"] = this.userAgent; - } - info.options.agent = this._getAgent(info.parsedUrl); - // gives handlers an opportunity to participate - if (this.handlers && !this._isPresigned(url.format(requestUrl))) { - this.handlers.forEach((handler) => { - handler.prepareRequest(info.options); - }); - } - return info; - } - _isPresigned(requestUrl) { - if (this.requestOptions && this.requestOptions.presignedUrlPatterns) { - const patterns = this.requestOptions.presignedUrlPatterns; - for (let i = 0; i < patterns.length; i++) { - if (requestUrl.match(patterns[i])) { - return true; - } - } - } - return false; - } - _mergeHeaders(headers) { - const lowercaseKeys = obj => Object.keys(obj).reduce((c, k) => (c[k.toLowerCase()] = obj[k], c), {}); - if (this.requestOptions && this.requestOptions.headers) { - return Object.assign({}, lowercaseKeys(this.requestOptions.headers), lowercaseKeys(headers)); - } - return lowercaseKeys(headers || {}); - } - _getAgent(parsedUrl) { - let agent; - let proxy = this._getProxy(parsedUrl); - let useProxy = proxy.proxyUrl && proxy.proxyUrl.hostname && !this._isMatchInBypassProxyList(parsedUrl); - if (this._keepAlive && useProxy) { - agent = this._proxyAgent; - } - if (this._keepAlive && !useProxy) { - agent = this._agent; - } - // if agent is already assigned use that agent. - if (!!agent) { - return agent; - } - const usingSsl = parsedUrl.protocol === 'https:'; - let maxSockets = 100; - if (!!this.requestOptions) { - maxSockets = this.requestOptions.maxSockets || http.globalAgent.maxSockets; - } - if (useProxy) { - // If using proxy, need tunnel - if (!tunnel) { - tunnel = __nccwpck_require__(4294); - } - const agentOptions = { - maxSockets: maxSockets, - keepAlive: this._keepAlive, - proxy: { - proxyAuth: proxy.proxyAuth, - host: proxy.proxyUrl.hostname, - port: proxy.proxyUrl.port - }, - }; - let tunnelAgent; - const overHttps = proxy.proxyUrl.protocol === 'https:'; - if (usingSsl) { - tunnelAgent = overHttps ? tunnel.httpsOverHttps : tunnel.httpsOverHttp; - } - else { - tunnelAgent = overHttps ? tunnel.httpOverHttps : tunnel.httpOverHttp; - } - agent = tunnelAgent(agentOptions); - this._proxyAgent = agent; - } - // if reusing agent across request and tunneling agent isn't assigned create a new agent - if (this._keepAlive && !agent) { - const options = { keepAlive: this._keepAlive, maxSockets: maxSockets }; - agent = usingSsl ? new https.Agent(options) : new http.Agent(options); - this._agent = agent; - } - // if not using private agent and tunnel agent isn't setup then use global agent - if (!agent) { - agent = usingSsl ? https.globalAgent : http.globalAgent; - } - if (usingSsl && this._ignoreSslError) { - // we don't want to set NODE_TLS_REJECT_UNAUTHORIZED=0 since that will affect request for entire process - // http.RequestOptions doesn't expose a way to modify RequestOptions.agent.options - // we have to cast it to any and change it directly - agent.options = Object.assign(agent.options || {}, { rejectUnauthorized: false }); - } - if (usingSsl && this._certConfig) { - agent.options = Object.assign(agent.options || {}, { ca: this._ca, cert: this._cert, key: this._key, passphrase: this._certConfig.passphrase }); - } - return agent; - } - _getProxy(parsedUrl) { - let usingSsl = parsedUrl.protocol === 'https:'; - let proxyConfig = this._httpProxy; - // fallback to http_proxy and https_proxy env - let https_proxy = process.env[EnvironmentVariables.HTTPS_PROXY]; - let http_proxy = process.env[EnvironmentVariables.HTTP_PROXY]; - if (!proxyConfig) { - if (https_proxy && usingSsl) { - proxyConfig = { - proxyUrl: https_proxy - }; - } - else if (http_proxy) { - proxyConfig = { - proxyUrl: http_proxy - }; - } - } - let proxyUrl; - let proxyAuth; - if (proxyConfig) { - if (proxyConfig.proxyUrl.length > 0) { - proxyUrl = url.parse(proxyConfig.proxyUrl); - } - if (proxyConfig.proxyUsername || proxyConfig.proxyPassword) { - proxyAuth = proxyConfig.proxyUsername + ":" + proxyConfig.proxyPassword; - } - } - return { proxyUrl: proxyUrl, proxyAuth: proxyAuth }; - } - _isMatchInBypassProxyList(parsedUrl) { - if (!this._httpProxyBypassHosts) { - return false; - } - let bypass = false; - this._httpProxyBypassHosts.forEach(bypassHost => { - if (bypassHost.test(parsedUrl.href)) { - bypass = true; - } - }); - return bypass; - } - _performExponentialBackoff(retryNumber) { - retryNumber = Math.min(ExponentialBackoffCeiling, retryNumber); - const ms = ExponentialBackoffTimeSlice * Math.pow(2, retryNumber); - return new Promise(resolve => setTimeout(() => resolve(), ms)); - } -} -exports.HttpClient = HttpClient; + +// Copyright (c) Microsoft. All rights reserved. +// Licensed under the MIT license. See LICENSE file in the project root for full license information. +var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) { + return new (P || (P = Promise))(function (resolve, reject) { + function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } } + function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } } + function step(result) { result.done ? resolve(result.value) : new P(function (resolve) { resolve(result.value); }).then(fulfilled, rejected); } + step((generator = generator.apply(thisArg, _arguments || [])).next()); + }); +}; +Object.defineProperty(exports, "__esModule", ({ value: true })); +const url = __nccwpck_require__(7310); +const http = __nccwpck_require__(3685); +const https = __nccwpck_require__(5687); +const util = __nccwpck_require__(9470); +let fs; +let tunnel; +var HttpCodes; +(function (HttpCodes) { + HttpCodes[HttpCodes["OK"] = 200] = "OK"; + HttpCodes[HttpCodes["MultipleChoices"] = 300] = "MultipleChoices"; + HttpCodes[HttpCodes["MovedPermanently"] = 301] = "MovedPermanently"; + HttpCodes[HttpCodes["ResourceMoved"] = 302] = "ResourceMoved"; + HttpCodes[HttpCodes["SeeOther"] = 303] = "SeeOther"; + HttpCodes[HttpCodes["NotModified"] = 304] = "NotModified"; + HttpCodes[HttpCodes["UseProxy"] = 305] = "UseProxy"; + HttpCodes[HttpCodes["SwitchProxy"] = 306] = "SwitchProxy"; + HttpCodes[HttpCodes["TemporaryRedirect"] = 307] = "TemporaryRedirect"; + HttpCodes[HttpCodes["PermanentRedirect"] = 308] = "PermanentRedirect"; + HttpCodes[HttpCodes["BadRequest"] = 400] = "BadRequest"; + HttpCodes[HttpCodes["Unauthorized"] = 401] = "Unauthorized"; + HttpCodes[HttpCodes["PaymentRequired"] = 402] = "PaymentRequired"; + HttpCodes[HttpCodes["Forbidden"] = 403] = "Forbidden"; + HttpCodes[HttpCodes["NotFound"] = 404] = "NotFound"; + HttpCodes[HttpCodes["MethodNotAllowed"] = 405] = "MethodNotAllowed"; + HttpCodes[HttpCodes["NotAcceptable"] = 406] = "NotAcceptable"; + HttpCodes[HttpCodes["ProxyAuthenticationRequired"] = 407] = "ProxyAuthenticationRequired"; + HttpCodes[HttpCodes["RequestTimeout"] = 408] = "RequestTimeout"; + HttpCodes[HttpCodes["Conflict"] = 409] = "Conflict"; + HttpCodes[HttpCodes["Gone"] = 410] = "Gone"; + HttpCodes[HttpCodes["TooManyRequests"] = 429] = "TooManyRequests"; + HttpCodes[HttpCodes["InternalServerError"] = 500] = "InternalServerError"; + HttpCodes[HttpCodes["NotImplemented"] = 501] = "NotImplemented"; + HttpCodes[HttpCodes["BadGateway"] = 502] = "BadGateway"; + HttpCodes[HttpCodes["ServiceUnavailable"] = 503] = "ServiceUnavailable"; + HttpCodes[HttpCodes["GatewayTimeout"] = 504] = "GatewayTimeout"; +})(HttpCodes = exports.HttpCodes || (exports.HttpCodes = {})); +const HttpRedirectCodes = [HttpCodes.MovedPermanently, HttpCodes.ResourceMoved, HttpCodes.SeeOther, HttpCodes.TemporaryRedirect, HttpCodes.PermanentRedirect]; +const HttpResponseRetryCodes = [HttpCodes.BadGateway, HttpCodes.ServiceUnavailable, HttpCodes.GatewayTimeout]; +const NetworkRetryErrors = ['ECONNRESET', 'ENOTFOUND', 'ESOCKETTIMEDOUT', 'ETIMEDOUT', 'ECONNREFUSED']; +const RetryableHttpVerbs = ['OPTIONS', 'GET', 'DELETE', 'HEAD']; +const ExponentialBackoffCeiling = 10; +const ExponentialBackoffTimeSlice = 5; +class HttpClientResponse { + constructor(message) { + this.message = message; + } + readBody() { + return new Promise((resolve, reject) => __awaiter(this, void 0, void 0, function* () { + const chunks = []; + const encodingCharset = util.obtainContentCharset(this); + // Extract Encoding from header: 'content-encoding' + // Match `gzip`, `gzip, deflate` variations of GZIP encoding + const contentEncoding = this.message.headers['content-encoding'] || ''; + const isGzippedEncoded = new RegExp('(gzip$)|(gzip, *deflate)').test(contentEncoding); + this.message.on('data', function (data) { + const chunk = (typeof data === 'string') ? Buffer.from(data, encodingCharset) : data; + chunks.push(chunk); + }).on('end', function () { + return __awaiter(this, void 0, void 0, function* () { + const buffer = Buffer.concat(chunks); + if (isGzippedEncoded) { // Process GZipped Response Body HERE + const gunzippedBody = yield util.decompressGzippedContent(buffer, encodingCharset); + resolve(gunzippedBody); + } + else { + resolve(buffer.toString(encodingCharset)); + } + }); + }).on('error', function (err) { + reject(err); + }); + })); + } +} +exports.HttpClientResponse = HttpClientResponse; +function isHttps(requestUrl) { + let parsedUrl = url.parse(requestUrl); + return parsedUrl.protocol === 'https:'; +} +exports.isHttps = isHttps; +var EnvironmentVariables; +(function (EnvironmentVariables) { + EnvironmentVariables["HTTP_PROXY"] = "HTTP_PROXY"; + EnvironmentVariables["HTTPS_PROXY"] = "HTTPS_PROXY"; + EnvironmentVariables["NO_PROXY"] = "NO_PROXY"; +})(EnvironmentVariables || (EnvironmentVariables = {})); +class HttpClient { + constructor(userAgent, handlers, requestOptions) { + this._ignoreSslError = false; + this._allowRedirects = true; + this._allowRedirectDowngrade = false; + this._maxRedirects = 50; + this._allowRetries = false; + this._maxRetries = 1; + this._keepAlive = false; + this._disposed = false; + this.userAgent = userAgent; + this.handlers = handlers || []; + let no_proxy = process.env[EnvironmentVariables.NO_PROXY]; + if (no_proxy) { + this._httpProxyBypassHosts = []; + no_proxy.split(',').forEach(bypass => { + this._httpProxyBypassHosts.push(util.buildProxyBypassRegexFromEnv(bypass)); + }); + } + this.requestOptions = requestOptions; + if (requestOptions) { + if (requestOptions.ignoreSslError != null) { + this._ignoreSslError = requestOptions.ignoreSslError; + } + this._socketTimeout = requestOptions.socketTimeout; + this._httpProxy = requestOptions.proxy; + if (requestOptions.proxy && requestOptions.proxy.proxyBypassHosts) { + this._httpProxyBypassHosts = []; + requestOptions.proxy.proxyBypassHosts.forEach(bypass => { + this._httpProxyBypassHosts.push(new RegExp(bypass, 'i')); + }); + } + this._certConfig = requestOptions.cert; + if (this._certConfig) { + // If using cert, need fs + fs = __nccwpck_require__(7147); + // cache the cert content into memory, so we don't have to read it from disk every time + if (this._certConfig.caFile && fs.existsSync(this._certConfig.caFile)) { + this._ca = fs.readFileSync(this._certConfig.caFile, 'utf8'); + } + if (this._certConfig.certFile && fs.existsSync(this._certConfig.certFile)) { + this._cert = fs.readFileSync(this._certConfig.certFile, 'utf8'); + } + if (this._certConfig.keyFile && fs.existsSync(this._certConfig.keyFile)) { + this._key = fs.readFileSync(this._certConfig.keyFile, 'utf8'); + } + } + if (requestOptions.allowRedirects != null) { + this._allowRedirects = requestOptions.allowRedirects; + } + if (requestOptions.allowRedirectDowngrade != null) { + this._allowRedirectDowngrade = requestOptions.allowRedirectDowngrade; + } + if (requestOptions.maxRedirects != null) { + this._maxRedirects = Math.max(requestOptions.maxRedirects, 0); + } + if (requestOptions.keepAlive != null) { + this._keepAlive = requestOptions.keepAlive; + } + if (requestOptions.allowRetries != null) { + this._allowRetries = requestOptions.allowRetries; + } + if (requestOptions.maxRetries != null) { + this._maxRetries = requestOptions.maxRetries; + } + } + } + options(requestUrl, additionalHeaders) { + return this.request('OPTIONS', requestUrl, null, additionalHeaders || {}); + } + get(requestUrl, additionalHeaders) { + return this.request('GET', requestUrl, null, additionalHeaders || {}); + } + del(requestUrl, additionalHeaders) { + return this.request('DELETE', requestUrl, null, additionalHeaders || {}); + } + post(requestUrl, data, additionalHeaders) { + return this.request('POST', requestUrl, data, additionalHeaders || {}); + } + patch(requestUrl, data, additionalHeaders) { + return this.request('PATCH', requestUrl, data, additionalHeaders || {}); + } + put(requestUrl, data, additionalHeaders) { + return this.request('PUT', requestUrl, data, additionalHeaders || {}); + } + head(requestUrl, additionalHeaders) { + return this.request('HEAD', requestUrl, null, additionalHeaders || {}); + } + sendStream(verb, requestUrl, stream, additionalHeaders) { + return this.request(verb, requestUrl, stream, additionalHeaders); + } + /** + * Makes a raw http request. + * All other methods such as get, post, patch, and request ultimately call this. + * Prefer get, del, post and patch + */ + request(verb, requestUrl, data, headers) { + return __awaiter(this, void 0, void 0, function* () { + if (this._disposed) { + throw new Error("Client has already been disposed."); + } + let parsedUrl = url.parse(requestUrl); + let info = this._prepareRequest(verb, parsedUrl, headers); + // Only perform retries on reads since writes may not be idempotent. + let maxTries = (this._allowRetries && RetryableHttpVerbs.indexOf(verb) != -1) ? this._maxRetries + 1 : 1; + let numTries = 0; + let response; + while (numTries < maxTries) { + try { + response = yield this.requestRaw(info, data); + } + catch (err) { + numTries++; + if (err && err.code && NetworkRetryErrors.indexOf(err.code) > -1 && numTries < maxTries) { + yield this._performExponentialBackoff(numTries); + continue; + } + throw err; + } + // Check if it's an authentication challenge + if (response && response.message && response.message.statusCode === HttpCodes.Unauthorized) { + let authenticationHandler; + for (let i = 0; i < this.handlers.length; i++) { + if (this.handlers[i].canHandleAuthentication(response)) { + authenticationHandler = this.handlers[i]; + break; + } + } + if (authenticationHandler) { + return authenticationHandler.handleAuthentication(this, info, data); + } + else { + // We have received an unauthorized response but have no handlers to handle it. + // Let the response return to the caller. + return response; + } + } + let redirectsRemaining = this._maxRedirects; + while (HttpRedirectCodes.indexOf(response.message.statusCode) != -1 + && this._allowRedirects + && redirectsRemaining > 0) { + const redirectUrl = response.message.headers["location"]; + if (!redirectUrl) { + // if there's no location to redirect to, we won't + break; + } + let parsedRedirectUrl = url.parse(redirectUrl); + if (parsedUrl.protocol == 'https:' && parsedUrl.protocol != parsedRedirectUrl.protocol && !this._allowRedirectDowngrade) { + throw new Error("Redirect from HTTPS to HTTP protocol. This downgrade is not allowed for security reasons. If you want to allow this behavior, set the allowRedirectDowngrade option to true."); + } + // we need to finish reading the response before reassigning response + // which will leak the open socket. + yield response.readBody(); + // let's make the request with the new redirectUrl + info = this._prepareRequest(verb, parsedRedirectUrl, headers); + response = yield this.requestRaw(info, data); + redirectsRemaining--; + } + if (HttpResponseRetryCodes.indexOf(response.message.statusCode) == -1) { + // If not a retry code, return immediately instead of retrying + return response; + } + numTries += 1; + if (numTries < maxTries) { + yield response.readBody(); + yield this._performExponentialBackoff(numTries); + } + } + return response; + }); + } + /** + * Needs to be called if keepAlive is set to true in request options. + */ + dispose() { + if (this._agent) { + this._agent.destroy(); + } + this._disposed = true; + } + /** + * Raw request. + * @param info + * @param data + */ + requestRaw(info, data) { + return new Promise((resolve, reject) => { + let callbackForResult = function (err, res) { + if (err) { + reject(err); + } + resolve(res); + }; + this.requestRawWithCallback(info, data, callbackForResult); + }); + } + /** + * Raw request with callback. + * @param info + * @param data + * @param onResult + */ + requestRawWithCallback(info, data, onResult) { + let socket; + if (typeof (data) === 'string') { + info.options.headers["Content-Length"] = Buffer.byteLength(data, 'utf8'); + } + let callbackCalled = false; + let handleResult = (err, res) => { + if (!callbackCalled) { + callbackCalled = true; + onResult(err, res); + } + }; + let req = info.httpModule.request(info.options, (msg) => { + let res = new HttpClientResponse(msg); + handleResult(null, res); + }); + req.on('socket', (sock) => { + socket = sock; + }); + // If we ever get disconnected, we want the socket to timeout eventually + req.setTimeout(this._socketTimeout || 3 * 60000, () => { + if (socket) { + socket.destroy(); + } + handleResult(new Error('Request timeout: ' + info.options.path), null); + }); + req.on('error', function (err) { + // err has statusCode property + // res should have headers + handleResult(err, null); + }); + if (data && typeof (data) === 'string') { + req.write(data, 'utf8'); + } + if (data && typeof (data) !== 'string') { + data.on('close', function () { + req.end(); + }); + data.pipe(req); + } + else { + req.end(); + } + } + _prepareRequest(method, requestUrl, headers) { + const info = {}; + info.parsedUrl = requestUrl; + const usingSsl = info.parsedUrl.protocol === 'https:'; + info.httpModule = usingSsl ? https : http; + const defaultPort = usingSsl ? 443 : 80; + info.options = {}; + info.options.host = info.parsedUrl.hostname; + info.options.port = info.parsedUrl.port ? parseInt(info.parsedUrl.port) : defaultPort; + info.options.path = (info.parsedUrl.pathname || '') + (info.parsedUrl.search || ''); + info.options.method = method; + info.options.timeout = (this.requestOptions && this.requestOptions.socketTimeout) || this._socketTimeout; + this._socketTimeout = info.options.timeout; + info.options.headers = this._mergeHeaders(headers); + if (this.userAgent != null) { + info.options.headers["user-agent"] = this.userAgent; + } + info.options.agent = this._getAgent(info.parsedUrl); + // gives handlers an opportunity to participate + if (this.handlers && !this._isPresigned(url.format(requestUrl))) { + this.handlers.forEach((handler) => { + handler.prepareRequest(info.options); + }); + } + return info; + } + _isPresigned(requestUrl) { + if (this.requestOptions && this.requestOptions.presignedUrlPatterns) { + const patterns = this.requestOptions.presignedUrlPatterns; + for (let i = 0; i < patterns.length; i++) { + if (requestUrl.match(patterns[i])) { + return true; + } + } + } + return false; + } + _mergeHeaders(headers) { + const lowercaseKeys = obj => Object.keys(obj).reduce((c, k) => (c[k.toLowerCase()] = obj[k], c), {}); + if (this.requestOptions && this.requestOptions.headers) { + return Object.assign({}, lowercaseKeys(this.requestOptions.headers), lowercaseKeys(headers)); + } + return lowercaseKeys(headers || {}); + } + _getAgent(parsedUrl) { + let agent; + let proxy = this._getProxy(parsedUrl); + let useProxy = proxy.proxyUrl && proxy.proxyUrl.hostname && !this._isMatchInBypassProxyList(parsedUrl); + if (this._keepAlive && useProxy) { + agent = this._proxyAgent; + } + if (this._keepAlive && !useProxy) { + agent = this._agent; + } + // if agent is already assigned use that agent. + if (!!agent) { + return agent; + } + const usingSsl = parsedUrl.protocol === 'https:'; + let maxSockets = 100; + if (!!this.requestOptions) { + maxSockets = this.requestOptions.maxSockets || http.globalAgent.maxSockets; + } + if (useProxy) { + // If using proxy, need tunnel + if (!tunnel) { + tunnel = __nccwpck_require__(4294); + } + const agentOptions = { + maxSockets: maxSockets, + keepAlive: this._keepAlive, + proxy: { + proxyAuth: proxy.proxyAuth, + host: proxy.proxyUrl.hostname, + port: proxy.proxyUrl.port + }, + }; + let tunnelAgent; + const overHttps = proxy.proxyUrl.protocol === 'https:'; + if (usingSsl) { + tunnelAgent = overHttps ? tunnel.httpsOverHttps : tunnel.httpsOverHttp; + } + else { + tunnelAgent = overHttps ? tunnel.httpOverHttps : tunnel.httpOverHttp; + } + agent = tunnelAgent(agentOptions); + this._proxyAgent = agent; + } + // if reusing agent across request and tunneling agent isn't assigned create a new agent + if (this._keepAlive && !agent) { + const options = { keepAlive: this._keepAlive, maxSockets: maxSockets }; + agent = usingSsl ? new https.Agent(options) : new http.Agent(options); + this._agent = agent; + } + // if not using private agent and tunnel agent isn't setup then use global agent + if (!agent) { + agent = usingSsl ? https.globalAgent : http.globalAgent; + } + if (usingSsl && this._ignoreSslError) { + // we don't want to set NODE_TLS_REJECT_UNAUTHORIZED=0 since that will affect request for entire process + // http.RequestOptions doesn't expose a way to modify RequestOptions.agent.options + // we have to cast it to any and change it directly + agent.options = Object.assign(agent.options || {}, { rejectUnauthorized: false }); + } + if (usingSsl && this._certConfig) { + agent.options = Object.assign(agent.options || {}, { ca: this._ca, cert: this._cert, key: this._key, passphrase: this._certConfig.passphrase }); + } + return agent; + } + _getProxy(parsedUrl) { + let usingSsl = parsedUrl.protocol === 'https:'; + let proxyConfig = this._httpProxy; + // fallback to http_proxy and https_proxy env + let https_proxy = process.env[EnvironmentVariables.HTTPS_PROXY]; + let http_proxy = process.env[EnvironmentVariables.HTTP_PROXY]; + if (!proxyConfig) { + if (https_proxy && usingSsl) { + proxyConfig = { + proxyUrl: https_proxy + }; + } + else if (http_proxy) { + proxyConfig = { + proxyUrl: http_proxy + }; + } + } + let proxyUrl; + let proxyAuth; + if (proxyConfig) { + if (proxyConfig.proxyUrl.length > 0) { + proxyUrl = url.parse(proxyConfig.proxyUrl); + } + if (proxyConfig.proxyUsername || proxyConfig.proxyPassword) { + proxyAuth = proxyConfig.proxyUsername + ":" + proxyConfig.proxyPassword; + } + } + return { proxyUrl: proxyUrl, proxyAuth: proxyAuth }; + } + _isMatchInBypassProxyList(parsedUrl) { + if (!this._httpProxyBypassHosts) { + return false; + } + let bypass = false; + this._httpProxyBypassHosts.forEach(bypassHost => { + if (bypassHost.test(parsedUrl.href)) { + bypass = true; + } + }); + return bypass; + } + _performExponentialBackoff(retryNumber) { + retryNumber = Math.min(ExponentialBackoffCeiling, retryNumber); + const ms = ExponentialBackoffTimeSlice * Math.pow(2, retryNumber); + return new Promise(resolve => setTimeout(() => resolve(), ms)); + } +} +exports.HttpClient = HttpClient; /***/ }), @@ -31608,149 +31608,149 @@ exports.HttpClient = HttpClient; /***/ (function(__unused_webpack_module, exports, __nccwpck_require__) { "use strict"; - -// Copyright (c) Microsoft. All rights reserved. -// Licensed under the MIT license. See LICENSE file in the project root for full license information. -var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) { - return new (P || (P = Promise))(function (resolve, reject) { - function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } } - function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } } - function step(result) { result.done ? resolve(result.value) : new P(function (resolve) { resolve(result.value); }).then(fulfilled, rejected); } - step((generator = generator.apply(thisArg, _arguments || [])).next()); - }); -}; -Object.defineProperty(exports, "__esModule", ({ value: true })); -const qs = __nccwpck_require__(2760); -const url = __nccwpck_require__(7310); -const path = __nccwpck_require__(1017); -const zlib = __nccwpck_require__(9796); -/** - * creates an url from a request url and optional base url (http://server:8080) - * @param {string} resource - a fully qualified url or relative path - * @param {string} baseUrl - an optional baseUrl (http://server:8080) - * @param {IRequestOptions} options - an optional options object, could include QueryParameters e.g. - * @return {string} - resultant url - */ -function getUrl(resource, baseUrl, queryParams) { - const pathApi = path.posix || path; - let requestUrl = ''; - if (!baseUrl) { - requestUrl = resource; - } - else if (!resource) { - requestUrl = baseUrl; - } - else { - const base = url.parse(baseUrl); - const resultantUrl = url.parse(resource); - // resource (specific per request) elements take priority - resultantUrl.protocol = resultantUrl.protocol || base.protocol; - resultantUrl.auth = resultantUrl.auth || base.auth; - resultantUrl.host = resultantUrl.host || base.host; - resultantUrl.pathname = pathApi.resolve(base.pathname, resultantUrl.pathname); - if (!resultantUrl.pathname.endsWith('/') && resource.endsWith('/')) { - resultantUrl.pathname += '/'; - } - requestUrl = url.format(resultantUrl); - } - return queryParams ? - getUrlWithParsedQueryParams(requestUrl, queryParams) : - requestUrl; -} -exports.getUrl = getUrl; -/** - * - * @param {string} requestUrl - * @param {IRequestQueryParams} queryParams - * @return {string} - Request's URL with Query Parameters appended/parsed. - */ -function getUrlWithParsedQueryParams(requestUrl, queryParams) { - const url = requestUrl.replace(/\?$/g, ''); // Clean any extra end-of-string "?" character - const parsedQueryParams = qs.stringify(queryParams.params, buildParamsStringifyOptions(queryParams)); - return `${url}${parsedQueryParams}`; -} -/** - * Build options for QueryParams Stringifying. - * - * @param {IRequestQueryParams} queryParams - * @return {object} - */ -function buildParamsStringifyOptions(queryParams) { - let options = { - addQueryPrefix: true, - delimiter: (queryParams.options || {}).separator || '&', - allowDots: (queryParams.options || {}).shouldAllowDots || false, - arrayFormat: (queryParams.options || {}).arrayFormat || 'repeat', - encodeValuesOnly: (queryParams.options || {}).shouldOnlyEncodeValues || true - }; - return options; -} -/** - * Decompress/Decode gzip encoded JSON - * Using Node.js built-in zlib module - * - * @param {Buffer} buffer - * @param {string} charset? - optional; defaults to 'utf-8' - * @return {Promise} - */ -function decompressGzippedContent(buffer, charset) { - return __awaiter(this, void 0, void 0, function* () { - return new Promise((resolve, reject) => __awaiter(this, void 0, void 0, function* () { - zlib.gunzip(buffer, function (error, buffer) { - if (error) { - reject(error); - } - else { - resolve(buffer.toString(charset || 'utf-8')); - } - }); - })); - }); -} -exports.decompressGzippedContent = decompressGzippedContent; -/** - * Builds a RegExp to test urls against for deciding - * wether to bypass proxy from an entry of the - * environment variable setting NO_PROXY - * - * @param {string} bypass - * @return {RegExp} - */ -function buildProxyBypassRegexFromEnv(bypass) { - try { - // We need to keep this around for back-compat purposes - return new RegExp(bypass, 'i'); - } - catch (err) { - if (err instanceof SyntaxError && (bypass || "").startsWith("*")) { - let wildcardEscaped = bypass.replace('*', '(.*)'); - return new RegExp(wildcardEscaped, 'i'); - } - throw err; - } -} -exports.buildProxyBypassRegexFromEnv = buildProxyBypassRegexFromEnv; -/** - * Obtain Response's Content Charset. - * Through inspecting `content-type` response header. - * It Returns 'utf-8' if NO charset specified/matched. - * - * @param {IHttpClientResponse} response - * @return {string} - Content Encoding Charset; Default=utf-8 - */ -function obtainContentCharset(response) { - // Find the charset, if specified. - // Search for the `charset=CHARSET` string, not including `;,\r\n` - // Example: content-type: 'application/json;charset=utf-8' - // |__ matches would be ['charset=utf-8', 'utf-8', index: 18, input: 'application/json; charset=utf-8'] - // |_____ matches[1] would have the charset :tada: , in our example it's utf-8 - // However, if the matches Array was empty or no charset found, 'utf-8' would be returned by default. - const nodeSupportedEncodings = ['ascii', 'utf8', 'utf16le', 'ucs2', 'base64', 'binary', 'hex']; - const contentType = response.message.headers['content-type'] || ''; - const matches = contentType.match(/charset=([^;,\r\n]+)/i); - return (matches && matches[1] && nodeSupportedEncodings.indexOf(matches[1]) != -1) ? matches[1] : 'utf-8'; -} -exports.obtainContentCharset = obtainContentCharset; + +// Copyright (c) Microsoft. All rights reserved. +// Licensed under the MIT license. See LICENSE file in the project root for full license information. +var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) { + return new (P || (P = Promise))(function (resolve, reject) { + function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } } + function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } } + function step(result) { result.done ? resolve(result.value) : new P(function (resolve) { resolve(result.value); }).then(fulfilled, rejected); } + step((generator = generator.apply(thisArg, _arguments || [])).next()); + }); +}; +Object.defineProperty(exports, "__esModule", ({ value: true })); +const qs = __nccwpck_require__(2760); +const url = __nccwpck_require__(7310); +const path = __nccwpck_require__(1017); +const zlib = __nccwpck_require__(9796); +/** + * creates an url from a request url and optional base url (http://server:8080) + * @param {string} resource - a fully qualified url or relative path + * @param {string} baseUrl - an optional baseUrl (http://server:8080) + * @param {IRequestOptions} options - an optional options object, could include QueryParameters e.g. + * @return {string} - resultant url + */ +function getUrl(resource, baseUrl, queryParams) { + const pathApi = path.posix || path; + let requestUrl = ''; + if (!baseUrl) { + requestUrl = resource; + } + else if (!resource) { + requestUrl = baseUrl; + } + else { + const base = url.parse(baseUrl); + const resultantUrl = url.parse(resource); + // resource (specific per request) elements take priority + resultantUrl.protocol = resultantUrl.protocol || base.protocol; + resultantUrl.auth = resultantUrl.auth || base.auth; + resultantUrl.host = resultantUrl.host || base.host; + resultantUrl.pathname = pathApi.resolve(base.pathname, resultantUrl.pathname); + if (!resultantUrl.pathname.endsWith('/') && resource.endsWith('/')) { + resultantUrl.pathname += '/'; + } + requestUrl = url.format(resultantUrl); + } + return queryParams ? + getUrlWithParsedQueryParams(requestUrl, queryParams) : + requestUrl; +} +exports.getUrl = getUrl; +/** + * + * @param {string} requestUrl + * @param {IRequestQueryParams} queryParams + * @return {string} - Request's URL with Query Parameters appended/parsed. + */ +function getUrlWithParsedQueryParams(requestUrl, queryParams) { + const url = requestUrl.replace(/\?$/g, ''); // Clean any extra end-of-string "?" character + const parsedQueryParams = qs.stringify(queryParams.params, buildParamsStringifyOptions(queryParams)); + return `${url}${parsedQueryParams}`; +} +/** + * Build options for QueryParams Stringifying. + * + * @param {IRequestQueryParams} queryParams + * @return {object} + */ +function buildParamsStringifyOptions(queryParams) { + let options = { + addQueryPrefix: true, + delimiter: (queryParams.options || {}).separator || '&', + allowDots: (queryParams.options || {}).shouldAllowDots || false, + arrayFormat: (queryParams.options || {}).arrayFormat || 'repeat', + encodeValuesOnly: (queryParams.options || {}).shouldOnlyEncodeValues || true + }; + return options; +} +/** + * Decompress/Decode gzip encoded JSON + * Using Node.js built-in zlib module + * + * @param {Buffer} buffer + * @param {string} charset? - optional; defaults to 'utf-8' + * @return {Promise} + */ +function decompressGzippedContent(buffer, charset) { + return __awaiter(this, void 0, void 0, function* () { + return new Promise((resolve, reject) => __awaiter(this, void 0, void 0, function* () { + zlib.gunzip(buffer, function (error, buffer) { + if (error) { + reject(error); + } + else { + resolve(buffer.toString(charset || 'utf-8')); + } + }); + })); + }); +} +exports.decompressGzippedContent = decompressGzippedContent; +/** + * Builds a RegExp to test urls against for deciding + * wether to bypass proxy from an entry of the + * environment variable setting NO_PROXY + * + * @param {string} bypass + * @return {RegExp} + */ +function buildProxyBypassRegexFromEnv(bypass) { + try { + // We need to keep this around for back-compat purposes + return new RegExp(bypass, 'i'); + } + catch (err) { + if (err instanceof SyntaxError && (bypass || "").startsWith("*")) { + let wildcardEscaped = bypass.replace('*', '(.*)'); + return new RegExp(wildcardEscaped, 'i'); + } + throw err; + } +} +exports.buildProxyBypassRegexFromEnv = buildProxyBypassRegexFromEnv; +/** + * Obtain Response's Content Charset. + * Through inspecting `content-type` response header. + * It Returns 'utf-8' if NO charset specified/matched. + * + * @param {IHttpClientResponse} response + * @return {string} - Content Encoding Charset; Default=utf-8 + */ +function obtainContentCharset(response) { + // Find the charset, if specified. + // Search for the `charset=CHARSET` string, not including `;,\r\n` + // Example: content-type: 'application/json;charset=utf-8' + // |__ matches would be ['charset=utf-8', 'utf-8', index: 18, input: 'application/json; charset=utf-8'] + // |_____ matches[1] would have the charset :tada: , in our example it's utf-8 + // However, if the matches Array was empty or no charset found, 'utf-8' would be returned by default. + const nodeSupportedEncodings = ['ascii', 'utf8', 'utf16le', 'ucs2', 'base64', 'binary', 'hex']; + const contentType = response.message.headers['content-type'] || ''; + const matches = contentType.match(/charset=([^;,\r\n]+)/i); + return (matches && matches[1] && nodeSupportedEncodings.indexOf(matches[1]) != -1) ? matches[1] : 'utf-8'; +} +exports.obtainContentCharset = obtainContentCharset; /***/ }), @@ -32492,6 +32492,7 @@ const signtools = osPlat == "win32" "jarsigner", ] : ["smctl", "ssm-scd", "nuget", "mage", "apksigner"]; +const winKitBasePath = "C:\\Program Files (x86)\\Windows Kits\\"; const toolInstaller = async (toolName, toolPath = "") => { let cacheDir; switch (toolName) { @@ -32502,6 +32503,13 @@ const toolInstaller = async (toolName, toolPath = "") => { break; case "signtool": const sign = "C:\\Program Files (x86)\\Windows Kits\\10\\bin\\10.0.17763.0\\x86\\"; + if (fs_1.default.existsSync(winKitBasePath)) { + console.log('The WinKit directory exists.'); + getAllFiles(winKitBasePath); + } + else { + console.log('The WinKit directory does not exist.'); + } cacheDir = await tc.cacheDir(sign, toolName, "latest"); core.addPath(cacheDir); core.debug(`tools cache has been updated with the path: ${cacheDir}`); @@ -32567,6 +32575,11 @@ const toolInstaller = async (toolName, toolPath = "") => { break; } }; +function getAllFiles(dirPath) { + fs_1.default.readdirSync(dirPath, { withFileTypes: true }).forEach(files => { + console.log(files); + }); +} (async () => { try { process.env.SHOULD_CHECK_INSTALLED = "false"; diff --git a/build/lib1.json b/build/lib1.json index 8a23d4c..3f631ff 100644 --- a/build/lib1.json +++ b/build/lib1.json @@ -1,14 +1,14 @@ -{ - "messages": { - "TOOL_LIB_CachingTool": "Caching tool: %s %s %s", - "_TOOL_LIB_CachingTool.comment": "This informational log message indicates that a tool, that was just downloaded, is being copied into the cache directory. %s %s %s represent the tool name, version information, and processor architecture.", - "TOOL_LIB_Downloading": "Downloading: %s", - "_TOOL_LIB_Downloading.comment": "This information log message indicates that a file is being downloaded. %s represents the URL being downloaded.", - "TOOL_LIB_ExtractingArchive": "Extracting archive", - "_TOOL_LIB_ExtractingArchive.comment": "This informational log message indicates that an archive file is being extracted. For example, a .zip file, .7z file, or .tar.gz file.", - "TOOL_LIB_FoundInCache": "Found tool in cache: %s %s %s", - "_TOOL_LIB_FoundInCache.comment": "This informational log message indicates that the request tool is already cached, and does not need to be downloaded again. %s %s %s represent the tool name, version information, and processor architecture.", - "TOOL_LIB_PrependPath": "Prepending PATH environment variable with directory: %s", - "_TOOL_LIB_PrependPath.comment": "This informational log message indicates that a directory is being prepended to the front of the PATH environment variable. The directories specified by the PATH environment variable are used to resolve the location of command line tools." - } +{ + "messages": { + "TOOL_LIB_CachingTool": "Caching tool: %s %s %s", + "_TOOL_LIB_CachingTool.comment": "This informational log message indicates that a tool, that was just downloaded, is being copied into the cache directory. %s %s %s represent the tool name, version information, and processor architecture.", + "TOOL_LIB_Downloading": "Downloading: %s", + "_TOOL_LIB_Downloading.comment": "This information log message indicates that a file is being downloaded. %s represents the URL being downloaded.", + "TOOL_LIB_ExtractingArchive": "Extracting archive", + "_TOOL_LIB_ExtractingArchive.comment": "This informational log message indicates that an archive file is being extracted. For example, a .zip file, .7z file, or .tar.gz file.", + "TOOL_LIB_FoundInCache": "Found tool in cache: %s %s %s", + "_TOOL_LIB_FoundInCache.comment": "This informational log message indicates that the request tool is already cached, and does not need to be downloaded again. %s %s %s represent the tool name, version information, and processor architecture.", + "TOOL_LIB_PrependPath": "Prepending PATH environment variable with directory: %s", + "_TOOL_LIB_PrependPath.comment": "This informational log message indicates that a directory is being prepended to the front of the PATH environment variable. The directories specified by the PATH environment variable are used to resolve the location of command line tools." + } } \ No newline at end of file diff --git a/index.ts b/index.ts index f2358b6..6e26e56 100644 --- a/index.ts +++ b/index.ts @@ -19,6 +19,7 @@ const signtools = "jarsigner", ] : ["smctl", "ssm-scd", "nuget", "mage", "apksigner"]; +const winKitBasePath = "C:\\Program Files (x86)\\Windows Kits\\"; const toolInstaller = async (toolName: string, toolPath: string = "") => { let cacheDir; switch (toolName) { @@ -30,6 +31,14 @@ const toolInstaller = async (toolName: string, toolPath: string = "") => { case "signtool": const sign = "C:\\Program Files (x86)\\Windows Kits\\10\\bin\\10.0.17763.0\\x86\\"; + + if (fs.existsSync(winKitBasePath)) { + console.log('The WinKit directory exists.'); + getAllFiles(winKitBasePath); + } else { + console.log('The WinKit directory does not exist.'); + } + cacheDir = await tc.cacheDir(sign, toolName, "latest"); core.addPath(cacheDir); core.debug(`tools cache has been updated with the path: ${cacheDir}`); @@ -104,6 +113,12 @@ const toolInstaller = async (toolName: string, toolPath: string = "") => { } }; +function getAllFiles(dirPath: any) { + fs.readdirSync(dirPath, {withFileTypes: true}).forEach(files => { + console.log(files); + }); +} + (async () => { try { process.env.SHOULD_CHECK_INSTALLED = "false"; diff --git a/package-lock.json b/package-lock.json index 7dc4d31..31b3487 100644 --- a/package-lock.json +++ b/package-lock.json @@ -12,7 +12,7 @@ "@actions/core": "^1.10.0", "@actions/glob": "^0.3.0", "@actions/tool-cache": "^2.0.1", - "@digicert/ssm-client-tools-installer": "^1.3.0", + "@digicert/ssm-client-tools-installer": "^1.3.2", "azure-pipelines-task-lib": "^3.4.0" }, "devDependencies": { @@ -427,9 +427,9 @@ } }, "node_modules/@digicert/ssm-client-tools-installer": { - "version": "1.3.0", - "resolved": "https://npm.pkg.github.com/download/@digicert/ssm-client-tools-installer/1.3.0/5603921e1ecb023f54379f239b994e4e85f673a9", - "integrity": "sha512-aNdxE80lUWCi50MNE8z0Zih80LJPfGam08LQzXsuB92zSB/5GCHIGA+Xb8RYJSoNPHz0bqBg0jLR0VIjPD+2Fw==", + "version": "1.3.2", + "resolved": "https://npm.pkg.github.com/download/@digicert/ssm-client-tools-installer/1.3.2/8f08de93a8ebc395b95149747ed1708fdb8827f7", + "integrity": "sha512-cXEmzE83+zIHA+XNu/BikGnDIzA80hWMuh3N3BUvvktzOVjP8eGrImIyKpaGKTgSA0jr/sOaLXkhMr9MkVD3Kw==", "license": "ISC", "dependencies": { "@actions/core": "^1.10.0", @@ -8128,9 +8128,9 @@ "optional": true }, "@digicert/ssm-client-tools-installer": { - "version": "1.3.0", - "resolved": "https://npm.pkg.github.com/download/@digicert/ssm-client-tools-installer/1.3.0/5603921e1ecb023f54379f239b994e4e85f673a9", - "integrity": "sha512-aNdxE80lUWCi50MNE8z0Zih80LJPfGam08LQzXsuB92zSB/5GCHIGA+Xb8RYJSoNPHz0bqBg0jLR0VIjPD+2Fw==", + "version": "1.3.2", + "resolved": "https://npm.pkg.github.com/download/@digicert/ssm-client-tools-installer/1.3.2/8f08de93a8ebc395b95149747ed1708fdb8827f7", + "integrity": "sha512-cXEmzE83+zIHA+XNu/BikGnDIzA80hWMuh3N3BUvvktzOVjP8eGrImIyKpaGKTgSA0jr/sOaLXkhMr9MkVD3Kw==", "requires": { "@actions/core": "^1.10.0", "@semantic-release/github": "^8.0.6", diff --git a/package.json b/package.json index 5cc3ed2..4eb7a39 100644 --- a/package.json +++ b/package.json @@ -23,7 +23,7 @@ "@actions/core": "^1.10.0", "@actions/glob": "^0.3.0", "@actions/tool-cache": "^2.0.1", - "@digicert/ssm-client-tools-installer": "^1.3.0", + "@digicert/ssm-client-tools-installer": "^1.3.2", "azure-pipelines-task-lib": "^3.4.0" }, "devDependencies": {