Merge pull request #58 from DeterminateSystems/diff-store-fact

Add store diff fact
This commit is contained in:
Luc Perkins 2024-05-29 15:38:31 -03:00 committed by GitHub
commit 7718b5acea
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
3 changed files with 21 additions and 11 deletions

12
dist/index.js generated vendored
View file

@ -95218,6 +95218,9 @@ async function flakeHubLogin(netrc) {
var ENV_DAEMON_DIR = "MAGIC_NIX_CACHE_DAEMONDIR";
var FACT_ENV_VARS_PRESENT = "required_env_vars_present";
var FACT_DIFF_STORE_ENABLED = "diff_store";
var FACT_NOOP_MODE = "noop_mode";
var STATE_DAEMONDIR = "MAGIC_NIX_CACHE_DAEMONDIR";
var STATE_STARTED = "MAGIC_NIX_CACHE_STARTED";
var STARTED_HINT = "true";
@ -95233,6 +95236,8 @@ var MagicNixCacheAction = class extends DetSysAction {
requireNix: "warn"
});
this.hostAndPort = inputs_exports.getString("listen");
this.diffStore = inputs_exports.getBool("diff-store");
this.addFact(FACT_DIFF_STORE_ENABLED, this.diffStore);
this.httpClient = got_dist_source.extend({
retry: {
limit: 1,
@ -95262,7 +95267,7 @@ var MagicNixCacheAction = class extends DetSysAction {
} else {
this.noopMode = process.env[ENV_DAEMON_DIR] !== this.daemonDir;
}
this.addFact("noop_mode", this.noopMode);
this.addFact(FACT_NOOP_MODE, this.noopMode);
this.stapleFile("daemon.log", external_node_path_namespaceObject.join(this.daemonDir, "daemon.log"));
}
async main() {
@ -95307,7 +95312,7 @@ var MagicNixCacheAction = class extends DetSysAction {
);
}
}
this.addFact("authenticated_env", !anyMissing);
this.addFact(FACT_ENV_VARS_PRESENT, !anyMissing);
if (anyMissing) {
return;
}
@ -95360,7 +95365,6 @@ var MagicNixCacheAction = class extends DetSysAction {
const flakeHubApiServer = inputs_exports.getString("flakehub-api-server");
const flakeHubFlakeName = inputs_exports.getString("flakehub-flake-name");
const useGhaCache = inputs_exports.getBool("use-gha-cache");
const diffStore = inputs_exports.getBool("diff-store");
const daemonCliFlags = [
"--startup-notification-url",
`http://127.0.0.1:${notifyPort}`,
@ -95372,7 +95376,7 @@ var MagicNixCacheAction = class extends DetSysAction {
diagnosticEndpoint,
"--nix-conf",
nixConfPath
].concat(diffStore ? ["--diff-store"] : []).concat(
].concat(this.diffStore ? ["--diff-store"] : []).concat(
useFlakeHub ? [
"--use-flakehub",
"--flakehub-cache-server",

2
dist/index.js.map generated vendored

File diff suppressed because one or more lines are too long

View file

@ -14,6 +14,10 @@ import { inspect } from "node:util";
// twice.
const ENV_DAEMON_DIR = "MAGIC_NIX_CACHE_DAEMONDIR";
const FACT_ENV_VARS_PRESENT = "required_env_vars_present";
const FACT_DIFF_STORE_ENABLED = "diff_store";
const FACT_NOOP_MODE = "noop_mode";
const STATE_DAEMONDIR = "MAGIC_NIX_CACHE_DAEMONDIR";
const STATE_STARTED = "MAGIC_NIX_CACHE_STARTED";
const STARTED_HINT = "true";
@ -27,9 +31,9 @@ const TEXT_TRUST_UNKNOWN =
class MagicNixCacheAction extends DetSysAction {
private hostAndPort: string;
private diffStore: boolean;
private httpClient: Got;
noopMode: boolean;
private noopMode: boolean;
private daemonDir: string;
private daemonStarted: boolean;
@ -42,6 +46,9 @@ class MagicNixCacheAction extends DetSysAction {
});
this.hostAndPort = inputs.getString("listen");
this.diffStore = inputs.getBool("diff-store");
this.addFact(FACT_DIFF_STORE_ENABLED, this.diffStore);
this.httpClient = got.extend({
retry: {
@ -75,7 +82,7 @@ class MagicNixCacheAction extends DetSysAction {
} else {
this.noopMode = process.env[ENV_DAEMON_DIR] !== this.daemonDir;
}
this.addFact("noop_mode", this.noopMode);
this.addFact(FACT_NOOP_MODE, this.noopMode);
this.stapleFile("daemon.log", path.join(this.daemonDir, "daemon.log"));
}
@ -130,7 +137,7 @@ class MagicNixCacheAction extends DetSysAction {
}
}
this.addFact("authenticated_env", !anyMissing);
this.addFact(FACT_ENV_VARS_PRESENT, !anyMissing);
if (anyMissing) {
return;
}
@ -192,7 +199,6 @@ class MagicNixCacheAction extends DetSysAction {
const flakeHubApiServer = inputs.getString("flakehub-api-server");
const flakeHubFlakeName = inputs.getString("flakehub-flake-name");
const useGhaCache = inputs.getBool("use-gha-cache");
const diffStore = inputs.getBool("diff-store");
const daemonCliFlags: string[] = [
"--startup-notification-url",
@ -206,7 +212,7 @@ class MagicNixCacheAction extends DetSysAction {
"--nix-conf",
nixConfPath,
]
.concat(diffStore ? ["--diff-store"] : [])
.concat(this.diffStore ? ["--diff-store"] : [])
.concat(
useFlakeHub
? [