Start-proxy: Fetch OS specific binary

This commit is contained in:
Marco Gario 2024-11-19 14:30:33 +00:00
Родитель cba5fb58d4
Коммит 8f3b48727f
3 изменённых файлов: 33 добавлений и 14 удалений

20
lib/start-proxy-action.js сгенерированный
Просмотреть файл

@ -32,8 +32,8 @@ const actionsUtil = __importStar(require("./actions-util"));
const logging_1 = require("./logging");
const util = __importStar(require("./util"));
const UPDATEJOB_PROXY = "update-job-proxy";
const UPDATEJOB_PROXY_VERSION = "v2.0.20240722180912";
const UPDATEJOB_PROXY_URL = "https://github.com/github/codeql-action/releases/download/codeql-bundle-v2.18.1/update-job-proxy.tar.gz";
const UPDATEJOB_PROXY_VERSION = "v2.0.20241023203727";
const UPDATEJOB_PROXY_URL_PREFIX = "https://github.com/github/codeql-action/releases/download/codeql-bundle-v2.18.1/";
const PROXY_USER = "proxy_user";
const KEY_SIZE = 2048;
const KEY_EXPIRY_YEARS = 2;
@ -196,13 +196,21 @@ function getProxyAuth() {
return;
}
async function getProxyBinaryPath() {
let proxyBin = toolcache.find(UPDATEJOB_PROXY, UPDATEJOB_PROXY_VERSION);
const proxyFileName = process.platform === "win32" ? `${UPDATEJOB_PROXY}.exe` : UPDATEJOB_PROXY;
const platform = process.platform === "win32"
? "win64"
: process.platform === "darwin"
? "osx64"
: "linux64";
const proxyPackage = `${UPDATEJOB_PROXY}-${platform}.tar.gz`;
const proxyURL = `${UPDATEJOB_PROXY_URL_PREFIX}${proxyPackage}`;
let proxyBin = toolcache.find(proxyFileName, UPDATEJOB_PROXY_VERSION);
if (!proxyBin) {
const temp = await toolcache.downloadTool(UPDATEJOB_PROXY_URL);
const temp = await toolcache.downloadTool(proxyURL);
const extracted = await toolcache.extractTar(temp);
proxyBin = await toolcache.cacheDir(extracted, UPDATEJOB_PROXY, UPDATEJOB_PROXY_VERSION);
proxyBin = await toolcache.cacheDir(extracted, proxyFileName, UPDATEJOB_PROXY_VERSION);
}
proxyBin = path.join(proxyBin, UPDATEJOB_PROXY);
proxyBin = path.join(proxyBin, proxyFileName);
return proxyBin;
}
function credentialToStr(c) {

Различия файлов скрыты, потому что одна или несколько строк слишком длинны

Просмотреть файл

@ -10,9 +10,9 @@ import { getActionsLogger, Logger } from "./logging";
import * as util from "./util";
const UPDATEJOB_PROXY = "update-job-proxy";
const UPDATEJOB_PROXY_VERSION = "v2.0.20240722180912";
const UPDATEJOB_PROXY_URL =
"https://github.com/github/codeql-action/releases/download/codeql-bundle-v2.18.1/update-job-proxy.tar.gz";
const UPDATEJOB_PROXY_VERSION = "v2.0.20241023203727";
const UPDATEJOB_PROXY_URL_PREFIX =
"https://github.com/github/codeql-action/releases/download/codeql-bundle-v2.18.1/";
const PROXY_USER = "proxy_user";
const KEY_SIZE = 2048;
const KEY_EXPIRY_YEARS = 2;
@ -229,17 +229,28 @@ function getProxyAuth(): BasicAuthCredentials | undefined {
}
async function getProxyBinaryPath(): Promise<string> {
let proxyBin = toolcache.find(UPDATEJOB_PROXY, UPDATEJOB_PROXY_VERSION);
const proxyFileName =
process.platform === "win32" ? `${UPDATEJOB_PROXY}.exe` : UPDATEJOB_PROXY;
const platform =
process.platform === "win32"
? "win64"
: process.platform === "darwin"
? "osx64"
: "linux64";
const proxyPackage = `${UPDATEJOB_PROXY}-${platform}.tar.gz`;
const proxyURL = `${UPDATEJOB_PROXY_URL_PREFIX}${proxyPackage}`;
let proxyBin = toolcache.find(proxyFileName, UPDATEJOB_PROXY_VERSION);
if (!proxyBin) {
const temp = await toolcache.downloadTool(UPDATEJOB_PROXY_URL);
const temp = await toolcache.downloadTool(proxyURL);
const extracted = await toolcache.extractTar(temp);
proxyBin = await toolcache.cacheDir(
extracted,
UPDATEJOB_PROXY,
proxyFileName,
UPDATEJOB_PROXY_VERSION,
);
}
proxyBin = path.join(proxyBin, UPDATEJOB_PROXY);
proxyBin = path.join(proxyBin, proxyFileName);
return proxyBin;
}