mirror of
https://github.com/DeterminateSystems/magic-nix-cache-action.git
synced 2024-12-27 01:30:35 +01:00
Always log status code and body
This commit is contained in:
parent
ec531ea91f
commit
afefc2fc85
3 changed files with 24 additions and 17 deletions
17
dist/index.js
generated
vendored
17
dist/index.js
generated
vendored
|
@ -94811,6 +94811,7 @@ var MagicNixCacheAction = class {
|
||||||
requireNix: "warn"
|
requireNix: "warn"
|
||||||
});
|
});
|
||||||
this.strictMode = inputs_exports.getBool("strict-mode");
|
this.strictMode = inputs_exports.getBool("strict-mode");
|
||||||
|
this.hostAndPort = inputs_exports.getString("listen");
|
||||||
this.client = got_dist_source.extend({
|
this.client = got_dist_source.extend({
|
||||||
retry: {
|
retry: {
|
||||||
limit: 1,
|
limit: 1,
|
||||||
|
@ -94908,7 +94909,6 @@ var MagicNixCacheAction = class {
|
||||||
const log = tailLog(this.daemonDir);
|
const log = tailLog(this.daemonDir);
|
||||||
const netrc = await netrcPath();
|
const netrc = await netrcPath();
|
||||||
const nixConfPath = `${process.env["HOME"]}/.config/nix/nix.conf`;
|
const nixConfPath = `${process.env["HOME"]}/.config/nix/nix.conf`;
|
||||||
const hostAndPort = inputs_exports.getString("listen");
|
|
||||||
const upstreamCache = inputs_exports.getString("upstream-cache");
|
const upstreamCache = inputs_exports.getString("upstream-cache");
|
||||||
const diagnosticEndpoint = inputs_exports.getString("diagnostic-endpoint");
|
const diagnosticEndpoint = inputs_exports.getString("diagnostic-endpoint");
|
||||||
const useFlakeHub = inputs_exports.getBool("use-flakehub");
|
const useFlakeHub = inputs_exports.getBool("use-flakehub");
|
||||||
|
@ -94920,7 +94920,7 @@ var MagicNixCacheAction = class {
|
||||||
"--startup-notification-url",
|
"--startup-notification-url",
|
||||||
`http://127.0.0.1:${notifyPort}`,
|
`http://127.0.0.1:${notifyPort}`,
|
||||||
"--listen",
|
"--listen",
|
||||||
hostAndPort,
|
this.hostAndPort,
|
||||||
"--upstream",
|
"--upstream",
|
||||||
upstreamCache,
|
upstreamCache,
|
||||||
"--diagnostic-endpoint",
|
"--diagnostic-endpoint",
|
||||||
|
@ -94995,9 +94995,11 @@ var MagicNixCacheAction = class {
|
||||||
}
|
}
|
||||||
try {
|
try {
|
||||||
core.debug(`Indicating workflow start`);
|
core.debug(`Indicating workflow start`);
|
||||||
const hostAndPort = inputs_exports.getString("listen");
|
|
||||||
const res = await this.client.post(
|
const res = await this.client.post(
|
||||||
`http://${hostAndPort}/api/workflow-start`
|
`http://${this.hostAndPort}/api/workflow-start`
|
||||||
|
);
|
||||||
|
core.debug(
|
||||||
|
`post to /api/workflow-start (status: ${res.statusCode}, body: ${res.body})`
|
||||||
);
|
);
|
||||||
if (res.statusCode !== 200) {
|
if (res.statusCode !== 200) {
|
||||||
this.failInStrictMode(
|
this.failInStrictMode(
|
||||||
|
@ -95028,16 +95030,17 @@ var MagicNixCacheAction = class {
|
||||||
const log = tailLog(this.daemonDir);
|
const log = tailLog(this.daemonDir);
|
||||||
try {
|
try {
|
||||||
core.debug(`about to post to localhost`);
|
core.debug(`about to post to localhost`);
|
||||||
const hostAndPort = inputs_exports.getString("listen");
|
|
||||||
const res = await this.client.post(
|
const res = await this.client.post(
|
||||||
`http://${hostAndPort}/api/workflow-finish`
|
`http://${this.hostAndPort}/api/workflow-finish`
|
||||||
|
);
|
||||||
|
core.debug(
|
||||||
|
`post to /api/workflow-finish (status: ${res.statusCode}, body: ${res.body})`
|
||||||
);
|
);
|
||||||
if (res.statusCode !== 200) {
|
if (res.statusCode !== 200) {
|
||||||
this.failInStrictMode(
|
this.failInStrictMode(
|
||||||
`Failed to trigger workflow finish hook; expected status 200 but got ${res.statusCode}`
|
`Failed to trigger workflow finish hook; expected status 200 but got ${res.statusCode}`
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
core.debug(`back from post: ${res.body}`);
|
|
||||||
} finally {
|
} finally {
|
||||||
core.debug(`unwatching the daemon log`);
|
core.debug(`unwatching the daemon log`);
|
||||||
log.unwatch();
|
log.unwatch();
|
||||||
|
|
2
dist/index.js.map
generated
vendored
2
dist/index.js.map
generated
vendored
File diff suppressed because one or more lines are too long
22
src/index.ts
22
src/index.ts
|
@ -29,6 +29,7 @@ const TEXT_TRUST_UNKNOWN =
|
||||||
class MagicNixCacheAction {
|
class MagicNixCacheAction {
|
||||||
idslib: IdsToolbox;
|
idslib: IdsToolbox;
|
||||||
private strictMode: boolean;
|
private strictMode: boolean;
|
||||||
|
private hostAndPort: string;
|
||||||
private client: Got;
|
private client: Got;
|
||||||
|
|
||||||
noopMode: boolean;
|
noopMode: boolean;
|
||||||
|
@ -44,6 +45,7 @@ class MagicNixCacheAction {
|
||||||
});
|
});
|
||||||
|
|
||||||
this.strictMode = inputs.getBool("strict-mode");
|
this.strictMode = inputs.getBool("strict-mode");
|
||||||
|
this.hostAndPort = inputs.getString("listen");
|
||||||
|
|
||||||
this.client = got.extend({
|
this.client = got.extend({
|
||||||
retry: {
|
retry: {
|
||||||
|
@ -159,8 +161,6 @@ class MagicNixCacheAction {
|
||||||
const log = tailLog(this.daemonDir);
|
const log = tailLog(this.daemonDir);
|
||||||
const netrc = await netrcPath();
|
const netrc = await netrcPath();
|
||||||
const nixConfPath = `${process.env["HOME"]}/.config/nix/nix.conf`;
|
const nixConfPath = `${process.env["HOME"]}/.config/nix/nix.conf`;
|
||||||
|
|
||||||
const hostAndPort = inputs.getString("listen");
|
|
||||||
const upstreamCache = inputs.getString("upstream-cache");
|
const upstreamCache = inputs.getString("upstream-cache");
|
||||||
const diagnosticEndpoint = inputs.getString("diagnostic-endpoint");
|
const diagnosticEndpoint = inputs.getString("diagnostic-endpoint");
|
||||||
const useFlakeHub = inputs.getBool("use-flakehub");
|
const useFlakeHub = inputs.getBool("use-flakehub");
|
||||||
|
@ -173,7 +173,7 @@ class MagicNixCacheAction {
|
||||||
"--startup-notification-url",
|
"--startup-notification-url",
|
||||||
`http://127.0.0.1:${notifyPort}`,
|
`http://127.0.0.1:${notifyPort}`,
|
||||||
"--listen",
|
"--listen",
|
||||||
hostAndPort,
|
this.hostAndPort,
|
||||||
"--upstream",
|
"--upstream",
|
||||||
upstreamCache,
|
upstreamCache,
|
||||||
"--diagnostic-endpoint",
|
"--diagnostic-endpoint",
|
||||||
|
@ -273,9 +273,12 @@ class MagicNixCacheAction {
|
||||||
|
|
||||||
try {
|
try {
|
||||||
actionsCore.debug(`Indicating workflow start`);
|
actionsCore.debug(`Indicating workflow start`);
|
||||||
const hostAndPort = inputs.getString("listen");
|
|
||||||
const res: Response<string> = await this.client.post(
|
const res: Response<string> = await this.client.post(
|
||||||
`http://${hostAndPort}/api/workflow-start`,
|
`http://${this.hostAndPort}/api/workflow-start`,
|
||||||
|
);
|
||||||
|
|
||||||
|
actionsCore.debug(
|
||||||
|
`post to /api/workflow-start (status: ${res.statusCode}, body: ${res.body})`,
|
||||||
);
|
);
|
||||||
|
|
||||||
if (res.statusCode !== 200) {
|
if (res.statusCode !== 200) {
|
||||||
|
@ -313,9 +316,12 @@ class MagicNixCacheAction {
|
||||||
|
|
||||||
try {
|
try {
|
||||||
actionsCore.debug(`about to post to localhost`);
|
actionsCore.debug(`about to post to localhost`);
|
||||||
const hostAndPort = inputs.getString("listen");
|
|
||||||
const res: Response<string> = await this.client.post(
|
const res: Response<string> = await this.client.post(
|
||||||
`http://${hostAndPort}/api/workflow-finish`,
|
`http://${this.hostAndPort}/api/workflow-finish`,
|
||||||
|
);
|
||||||
|
|
||||||
|
actionsCore.debug(
|
||||||
|
`post to /api/workflow-finish (status: ${res.statusCode}, body: ${res.body})`,
|
||||||
);
|
);
|
||||||
|
|
||||||
if (res.statusCode !== 200) {
|
if (res.statusCode !== 200) {
|
||||||
|
@ -323,8 +329,6 @@ class MagicNixCacheAction {
|
||||||
`Failed to trigger workflow finish hook; expected status 200 but got ${res.statusCode}`,
|
`Failed to trigger workflow finish hook; expected status 200 but got ${res.statusCode}`,
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
actionsCore.debug(`back from post: ${res.body}`);
|
|
||||||
} finally {
|
} finally {
|
||||||
actionsCore.debug(`unwatching the daemon log`);
|
actionsCore.debug(`unwatching the daemon log`);
|
||||||
log.unwatch();
|
log.unwatch();
|
||||||
|
|
Loading…
Reference in a new issue