mirror of
https://github.com/DeterminateSystems/magic-nix-cache-action.git
synced 2024-12-26 17:30:34 +01:00
Merge pull request #30 from DeterminateSystems/get-cache-log
Correct cache log
This commit is contained in:
commit
80b14c93dd
2 changed files with 19 additions and 13 deletions
16
dist/index.js
generated
vendored
16
dist/index.js
generated
vendored
|
@ -3,9 +3,8 @@ import * as os$2 from 'node:os';
|
||||||
import os__default from 'node:os';
|
import os__default from 'node:os';
|
||||||
import * as path$1 from 'node:path';
|
import * as path$1 from 'node:path';
|
||||||
import { spawn } from 'node:child_process';
|
import { spawn } from 'node:child_process';
|
||||||
import { openSync, writeSync, close, createWriteStream } from 'node:fs';
|
import { openSync, writeSync, close, readFileSync, createWriteStream } from 'node:fs';
|
||||||
import { pipeline } from 'node:stream/promises';
|
import { pipeline } from 'node:stream/promises';
|
||||||
import { setTimeout as setTimeout$1 } from 'timers/promises';
|
|
||||||
import { promisify as promisify$1, inspect } from 'node:util';
|
import { promisify as promisify$1, inspect } from 'node:util';
|
||||||
import require$$0 from 'os';
|
import require$$0 from 'os';
|
||||||
import require$$1 from 'fs';
|
import require$$1 from 'fs';
|
||||||
|
@ -12105,7 +12104,7 @@ var got$1 = got;
|
||||||
const ENV_CACHE_DAEMONDIR = 'MAGIC_NIX_CACHE_DAEMONDIR';
|
const ENV_CACHE_DAEMONDIR = 'MAGIC_NIX_CACHE_DAEMONDIR';
|
||||||
const gotClient = got$1.extend({
|
const gotClient = got$1.extend({
|
||||||
retry: {
|
retry: {
|
||||||
limit: 5,
|
limit: 1,
|
||||||
methods: ['POST', 'GET', 'PUT', 'HEAD', 'DELETE', 'OPTIONS', 'TRACE'],
|
methods: ['POST', 'GET', 'PUT', 'HEAD', 'DELETE', 'OPTIONS', 'TRACE'],
|
||||||
},
|
},
|
||||||
hooks: {
|
hooks: {
|
||||||
|
@ -12181,7 +12180,7 @@ async function setUpAutoCache() {
|
||||||
else {
|
else {
|
||||||
runEnv = process.env;
|
runEnv = process.env;
|
||||||
}
|
}
|
||||||
const output = openSync(`${daemonDir}/parent.log`, 'a');
|
const output = openSync(`${daemonDir}/daemon.log`, 'a');
|
||||||
const launch = spawn(daemonBin, [
|
const launch = spawn(daemonBin, [
|
||||||
'--daemon-dir', daemonDir,
|
'--daemon-dir', daemonDir,
|
||||||
'--listen', coreExports.getInput('listen'),
|
'--listen', coreExports.getInput('listen'),
|
||||||
|
@ -12244,7 +12243,6 @@ async function tearDownAutoCache() {
|
||||||
const log = new Tail_1(path$1.join(daemonDir, 'daemon.log'));
|
const log = new Tail_1(path$1.join(daemonDir, 'daemon.log'));
|
||||||
coreExports.debug(`tailing daemon.log...`);
|
coreExports.debug(`tailing daemon.log...`);
|
||||||
log.on('line', (line) => {
|
log.on('line', (line) => {
|
||||||
coreExports.debug(`got a log line`);
|
|
||||||
coreExports.info(line);
|
coreExports.info(line);
|
||||||
});
|
});
|
||||||
try {
|
try {
|
||||||
|
@ -12254,7 +12252,6 @@ async function tearDownAutoCache() {
|
||||||
coreExports.debug(res);
|
coreExports.debug(res);
|
||||||
}
|
}
|
||||||
finally {
|
finally {
|
||||||
await setTimeout$1(5000);
|
|
||||||
coreExports.debug(`unwatching the daemon log`);
|
coreExports.debug(`unwatching the daemon log`);
|
||||||
log.unwatch();
|
log.unwatch();
|
||||||
}
|
}
|
||||||
|
@ -12267,6 +12264,13 @@ async function tearDownAutoCache() {
|
||||||
throw e;
|
throw e;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
finally {
|
||||||
|
if (coreExports.isDebug()) {
|
||||||
|
coreExports.info("Entire log:");
|
||||||
|
const log = readFileSync(path$1.join(daemonDir, 'daemon.log'));
|
||||||
|
coreExports.info(log.toString());
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
const isPost = !!process.env['STATE_isPost'];
|
const isPost = !!process.env['STATE_isPost'];
|
||||||
try {
|
try {
|
||||||
|
|
16
src/index.ts
16
src/index.ts
|
@ -4,9 +4,8 @@ import * as fs from 'node:fs/promises';
|
||||||
import * as os from 'node:os';
|
import * as os from 'node:os';
|
||||||
import * as path from 'node:path';
|
import * as path from 'node:path';
|
||||||
import { spawn } from 'node:child_process';
|
import { spawn } from 'node:child_process';
|
||||||
import { createWriteStream, openSync, writeSync, close } from 'node:fs';
|
import { createWriteStream, openSync, writeSync, close, readFileSync } from 'node:fs';
|
||||||
import { pipeline } from 'node:stream/promises';
|
import { pipeline } from 'node:stream/promises';
|
||||||
import { setTimeout } from 'timers/promises';
|
|
||||||
import { inspect } from 'node:util';
|
import { inspect } from 'node:util';
|
||||||
|
|
||||||
import * as core from '@actions/core';
|
import * as core from '@actions/core';
|
||||||
|
@ -17,7 +16,7 @@ const ENV_CACHE_DAEMONDIR = 'MAGIC_NIX_CACHE_DAEMONDIR';
|
||||||
|
|
||||||
const gotClient = got.extend({
|
const gotClient = got.extend({
|
||||||
retry: {
|
retry: {
|
||||||
limit: 5,
|
limit: 1,
|
||||||
methods: [ 'POST', 'GET', 'PUT', 'HEAD', 'DELETE', 'OPTIONS', 'TRACE' ],
|
methods: [ 'POST', 'GET', 'PUT', 'HEAD', 'DELETE', 'OPTIONS', 'TRACE' ],
|
||||||
},
|
},
|
||||||
hooks: {
|
hooks: {
|
||||||
|
@ -113,7 +112,7 @@ async function setUpAutoCache() {
|
||||||
runEnv = process.env;
|
runEnv = process.env;
|
||||||
}
|
}
|
||||||
|
|
||||||
const output = openSync(`${daemonDir}/parent.log`, 'a');
|
const output = openSync(`${daemonDir}/daemon.log`, 'a');
|
||||||
const launch = spawn(
|
const launch = spawn(
|
||||||
daemonBin,
|
daemonBin,
|
||||||
[
|
[
|
||||||
|
@ -187,7 +186,6 @@ async function tearDownAutoCache() {
|
||||||
const log = new Tail(path.join(daemonDir, 'daemon.log'));
|
const log = new Tail(path.join(daemonDir, 'daemon.log'));
|
||||||
core.debug(`tailing daemon.log...`);
|
core.debug(`tailing daemon.log...`);
|
||||||
log.on('line', (line) => {
|
log.on('line', (line) => {
|
||||||
core.debug(`got a log line`);
|
|
||||||
core.info(line);
|
core.info(line);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
@ -198,8 +196,6 @@ async function tearDownAutoCache() {
|
||||||
core.debug(`back from post`);
|
core.debug(`back from post`);
|
||||||
core.debug(res);
|
core.debug(res);
|
||||||
} finally {
|
} finally {
|
||||||
await setTimeout(5000);
|
|
||||||
|
|
||||||
core.debug(`unwatching the daemon log`);
|
core.debug(`unwatching the daemon log`);
|
||||||
log.unwatch();
|
log.unwatch();
|
||||||
}
|
}
|
||||||
|
@ -211,6 +207,12 @@ async function tearDownAutoCache() {
|
||||||
if (e.code !== 'ESRCH') {
|
if (e.code !== 'ESRCH') {
|
||||||
throw e;
|
throw e;
|
||||||
}
|
}
|
||||||
|
} finally {
|
||||||
|
if (core.isDebug()) {
|
||||||
|
core.info("Entire log:");
|
||||||
|
const log = readFileSync(path.join(daemonDir, 'daemon.log'));
|
||||||
|
core.info(log.toString());
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue