Staple the magic-nix-cache daemon log in error conditions

This commit is contained in:
Graham Christensen 2024-05-06 11:35:14 -04:00
parent 4ae13c51d8
commit 3b0ad43946
3 changed files with 16 additions and 4 deletions

10
dist/index.js generated vendored
View file

@ -94765,6 +94765,10 @@ var MagicNixCacheAction = class {
this.unsafeDaemonDir = this.idslib.getTemporaryName(); this.unsafeDaemonDir = this.idslib.getTemporaryName();
core.exportVariable(ENV_CACHE_DAEMONDIR, this.unsafeDaemonDir); core.exportVariable(ENV_CACHE_DAEMONDIR, this.unsafeDaemonDir);
} }
this.idslib.stapleFile(
"daemon.log",
external_node_path_namespaceObject.join(this.unsafeDaemonDir, "daemon.log")
);
} }
async getDaemonDir() { async getDaemonDir() {
if (this.daemonDir === void 0) { if (this.daemonDir === void 0) {
@ -94911,6 +94915,10 @@ var MagicNixCacheAction = class {
return `${lastPath}/bin/magic-nix-cache`; return `${lastPath}/bin/magic-nix-cache`;
} }
async notifyAutoCache() { async notifyAutoCache() {
if (!await this.daemonDirExists()) {
core.debug("magic-nix-cache not started - Skipping");
return;
}
try { try {
core.debug(`Indicating workflow start`); core.debug(`Indicating workflow start`);
const hostAndPort = inputs_exports.getString("listen"); const hostAndPort = inputs_exports.getString("listen");
@ -94923,7 +94931,7 @@ var MagicNixCacheAction = class {
} }
} }
async tearDownAutoCache() { async tearDownAutoCache() {
if (await this.daemonDirExists()) { if (!await this.daemonDirExists()) {
core.debug("magic-nix-cache not started - Skipping"); core.debug("magic-nix-cache not started - Skipping");
return; return;
} }

2
dist/index.js.map generated vendored

File diff suppressed because one or more lines are too long

View file

@ -50,6 +50,10 @@ class MagicNixCacheAction {
this.unsafeDaemonDir = this.idslib.getTemporaryName(); this.unsafeDaemonDir = this.idslib.getTemporaryName();
actionsCore.exportVariable(ENV_CACHE_DAEMONDIR, this.unsafeDaemonDir); actionsCore.exportVariable(ENV_CACHE_DAEMONDIR, this.unsafeDaemonDir);
} }
this.idslib.stapleFile(
"daemon.log",
path.join(this.unsafeDaemonDir, "daemon.log"),
);
} }
async getDaemonDir(): Promise<string> { async getDaemonDir(): Promise<string> {
@ -235,7 +239,7 @@ class MagicNixCacheAction {
} }
async notifyAutoCache(): Promise<void> { async notifyAutoCache(): Promise<void> {
if (!await this.daemonDirExists()) { if (!(await this.daemonDirExists())) {
actionsCore.debug("magic-nix-cache not started - Skipping"); actionsCore.debug("magic-nix-cache not started - Skipping");
return; return;
} }
@ -255,7 +259,7 @@ class MagicNixCacheAction {
} }
async tearDownAutoCache(): Promise<void> { async tearDownAutoCache(): Promise<void> {
if (!await this.daemonDirExists()) { if (!(await this.daemonDirExists())) {
actionsCore.debug("magic-nix-cache not started - Skipping"); actionsCore.debug("magic-nix-cache not started - Skipping");
return; return;
} }