Try upload teh proxy logs
This commit is contained in:
parent
7baf39279e
commit
0b84d89476
3 changed files with 33 additions and 10 deletions
17
lib/start-proxy-action-post.js
generated
17
lib/start-proxy-action-post.js
generated
|
|
@ -28,7 +28,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
||||||
* It will run after the all steps in this job, in reverse order in relation to
|
* It will run after the all steps in this job, in reverse order in relation to
|
||||||
* other `post:` hooks.
|
* other `post:` hooks.
|
||||||
*/
|
*/
|
||||||
const fs = __importStar(require("fs"));
|
const artifact = __importStar(require("@actions/artifact"));
|
||||||
const core = __importStar(require("@actions/core"));
|
const core = __importStar(require("@actions/core"));
|
||||||
const actionsUtil = __importStar(require("./actions-util"));
|
const actionsUtil = __importStar(require("./actions-util"));
|
||||||
const configUtils = __importStar(require("./config-utils"));
|
const configUtils = __importStar(require("./config-utils"));
|
||||||
|
|
@ -46,9 +46,18 @@ async function runWrapper() {
|
||||||
const config = await configUtils.getConfig(actionsUtil.getTemporaryDirectory(), core);
|
const config = await configUtils.getConfig(actionsUtil.getTemporaryDirectory(), core);
|
||||||
if ((config && config.debugMode) || core.isDebug()) {
|
if ((config && config.debugMode) || core.isDebug()) {
|
||||||
const logFilePath = core.getState("proxy-log-file");
|
const logFilePath = core.getState("proxy-log-file");
|
||||||
if (logFilePath) {
|
core.info("Debug mode is on. Uploading proxy log as Actions debugging artifact...");
|
||||||
const readStream = fs.createReadStream(logFilePath);
|
try {
|
||||||
readStream.pipe(process.stdout, { end: true });
|
await artifact
|
||||||
|
.create()
|
||||||
|
.uploadArtifact("proxy-log-file", [logFilePath], actionsUtil.getTemporaryDirectory(), {
|
||||||
|
continueOnError: true,
|
||||||
|
retentionDays: 7,
|
||||||
|
});
|
||||||
|
}
|
||||||
|
catch (e) {
|
||||||
|
// A failure to upload debug artifacts should not fail the entire action.
|
||||||
|
core.warning(`Failed to upload debug artifacts: ${e}`);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1 +1 @@
|
||||||
{"version":3,"file":"start-proxy-action-post.js","sourceRoot":"","sources":["../src/start-proxy-action-post.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;AAAA;;;;GAIG;AACH,uCAAyB;AAEzB,oDAAsC;AAEtC,4DAA8C;AAC9C,4DAA8C;AAC9C,iCAAmC;AAEnC,KAAK,UAAU,UAAU;IACvB,IAAI,CAAC;QACH,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;IACH,CAAC;IAAC,OAAO,KAAK,EAAE,CAAC;QACf,IAAI,CAAC,SAAS,CACZ,wCAAwC,IAAA,gBAAS,EAAC,KAAK,CAAC,CAAC,OAAO,EAAE,CACnE,CAAC;IACJ,CAAC;IACD,MAAM,MAAM,GAAG,MAAM,WAAW,CAAC,SAAS,CACxC,WAAW,CAAC,qBAAqB,EAAE,EACnC,IAAI,CACL,CAAC;IAEF,IAAI,CAAC,MAAM,IAAI,MAAM,CAAC,SAAS,CAAC,IAAI,IAAI,CAAC,OAAO,EAAE,EAAE,CAAC;QACnD,MAAM,WAAW,GAAG,IAAI,CAAC,QAAQ,CAAC,gBAAgB,CAAC,CAAC;QACpD,IAAI,WAAW,EAAE,CAAC;YAChB,MAAM,UAAU,GAAG,EAAE,CAAC,gBAAgB,CAAC,WAAW,CAAC,CAAC;YACpD,UAAU,CAAC,IAAI,CAAC,OAAO,CAAC,MAAM,EAAE,EAAE,GAAG,EAAE,IAAI,EAAE,CAAC,CAAC;QACjD,CAAC;IACH,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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* It will run after the all steps in this job, in reverse order in relation to
|
||||||
* other `post:` hooks.
|
* other `post:` hooks.
|
||||||
*/
|
*/
|
||||||
import * as fs from "fs";
|
import * as artifact from "@actions/artifact";
|
||||||
|
|
||||||
import * as core from "@actions/core";
|
import * as core from "@actions/core";
|
||||||
|
|
||||||
import * as actionsUtil from "./actions-util";
|
import * as actionsUtil from "./actions-util";
|
||||||
|
|
@ -29,9 +28,24 @@ async function runWrapper() {
|
||||||
|
|
||||||
if ((config && config.debugMode) || core.isDebug()) {
|
if ((config && config.debugMode) || core.isDebug()) {
|
||||||
const logFilePath = core.getState("proxy-log-file");
|
const logFilePath = core.getState("proxy-log-file");
|
||||||
if (logFilePath) {
|
core.info(
|
||||||
const readStream = fs.createReadStream(logFilePath);
|
"Debug mode is on. Uploading proxy log as Actions debugging artifact...",
|
||||||
readStream.pipe(process.stdout, { end: true });
|
);
|
||||||
|
try {
|
||||||
|
await artifact
|
||||||
|
.create()
|
||||||
|
.uploadArtifact(
|
||||||
|
"proxy-log-file",
|
||||||
|
[logFilePath],
|
||||||
|
actionsUtil.getTemporaryDirectory(),
|
||||||
|
{
|
||||||
|
continueOnError: true,
|
||||||
|
retentionDays: 7,
|
||||||
|
},
|
||||||
|
);
|
||||||
|
} catch (e) {
|
||||||
|
// A failure to upload debug artifacts should not fail the entire action.
|
||||||
|
core.warning(`Failed to upload debug artifacts: ${e}`);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue