@adea-ai/app-framework-release-tools 0.3.0 → 0.4.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cli.js +578 -111
- package/dist/index.js +202 -0
- package/dist/release-tools-source.json +1 -1
- package/package.json +1 -1
package/dist/cli.js
CHANGED
|
@@ -41,6 +41,7 @@ __export(exports_src, {
|
|
|
41
41
|
selectRetainedStep: () => selectRetainedStep,
|
|
42
42
|
signReleaseArtifact: () => signReleaseArtifact,
|
|
43
43
|
stageBuildStep: () => stageBuildStep,
|
|
44
|
+
stageLinuxPackagePair: () => stageLinuxPackagePair,
|
|
44
45
|
stagePlatformArtifacts: () => stagePlatformArtifacts,
|
|
45
46
|
stageReleaseDescriptors: () => stageReleaseDescriptors,
|
|
46
47
|
verifyDailyReleaseMatrix: () => verifyDailyReleaseMatrix,
|
|
@@ -49,10 +50,10 @@ __export(exports_src, {
|
|
|
49
50
|
});
|
|
50
51
|
|
|
51
52
|
// src/cli.ts
|
|
52
|
-
import { Effect as
|
|
53
|
+
import { Effect as Effect30 } from "effect";
|
|
53
54
|
|
|
54
55
|
// src/cli-commands.ts
|
|
55
|
-
import { Effect as
|
|
56
|
+
import { Effect as Effect29 } from "effect";
|
|
56
57
|
|
|
57
58
|
// ../../src/installer/hosted-runner.ts
|
|
58
59
|
import { isAbsolute } from "path";
|
|
@@ -8238,6 +8239,206 @@ var stageBuildStep = (context, directory, artifacts) => run2(context, stageBuild
|
|
|
8238
8239
|
var inspectStagedStep = (context, directory) => run2(context, inspectStagedStepEffect(context, directory));
|
|
8239
8240
|
var qualifyStep = (context, directory) => run2(context, qualifyStepEffect(context, directory));
|
|
8240
8241
|
var qualifyUpgradeStep = (context, directory, onStage) => run2(context, qualifyUpgradeStepEffect(context, directory, onStage));
|
|
8242
|
+
// src/library/linux-package-pair.ts
|
|
8243
|
+
import { execFile as execFile3 } from "child_process";
|
|
8244
|
+
import {
|
|
8245
|
+
chmod as chmod3,
|
|
8246
|
+
link,
|
|
8247
|
+
mkdir as mkdir11,
|
|
8248
|
+
mkdtemp as mkdtemp10,
|
|
8249
|
+
open as open13,
|
|
8250
|
+
readFile as readFile10,
|
|
8251
|
+
realpath as realpath10,
|
|
8252
|
+
rm as rm10,
|
|
8253
|
+
writeFile as writeFile11
|
|
8254
|
+
} from "fs/promises";
|
|
8255
|
+
import { dirname as dirname14, join as join34, resolve as resolve16 } from "path";
|
|
8256
|
+
import { promisify as promisify2 } from "util";
|
|
8257
|
+
var shasum = /^[a-f0-9]{64}$/;
|
|
8258
|
+
var basename15 = /^[a-zA-Z0-9][a-zA-Z0-9_.-]*$/;
|
|
8259
|
+
var validTag = /^v(?:0|[1-9]\d*)\.(?:0|[1-9]\d*)\.(?:0|[1-9]\d*)$/;
|
|
8260
|
+
var exec = promisify2(execFile3);
|
|
8261
|
+
function requireThat2(condition, message) {
|
|
8262
|
+
if (!condition)
|
|
8263
|
+
throw new Error(message);
|
|
8264
|
+
}
|
|
8265
|
+
function record2(value) {
|
|
8266
|
+
requireThat2(typeof value === "object" && value !== null && !Array.isArray(value), "Invalid producer receipt");
|
|
8267
|
+
return value;
|
|
8268
|
+
}
|
|
8269
|
+
function validIdentity(value) {
|
|
8270
|
+
const { name, size, sha256 } = record2(value);
|
|
8271
|
+
requireThat2(typeof name === "string" && basename15.test(name) && typeof size === "number" && Number.isSafeInteger(size) && size > 0 && typeof sha256 === "string" && shasum.test(sha256), "Invalid package artifact identity");
|
|
8272
|
+
return { name, size, sha256 };
|
|
8273
|
+
}
|
|
8274
|
+
var inspectWithNativeTools = async (tool, args) => {
|
|
8275
|
+
try {
|
|
8276
|
+
const { stdout } = await exec(tool, [...args], {
|
|
8277
|
+
encoding: "utf8",
|
|
8278
|
+
maxBuffer: 128 * 1024,
|
|
8279
|
+
timeout: 30000,
|
|
8280
|
+
env: { PATH: process.env.PATH, LC_ALL: "C" }
|
|
8281
|
+
});
|
|
8282
|
+
return stdout;
|
|
8283
|
+
} catch (error) {
|
|
8284
|
+
if (error.code === "ENOENT")
|
|
8285
|
+
throw new Error(`${tool} is required to inspect Linux package candidates`, { cause: error });
|
|
8286
|
+
throw new Error(`${tool} could not inspect Linux package candidate`, { cause: error });
|
|
8287
|
+
}
|
|
8288
|
+
};
|
|
8289
|
+
function parseDebianIdentity(text, packageName, version) {
|
|
8290
|
+
const fields = text.trimEnd().split(/\r?\n/);
|
|
8291
|
+
requireThat2(fields.length === 3 && new Set(fields).size === 3 && [`Package: ${packageName}`, `Version: ${version}`, "Architecture: amd64"].every((value) => fields.includes(value)), "Debian package name, version or architecture does not match the release policy");
|
|
8292
|
+
}
|
|
8293
|
+
function requireRegularDesktopEntry(listing, id) {
|
|
8294
|
+
const lines = listing.trimEnd().split(/\r?\n/);
|
|
8295
|
+
const fields = /^[d-][-rwxstST]{9} +\d+\/\d+ +\d+ +\d{4}-\d{2}-\d{2} \d{2}:\d{2} (.+)$/;
|
|
8296
|
+
requireThat2(lines.length === 2 && lines[0]?.startsWith("d") && fields.exec(lines[0])?.[1] === "squashfs-root" && lines[1]?.startsWith("-") && fields.exec(lines[1])?.[1] === `squashfs-root/${id}`, "AppImage must contain one regular root desktop entry");
|
|
8297
|
+
}
|
|
8298
|
+
function requireDesktopIdentity(text, name, version) {
|
|
8299
|
+
let inDesktop = false;
|
|
8300
|
+
let foundGroup = false;
|
|
8301
|
+
const fields = new Map;
|
|
8302
|
+
for (const line of text.split(/\r?\n/)) {
|
|
8303
|
+
if (/^\[.*\]$/.test(line)) {
|
|
8304
|
+
inDesktop = line === "[Desktop Entry]";
|
|
8305
|
+
if (inDesktop) {
|
|
8306
|
+
requireThat2(!foundGroup, "Duplicate AppImage desktop entry");
|
|
8307
|
+
foundGroup = true;
|
|
8308
|
+
}
|
|
8309
|
+
continue;
|
|
8310
|
+
}
|
|
8311
|
+
if (!inDesktop || !line || line.startsWith("#"))
|
|
8312
|
+
continue;
|
|
8313
|
+
const match = /^([^=]+)=(.*)$/.exec(line);
|
|
8314
|
+
requireThat2(match && !fields.has(match[1]), "Malformed or duplicate AppImage desktop fields");
|
|
8315
|
+
fields.set(match[1], match[2]);
|
|
8316
|
+
}
|
|
8317
|
+
requireThat2(fields.get("Type") === "Application" && fields.get("Name") === name && fields.get("X-AppImage-Version") === version, "AppImage desktop entry has wrong app identity or release version");
|
|
8318
|
+
}
|
|
8319
|
+
function digestWindow(runtime) {
|
|
8320
|
+
const sectionStart = Number(runtime.readBigUInt64LE(40));
|
|
8321
|
+
const sectionSize = runtime.readUInt16LE(58);
|
|
8322
|
+
const count = runtime.readUInt16LE(60);
|
|
8323
|
+
const namesIndex = runtime.readUInt16LE(62);
|
|
8324
|
+
requireThat2(Number.isSafeInteger(sectionStart) && sectionStart >= 64 && sectionSize === 64 && namesIndex < count && sectionStart + count * sectionSize <= runtime.length, "Invalid pinned AppImage runtime ELF section table");
|
|
8325
|
+
const namesHeader = sectionStart + sectionSize * namesIndex;
|
|
8326
|
+
const namesStart = Number(runtime.readBigUInt64LE(namesHeader + 24));
|
|
8327
|
+
const namesSize = Number(runtime.readBigUInt64LE(namesHeader + 32));
|
|
8328
|
+
requireThat2(Number.isSafeInteger(namesStart) && Number.isSafeInteger(namesSize) && namesStart >= 64 && namesStart + namesSize <= runtime.length, "Invalid pinned AppImage runtime ELF section names");
|
|
8329
|
+
const names = runtime.subarray(namesStart, namesStart + namesSize);
|
|
8330
|
+
const matches = [];
|
|
8331
|
+
for (let i = 0;i < count; i++) {
|
|
8332
|
+
const section = sectionStart + sectionSize * i;
|
|
8333
|
+
const nameAt = runtime.readUInt32LE(section);
|
|
8334
|
+
const end = names.indexOf(0, nameAt);
|
|
8335
|
+
if (end < 0 || names.toString("ascii", nameAt, end) !== ".digest_md5")
|
|
8336
|
+
continue;
|
|
8337
|
+
const dataAt = Number(runtime.readBigUInt64LE(section + 24));
|
|
8338
|
+
const dataSize = Number(runtime.readBigUInt64LE(section + 32));
|
|
8339
|
+
requireThat2(Number.isSafeInteger(dataAt) && Number.isSafeInteger(dataSize) && dataAt >= 64 && dataSize >= 16 && dataAt + dataSize <= runtime.length, "Invalid pinned AppImage runtime digest section");
|
|
8340
|
+
matches.push(dataAt);
|
|
8341
|
+
}
|
|
8342
|
+
requireThat2(matches.length === 1, "Expected one pinned AppImage runtime digest section");
|
|
8343
|
+
return matches[0];
|
|
8344
|
+
}
|
|
8345
|
+
function type2X64(bytes) {
|
|
8346
|
+
return bytes.length >= 64 && bytes.toString("hex", 0, 6) === "7f454c460201" && bytes.toString("hex", 8, 11) === "414902" && bytes.readUInt16LE(18) === 62;
|
|
8347
|
+
}
|
|
8348
|
+
async function verifyEmbeddedRuntime(path, runtime) {
|
|
8349
|
+
requireThat2(type2X64(runtime), "Expected a pinned Type 2 x86_64 AppImage runtime");
|
|
8350
|
+
const ignored = digestWindow(runtime);
|
|
8351
|
+
const fd = await open13(path, "r");
|
|
8352
|
+
try {
|
|
8353
|
+
const prefix = Buffer.alloc(runtime.length + 4);
|
|
8354
|
+
let filled = 0;
|
|
8355
|
+
while (filled < prefix.length) {
|
|
8356
|
+
const { bytesRead } = await fd.read(prefix, filled, prefix.length - filled, filled);
|
|
8357
|
+
if (!bytesRead)
|
|
8358
|
+
throw new Error("Incomplete embedded AppImage runtime or SquashFS header");
|
|
8359
|
+
filled += bytesRead;
|
|
8360
|
+
}
|
|
8361
|
+
requireThat2(type2X64(prefix), "Expected a Type 2 x86_64 AppImage");
|
|
8362
|
+
requireThat2(runtime.subarray(0, ignored).equals(prefix.subarray(0, ignored)) && runtime.subarray(ignored + 16).equals(prefix.subarray(ignored + 16, runtime.length)), "AppImage runtime differs from its trusted pin outside the tool-generated digest");
|
|
8363
|
+
requireThat2(prefix.toString("ascii", runtime.length) === "hsqs", "Missing embedded SquashFS at the pinned runtime offset");
|
|
8364
|
+
} finally {
|
|
8365
|
+
await fd.close();
|
|
8366
|
+
}
|
|
8367
|
+
}
|
|
8368
|
+
async function stageLinuxPackagePairWithInspection(options, inspect) {
|
|
8369
|
+
const { expected, sources } = options;
|
|
8370
|
+
const receipt = record2(options.producer);
|
|
8371
|
+
const archive = validIdentity(expected.archive);
|
|
8372
|
+
const runtime = validIdentity(expected.runtime);
|
|
8373
|
+
requireThat2(validTag.test(expected.tag) && /^[a-f0-9]{40}$/.test(expected.sourceSha) && basename15.test(expected.debName) && expected.debName.endsWith(".deb") && basename15.test(expected.appImageName) && expected.appImageName.endsWith(".AppImage") && archive.name.endsWith(".tar.zst") && /^[a-z0-9][a-z0-9+.-]+$/.test(expected.debPackage) && /^[A-Za-z0-9][A-Za-z0-9_.-]*\.desktop$/.test(expected.desktopId) && expected.desktopName.length > 0 && !/[\r\n]/.test(expected.desktopName) && Number.isSafeInteger(expected.runtime.size) && expected.runtime.size >= 64 && expected.runtime.size <= 64 * 1024 * 1024 && shasum.test(expected.runtime.sha256), "Invalid trusted Linux package policy");
|
|
8374
|
+
requireThat2(receipt.tag === expected.tag && receipt.sourceSha === expected.sourceSha && receipt.platform === "linux-x64" && receipt.updateArchiveSha256 === archive.sha256 && Array.isArray(receipt.artifacts) && receipt.artifacts.length === 2, "Package producer receipt names a different source, tag, platform or update archive");
|
|
8375
|
+
const names = [expected.debName, expected.appImageName];
|
|
8376
|
+
const artifacts = receipt.artifacts.map(validIdentity);
|
|
8377
|
+
const trustedArtifacts = expected.artifacts.map(validIdentity);
|
|
8378
|
+
requireThat2(trustedArtifacts.length === 2 && names.every((name) => {
|
|
8379
|
+
const fromProducer = artifacts.find((file) => file.name === name);
|
|
8380
|
+
const trusted = trustedArtifacts.find((file) => file.name === name);
|
|
8381
|
+
return fromProducer && trusted && trusted.size === fromProducer.size && trusted.sha256 === fromProducer.sha256;
|
|
8382
|
+
}), "Package producer receipt must describe exactly the protected DEB and AppImage");
|
|
8383
|
+
const destination = resolve16(options.output);
|
|
8384
|
+
const parent = await realpath10(dirname14(destination));
|
|
8385
|
+
const work = await mkdtemp10(join34(parent, ".linux-package-pair-"));
|
|
8386
|
+
try {
|
|
8387
|
+
const files = await runReleaseLibrary(provideLibraryPorts()(stageExpectedFilesEffect({
|
|
8388
|
+
directory: work,
|
|
8389
|
+
expected: [...names, archive.name, runtime.name],
|
|
8390
|
+
sources
|
|
8391
|
+
})));
|
|
8392
|
+
requireThat2([...artifacts, archive, runtime].every((asset) => files.some((file) => file.name === asset.name && file.size === asset.size && file.digest === `sha256:${asset.sha256}`)), "Staged package or update archive does not agree with its bound size and digest");
|
|
8393
|
+
const deb = join34(work, expected.debName);
|
|
8394
|
+
const image = join34(work, expected.appImageName);
|
|
8395
|
+
const version = expected.tag.slice(1);
|
|
8396
|
+
parseDebianIdentity(await inspect("dpkg-deb", ["--field", deb, "Package", "Version", "Architecture"]), expected.debPackage, version);
|
|
8397
|
+
await verifyEmbeddedRuntime(image, await readFile10(join34(work, runtime.name)));
|
|
8398
|
+
const offset = String(runtime.size);
|
|
8399
|
+
requireRegularDesktopEntry(await inspect("unsquashfs", [
|
|
8400
|
+
"-offset",
|
|
8401
|
+
offset,
|
|
8402
|
+
"-lln",
|
|
8403
|
+
"-no-wildcards",
|
|
8404
|
+
image,
|
|
8405
|
+
expected.desktopId
|
|
8406
|
+
]), expected.desktopId);
|
|
8407
|
+
requireDesktopIdentity(await inspect("unsquashfs", [
|
|
8408
|
+
"-offset",
|
|
8409
|
+
offset,
|
|
8410
|
+
"-cat",
|
|
8411
|
+
"-no-wildcards",
|
|
8412
|
+
image,
|
|
8413
|
+
expected.desktopId
|
|
8414
|
+
]), expected.desktopName, version);
|
|
8415
|
+
await chmod3(image, 493);
|
|
8416
|
+
const staged = {
|
|
8417
|
+
schema: "linux-package-pair/v1",
|
|
8418
|
+
tag: expected.tag,
|
|
8419
|
+
sourceSha: expected.sourceSha,
|
|
8420
|
+
platform: "linux-x64",
|
|
8421
|
+
updateArchiveSha256: archive.sha256,
|
|
8422
|
+
artifacts: names.map((name) => artifacts.find((file) => file.name === name))
|
|
8423
|
+
};
|
|
8424
|
+
await mkdir11(destination);
|
|
8425
|
+
try {
|
|
8426
|
+
for (const name of names)
|
|
8427
|
+
await link(join34(work, name), join34(destination, name));
|
|
8428
|
+
await writeFile11(join34(destination, "linux-package-pair.json"), JSON.stringify(staged) + `
|
|
8429
|
+
`, {
|
|
8430
|
+
flag: "wx"
|
|
8431
|
+
});
|
|
8432
|
+
} catch (error) {
|
|
8433
|
+
await rm10(destination, { recursive: true, force: true });
|
|
8434
|
+
throw error;
|
|
8435
|
+
}
|
|
8436
|
+
return staged;
|
|
8437
|
+
} finally {
|
|
8438
|
+
await rm10(work, { recursive: true, force: true });
|
|
8439
|
+
}
|
|
8440
|
+
}
|
|
8441
|
+
var stageLinuxPackagePair = (options) => stageLinuxPackagePairWithInspection(options, inspectWithNativeTools);
|
|
8241
8442
|
// src/framework-loader.ts
|
|
8242
8443
|
var releaseTools = async () => exports_src;
|
|
8243
8444
|
|
|
@@ -8259,25 +8460,280 @@ function electrobunArtifacts(appName, platform) {
|
|
|
8259
8460
|
}[platform];
|
|
8260
8461
|
}
|
|
8261
8462
|
|
|
8463
|
+
// src/library/daily-native-observer.ts
|
|
8464
|
+
import { execFile as execFile4 } from "child_process";
|
|
8465
|
+
import { createHash as createHash16, randomBytes as randomBytes3 } from "crypto";
|
|
8466
|
+
import { join as join35, resolve as resolve17 } from "path";
|
|
8467
|
+
import { Effect as Effect25 } from "effect";
|
|
8468
|
+
var runDailyNativeDriver = (script, input, env) => new Promise((finish, reject) => {
|
|
8469
|
+
const child = execFile4(process.execPath, ["--no-env-file", script], {
|
|
8470
|
+
cwd: input.profile,
|
|
8471
|
+
env,
|
|
8472
|
+
maxBuffer: 16 * 1024,
|
|
8473
|
+
timeout: 120000,
|
|
8474
|
+
killSignal: "SIGKILL",
|
|
8475
|
+
windowsHide: true
|
|
8476
|
+
}, (error, stdout) => {
|
|
8477
|
+
if (error)
|
|
8478
|
+
return reject(new Error("Native observer driver failed"));
|
|
8479
|
+
try {
|
|
8480
|
+
finish(JSON.parse(stdout));
|
|
8481
|
+
} catch {
|
|
8482
|
+
reject(new Error("Native observer driver did not emit one JSON result"));
|
|
8483
|
+
}
|
|
8484
|
+
});
|
|
8485
|
+
child.stdin?.on("error", () => {
|
|
8486
|
+
return;
|
|
8487
|
+
});
|
|
8488
|
+
child.stdin?.end(JSON.stringify(input) + `
|
|
8489
|
+
`);
|
|
8490
|
+
});
|
|
8491
|
+
function phaseEnvironment(env, profile) {
|
|
8492
|
+
const clean = {};
|
|
8493
|
+
for (const key of [
|
|
8494
|
+
"PATH",
|
|
8495
|
+
"SystemRoot",
|
|
8496
|
+
"WINDIR",
|
|
8497
|
+
"COMSPEC",
|
|
8498
|
+
"PATHEXT",
|
|
8499
|
+
"LANG",
|
|
8500
|
+
"LC_ALL",
|
|
8501
|
+
"DISPLAY",
|
|
8502
|
+
"XAUTHORITY",
|
|
8503
|
+
"DBUS_SESSION_BUS_ADDRESS",
|
|
8504
|
+
"CI",
|
|
8505
|
+
"GITHUB_ACTIONS",
|
|
8506
|
+
"RUNNER_ENVIRONMENT",
|
|
8507
|
+
"GITLAB_CI",
|
|
8508
|
+
"CI_JOB_ID",
|
|
8509
|
+
"CIRCLECI",
|
|
8510
|
+
"CIRCLE_BUILD_NUM",
|
|
8511
|
+
"FRAMEWORK_DISPOSABLE_RUNNER"
|
|
8512
|
+
]) {
|
|
8513
|
+
if (env[key])
|
|
8514
|
+
clean[key] = env[key];
|
|
8515
|
+
}
|
|
8516
|
+
return {
|
|
8517
|
+
...clean,
|
|
8518
|
+
HOME: profile,
|
|
8519
|
+
USERPROFILE: profile,
|
|
8520
|
+
LOCALAPPDATA: join35(profile, "LocalAppData"),
|
|
8521
|
+
XDG_CONFIG_HOME: join35(profile, ".config"),
|
|
8522
|
+
XDG_DATA_HOME: join35(profile, ".local", "share"),
|
|
8523
|
+
TEMP: join35(profile, "tmp"),
|
|
8524
|
+
TMP: join35(profile, "tmp"),
|
|
8525
|
+
TMPDIR: join35(profile, "tmp")
|
|
8526
|
+
};
|
|
8527
|
+
}
|
|
8528
|
+
function parseBaseline(value, target) {
|
|
8529
|
+
if (!isRecord(value) || !hasExactOwnKeys(value, ["kind", "tag", "sourceSha", "directory"]) || value.kind !== "published-installer" && value.kind !== "private-from-verified-payload" || !isReleaseTag(value.tag) || !versionLessThan(value.tag, target) || typeof value.sourceSha !== "string" || !isGitSha(value.sourceSha) || typeof value.directory !== "string" || !value.directory)
|
|
8530
|
+
throw new Error("Native observation needs declared exact older installer provenance");
|
|
8531
|
+
return {
|
|
8532
|
+
kind: value.kind,
|
|
8533
|
+
tag: value.tag,
|
|
8534
|
+
sourceSha: value.sourceSha,
|
|
8535
|
+
directory: value.directory
|
|
8536
|
+
};
|
|
8537
|
+
}
|
|
8538
|
+
function driverPath(value) {
|
|
8539
|
+
if (value.length > 240 || !/^[A-Za-z0-9_.-]+(?:\/[A-Za-z0-9_.-]+)*\.(?:ts|mjs)$/.test(value) || value.split("/").some((part) => part === "." || part === ".."))
|
|
8540
|
+
throw new Error("Invalid native observer path");
|
|
8541
|
+
return value;
|
|
8542
|
+
}
|
|
8543
|
+
var fixtureDigest = (nonce) => "sha256:" + createHash16("sha256").update(nonce).digest("hex");
|
|
8544
|
+
var confirmFixture = (value, nonce) => isRecord(value) && hasExactOwnKeys(value, ["digest"]) && value.digest === fixtureDigest(nonce);
|
|
8545
|
+
var observeDailyNativeEffect = (options, run) => Effect25.gen(function* () {
|
|
8546
|
+
const { env, platform: os, arch, cwd } = yield* ReleaseConfig;
|
|
8547
|
+
const fs = yield* ReleaseFs;
|
|
8548
|
+
const git = yield* ReleaseGit;
|
|
8549
|
+
const { identity, config, checkName } = options;
|
|
8550
|
+
yield* attempt(() => {
|
|
8551
|
+
assertHostedRunner(env, "Daily native observation");
|
|
8552
|
+
if (env.FRAMEWORK_DAILY_NATIVE_OBSERVER !== "test-only")
|
|
8553
|
+
throw new Error("Daily native observer is disabled without explicit test-only opt-in");
|
|
8554
|
+
assertDailyIdentity(identity);
|
|
8555
|
+
});
|
|
8556
|
+
const matrix = yield* attempt(() => planDailyReleaseMatrix(config, identity.tag));
|
|
8557
|
+
const check = matrix.checks.find((value) => value.name === checkName);
|
|
8558
|
+
if (!check)
|
|
8559
|
+
return yield* fail("Unknown Daily native check");
|
|
8560
|
+
const host = platformTargets[check.platform];
|
|
8561
|
+
if (os !== host[0] || arch !== host[1])
|
|
8562
|
+
return yield* fail(`Daily native check requires ${check.platform}`);
|
|
8563
|
+
if (os === "linux" && !env.DISPLAY)
|
|
8564
|
+
return yield* fail("Daily Linux native observer requires a display");
|
|
8565
|
+
const previous = check.format === "command" ? undefined : yield* attempt(() => parseBaseline(options.baseline, identity.tag));
|
|
8566
|
+
if (check.format === "command" && options.baseline !== undefined)
|
|
8567
|
+
return yield* fail("Command observation does not take an installer baseline");
|
|
8568
|
+
const prior = previous ? yield* attempt(() => priorDailyInstallerNames(config, previous.tag, check)) : undefined;
|
|
8569
|
+
if (previous && (!prior?.installer || previous.kind === "private-from-verified-payload" && !prior.payload))
|
|
8570
|
+
return yield* fail("Missing same-format baseline names");
|
|
8571
|
+
const path = yield* attempt(() => driverPath(options.driver));
|
|
8572
|
+
const revision = yield* step(() => git.run(["rev-parse", "HEAD"]));
|
|
8573
|
+
if (revision !== identity.sourceSha)
|
|
8574
|
+
return yield* fail("Native observer checkout does not match release source");
|
|
8575
|
+
const tree = yield* step(() => git.run(["ls-tree", revision, "--", path]));
|
|
8576
|
+
const blob = /^100(?:644|755) blob ([a-f0-9]{40})\t/.exec(tree)?.[1];
|
|
8577
|
+
if (!blob || tree.slice(tree.indexOf("\t") + 1) !== path)
|
|
8578
|
+
return yield* fail("Native observer is not a regular file of the pinned source");
|
|
8579
|
+
const temp = runnerTemp(env);
|
|
8580
|
+
if (!temp)
|
|
8581
|
+
return yield* fail("Daily native observation needs the runner temp directory");
|
|
8582
|
+
const tempStat = yield* step(() => fs.lstat(temp));
|
|
8583
|
+
if (!tempStat.isDirectory() || tempStat.isSymbolicLink())
|
|
8584
|
+
return yield* fail("Expected real runner temp directory");
|
|
8585
|
+
const root = yield* Effect25.acquireRelease(step(() => fs.mkdtemp(join35(temp, "daily-native-"))), (dir) => Effect25.promise(() => fs.rm(dir, { recursive: true, force: true })));
|
|
8586
|
+
const make = (name) => Effect25.gen(function* () {
|
|
8587
|
+
const dir = join35(root, name);
|
|
8588
|
+
yield* step(() => fs.mkdir(dir, { mode: 448 }));
|
|
8589
|
+
return dir;
|
|
8590
|
+
});
|
|
8591
|
+
const snapshot = (source, target, names) => Effect25.gen(function* () {
|
|
8592
|
+
const directory = resolve17(source);
|
|
8593
|
+
const info = yield* step(() => fs.lstat(directory));
|
|
8594
|
+
if (!info.isDirectory() || info.isSymbolicLink())
|
|
8595
|
+
return yield* fail("Expected real native input directory");
|
|
8596
|
+
return yield* stageExpectedFilesEffect({
|
|
8597
|
+
expected: names,
|
|
8598
|
+
directory: target,
|
|
8599
|
+
sources: Object.fromEntries(names.map((name) => [name, join35(directory, name)]))
|
|
8600
|
+
});
|
|
8601
|
+
});
|
|
8602
|
+
const scriptName = path.endsWith(".mjs") ? "observer.mjs" : "observer.ts";
|
|
8603
|
+
const script = join35(root, scriptName);
|
|
8604
|
+
yield* stageExpectedFilesEffect({
|
|
8605
|
+
directory: root,
|
|
8606
|
+
expected: [scriptName],
|
|
8607
|
+
sources: { [scriptName]: join35(cwd, path) }
|
|
8608
|
+
});
|
|
8609
|
+
const hash = yield* step(() => git.run(["hash-object", "--no-filters", "--", script]));
|
|
8610
|
+
if (hash !== blob)
|
|
8611
|
+
return yield* fail("Native observer file does not match its trusted source blob");
|
|
8612
|
+
const candidate = yield* make("candidate");
|
|
8613
|
+
const assets = yield* snapshot(options.artifacts, candidate, check.assets);
|
|
8614
|
+
const baseline = previous ? yield* make("baseline") : undefined;
|
|
8615
|
+
const baselineFiles = previous ? [
|
|
8616
|
+
prior.installer,
|
|
8617
|
+
...previous.kind === "private-from-verified-payload" ? [prior.payload] : []
|
|
8618
|
+
] : undefined;
|
|
8619
|
+
const earlier = previous && baseline ? yield* snapshot(previous.directory, baseline, baselineFiles) : undefined;
|
|
8620
|
+
const freshProfile = (name) => Effect25.gen(function* () {
|
|
8621
|
+
const dir = yield* make(name);
|
|
8622
|
+
yield* step(() => fs.mkdir(join35(dir, "tmp"), { mode: 448 }));
|
|
8623
|
+
return dir;
|
|
8624
|
+
});
|
|
8625
|
+
const fresh = yield* freshProfile("fresh");
|
|
8626
|
+
const call = (phase, profile, fixture) => step(async () => {
|
|
8627
|
+
if (await git.run(["hash-object", "--no-filters", "--", script]) !== blob)
|
|
8628
|
+
throw new Error("Native observer changed during qualification");
|
|
8629
|
+
const output = await run(script, {
|
|
8630
|
+
phase,
|
|
8631
|
+
tag: identity.tag,
|
|
8632
|
+
check: check.name,
|
|
8633
|
+
format: check.format,
|
|
8634
|
+
candidate,
|
|
8635
|
+
candidateFiles: check.assets,
|
|
8636
|
+
baseline,
|
|
8637
|
+
baselineFiles,
|
|
8638
|
+
baselineTag: previous?.tag,
|
|
8639
|
+
profile,
|
|
8640
|
+
fixture
|
|
8641
|
+
}, phaseEnvironment(env, profile));
|
|
8642
|
+
if (await git.run(["hash-object", "--no-filters", "--", script]) !== blob)
|
|
8643
|
+
throw new Error("Native observer changed during qualification");
|
|
8644
|
+
return output;
|
|
8645
|
+
}).pipe(Effect25.mapError(() => new Error(`Native observer phase failed: ${phase}`)));
|
|
8646
|
+
const installVersion = (phase, version, where) => Effect25.gen(function* () {
|
|
8647
|
+
const result = yield* call(phase, where);
|
|
8648
|
+
if (!isRecord(result) || !hasExactOwnKeys(result, ["version"]) || result.version !== version)
|
|
8649
|
+
return yield* fail(`Native observer did not observe the expected version: ${phase}`);
|
|
8650
|
+
return { version };
|
|
8651
|
+
});
|
|
8652
|
+
const launch = (phase, version, where) => Effect25.gen(function* () {
|
|
8653
|
+
const result = yield* call(phase, where);
|
|
8654
|
+
if (!isRecord(result) || !hasExactOwnKeys(result, ["version", "ready", "stopped"]) || result.version !== version || result.ready !== true || result.stopped !== true)
|
|
8655
|
+
return yield* fail(`Native observer did not observe a ready renderer: ${phase}`);
|
|
8656
|
+
return { version, ready: true };
|
|
8657
|
+
});
|
|
8658
|
+
const version = identity.tag.slice(1);
|
|
8659
|
+
let observations;
|
|
8660
|
+
if (previous && baseline && earlier) {
|
|
8661
|
+
const upgrade = yield* freshProfile("upgrade");
|
|
8662
|
+
const install = yield* installVersion("fresh-install", version, fresh);
|
|
8663
|
+
const launchedFresh = yield* launch("fresh-launch", version, fresh);
|
|
8664
|
+
const installedBefore = yield* installVersion("baseline-install", previous.tag.slice(1), upgrade);
|
|
8665
|
+
const nonce = randomBytes3(24).toString("hex");
|
|
8666
|
+
const before = yield* call("fixture-write", upgrade, nonce);
|
|
8667
|
+
if (!confirmFixture(before, nonce))
|
|
8668
|
+
return yield* fail("Native baseline did not observe synthetic fixture");
|
|
8669
|
+
const upgraded = yield* installVersion("upgrade-install", version, upgrade);
|
|
8670
|
+
const launched = yield* launch("upgrade-launch", version, upgrade);
|
|
8671
|
+
const after = yield* call("fixture-read", upgrade);
|
|
8672
|
+
if (!confirmFixture(after, nonce))
|
|
8673
|
+
return yield* fail("Native upgrade did not retain synthetic fixture");
|
|
8674
|
+
observations = {
|
|
8675
|
+
install,
|
|
8676
|
+
launch: launchedFresh,
|
|
8677
|
+
upgrade: {
|
|
8678
|
+
baselineTag: previous.tag,
|
|
8679
|
+
baselineAsset: earlier[0],
|
|
8680
|
+
baselineOrigin: {
|
|
8681
|
+
kind: previous.kind,
|
|
8682
|
+
sourceSha: previous.sourceSha,
|
|
8683
|
+
...earlier[1] ? { payload: earlier[1] } : {}
|
|
8684
|
+
},
|
|
8685
|
+
baselineVersion: installedBefore.version,
|
|
8686
|
+
upgradedVersion: upgraded.version,
|
|
8687
|
+
ready: launched.ready,
|
|
8688
|
+
fixtureBefore: fixtureDigest(nonce),
|
|
8689
|
+
fixtureAfter: fixtureDigest(nonce)
|
|
8690
|
+
}
|
|
8691
|
+
};
|
|
8692
|
+
} else {
|
|
8693
|
+
const install = yield* installVersion("command-install", version, fresh);
|
|
8694
|
+
const command = yield* call("command-probe", fresh);
|
|
8695
|
+
observations = { install, command };
|
|
8696
|
+
}
|
|
8697
|
+
return yield* createDailyNativeReceiptEffect({
|
|
8698
|
+
config,
|
|
8699
|
+
identity,
|
|
8700
|
+
checkName,
|
|
8701
|
+
artifacts: candidate,
|
|
8702
|
+
baselineArtifacts: baseline,
|
|
8703
|
+
report: {
|
|
8704
|
+
schema: "framework/daily-native-job/v1",
|
|
8705
|
+
...identity,
|
|
8706
|
+
appId: matrix.appId,
|
|
8707
|
+
profile: matrix.profile,
|
|
8708
|
+
check: check.name,
|
|
8709
|
+
platform: check.platform,
|
|
8710
|
+
format: check.format,
|
|
8711
|
+
host: { os, arch },
|
|
8712
|
+
assets,
|
|
8713
|
+
observations
|
|
8714
|
+
}
|
|
8715
|
+
}, { os, arch });
|
|
8716
|
+
}).pipe(Effect25.scoped);
|
|
8717
|
+
|
|
8262
8718
|
// src/library/daily-batch.ts
|
|
8263
|
-
import { join as
|
|
8264
|
-
import { Effect as
|
|
8265
|
-
var stageDailyBatchEffect = (options) =>
|
|
8719
|
+
import { join as join36, resolve as resolve18 } from "path";
|
|
8720
|
+
import { Effect as Effect26, Exit as Exit4 } from "effect";
|
|
8721
|
+
var stageDailyBatchEffect = (options) => Effect26.gen(function* () {
|
|
8266
8722
|
const fs = yield* ReleaseFs;
|
|
8267
|
-
const parent =
|
|
8723
|
+
const parent = resolve18(options.parent);
|
|
8268
8724
|
const root = yield* step(() => fs.lstat(parent));
|
|
8269
8725
|
if (!root.isDirectory() || root.isSymbolicLink())
|
|
8270
8726
|
return yield* fail("Daily staging needs an existing real scratch parent");
|
|
8271
8727
|
const original = yield* verifyDailyReleaseMatrixEffect(options);
|
|
8272
8728
|
const plan = yield* attempt(() => planDailyReleaseMatrix(options.config, options.identity.tag));
|
|
8273
|
-
const directory = yield*
|
|
8274
|
-
const copy = (source, name, expected) =>
|
|
8275
|
-
const target =
|
|
8729
|
+
const directory = yield* Effect26.acquireRelease(step(() => fs.mkdtemp(join36(parent, "daily-candidate-"))), (path, exit) => Exit4.isSuccess(exit) ? Effect26.void : Effect26.promise(() => fs.rm(path, { recursive: true, force: true })));
|
|
8730
|
+
const copy = (source, name, expected) => Effect26.gen(function* () {
|
|
8731
|
+
const target = join36(directory, name);
|
|
8276
8732
|
yield* step(() => fs.mkdir(target, { mode: 448 }));
|
|
8277
8733
|
yield* stageExpectedFilesEffect({
|
|
8278
8734
|
expected,
|
|
8279
8735
|
directory: target,
|
|
8280
|
-
sources: Object.fromEntries(expected.map((file) => [file,
|
|
8736
|
+
sources: Object.fromEntries(expected.map((file) => [file, join36(source, file)]))
|
|
8281
8737
|
});
|
|
8282
8738
|
return target;
|
|
8283
8739
|
});
|
|
@@ -8287,26 +8743,26 @@ var stageDailyBatchEffect = (options) => Effect25.gen(function* () {
|
|
|
8287
8743
|
if (original.assets.some((a, index) => a.name !== staged.assets[index]?.name || a.size !== staged.assets[index]?.size || a.digest !== staged.assets[index]?.digest))
|
|
8288
8744
|
return yield* fail("Daily inputs changed between inspection and local staging");
|
|
8289
8745
|
const manifest = { schema: "framework/daily-staged-batch/v1", ...staged };
|
|
8290
|
-
yield* step(() => fs.writeFile(
|
|
8746
|
+
yield* step(() => fs.writeFile(join36(directory, "candidate.json"), JSON.stringify(manifest) + `
|
|
8291
8747
|
`, {
|
|
8292
8748
|
flag: "wx",
|
|
8293
8749
|
mode: 384
|
|
8294
8750
|
}));
|
|
8295
8751
|
return { directory, ...manifest };
|
|
8296
|
-
}).pipe(
|
|
8752
|
+
}).pipe(Effect26.scoped);
|
|
8297
8753
|
|
|
8298
8754
|
// src/cli-runner.ts
|
|
8299
|
-
import { Cause as Cause3, Effect as
|
|
8755
|
+
import { Cause as Cause3, Effect as Effect27, Exit as Exit5 } from "effect";
|
|
8300
8756
|
function failureError(cause) {
|
|
8301
8757
|
const error = Cause3.squash(cause);
|
|
8302
8758
|
if (error instanceof ReleaseFailure)
|
|
8303
8759
|
return new Error(error.message);
|
|
8304
8760
|
return error instanceof Error ? error : new Error(String(error));
|
|
8305
8761
|
}
|
|
8306
|
-
var runCommand = (failure, program, options = {}) =>
|
|
8762
|
+
var runCommand = (failure, program, options = {}) => Effect27.gen(function* () {
|
|
8307
8763
|
const { env } = yield* ReleaseConfig;
|
|
8308
8764
|
const output = yield* ReleaseOutput;
|
|
8309
|
-
const exit = yield*
|
|
8765
|
+
const exit = yield* Effect27.exit(options.requireGitHubActions && env.GITHUB_ACTIONS !== "true" ? refuse("untrusted", "Invalid workflow invocation") : program);
|
|
8310
8766
|
if (Exit5.isSuccess(exit))
|
|
8311
8767
|
return 0;
|
|
8312
8768
|
if (Cause3.hasInterruptsOnly(exit.cause))
|
|
@@ -8317,7 +8773,7 @@ var runCommand = (failure, program, options = {}) => Effect26.gen(function* () {
|
|
|
8317
8773
|
return 1;
|
|
8318
8774
|
});
|
|
8319
8775
|
var readReleaseConfig = (path) => readBoundedJson(path, 262144);
|
|
8320
|
-
var readBoundedJson = (path, maxBytes, name = "configuration file") =>
|
|
8776
|
+
var readBoundedJson = (path, maxBytes, name = "configuration file") => Effect27.gen(function* () {
|
|
8321
8777
|
const fs = yield* ReleaseFs;
|
|
8322
8778
|
const info = yield* step(() => fs.lstat(path));
|
|
8323
8779
|
if (!info.isFile() || info.size < 1 || info.size > maxBytes)
|
|
@@ -8327,27 +8783,27 @@ var readBoundedJson = (path, maxBytes, name = "configuration file") => Effect26.
|
|
|
8327
8783
|
return yield* refuse("file-changed", `${name[0].toUpperCase()}${name.slice(1)} changed`);
|
|
8328
8784
|
return yield* step(async () => JSON.parse(bytes.toString("utf8")));
|
|
8329
8785
|
});
|
|
8330
|
-
var provideLivePorts = (program) => program.pipe(
|
|
8786
|
+
var provideLivePorts = (program) => program.pipe(Effect27.provideService(ReleaseConfig, {
|
|
8331
8787
|
env: process.env,
|
|
8332
8788
|
platform: process.platform,
|
|
8333
8789
|
arch: process.arch,
|
|
8334
8790
|
cwd: process.cwd()
|
|
8335
|
-
}),
|
|
8791
|
+
}), Effect27.provideService(ReleaseOutput, {
|
|
8336
8792
|
stdout: (text) => void process.stdout.write(text),
|
|
8337
8793
|
stderr: (text) => void process.stderr.write(text)
|
|
8338
|
-
}),
|
|
8794
|
+
}), Effect27.provideService(ReleaseGit, { run: gitRun }), Effect27.provideService(ReleaseGitHub, { run: ghRun, withEnvironment: ghRunWith }), Effect27.provideService(ReleaseFetch, { fetch }), Effect27.provideService(ReleaseClock, {
|
|
8339
8795
|
sleep: (milliseconds) => Bun.sleep(milliseconds),
|
|
8340
8796
|
now: () => new Date().toISOString()
|
|
8341
|
-
}),
|
|
8797
|
+
}), Effect27.provideService(ReleaseFs, nodeFs), Effect27.provideService(ReleaseSigning, {
|
|
8342
8798
|
privateKey: environmentKey(process.env),
|
|
8343
8799
|
codesign: codesignRun
|
|
8344
8800
|
}));
|
|
8345
8801
|
|
|
8346
8802
|
// src/commands/prepare-stable-catalog.ts
|
|
8347
|
-
import { createHash as
|
|
8803
|
+
import { createHash as createHash17 } from "crypto";
|
|
8348
8804
|
import { createReadStream } from "fs";
|
|
8349
|
-
import { lstat as lstat20, mkdir as
|
|
8350
|
-
import { basename as
|
|
8805
|
+
import { lstat as lstat20, mkdir as mkdir12, readFile as readFile11, rm as rm11, writeFile as writeFile12 } from "fs/promises";
|
|
8806
|
+
import { basename as basename16, dirname as dirname15, join as join37 } from "path";
|
|
8351
8807
|
|
|
8352
8808
|
// src/library/stable-catalogs.ts
|
|
8353
8809
|
function object(value) {
|
|
@@ -8511,7 +8967,7 @@ var read2 = async (path) => {
|
|
|
8511
8967
|
const stat = await lstat20(path);
|
|
8512
8968
|
if (!stat.isFile() || stat.size > 1024 * 1024)
|
|
8513
8969
|
throw new Error("Expected bounded ordinary JSON file");
|
|
8514
|
-
return JSON.parse(await
|
|
8970
|
+
return JSON.parse(await readFile11(path, "utf8"));
|
|
8515
8971
|
};
|
|
8516
8972
|
async function prepareStableCatalogCommand(args) {
|
|
8517
8973
|
const [
|
|
@@ -8531,7 +8987,7 @@ async function prepareStableCatalogCommand(args) {
|
|
|
8531
8987
|
const st = await lstat20(artifact);
|
|
8532
8988
|
if (!st.isFile())
|
|
8533
8989
|
throw new Error("Expected ordinary installer file");
|
|
8534
|
-
const hash =
|
|
8990
|
+
const hash = createHash17("sha256");
|
|
8535
8991
|
for await (const chunk of createReadStream(artifact))
|
|
8536
8992
|
hash.update(chunk);
|
|
8537
8993
|
const files = prepareStableCatalog({
|
|
@@ -8542,31 +8998,31 @@ async function prepareStableCatalogCommand(args) {
|
|
|
8542
8998
|
receipt: await read2(receiptPath),
|
|
8543
8999
|
manifest: await read2(manifestPath),
|
|
8544
9000
|
stablePointer: stablePointerPath && await read2(stablePointerPath),
|
|
8545
|
-
measuredAsset: { name:
|
|
9001
|
+
measuredAsset: { name: basename16(artifact), size: st.size, sha256: hash.digest("hex") }
|
|
8546
9002
|
});
|
|
8547
|
-
await
|
|
9003
|
+
await mkdir12(out);
|
|
8548
9004
|
try {
|
|
8549
9005
|
for (const entry of files) {
|
|
8550
|
-
const target =
|
|
8551
|
-
await
|
|
8552
|
-
await
|
|
9006
|
+
const target = join37(out, entry.path);
|
|
9007
|
+
await mkdir12(dirname15(target), { recursive: true });
|
|
9008
|
+
await writeFile12(target, entry.contents, { flag: "wx" });
|
|
8553
9009
|
}
|
|
8554
9010
|
return { channel, phase, files: files.length };
|
|
8555
9011
|
} catch (error) {
|
|
8556
|
-
await
|
|
9012
|
+
await rm11(out, { recursive: true, force: true });
|
|
8557
9013
|
throw error;
|
|
8558
9014
|
}
|
|
8559
9015
|
}
|
|
8560
9016
|
|
|
8561
9017
|
// src/library/apt/stage-apt-repository.ts
|
|
8562
9018
|
import { spawnSync as spawnSync2 } from "child_process";
|
|
8563
|
-
import { mkdir as
|
|
8564
|
-
import { dirname as
|
|
9019
|
+
import { mkdir as mkdir13, readFile as readFile12, rm as rm12, writeFile as writeFile13 } from "fs/promises";
|
|
9020
|
+
import { dirname as dirname16, isAbsolute as isAbsolute6, join as join38 } from "path";
|
|
8565
9021
|
|
|
8566
9022
|
// src/library/apt/apt-metadata.ts
|
|
8567
|
-
import { createHash as
|
|
9023
|
+
import { createHash as createHash18 } from "crypto";
|
|
8568
9024
|
import { gzipSync } from "zlib";
|
|
8569
|
-
var sha256 = (data) =>
|
|
9025
|
+
var sha256 = (data) => createHash18("sha256").update(data).digest("hex");
|
|
8570
9026
|
function stageAptMetadata({ policy, tag, assets, deb, control, now }) {
|
|
8571
9027
|
if (!/^v(?:0|[1-9][0-9]*)\.(?:0|[1-9][0-9]*)\.(?:0|[1-9][0-9]*)$/.test(tag))
|
|
8572
9028
|
throw new Error("Invalid release tag");
|
|
@@ -8649,22 +9105,22 @@ function cmd(program, options, label) {
|
|
|
8649
9105
|
return run.stdout;
|
|
8650
9106
|
}
|
|
8651
9107
|
async function add(path, bytes) {
|
|
8652
|
-
await
|
|
8653
|
-
await
|
|
9108
|
+
await mkdir13(dirname16(path), { recursive: true });
|
|
9109
|
+
await writeFile13(path, bytes, { flag: "wx" });
|
|
8654
9110
|
}
|
|
8655
9111
|
async function stageAptRepositoryCommand(args) {
|
|
8656
9112
|
const [tag, policyPath, inventoryPath, packagePath, output, signingHome, trustedFingerprint] = args;
|
|
8657
9113
|
if (args.length !== 7 || !tag || !/^v(?:0|[1-9]\d*)\.(?:0|[1-9]\d*)\.(?:0|[1-9]\d*)$/.test(tag) || !policyPath || !inventoryPath || !packagePath || !output || !signingHome || !isAbsolute6(signingHome) || !trustedFingerprint || !/^[A-F0-9]{40}$/.test(trustedFingerprint))
|
|
8658
9114
|
throw new Error("Expected TAG POLICY VERIFIED_INVENTORY DEB NEW_OUTPUT GPG_HOME PINNED_FINGERPRINT");
|
|
8659
|
-
const policy = JSON.parse(await
|
|
8660
|
-
const inventory = JSON.parse(await
|
|
9115
|
+
const policy = JSON.parse(await readFile12(policyPath, "utf8"));
|
|
9116
|
+
const inventory = JSON.parse(await readFile12(inventoryPath, "utf8"));
|
|
8661
9117
|
if (inventory.tag !== tag || !Array.isArray(inventory.assets))
|
|
8662
9118
|
throw new Error("Verified inventory does not name requested release");
|
|
8663
|
-
const deb = await
|
|
8664
|
-
await
|
|
9119
|
+
const deb = await readFile12(packagePath);
|
|
9120
|
+
await mkdir13(output, { mode: 448 });
|
|
8665
9121
|
try {
|
|
8666
|
-
const stagedInput =
|
|
8667
|
-
await
|
|
9122
|
+
const stagedInput = join38(output, ".input.deb");
|
|
9123
|
+
await writeFile13(stagedInput, deb, { mode: 384, flag: "wx" });
|
|
8668
9124
|
const control = cmd("dpkg-deb", ["--field", stagedInput], "Debian control inspection failed");
|
|
8669
9125
|
const staged = stageAptMetadata({
|
|
8670
9126
|
policy,
|
|
@@ -8674,11 +9130,11 @@ async function stageAptRepositoryCommand(args) {
|
|
|
8674
9130
|
control,
|
|
8675
9131
|
now: new Date
|
|
8676
9132
|
});
|
|
8677
|
-
const base =
|
|
8678
|
-
await add(
|
|
9133
|
+
const base = join38(output, "dists", policy.suite);
|
|
9134
|
+
await add(join38(output, staged.packagePath), deb);
|
|
8679
9135
|
for (const [path, contents] of staged.files)
|
|
8680
|
-
await add(
|
|
8681
|
-
await add(
|
|
9136
|
+
await add(join38(base, path), contents);
|
|
9137
|
+
await add(join38(base, "Release"), staged.release);
|
|
8682
9138
|
const flags = [
|
|
8683
9139
|
"--batch",
|
|
8684
9140
|
"--no-tty",
|
|
@@ -8695,25 +9151,25 @@ async function stageAptRepositoryCommand(args) {
|
|
|
8695
9151
|
["InRelease", "--clearsign"],
|
|
8696
9152
|
["Release.gpg", "--detach-sign"]
|
|
8697
9153
|
]) {
|
|
8698
|
-
cmd("gpg", [...flags, "--armor", "--output",
|
|
9154
|
+
cmd("gpg", [...flags, "--armor", "--output", join38(base, name), mode, join38(base, "Release")], `Could not produce ${name} with the pinned signing identity`);
|
|
8699
9155
|
}
|
|
8700
9156
|
const { unlink } = await import("fs/promises");
|
|
8701
9157
|
await unlink(stagedInput);
|
|
8702
|
-
await add(
|
|
9158
|
+
await add(join38(output, "STAGED"), `${tag}
|
|
8703
9159
|
`);
|
|
8704
9160
|
return { tag, staged: true };
|
|
8705
9161
|
} catch (error) {
|
|
8706
|
-
await
|
|
9162
|
+
await rm12(output, { recursive: true, force: true });
|
|
8707
9163
|
throw error;
|
|
8708
9164
|
}
|
|
8709
9165
|
}
|
|
8710
9166
|
|
|
8711
9167
|
// src/linux-channel-proof-cli.ts
|
|
8712
9168
|
import { spawnSync as spawnSync3 } from "child_process";
|
|
8713
|
-
import { createHash as
|
|
9169
|
+
import { createHash as createHash19 } from "crypto";
|
|
8714
9170
|
import { createReadStream as createReadStream2 } from "fs";
|
|
8715
|
-
import { lstat as lstat21, readFile as
|
|
8716
|
-
import { join as
|
|
9171
|
+
import { lstat as lstat21, readFile as readFile13, realpath as realpath11 } from "fs/promises";
|
|
9172
|
+
import { join as join39 } from "path";
|
|
8717
9173
|
import { pathToFileURL } from "url";
|
|
8718
9174
|
function check(ok, message) {
|
|
8719
9175
|
if (!ok)
|
|
@@ -8721,7 +9177,7 @@ function check(ok, message) {
|
|
|
8721
9177
|
}
|
|
8722
9178
|
async function hash(path) {
|
|
8723
9179
|
check((await lstat21(path)).isFile(), "artifact must be a regular file");
|
|
8724
|
-
const digest =
|
|
9180
|
+
const digest = createHash19("sha256");
|
|
8725
9181
|
for await (const chunk of createReadStream2(path))
|
|
8726
9182
|
digest.update(chunk);
|
|
8727
9183
|
return digest.digest("hex");
|
|
@@ -8754,9 +9210,9 @@ async function verifyRpmStage(stage) {
|
|
|
8754
9210
|
check(/^[0-9a-f]{64}$/.test(artifact.sha256), "expected SHA-256");
|
|
8755
9211
|
check(await hash(artifact.path) === artifact.sha256, "staged artifact digest mismatch");
|
|
8756
9212
|
}
|
|
8757
|
-
const repo = await
|
|
8758
|
-
const keyUrl = pathToFileURL(await
|
|
8759
|
-
const config = options(await
|
|
9213
|
+
const repo = await realpath11(stage.repository);
|
|
9214
|
+
const keyUrl = pathToFileURL(await realpath11(stage.publicKey)).href;
|
|
9215
|
+
const config = options(await readFile13(stage.repoFile, "utf8"), stage.repoId);
|
|
8760
9216
|
check(config.get("baseurl") === pathToFileURL(repo).href, "expected the local repository");
|
|
8761
9217
|
check(config.get("gpgkey") === keyUrl, "expected the configured QA public key");
|
|
8762
9218
|
for (const flag of ["pkg_gpgcheck", "repo_gpgcheck"]) {
|
|
@@ -8766,12 +9222,12 @@ async function verifyRpmStage(stage) {
|
|
|
8766
9222
|
check([...config.keys()].every((key) => allowed.has(key)), "unexpected repository options");
|
|
8767
9223
|
for (const path of [
|
|
8768
9224
|
stage.publicKey,
|
|
8769
|
-
|
|
8770
|
-
|
|
9225
|
+
join39(repo, "repodata/repomd.xml"),
|
|
9226
|
+
join39(repo, "repodata/repomd.xml.asc")
|
|
8771
9227
|
]) {
|
|
8772
9228
|
check((await lstat21(path)).isFile(), "expected regular key and signed metadata files");
|
|
8773
9229
|
}
|
|
8774
|
-
const result = spawnSync3("rpm", ["-qp", "--queryformat", "%{NAME}|%{VERSION}|%{ARCH}", await
|
|
9230
|
+
const result = spawnSync3("rpm", ["-qp", "--queryformat", "%{NAME}|%{VERSION}|%{ARCH}", await realpath11(stage.rpm.path)], { encoding: "utf8", timeout: 1e4 });
|
|
8775
9231
|
check(result.error?.code !== "ENOENT", "rpm is required for RPM header verification");
|
|
8776
9232
|
check(result.status === 0 && result.stdout === `${stage.packageName}|${stage.version}|${stage.architecture}`, "RPM header does not match the requested package, version and architecture");
|
|
8777
9233
|
return { kind: "rpm-staging-inputs", sourceSha: stage.sourceSha };
|
|
@@ -8801,10 +9257,10 @@ function verifyFlatpakCapabilities(policy, result) {
|
|
|
8801
9257
|
}
|
|
8802
9258
|
|
|
8803
9259
|
// src/library/arch-publish.ts
|
|
8804
|
-
import { createHash as
|
|
8805
|
-
import { join as
|
|
9260
|
+
import { createHash as createHash20 } from "crypto";
|
|
9261
|
+
import { join as join40 } from "path";
|
|
8806
9262
|
import { tmpdir as tmpdir5 } from "os";
|
|
8807
|
-
import { Effect as
|
|
9263
|
+
import { Effect as Effect28 } from "effect";
|
|
8808
9264
|
|
|
8809
9265
|
// ../../src/release/arch-package.ts
|
|
8810
9266
|
function archPkgver(tag) {
|
|
@@ -8985,7 +9441,7 @@ exec pacman -S --needed --noconfirm "$@"
|
|
|
8985
9441
|
// src/library/arch-publish.ts
|
|
8986
9442
|
var AUR_HOST_KEY = "aur.archlinux.org ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIEuBKrPzbawxA/k2g6NcyV5jmqwJ2s+zpgZGZ7tpLIcN";
|
|
8987
9443
|
var MAX_LICENSE_BYTES = 1024 * 1024;
|
|
8988
|
-
var feedBytes = (feed, path, maximum) =>
|
|
9444
|
+
var feedBytes = (feed, path, maximum) => Effect28.gen(function* () {
|
|
8989
9445
|
const { fetch: fetch2 } = yield* ReleaseFetch;
|
|
8990
9446
|
const scope = feedUrl(feed);
|
|
8991
9447
|
const response = yield* step(() => fetchReleaseLocation(`${scope}${path}`, scope, fetch2, AbortSignal.timeout(30000)));
|
|
@@ -8995,7 +9451,7 @@ var feedBytes = (feed, path, maximum) => Effect27.gen(function* () {
|
|
|
8995
9451
|
}
|
|
8996
9452
|
return yield* step(() => readReleaseBytes(response, maximum));
|
|
8997
9453
|
});
|
|
8998
|
-
var feedJson = (feed, path, maximum) =>
|
|
9454
|
+
var feedJson = (feed, path, maximum) => Effect28.gen(function* () {
|
|
8999
9455
|
const bytes = yield* feedBytes(feed, path, maximum);
|
|
9000
9456
|
if (!bytes)
|
|
9001
9457
|
return null;
|
|
@@ -9007,13 +9463,13 @@ var feedJson = (feed, path, maximum) => Effect27.gen(function* () {
|
|
|
9007
9463
|
}
|
|
9008
9464
|
});
|
|
9009
9465
|
});
|
|
9010
|
-
var readChannelTag = (feed, channel) =>
|
|
9466
|
+
var readChannelTag = (feed, channel) => Effect28.gen(function* () {
|
|
9011
9467
|
const parsed = yield* feedJson(feed, `channels/${channel}.json`, 262144);
|
|
9012
9468
|
if (parsed === null)
|
|
9013
9469
|
return null;
|
|
9014
9470
|
return yield* step(async () => parseFeedRelease(parsed).tag);
|
|
9015
9471
|
});
|
|
9016
|
-
var readLicense = (url) =>
|
|
9472
|
+
var readLicense = (url) => Effect28.gen(function* () {
|
|
9017
9473
|
const { fetch: fetch2 } = yield* ReleaseFetch;
|
|
9018
9474
|
const response = yield* step(() => fetch2(url, { redirect: "follow", signal: AbortSignal.timeout(30000) }));
|
|
9019
9475
|
if (response.status !== 200 || !response.body) {
|
|
@@ -9021,12 +9477,12 @@ var readLicense = (url) => Effect27.gen(function* () {
|
|
|
9021
9477
|
return yield* fail("Release license is unavailable");
|
|
9022
9478
|
}
|
|
9023
9479
|
const bytes = yield* step(() => readReleaseBytes(response, MAX_LICENSE_BYTES));
|
|
9024
|
-
const sha256 = yield* step(async () =>
|
|
9480
|
+
const sha256 = yield* step(async () => createHash20("sha256").update(bytes).digest("hex"));
|
|
9025
9481
|
return { url, sha256 };
|
|
9026
9482
|
});
|
|
9027
|
-
var git2 = (args) =>
|
|
9483
|
+
var git2 = (args) => Effect28.gen(function* () {
|
|
9028
9484
|
const { run } = yield* ReleaseGit;
|
|
9029
|
-
return yield*
|
|
9485
|
+
return yield* Effect28.tryPromise({
|
|
9030
9486
|
try: () => run(args),
|
|
9031
9487
|
catch: (error) => {
|
|
9032
9488
|
const stderr = String(error.stderr ?? "").trim().split(`
|
|
@@ -9039,11 +9495,11 @@ var git2 = (args) => Effect27.gen(function* () {
|
|
|
9039
9495
|
}
|
|
9040
9496
|
});
|
|
9041
9497
|
});
|
|
9042
|
-
var gitExit = (args) =>
|
|
9498
|
+
var gitExit = (args) => Effect28.gen(function* () {
|
|
9043
9499
|
const { run } = yield* ReleaseGit;
|
|
9044
|
-
return yield*
|
|
9500
|
+
return yield* Effect28.promise(() => run(args).then(() => 0, (error) => Number(error.code ?? 1) || 1));
|
|
9045
9501
|
});
|
|
9046
|
-
var verifyArchRelease = (options) =>
|
|
9502
|
+
var verifyArchRelease = (options) => Effect28.gen(function* () {
|
|
9047
9503
|
const parsed = parseReleaseConfig(options.config);
|
|
9048
9504
|
const { config } = options;
|
|
9049
9505
|
const repository = typeof config.repository === "string" && isRepositorySlug(config.repository) ? config.repository : null;
|
|
@@ -9063,7 +9519,7 @@ var verifyArchRelease = (options) => Effect27.gen(function* () {
|
|
|
9063
9519
|
if (!listed)
|
|
9064
9520
|
return yield* fail(`Missing signed descriptor: ${descriptorPolicy.name}`);
|
|
9065
9521
|
const bytes = yield* feedBytes(options.feed, `${options.tag}/${descriptorPolicy.name}`, 65536);
|
|
9066
|
-
if (!bytes || bytes.length !== listed.size ||
|
|
9522
|
+
if (!bytes || bytes.length !== listed.size || createHash20("sha256").update(bytes).digest("hex") !== listed.sha256)
|
|
9067
9523
|
return yield* fail(`Signed descriptor differs from its release: ${descriptorPolicy.name}`);
|
|
9068
9524
|
const json = yield* step(async () => {
|
|
9069
9525
|
try {
|
|
@@ -9093,7 +9549,7 @@ var verifyArchRelease = (options) => Effect27.gen(function* () {
|
|
|
9093
9549
|
return yield* fail("Signed descriptor does not bind the published archive");
|
|
9094
9550
|
return descriptor.asset;
|
|
9095
9551
|
});
|
|
9096
|
-
var publishArchPackageEffect = (options) =>
|
|
9552
|
+
var publishArchPackageEffect = (options) => Effect28.gen(function* () {
|
|
9097
9553
|
const { archPackage: policy, feed } = parseReleaseConfig(options.config);
|
|
9098
9554
|
if (!policy)
|
|
9099
9555
|
return { status: "not-configured" };
|
|
@@ -9135,7 +9591,7 @@ var publishArchPackageEffect = (options) => Effect27.gen(function* () {
|
|
|
9135
9591
|
const directory = options.printDirectory;
|
|
9136
9592
|
yield* step(() => fs.mkdir(directory, { recursive: true }));
|
|
9137
9593
|
for (const [name, contents] of Object.entries({ ...files, ...repositoryFiles }))
|
|
9138
|
-
yield* step(() => fs.writeFile(
|
|
9594
|
+
yield* step(() => fs.writeFile(join40(directory, name), contents, { mode: 420 }));
|
|
9139
9595
|
}
|
|
9140
9596
|
const base = { pkgname: policy.pkgname, pkgver: rendered.pkgver, pkgrel };
|
|
9141
9597
|
if (options.dryRun)
|
|
@@ -9147,15 +9603,15 @@ var publishArchPackageEffect = (options) => Effect27.gen(function* () {
|
|
|
9147
9603
|
const key = Buffer.from(encodedKey, "base64").toString("utf8");
|
|
9148
9604
|
if (!key.includes("PRIVATE KEY"))
|
|
9149
9605
|
return yield* fail("AUR_SSH_PRIVATE_KEY_B64 is not a private key");
|
|
9150
|
-
return yield*
|
|
9151
|
-
const work = yield* step(() => fs.mkdtemp(
|
|
9152
|
-
yield*
|
|
9606
|
+
return yield* Effect28.gen(function* () {
|
|
9607
|
+
const work = yield* step(() => fs.mkdtemp(join40(tmpdir5(), "arch-package-")));
|
|
9608
|
+
yield* Effect28.addFinalizer(() => Effect28.promise(() => fs.rm(work, { recursive: true, force: true }).then(() => {
|
|
9153
9609
|
return;
|
|
9154
9610
|
}, () => {
|
|
9155
9611
|
return;
|
|
9156
9612
|
})));
|
|
9157
|
-
const keyFile =
|
|
9158
|
-
const knownHosts =
|
|
9613
|
+
const keyFile = join40(work, "aur_id_ed25519");
|
|
9614
|
+
const knownHosts = join40(work, "aur_known_hosts");
|
|
9159
9615
|
yield* step(() => fs.mkdir(work, { recursive: true, mode: 448 }));
|
|
9160
9616
|
yield* step(() => fs.writeFile(keyFile, key.endsWith(`
|
|
9161
9617
|
`) ? key : `${key}
|
|
@@ -9163,7 +9619,7 @@ var publishArchPackageEffect = (options) => Effect27.gen(function* () {
|
|
|
9163
9619
|
yield* step(() => fs.writeFile(knownHosts, `${AUR_HOST_KEY}
|
|
9164
9620
|
`, { mode: 420 }));
|
|
9165
9621
|
const ssh = `ssh -i "${keyFile}" -o IdentitiesOnly=yes -o UserKnownHostsFile="${knownHosts}" -o StrictHostKeyChecking=yes`;
|
|
9166
|
-
const checkout =
|
|
9622
|
+
const checkout = join40(work, policy.pkgname);
|
|
9167
9623
|
yield* git2([
|
|
9168
9624
|
"-c",
|
|
9169
9625
|
`core.sshCommand=${ssh}`,
|
|
@@ -9176,7 +9632,7 @@ var publishArchPackageEffect = (options) => Effect27.gen(function* () {
|
|
|
9176
9632
|
checkout
|
|
9177
9633
|
]);
|
|
9178
9634
|
for (const [name, contents] of Object.entries(files))
|
|
9179
|
-
yield* step(() => fs.writeFile(
|
|
9635
|
+
yield* step(() => fs.writeFile(join40(checkout, name), contents, { mode: 420 }));
|
|
9180
9636
|
yield* git2(["-C", checkout, "add", "--", ...Object.keys(files)]);
|
|
9181
9637
|
const staged = yield* gitExit(["-C", checkout, "diff", "--cached", "--quiet"]);
|
|
9182
9638
|
if (staged === 0)
|
|
@@ -9197,35 +9653,35 @@ var publishArchPackageEffect = (options) => Effect27.gen(function* () {
|
|
|
9197
9653
|
]);
|
|
9198
9654
|
yield* git2(["-C", checkout, "-c", `core.sshCommand=${ssh}`, "push", "origin", "HEAD:master"]);
|
|
9199
9655
|
return { status: "published", ...base };
|
|
9200
|
-
}).pipe(
|
|
9656
|
+
}).pipe(Effect28.scoped);
|
|
9201
9657
|
});
|
|
9202
9658
|
|
|
9203
9659
|
// src/cli-commands.ts
|
|
9204
|
-
var print = (value) =>
|
|
9660
|
+
var print = (value) => Effect29.gen(function* () {
|
|
9205
9661
|
const { stdout } = yield* ReleaseOutput;
|
|
9206
9662
|
stdout(JSON.stringify(value) + `
|
|
9207
9663
|
`);
|
|
9208
9664
|
});
|
|
9209
|
-
var say = (line) =>
|
|
9665
|
+
var say = (line) => Effect29.gen(function* () {
|
|
9210
9666
|
const { stdout } = yield* ReleaseOutput;
|
|
9211
9667
|
stdout(line + `
|
|
9212
9668
|
`);
|
|
9213
9669
|
});
|
|
9214
9670
|
var invalid = (message = "Invalid workflow invocation") => refuse("usage", message);
|
|
9215
9671
|
var localFlag = (args) => args[0] === "--local" ? [true, args.slice(1)] : [false, args];
|
|
9216
|
-
var hostPlatform =
|
|
9672
|
+
var hostPlatform = Effect29.gen(function* () {
|
|
9217
9673
|
const { platform, arch } = yield* ReleaseConfig;
|
|
9218
9674
|
return yield* step(async () => hostReleasePlatform(platform, arch));
|
|
9219
9675
|
});
|
|
9220
|
-
var withPlanGitHub = (env, effect) =>
|
|
9676
|
+
var withPlanGitHub = (env, effect) => Effect29.gen(function* () {
|
|
9221
9677
|
const github = yield* ReleaseGitHub;
|
|
9222
|
-
return yield* effect.pipe(
|
|
9678
|
+
return yield* effect.pipe(Effect29.provideService(ReleaseGitHub, {
|
|
9223
9679
|
run: github.withEnvironment ? github.withEnvironment(releasePlanGitHubEnvironment(env)) : github.run
|
|
9224
9680
|
}));
|
|
9225
9681
|
});
|
|
9226
9682
|
var publish = (argv) => {
|
|
9227
9683
|
const [local, args] = localFlag(argv);
|
|
9228
|
-
return runCommand("Unable to publish release artifacts; check the trusted workflow or local checkout, receipts, signing configuration and staged bytes.",
|
|
9684
|
+
return runCommand("Unable to publish release artifacts; check the trusted workflow or local checkout, receipts, signing configuration and staged bytes.", Effect29.gen(function* () {
|
|
9229
9685
|
const [directory, configPath, out, ...extra] = args;
|
|
9230
9686
|
if (!directory || !configPath || extra.length || !out !== !local)
|
|
9231
9687
|
return yield* invalid();
|
|
@@ -9238,7 +9694,7 @@ var publish = (argv) => {
|
|
|
9238
9694
|
const clock = yield* ReleaseClock;
|
|
9239
9695
|
const platform = yield* hostPlatform;
|
|
9240
9696
|
const { repository } = yield* localTagProvenanceEffect({ config, tag, sourceSha });
|
|
9241
|
-
const plan = yield*
|
|
9697
|
+
const plan = yield* Effect29.uninterruptible(stageLocalReleaseEffect({
|
|
9242
9698
|
config,
|
|
9243
9699
|
directory,
|
|
9244
9700
|
out,
|
|
@@ -9256,7 +9712,7 @@ var publish = (argv) => {
|
|
|
9256
9712
|
};
|
|
9257
9713
|
var cut = (argv) => {
|
|
9258
9714
|
const [local, args] = localFlag(argv);
|
|
9259
|
-
return runCommand((error) => `Unable to cut the release: ${redactedErrorMessage(error)}. Check the trusted workflow or local checkout and release configuration.`,
|
|
9715
|
+
return runCommand((error) => `Unable to cut the release: ${redactedErrorMessage(error)}. Check the trusted workflow or local checkout and release configuration.`, Effect29.gen(function* () {
|
|
9260
9716
|
const [kind, path, sourceSha, ...extra] = args;
|
|
9261
9717
|
if (kind !== "daily" || !path || extra.length || !sourceSha !== !local)
|
|
9262
9718
|
return yield* invalid();
|
|
@@ -9266,7 +9722,7 @@ var cut = (argv) => {
|
|
|
9266
9722
|
const { env } = yield* ReleaseConfig;
|
|
9267
9723
|
if (local) {
|
|
9268
9724
|
const platform = yield* hostPlatform;
|
|
9269
|
-
const result = yield*
|
|
9725
|
+
const result = yield* Effect29.uninterruptible(runLocalReleaseCutEffect({ kind, config, sourceSha, platform }));
|
|
9270
9726
|
return yield* print(result);
|
|
9271
9727
|
}
|
|
9272
9728
|
const result = yield* releaseCutCommand({
|
|
@@ -9280,7 +9736,7 @@ var cut = (argv) => {
|
|
|
9280
9736
|
};
|
|
9281
9737
|
var promote = (argv) => {
|
|
9282
9738
|
const [local, args] = localFlag(argv);
|
|
9283
|
-
return runCommand("Unable to promote the release; check the trusted workflow or feed and release configuration.",
|
|
9739
|
+
return runCommand("Unable to promote the release; check the trusted workflow or feed and release configuration.", Effect29.gen(function* () {
|
|
9284
9740
|
const [path, out, ...extra] = args;
|
|
9285
9741
|
const { env } = yield* ReleaseConfig;
|
|
9286
9742
|
const held = env.STABLE_PROMOTION_HELD;
|
|
@@ -9290,7 +9746,7 @@ var promote = (argv) => {
|
|
|
9290
9746
|
if (local) {
|
|
9291
9747
|
const clock = yield* ReleaseClock;
|
|
9292
9748
|
const repository = yield* originRepositoryEffect;
|
|
9293
|
-
const result = yield*
|
|
9749
|
+
const result = yield* Effect29.uninterruptible(runLocalPromotionEffect({
|
|
9294
9750
|
config,
|
|
9295
9751
|
out,
|
|
9296
9752
|
now: clock.now(),
|
|
@@ -9303,7 +9759,7 @@ var promote = (argv) => {
|
|
|
9303
9759
|
yield* print(yield* promotionCommand({ env, config }));
|
|
9304
9760
|
}), { requireGitHubActions: !local });
|
|
9305
9761
|
};
|
|
9306
|
-
var finalize = (argv) => runCommand((error) => `Release finalization failed: ${redactedErrorMessage(error)}`,
|
|
9762
|
+
var finalize = (argv) => runCommand((error) => `Release finalization failed: ${redactedErrorMessage(error)}`, Effect29.gen(function* () {
|
|
9307
9763
|
const { env } = yield* ReleaseConfig;
|
|
9308
9764
|
if (argv[0] === "--local") {
|
|
9309
9765
|
const [configPath, tag, ...extra] = argv.slice(1);
|
|
@@ -9324,7 +9780,7 @@ var finalize = (argv) => runCommand((error) => `Release finalization failed: ${r
|
|
|
9324
9780
|
yield* finalizeReleasePleaseDraftEffect({ env, config, ...identity });
|
|
9325
9781
|
yield* say("Qualified draft published as a prerelease");
|
|
9326
9782
|
}));
|
|
9327
|
-
var planAssets = (args) => runCommand("Unable to plan release assets; check release provenance and the trusted workflow.",
|
|
9783
|
+
var planAssets = (args) => runCommand("Unable to plan release assets; check release provenance and the trusted workflow.", Effect29.gen(function* () {
|
|
9328
9784
|
const [tag, path, ...extra] = args;
|
|
9329
9785
|
if (!tag || !path || extra.length)
|
|
9330
9786
|
return yield* invalid("Expected release tag and configuration file");
|
|
@@ -9332,7 +9788,7 @@ var planAssets = (args) => runCommand("Unable to plan release assets; check rele
|
|
|
9332
9788
|
const { env } = yield* ReleaseConfig;
|
|
9333
9789
|
yield* print(yield* planReleaseAssetsEffect({ env, config, tag }));
|
|
9334
9790
|
}));
|
|
9335
|
-
var sign2 = (args) => runCommand("Unable to sign release artifact; check the identity, archive and signing key.",
|
|
9791
|
+
var sign2 = (args) => runCommand("Unable to sign release artifact; check the identity, archive and signing key.", Effect29.gen(function* () {
|
|
9336
9792
|
const [identityPath, artifactPath, feed, ...extra] = args;
|
|
9337
9793
|
const { env } = yield* ReleaseConfig;
|
|
9338
9794
|
if (!identityPath || !artifactPath || !feed || extra.length || !env.ADEA_RELEASE_SIGNING_KEY)
|
|
@@ -9343,7 +9799,7 @@ var sign2 = (args) => runCommand("Unable to sign release artifact; check the ide
|
|
|
9343
9799
|
}));
|
|
9344
9800
|
var signDescriptors = (argv) => {
|
|
9345
9801
|
const [local, args] = localFlag(argv);
|
|
9346
|
-
return runCommand("Unable to stage signed descriptors; check the trusted release, installer receipts and signing configuration.",
|
|
9802
|
+
return runCommand("Unable to stage signed descriptors; check the trusted release, installer receipts and signing configuration.", Effect29.gen(function* () {
|
|
9347
9803
|
const [directory, configPath, ...extra] = args;
|
|
9348
9804
|
const { env } = yield* ReleaseConfig;
|
|
9349
9805
|
const {
|
|
@@ -9376,7 +9832,7 @@ var signDescriptors = (argv) => {
|
|
|
9376
9832
|
}));
|
|
9377
9833
|
}));
|
|
9378
9834
|
};
|
|
9379
|
-
var releaseStep = (argv) => runCommand((error) => `Release step failed: ${error.message}`,
|
|
9835
|
+
var releaseStep = (argv) => runCommand((error) => `Release step failed: ${error.message}`, Effect29.gen(function* () {
|
|
9380
9836
|
const args = [...argv];
|
|
9381
9837
|
const flag = args.indexOf("--artifacts");
|
|
9382
9838
|
const artifacts = flag === -1 ? undefined : args.splice(flag, 2)[1];
|
|
@@ -9428,9 +9884,9 @@ var releaseStep = (argv) => runCommand((error) => `Release step failed: ${error.
|
|
|
9428
9884
|
return yield* invalid(`Unknown release step ${String(name)}`);
|
|
9429
9885
|
}
|
|
9430
9886
|
}));
|
|
9431
|
-
var verifyMacosSigning = (args) =>
|
|
9887
|
+
var verifyMacosSigning = (args) => Effect29.gen(function* () {
|
|
9432
9888
|
let problems = 0;
|
|
9433
|
-
const code = yield* runCommand("Unable to check the app signing; run it on macOS with codesign.",
|
|
9889
|
+
const code = yield* runCommand("Unable to check the app signing; run it on macOS with codesign.", Effect29.gen(function* () {
|
|
9434
9890
|
const [app, flag, ...extra] = args;
|
|
9435
9891
|
if (!app || extra.length || ![undefined, "--hardened"].includes(flag))
|
|
9436
9892
|
return yield* invalid("usage");
|
|
@@ -9443,14 +9899,14 @@ var verifyMacosSigning = (args) => Effect28.gen(function* () {
|
|
|
9443
9899
|
}));
|
|
9444
9900
|
return code || (problems ? 1 : 0);
|
|
9445
9901
|
});
|
|
9446
|
-
var publishFramework = (args) => runCommand((error) => error.message,
|
|
9902
|
+
var publishFramework = (args) => runCommand((error) => error.message, Effect29.gen(function* () {
|
|
9447
9903
|
const [archive, flag, ...extra] = args;
|
|
9448
9904
|
if (!archive || extra.length || flag !== undefined && flag !== "--dry-run")
|
|
9449
9905
|
return yield* invalid("Expected one framework package archive and an optional --dry-run");
|
|
9450
9906
|
const { env } = yield* ReleaseConfig;
|
|
9451
9907
|
yield* print(yield* step(() => publishFrameworkPackage({ env, archive, dryRun: flag === "--dry-run" })));
|
|
9452
9908
|
}));
|
|
9453
|
-
var publishArch = (argv) => runCommand((error) => `Unable to publish the Arch package: ${redactedErrorMessage(error)}`,
|
|
9909
|
+
var publishArch = (argv) => runCommand((error) => `Unable to publish the Arch package: ${redactedErrorMessage(error)}`, Effect29.gen(function* () {
|
|
9454
9910
|
const args = [...argv];
|
|
9455
9911
|
const printIndex = args.indexOf("--print");
|
|
9456
9912
|
const printDirectory = printIndex === -1 ? undefined : args[printIndex + 1];
|
|
@@ -9485,7 +9941,7 @@ var publishArch = (argv) => runCommand((error) => `Unable to publish the Arch pa
|
|
|
9485
9941
|
...printDirectory ? { printDirectory } : {}
|
|
9486
9942
|
}));
|
|
9487
9943
|
}));
|
|
9488
|
-
var dailyMatrix = (args) => runCommand("Unable to prepare the Daily matrix; check the command arguments and use matching exact staged artifacts and native receipts.",
|
|
9944
|
+
var dailyMatrix = (args) => runCommand("Unable to prepare the Daily matrix; check the command arguments and use matching exact staged artifacts and native receipts.", Effect29.gen(function* () {
|
|
9489
9945
|
const [action, configPath, ...operands] = args;
|
|
9490
9946
|
if (!configPath)
|
|
9491
9947
|
return yield* invalid();
|
|
@@ -9494,7 +9950,7 @@ var dailyMatrix = (args) => runCommand("Unable to prepare the Daily matrix; chec
|
|
|
9494
9950
|
const matrix = yield* step(async () => planDailyReleaseMatrix(config, operands[0]));
|
|
9495
9951
|
return yield* print(matrix);
|
|
9496
9952
|
}
|
|
9497
|
-
if (!(action === "verify" && operands.length === 3 || action === "stage-local" && operands.length === 4 || action === "produce-native-receipt" && (operands.length === 4 || operands.length === 5)))
|
|
9953
|
+
if (!(action === "verify" && operands.length === 3 || action === "stage-local" && operands.length === 4 || action === "produce-native-receipt" && (operands.length === 4 || operands.length === 5) || action === "observe-native" && (operands.length === 4 || operands.length === 5)))
|
|
9498
9954
|
return yield* invalid();
|
|
9499
9955
|
const [identityPath, artifacts, receipts, parent, baselineArtifacts] = operands;
|
|
9500
9956
|
const raw = yield* readBoundedJson(identityPath, 4096, "Daily identity");
|
|
@@ -9503,6 +9959,17 @@ var dailyMatrix = (args) => runCommand("Unable to prepare the Daily matrix; chec
|
|
|
9503
9959
|
const { tag, sourceSha, workflowSha, runId, runAttempt } = raw;
|
|
9504
9960
|
const config = yield* readReleaseConfig(configPath);
|
|
9505
9961
|
const identity = { tag, sourceSha, workflowSha, runId, runAttempt };
|
|
9962
|
+
if (action === "observe-native") {
|
|
9963
|
+
const baseline = baselineArtifacts ? yield* readBoundedJson(baselineArtifacts, 4096, "Daily baseline") : undefined;
|
|
9964
|
+
return yield* print(yield* observeDailyNativeEffect({
|
|
9965
|
+
config,
|
|
9966
|
+
identity,
|
|
9967
|
+
artifacts,
|
|
9968
|
+
checkName: receipts,
|
|
9969
|
+
driver: parent,
|
|
9970
|
+
baseline
|
|
9971
|
+
}, runDailyNativeDriver));
|
|
9972
|
+
}
|
|
9506
9973
|
if (action === "produce-native-receipt") {
|
|
9507
9974
|
const { env, platform: os, arch } = yield* ReleaseConfig;
|
|
9508
9975
|
yield* step(async () => assertHostedRunner(env, "Daily native receipt"));
|
|
@@ -9525,13 +9992,13 @@ var dailyMatrix = (args) => runCommand("Unable to prepare the Daily matrix; chec
|
|
|
9525
9992
|
const result = action === "verify" ? yield* verifyDailyReleaseMatrixEffect(options) : yield* stageDailyBatchEffect({ ...options, parent });
|
|
9526
9993
|
return yield* print(result);
|
|
9527
9994
|
}));
|
|
9528
|
-
var prepareStableCatalog2 = (args) => runCommand((error) => `Unable to prepare Stable catalog: ${redactedErrorMessage(error)}`,
|
|
9995
|
+
var prepareStableCatalog2 = (args) => runCommand((error) => `Unable to prepare Stable catalog: ${redactedErrorMessage(error)}`, Effect29.gen(function* () {
|
|
9529
9996
|
yield* print(yield* step(() => prepareStableCatalogCommand(args)));
|
|
9530
9997
|
}));
|
|
9531
|
-
var stageAptRepository = (args) => runCommand((error) => `Unable to stage Apt repository: ${redactedErrorMessage(error)}`,
|
|
9998
|
+
var stageAptRepository = (args) => runCommand((error) => `Unable to stage Apt repository: ${redactedErrorMessage(error)}`, Effect29.gen(function* () {
|
|
9532
9999
|
yield* print(yield* step(() => stageAptRepositoryCommand(args)));
|
|
9533
10000
|
}));
|
|
9534
|
-
var linuxChannelProof = (args) => runCommand((error) => `Unable to check Linux package channel: ${redactedErrorMessage(error)}`,
|
|
10001
|
+
var linuxChannelProof = (args) => runCommand((error) => `Unable to check Linux package channel: ${redactedErrorMessage(error)}`, Effect29.gen(function* () {
|
|
9535
10002
|
const [channel, input, ...extra] = args;
|
|
9536
10003
|
if (channel !== "rpm" && channel !== "flatpak" || !input || extra.length)
|
|
9537
10004
|
return yield* invalid("Expected <rpm|flatpak> <input.json>");
|
|
@@ -9565,7 +10032,7 @@ var releaseCli = (argv) => {
|
|
|
9565
10032
|
const command = name === undefined ? undefined : commands[name];
|
|
9566
10033
|
if (command)
|
|
9567
10034
|
return command(args);
|
|
9568
|
-
return
|
|
10035
|
+
return Effect29.gen(function* () {
|
|
9569
10036
|
const { stderr } = yield* ReleaseOutput;
|
|
9570
10037
|
stderr(`Usage: adea-release <${Object.keys(commands).join("|")}> [arguments]; unknown command ${String(name)}
|
|
9571
10038
|
`);
|
|
@@ -9574,4 +10041,4 @@ var releaseCli = (argv) => {
|
|
|
9574
10041
|
};
|
|
9575
10042
|
|
|
9576
10043
|
// src/cli.ts
|
|
9577
|
-
process.exitCode = await
|
|
10044
|
+
process.exitCode = await Effect30.runPromise(provideLivePorts(releaseCli(process.argv.slice(2))));
|