Compare commits

...

3 Commits

Author SHA1 Message Date
gustavderdrache 5f9e43ae73 pnpm run all 2025-06-23 12:43:41 -04:00
gustavderdrache 0b77516ea1 Bump detsys-ts PR reference 2025-06-23 11:40:39 -04:00
gustavderdrache 3610f32cba Track correlations (DeterminateSystems/detsys-ts#101) 2025-06-20 18:07:13 -04:00
3 changed files with 59 additions and 10 deletions
Generated Vendored
+54 -5
View File
@@ -93812,7 +93812,7 @@ const external_dns_promises_namespaceObject = __WEBPACK_EXTERNAL_createRequire(i
var cache = __nccwpck_require__(7389);
// EXTERNAL MODULE: external "child_process"
var external_child_process_ = __nccwpck_require__(5317);
;// CONCATENATED MODULE: ./node_modules/.pnpm/github.com+DeterminateSystems+detsys-ts@4bf247b1cb6b057abe94721ea1bfa131618e2b7f_qygv7jy5hm2oenc72q37xutlhi/node_modules/detsys-ts/dist/index.js
;// CONCATENATED MODULE: ./node_modules/.pnpm/github.com+DeterminateSystems+detsys-ts@4e79c5b32d326f3596e09300d5d5ce5e7a412786_objx2bnahfcrlmccv7oxmqb33m/node_modules/detsys-ts/dist/index.js
var __defProp = Object.defineProperty;
var __export = (target, all) => {
for (var name in all)
@@ -94256,7 +94256,8 @@ function identify(projectName) {
"GITHUB_REPOSITORY_OWNER",
"GITHUB_REPOSITORY_OWNER_ID"
])
}
},
is_ci: true
};
core.debug("Correlation data:");
core.debug(JSON.stringify(ident, null, 2));
@@ -94698,6 +94699,7 @@ var EVENT_ARTIFACT_CACHE_HIT = "artifact_cache_hit";
var EVENT_ARTIFACT_CACHE_MISS = "artifact_cache_miss";
var EVENT_ARTIFACT_CACHE_PERSIST = "artifact_cache_persist";
var EVENT_PREFLIGHT_REQUIRE_NIX_DENIED = "preflight-require-nix-denied";
var EVENT_STORE_IDENTITY_FAILED = "store_identity_failed";
var FACT_ARTIFACT_FETCHED_FROM_CACHE = "artifact_fetched_from_cache";
var FACT_ENDED_WITH_EXCEPTION = "ended_with_exception";
var FACT_FINAL_EXCEPTION = "final_exception";
@@ -94722,6 +94724,49 @@ var PROGRAM_NAME_CRASH_DENY_LIST = [
"nix-store-tests",
"nix-util-tests"
];
var determinateStateDir = "/var/lib/determinate";
var determinateIdentityFile = external_path_.join(determinateStateDir, "identity.json");
var isRoot = external_os_.userInfo().uid === 0;
async function sudoEnsureDeterminateStateDir() {
const code = await exec.exec("sudo", [
"mkdir",
"-p",
determinateStateDir
]);
if (code !== 0) {
throw new Error(`sudo mkdir -p exit: ${code}`);
}
}
async function ensureDeterminateStateDir() {
if (isRoot) {
await (0,promises_namespaceObject.mkdir)(determinateStateDir, { recursive: true });
} else {
return sudoEnsureDeterminateStateDir();
}
}
async function sudoWriteCorrelationHashes(hashes) {
const buffer = Buffer.from(hashes);
const code = await exec.exec(
"sudo",
["tee", determinateIdentityFile],
{
input: buffer,
// Ignore output from tee
outStream: (0,external_fs_.createWriteStream)("/dev/null")
}
);
if (code !== 0) {
throw new Error(`sudo tee exit: ${code}`);
}
}
async function writeCorrelationHashes(hashes) {
await ensureDeterminateStateDir();
if (isRoot) {
await promises_namespaceObject.writeFile(determinateIdentityFile, hashes, "utf-8");
} else {
return sudoWriteCorrelationHashes(hashes);
}
}
var DetSysAction = class {
determineExecutionPhase() {
const currentPhase = core.getState(STATE_KEY_EXECUTION_PHASE);
@@ -94900,9 +94945,13 @@ var DetSysAction = class {
async executeAsync() {
try {
await this.checkIn();
process.env.DETSYS_CORRELATION = JSON.stringify(
this.getCorrelationHashes()
);
const correlationHashes = JSON.stringify(this.getCorrelationHashes());
process.env.DETSYS_CORRELATION = correlationHashes;
try {
await writeCorrelationHashes(correlationHashes);
} catch (error3) {
this.recordEvent(EVENT_STORE_IDENTITY_FAILED, { error: String(error3) });
}
if (!await this.preflightRequireNix()) {
this.recordEvent(EVENT_PREFLIGHT_REQUIRE_NIX_DENIED);
return;
+1 -1
View File
@@ -29,7 +29,7 @@
"@actions/core": "^1.11.1",
"@actions/exec": "^1.1.1",
"@actions/github": "^6.0.1",
"detsys-ts": "github:DeterminateSystems/detsys-ts",
"detsys-ts": "github:DeterminateSystems/detsys-ts#gustavderdrache/write-correlation",
"got": "^14.4.7",
"string-argv": "^0.3.2",
"vitest": "^3.2.0"
+4 -4
View File
@@ -15,8 +15,8 @@ dependencies:
specifier: ^6.0.1
version: 6.0.1
detsys-ts:
specifier: github:DeterminateSystems/detsys-ts
version: github.com/DeterminateSystems/detsys-ts/4bf247b1cb6b057abe94721ea1bfa131618e2b7f
specifier: github:DeterminateSystems/detsys-ts#gustavderdrache/write-correlation
version: github.com/DeterminateSystems/detsys-ts/4e79c5b32d326f3596e09300d5d5ce5e7a412786
got:
specifier: ^14.4.7
version: 14.4.7
@@ -6380,10 +6380,10 @@ packages:
engines: { node: ">=10" }
dev: true
github.com/DeterminateSystems/detsys-ts/4bf247b1cb6b057abe94721ea1bfa131618e2b7f:
github.com/DeterminateSystems/detsys-ts/4e79c5b32d326f3596e09300d5d5ce5e7a412786:
resolution:
{
tarball: https://codeload.github.com/DeterminateSystems/detsys-ts/tar.gz/4bf247b1cb6b057abe94721ea1bfa131618e2b7f,
tarball: https://codeload.github.com/DeterminateSystems/detsys-ts/tar.gz/4e79c5b32d326f3596e09300d5d5ce5e7a412786,
}
name: detsys-ts
version: 1.0.0