Clean-up logging
This commit is contained in:
parent
dc92ab6239
commit
3b3012e891
3 changed files with 21 additions and 15 deletions
16
lib/start-proxy-action.js
generated
16
lib/start-proxy-action.js
generated
|
|
@ -30,6 +30,7 @@ const toolcache = __importStar(require("@actions/tool-cache"));
|
|||
const node_forge_1 = require("node-forge");
|
||||
const actionsUtil = __importStar(require("./actions-util"));
|
||||
const util = __importStar(require("./util"));
|
||||
const logging_1 = require("./logging");
|
||||
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";
|
||||
|
|
@ -79,12 +80,14 @@ function generateCertificateAuthority() {
|
|||
return { cert: pem, key };
|
||||
}
|
||||
async function runWrapper() {
|
||||
// Setup logging
|
||||
const logger = (0, logging_1.getActionsLogger)();
|
||||
// Setup logging for the proxy
|
||||
const tempDir = actionsUtil.getTemporaryDirectory();
|
||||
const logFilePath = path.resolve(tempDir, "proxy.log");
|
||||
core.saveState("proxy-log-file", logFilePath);
|
||||
const proxyLogFilePath = path.resolve(tempDir, "proxy.log");
|
||||
core.saveState("proxy-log-file", proxyLogFilePath);
|
||||
// Get the configuration options
|
||||
const credentials = getCredentials();
|
||||
logger.debug(`Credentials loaded for the following URLs:\n ${credentials.map(c => c.host).join("\n")}`);
|
||||
const ca = generateCertificateAuthority();
|
||||
const proxyAuth = getProxyAuth();
|
||||
const proxyConfig = {
|
||||
|
|
@ -94,9 +97,9 @@ async function runWrapper() {
|
|||
};
|
||||
// Start the Proxy
|
||||
const proxyBin = await getProxyBinaryPath();
|
||||
await startProxy(proxyBin, proxyConfig, logFilePath);
|
||||
await startProxy(proxyBin, proxyConfig, proxyLogFilePath, logger);
|
||||
}
|
||||
async function startProxy(binPath, config, logFilePath) {
|
||||
async function startProxy(binPath, config, logFilePath, logger) {
|
||||
const host = "127.0.0.1";
|
||||
let port = 49152;
|
||||
try {
|
||||
|
|
@ -130,7 +133,7 @@ async function startProxy(binPath, config, logFilePath) {
|
|||
if (subprocessError) {
|
||||
throw subprocessError;
|
||||
}
|
||||
core.info(`Proxy started on ${host}:${port}`);
|
||||
logger.info(`Proxy started on ${host}:${port}`);
|
||||
core.setOutput("proxy_host", host);
|
||||
core.setOutput("proxy_port", port.toString());
|
||||
core.setOutput("proxy_ca_certificate", config.ca.cert);
|
||||
|
|
@ -145,7 +148,6 @@ async function startProxy(binPath, config, logFilePath) {
|
|||
function getCredentials() {
|
||||
const encodedCredentials = actionsUtil.getOptionalInput("registries_credentials");
|
||||
if (encodedCredentials !== undefined) {
|
||||
core.info(`Using encoded credentials.`);
|
||||
const credentialsStr = Buffer.from(encodedCredentials, "base64").toString();
|
||||
return JSON.parse(credentialsStr);
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue