Compare commits

...

2 Commits

Author SHA1 Message Date
Michael B. Gale
b24bd4a46f Don't fail post start-proxy action if killing the proxy process fails
Otherwise logs won't get uploaded as artifact, even in debug mode
2025-04-25 16:53:21 +01:00
Michael B. Gale
6e35f86a20 Add proxy_binary input to start-proxy Action
This allows a custom binary to be used. Mainly for testing.
2025-04-25 16:53:09 +01:00
7 changed files with 22 additions and 6 deletions

View File

@@ -53,7 +53,12 @@ async function runWrapper() {
// Kill the running proxy
const pid = core.getState("proxy-process-pid");
if (pid) {
process.kill(Number(pid));
try {
process.kill(Number(pid));
}
catch (error) {
logger.error(`Failed to kill proxy process: ${(0, util_1.getErrorMessage)(error)}`);
}
}
const config = await configUtils.getConfig(actionsUtil.getTemporaryDirectory(), logger);
if ((config && config.debugMode) || core.isDebug()) {

View File

@@ -1 +1 @@
{"version":3,"file":"start-proxy-action-post.js","sourceRoot":"","sources":["../src/start-proxy-action-post.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;;;;GAIG;AACH,oDAAsC;AAEtC,4DAA8C;AAC9C,6CAAgD;AAChD,4DAA8C;AAC9C,uDAA8D;AAC9D,uCAA6C;AAC7C,iCAAoE;AAEpE,KAAK,UAAU,UAAU;IACvB,MAAM,MAAM,GAAG,IAAA,0BAAgB,GAAE,CAAC;IAElC,IAAI,CAAC;QACH,4CAA4C;QAC5C,WAAW,CAAC,aAAa,EAAE,CAAC;QAE5B,yBAAyB;QACzB,MAAM,GAAG,GAAG,IAAI,CAAC,QAAQ,CAAC,mBAAmB,CAAC,CAAC;QAC/C,IAAI,GAAG,EAAE,CAAC;YACR,OAAO,CAAC,IAAI,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC,CAAC;QAC5B,CAAC;QAED,MAAM,MAAM,GAAG,MAAM,WAAW,CAAC,SAAS,CACxC,WAAW,CAAC,qBAAqB,EAAE,EACnC,MAAM,CACP,CAAC;QAEF,IAAI,CAAC,MAAM,IAAI,MAAM,CAAC,SAAS,CAAC,IAAI,IAAI,CAAC,OAAO,EAAE,EAAE,CAAC;YACnD,MAAM,WAAW,GAAG,IAAI,CAAC,QAAQ,CAAC,gBAAgB,CAAC,CAAC;YACpD,MAAM,CAAC,IAAI,CACT,wEAAwE,CACzE,CAAC;YACF,IAAI,MAAM,EAAE,aAAa,CAAC,IAAI,KAAK,SAAS,EAAE,CAAC;gBAC7C,MAAM,CAAC,OAAO,CACZ,qFAAqF,CACtF,CAAC;gBACF,OAAO;YACT,CAAC;YACD,MAAM,aAAa,GAAG,MAAM,IAAA,6BAAgB,GAAE,CAAC;YAC/C,IAAA,gCAAyB,EAAC,aAAa,EAAE,MAAM,CAAC,CAAC;YAEjD,MAAM,gBAAgB,GAAG,MAAM,IAAA,2CAAyB,EACtD,MAAM,EACN,aAAa,CAAC,IAAI,CACnB,CAAC;YAEF,MAAM,gBAAgB,CAAC,cAAc,CACnC,gBAAgB,EAChB,CAAC,WAAW,CAAC,EACb,WAAW,CAAC,qBAAqB,EAAE,EACnC;gBACE,wFAAwF;gBACxF,aAAa,EAAE,CAAC;aACjB,CACF,CAAC;QACJ,CAAC;IACH,CAAC;IAAC,OAAO,KAAK,EAAE,CAAC;QACf,gEAAgE;QAChE,MAAM,CAAC,OAAO,CACZ,wCAAwC,IAAA,sBAAe,EAAC,KAAK,CAAC,EAAE,CACjE,CAAC;IACJ,CAAC;AACH,CAAC;AAED,KAAK,UAAU,EAAE,CAAC"}
{"version":3,"file":"start-proxy-action-post.js","sourceRoot":"","sources":["../src/start-proxy-action-post.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;;;;GAIG;AACH,oDAAsC;AAEtC,4DAA8C;AAC9C,6CAAgD;AAChD,4DAA8C;AAC9C,uDAA8D;AAC9D,uCAA6C;AAC7C,iCAAoE;AAEpE,KAAK,UAAU,UAAU;IACvB,MAAM,MAAM,GAAG,IAAA,0BAAgB,GAAE,CAAC;IAElC,IAAI,CAAC;QACH,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QACJ,CAAC;IACH,CAAC;IAAC,OAAO,KAAK,EAAE,CAAC;QACf,gEAAgE;QAChE,MAAM,CAAC,OAAO,CACZ,wCAAwC,IAAA,sBAAe,EAAC,KAAK,CAAC,EAAE,CACjE,CAAC;IACJ,CAAC;AACH,CAAC;AAED,KAAK,UAAU,EAAE,CAAC"}

View File

@@ -112,7 +112,8 @@ async function runWrapper() {
ca,
};
// Start the Proxy
const proxyBin = await getProxyBinaryPath();
const proxyBin = actionsUtil.getOptionalInput("proxy_binary") ??
(await getProxyBinaryPath());
await startProxy(proxyBin, proxyConfig, proxyLogFilePath, logger);
}
async function startProxy(binPath, config, logFilePath, logger) {

File diff suppressed because one or more lines are too long

View File

@@ -22,7 +22,11 @@ async function runWrapper() {
// Kill the running proxy
const pid = core.getState("proxy-process-pid");
if (pid) {
process.kill(Number(pid));
try {
process.kill(Number(pid));
} catch (error) {
logger.error(`Failed to kill proxy process: ${getErrorMessage(error)}`);
}
}
const config = await configUtils.getConfig(

View File

@@ -119,7 +119,9 @@ async function runWrapper() {
};
// Start the Proxy
const proxyBin = await getProxyBinaryPath();
const proxyBin =
actionsUtil.getOptionalInput("proxy_binary") ??
(await getProxyBinaryPath());
await startProxy(proxyBin, proxyConfig, proxyLogFilePath, logger);
}

View File

@@ -2,6 +2,10 @@ name: "CodeQL: Start proxy"
description: "[Experimental] Start HTTP proxy server. This action is for internal GitHub used only and will change without notice."
author: "GitHub"
inputs:
proxy_binary:
description: >-
A path for the proxy binary to use.
required: false
registry_secrets:
description: The URLs and credentials of package registries
required: false