Update generated content

Signed-off-by: CrazyMax <crazy-max@users.noreply.github.com>
This commit is contained in:
CrazyMax 2021-05-30 16:41:24 +02:00
parent cd8b844a0a
commit 68810d1ede
No known key found for this signature in database
GPG Key ID: 3248E46B6BB8C7F7
2 changed files with 132 additions and 50 deletions

180
dist/index.js generated vendored
View File

@ -534,7 +534,6 @@ function run() {
core.endGroup(); core.endGroup();
} }
const buildxVersion = yield buildx.getVersion(); const buildxVersion = yield buildx.getVersion();
core.info(`Using buildx ${buildxVersion}`);
const builderName = inputs.driver == 'docker' ? 'default' : `builder-${__webpack_require__(840).v4()}`; const builderName = inputs.driver == 'docker' ? 'default' : `builder-${__webpack_require__(840).v4()}`;
context.setOutput('name', builderName); context.setOutput('name', builderName);
stateHelper.setBuilderName(builderName); stateHelper.setBuilderName(builderName);
@ -2053,6 +2052,25 @@ exports.toCommandValue = toCommandValue;
"use strict"; "use strict";
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
if (k2 === undefined) k2 = k;
Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
}) : (function(o, m, k, k2) {
if (k2 === undefined) k2 = k;
o[k2] = m[k];
}));
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
Object.defineProperty(o, "default", { enumerable: true, value: v });
}) : function(o, v) {
o["default"] = v;
});
var __importStar = (this && this.__importStar) || function (mod) {
if (mod && mod.__esModule) return mod;
var result = {};
if (mod != null) for (var k in mod) if (k !== "default" && Object.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
__setModuleDefault(result, mod);
return result;
};
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) { var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); } function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
return new (P || (P = Promise))(function (resolve, reject) { return new (P || (P = Promise))(function (resolve, reject) {
@ -2062,14 +2080,8 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
step((generator = generator.apply(thisArg, _arguments || [])).next()); step((generator = generator.apply(thisArg, _arguments || [])).next());
}); });
}; };
var __importStar = (this && this.__importStar) || function (mod) {
if (mod && mod.__esModule) return mod;
var result = {};
if (mod != null) for (var k in mod) if (Object.hasOwnProperty.call(mod, k)) result[k] = mod[k];
result["default"] = mod;
return result;
};
Object.defineProperty(exports, "__esModule", { value: true }); Object.defineProperty(exports, "__esModule", { value: true });
exports.RetryHelper = void 0;
const core = __importStar(__webpack_require__(186)); const core = __importStar(__webpack_require__(186));
/** /**
* Internal class for retries * Internal class for retries
@ -3285,6 +3297,25 @@ module.exports = v4;
"use strict"; "use strict";
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
if (k2 === undefined) k2 = k;
Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
}) : (function(o, m, k, k2) {
if (k2 === undefined) k2 = k;
o[k2] = m[k];
}));
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
Object.defineProperty(o, "default", { enumerable: true, value: v });
}) : function(o, v) {
o["default"] = v;
});
var __importStar = (this && this.__importStar) || function (mod) {
if (mod && mod.__esModule) return mod;
var result = {};
if (mod != null) for (var k in mod) if (k !== "default" && Object.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
__setModuleDefault(result, mod);
return result;
};
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) { var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); } function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
return new (P || (P = Promise))(function (resolve, reject) { return new (P || (P = Promise))(function (resolve, reject) {
@ -3294,14 +3325,8 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
step((generator = generator.apply(thisArg, _arguments || [])).next()); step((generator = generator.apply(thisArg, _arguments || [])).next());
}); });
}; };
var __importStar = (this && this.__importStar) || function (mod) {
if (mod && mod.__esModule) return mod;
var result = {};
if (mod != null) for (var k in mod) if (Object.hasOwnProperty.call(mod, k)) result[k] = mod[k];
result["default"] = mod;
return result;
};
Object.defineProperty(exports, "__esModule", { value: true }); Object.defineProperty(exports, "__esModule", { value: true });
exports._readLinuxVersionFile = exports._getOsVersion = exports._findMatch = void 0;
const semver = __importStar(__webpack_require__(562)); const semver = __importStar(__webpack_require__(562));
const core_1 = __webpack_require__(186); const core_1 = __webpack_require__(186);
// needs to be require for core node modules to be mocked // needs to be require for core node modules to be mocked
@ -6779,6 +6804,25 @@ exports.default = _default;
"use strict"; "use strict";
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
if (k2 === undefined) k2 = k;
Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
}) : (function(o, m, k, k2) {
if (k2 === undefined) k2 = k;
o[k2] = m[k];
}));
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
Object.defineProperty(o, "default", { enumerable: true, value: v });
}) : function(o, v) {
o["default"] = v;
});
var __importStar = (this && this.__importStar) || function (mod) {
if (mod && mod.__esModule) return mod;
var result = {};
if (mod != null) for (var k in mod) if (k !== "default" && Object.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
__setModuleDefault(result, mod);
return result;
};
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) { var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); } function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
return new (P || (P = Promise))(function (resolve, reject) { return new (P || (P = Promise))(function (resolve, reject) {
@ -6788,17 +6832,11 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
step((generator = generator.apply(thisArg, _arguments || [])).next()); step((generator = generator.apply(thisArg, _arguments || [])).next());
}); });
}; };
var __importStar = (this && this.__importStar) || function (mod) {
if (mod && mod.__esModule) return mod;
var result = {};
if (mod != null) for (var k in mod) if (Object.hasOwnProperty.call(mod, k)) result[k] = mod[k];
result["default"] = mod;
return result;
};
var __importDefault = (this && this.__importDefault) || function (mod) { var __importDefault = (this && this.__importDefault) || function (mod) {
return (mod && mod.__esModule) ? mod : { "default": mod }; return (mod && mod.__esModule) ? mod : { "default": mod };
}; };
Object.defineProperty(exports, "__esModule", { value: true }); Object.defineProperty(exports, "__esModule", { value: true });
exports.evaluateVersions = exports.isExplicitVersion = exports.findFromManifest = exports.getManifestFromRepo = exports.findAllVersions = exports.find = exports.cacheFile = exports.cacheDir = exports.extractZip = exports.extractXar = exports.extractTar = exports.extract7z = exports.downloadTool = exports.HTTPError = void 0;
const core = __importStar(__webpack_require__(186)); const core = __importStar(__webpack_require__(186));
const io = __importStar(__webpack_require__(436)); const io = __importStar(__webpack_require__(436));
const fs = __importStar(__webpack_require__(747)); const fs = __importStar(__webpack_require__(747));
@ -6830,9 +6868,10 @@ const userAgent = 'actions/tool-cache';
* @param url url of tool to download * @param url url of tool to download
* @param dest path to download tool * @param dest path to download tool
* @param auth authorization header * @param auth authorization header
* @param headers other headers
* @returns path to downloaded tool * @returns path to downloaded tool
*/ */
function downloadTool(url, dest, auth) { function downloadTool(url, dest, auth, headers) {
return __awaiter(this, void 0, void 0, function* () { return __awaiter(this, void 0, void 0, function* () {
dest = dest || path.join(_getTempDirectory(), v4_1.default()); dest = dest || path.join(_getTempDirectory(), v4_1.default());
yield io.mkdirP(path.dirname(dest)); yield io.mkdirP(path.dirname(dest));
@ -6843,7 +6882,7 @@ function downloadTool(url, dest, auth) {
const maxSeconds = _getGlobal('TEST_DOWNLOAD_TOOL_RETRY_MAX_SECONDS', 20); const maxSeconds = _getGlobal('TEST_DOWNLOAD_TOOL_RETRY_MAX_SECONDS', 20);
const retryHelper = new retry_helper_1.RetryHelper(maxAttempts, minSeconds, maxSeconds); const retryHelper = new retry_helper_1.RetryHelper(maxAttempts, minSeconds, maxSeconds);
return yield retryHelper.execute(() => __awaiter(this, void 0, void 0, function* () { return yield retryHelper.execute(() => __awaiter(this, void 0, void 0, function* () {
return yield downloadToolAttempt(url, dest || '', auth); return yield downloadToolAttempt(url, dest || '', auth, headers);
}), (err) => { }), (err) => {
if (err instanceof HTTPError && err.httpStatusCode) { if (err instanceof HTTPError && err.httpStatusCode) {
// Don't retry anything less than 500, except 408 Request Timeout and 429 Too Many Requests // Don't retry anything less than 500, except 408 Request Timeout and 429 Too Many Requests
@ -6859,7 +6898,7 @@ function downloadTool(url, dest, auth) {
}); });
} }
exports.downloadTool = downloadTool; exports.downloadTool = downloadTool;
function downloadToolAttempt(url, dest, auth) { function downloadToolAttempt(url, dest, auth, headers) {
return __awaiter(this, void 0, void 0, function* () { return __awaiter(this, void 0, void 0, function* () {
if (fs.existsSync(dest)) { if (fs.existsSync(dest)) {
throw new Error(`Destination file path ${dest} already exists`); throw new Error(`Destination file path ${dest} already exists`);
@ -6868,12 +6907,12 @@ function downloadToolAttempt(url, dest, auth) {
const http = new httpm.HttpClient(userAgent, [], { const http = new httpm.HttpClient(userAgent, [], {
allowRetries: false allowRetries: false
}); });
let headers;
if (auth) { if (auth) {
core.debug('set auth'); core.debug('set auth');
headers = { if (headers === undefined) {
authorization: auth headers = {};
}; }
headers.authorization = auth;
} }
const response = yield http.get(url, headers); const response = yield http.get(url, headers);
if (response.message.statusCode !== 200) { if (response.message.statusCode !== 200) {
@ -7031,6 +7070,7 @@ function extractTar(file, dest, flags = 'xz') {
if (isGnuTar) { if (isGnuTar) {
// Suppress warnings when using GNU tar to extract archives created by BSD tar // Suppress warnings when using GNU tar to extract archives created by BSD tar
args.push('--warning=no-unknown-keyword'); args.push('--warning=no-unknown-keyword');
args.push('--overwrite');
} }
args.push('-C', destArg, '-f', fileArg); args.push('-C', destArg, '-f', fileArg);
yield exec_1.exec(`tar`, args); yield exec_1.exec(`tar`, args);
@ -7096,20 +7136,50 @@ function extractZipWin(file, dest) {
// build the powershell command // build the powershell command
const escapedFile = file.replace(/'/g, "''").replace(/"|\n|\r/g, ''); // double-up single quotes, remove double quotes and newlines const escapedFile = file.replace(/'/g, "''").replace(/"|\n|\r/g, ''); // double-up single quotes, remove double quotes and newlines
const escapedDest = dest.replace(/'/g, "''").replace(/"|\n|\r/g, ''); const escapedDest = dest.replace(/'/g, "''").replace(/"|\n|\r/g, '');
const command = `$ErrorActionPreference = 'Stop' ; try { Add-Type -AssemblyName System.IO.Compression.FileSystem } catch { } ; [System.IO.Compression.ZipFile]::ExtractToDirectory('${escapedFile}', '${escapedDest}')`; const pwshPath = yield io.which('pwsh', false);
// run powershell //To match the file overwrite behavior on nix systems, we use the overwrite = true flag for ExtractToDirectory
const powershellPath = yield io.which('powershell', true); //and the -Force flag for Expand-Archive as a fallback
const args = [ if (pwshPath) {
'-NoLogo', //attempt to use pwsh with ExtractToDirectory, if this fails attempt Expand-Archive
'-Sta', const pwshCommand = [
'-NoProfile', `$ErrorActionPreference = 'Stop' ;`,
'-NonInteractive', `try { Add-Type -AssemblyName System.IO.Compression.ZipFile } catch { } ;`,
'-ExecutionPolicy', `try { [System.IO.Compression.ZipFile]::ExtractToDirectory('${escapedFile}', '${escapedDest}', $true) }`,
'Unrestricted', `catch { if (($_.Exception.GetType().FullName -eq 'System.Management.Automation.MethodException') -or ($_.Exception.GetType().FullName -eq 'System.Management.Automation.RuntimeException') ){ Expand-Archive -LiteralPath '${escapedFile}' -DestinationPath '${escapedDest}' -Force } else { throw $_ } } ;`
'-Command', ].join(' ');
command const args = [
]; '-NoLogo',
yield exec_1.exec(`"${powershellPath}"`, args); '-NoProfile',
'-NonInteractive',
'-ExecutionPolicy',
'Unrestricted',
'-Command',
pwshCommand
];
core.debug(`Using pwsh at path: ${pwshPath}`);
yield exec_1.exec(`"${pwshPath}"`, args);
}
else {
const powershellCommand = [
`$ErrorActionPreference = 'Stop' ;`,
`try { Add-Type -AssemblyName System.IO.Compression.FileSystem } catch { } ;`,
`if ((Get-Command -Name Expand-Archive -Module Microsoft.PowerShell.Archive -ErrorAction Ignore)) { Expand-Archive -LiteralPath '${escapedFile}' -DestinationPath '${escapedDest}' -Force }`,
`else {[System.IO.Compression.ZipFile]::ExtractToDirectory('${escapedFile}', '${escapedDest}', $true) }`
].join(' ');
const args = [
'-NoLogo',
'-Sta',
'-NoProfile',
'-NonInteractive',
'-ExecutionPolicy',
'Unrestricted',
'-Command',
powershellCommand
];
const powershellPath = yield io.which('powershell', true);
core.debug(`Using powershell at path: ${powershellPath}`);
yield exec_1.exec(`"${powershellPath}"`, args);
}
}); });
} }
function extractZipNix(file, dest) { function extractZipNix(file, dest) {
@ -7119,6 +7189,7 @@ function extractZipNix(file, dest) {
if (!core.isDebug()) { if (!core.isDebug()) {
args.unshift('-q'); args.unshift('-q');
} }
args.unshift('-o'); //overwrite with -o, otherwise a prompt is shown which freezes the run
yield exec_1.exec(`"${unzipPath}"`, args, { cwd: dest }); yield exec_1.exec(`"${unzipPath}"`, args, { cwd: dest });
}); });
} }
@ -7201,9 +7272,9 @@ function find(toolName, versionSpec, arch) {
} }
arch = arch || os.arch(); arch = arch || os.arch();
// attempt to resolve an explicit version // attempt to resolve an explicit version
if (!_isExplicitVersion(versionSpec)) { if (!isExplicitVersion(versionSpec)) {
const localVersions = findAllVersions(toolName, arch); const localVersions = findAllVersions(toolName, arch);
const match = _evaluateVersions(localVersions, versionSpec); const match = evaluateVersions(localVersions, versionSpec);
versionSpec = match; versionSpec = match;
} }
// check for the explicit version in the cache // check for the explicit version in the cache
@ -7236,7 +7307,7 @@ function findAllVersions(toolName, arch) {
if (fs.existsSync(toolPath)) { if (fs.existsSync(toolPath)) {
const children = fs.readdirSync(toolPath); const children = fs.readdirSync(toolPath);
for (const child of children) { for (const child of children) {
if (_isExplicitVersion(child)) { if (isExplicitVersion(child)) {
const fullPath = path.join(toolPath, child, arch || ''); const fullPath = path.join(toolPath, child, arch || '');
if (fs.existsSync(fullPath) && fs.existsSync(`${fullPath}.complete`)) { if (fs.existsSync(fullPath) && fs.existsSync(`${fullPath}.complete`)) {
versions.push(child); versions.push(child);
@ -7319,14 +7390,26 @@ function _completeToolPath(tool, version, arch) {
fs.writeFileSync(markerPath, ''); fs.writeFileSync(markerPath, '');
core.debug('finished caching tool'); core.debug('finished caching tool');
} }
function _isExplicitVersion(versionSpec) { /**
* Check if version string is explicit
*
* @param versionSpec version string to check
*/
function isExplicitVersion(versionSpec) {
const c = semver.clean(versionSpec) || ''; const c = semver.clean(versionSpec) || '';
core.debug(`isExplicit: ${c}`); core.debug(`isExplicit: ${c}`);
const valid = semver.valid(c) != null; const valid = semver.valid(c) != null;
core.debug(`explicit? ${valid}`); core.debug(`explicit? ${valid}`);
return valid; return valid;
} }
function _evaluateVersions(versions, versionSpec) { exports.isExplicitVersion = isExplicitVersion;
/**
* Get the highest satisfiying semantic version in `versions` which satisfies `versionSpec`
*
* @param versions array of versions to evaluate
* @param versionSpec semantic version spec to satisfy
*/
function evaluateVersions(versions, versionSpec) {
let version = ''; let version = '';
core.debug(`evaluating ${versions.length} versions`); core.debug(`evaluating ${versions.length} versions`);
versions = versions.sort((a, b) => { versions = versions.sort((a, b) => {
@ -7351,6 +7434,7 @@ function _evaluateVersions(versions, versionSpec) {
} }
return version; return version;
} }
exports.evaluateVersions = evaluateVersions;
/** /**
* Gets RUNNER_TOOL_CACHE * Gets RUNNER_TOOL_CACHE
*/ */

View File

@ -25,8 +25,6 @@ async function run(): Promise<void> {
} }
const buildxVersion = await buildx.getVersion(); const buildxVersion = await buildx.getVersion();
core.info(`Using buildx ${buildxVersion}`);
const builderName: string = inputs.driver == 'docker' ? 'default' : `builder-${require('uuid').v4()}`; const builderName: string = inputs.driver == 'docker' ? 'default' : `builder-${require('uuid').v4()}`;
context.setOutput('name', builderName); context.setOutput('name', builderName);
stateHelper.setBuilderName(builderName); stateHelper.setBuilderName(builderName);