@intentius/chant 0.124.103 → 0.124.105
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/audit/secrets.d.ts +6 -0
- package/dist/audit/secrets.js +9 -2
- package/dist/capabilities/templates.d.ts +66 -3
- package/dist/capabilities/templates.js +220 -81
- package/dist/cli/commands/import-index.d.ts +15 -0
- package/dist/cli/commands/import-index.js +37 -3
- package/dist/cli/handlers/lifecycle.js +6 -0
- package/dist/cli/handlers/release-config.d.ts +15 -0
- package/dist/cli/handlers/release-config.js +58 -0
- package/dist/cli/handlers/release-doctor.js +8 -3
- package/dist/cli/handlers/release-init.js +7 -4
- package/dist/cli/handlers/release.js +36 -3
- package/dist/cli/handlers/search.d.ts +1 -1
- package/dist/cli/handlers/search.js +24 -2
- package/dist/cli/main.js +12 -2
- package/dist/cli/parse-args.js +9 -2
- package/dist/cli/registry.d.ts +2 -0
- package/dist/cli/release-commands/cut.js +3 -0
- package/dist/cli/release-commands/doctor.js +5 -2
- package/dist/cloud-lister/aws.d.ts +9 -0
- package/dist/cloud-lister/aws.js +20 -0
- package/dist/config-import.js +26 -4
- package/dist/config.d.ts +24 -0
- package/dist/config.js +6 -0
- package/dist/floor-table.data.js +8 -6
- package/dist/floor-table.js +3 -1
- package/dist/graph-refs.d.ts +22 -0
- package/dist/graph-refs.js +20 -11
- package/dist/lifecycle/cloud-index.d.ts +6 -0
- package/dist/lifecycle/cloud-index.js +32 -5
- package/dist/lifecycle/derive-edges.d.ts +1 -1
- package/dist/lifecycle/derive-edges.js +5 -3
- package/dist/lifecycle/identity-match.d.ts +18 -2
- package/dist/lifecycle/identity-match.js +10 -5
- package/dist/lifecycle/index-drift.d.ts +13 -0
- package/dist/lifecycle/index-drift.js +21 -3
- package/dist/lifecycle/index-import.d.ts +24 -2
- package/dist/lifecycle/index-import.js +61 -9
- package/dist/lifecycle/index-join.d.ts +1 -1
- package/dist/lifecycle/index-join.js +1 -1
- package/dist/lifecycle/publish-declaration.d.ts +6 -0
- package/dist/lifecycle/publish-declaration.js +18 -1
- package/dist/lifecycle/publish-forge.d.ts +2 -0
- package/dist/lifecycle/publish-forge.js +3 -1
- package/dist/lifecycle/publish-oci.d.ts +27 -0
- package/dist/lifecycle/publish-oci.js +63 -8
- package/dist/lifecycle/release-artifacts.js +3 -1
- package/dist/lifecycle/release-at.d.ts +5 -1
- package/dist/lifecycle/release-at.js +69 -4
- package/dist/lifecycle/release-changelog.d.ts +18 -5
- package/dist/lifecycle/release-changelog.js +22 -10
- package/dist/lifecycle/release-cut.d.ts +13 -1
- package/dist/lifecycle/release-cut.js +3 -0
- package/dist/lifecycle/release-doctor.d.ts +10 -0
- package/dist/lifecycle/release-doctor.js +84 -14
- package/dist/lifecycle/release-green.d.ts +5 -2
- package/dist/lifecycle/release-green.js +40 -8
- package/dist/lifecycle/release-images.d.ts +39 -3
- package/dist/lifecycle/release-images.js +84 -7
- package/dist/lifecycle/release-init-goreleaser-images.d.ts +21 -0
- package/dist/lifecycle/release-init-goreleaser-images.js +160 -0
- package/dist/lifecycle/release-init.d.ts +38 -7
- package/dist/lifecycle/release-init.js +298 -52
- package/dist/lifecycle/release-next.d.ts +1 -1
- package/dist/lifecycle/release-next.js +9 -4
- package/dist/local-chant.d.ts +3 -0
- package/dist/local-chant.js +28 -2
- package/dist/release-floors.d.ts +10 -6
- package/dist/release-floors.js +10 -6
- package/dist/ts-loader.d.ts +12 -3
- package/dist/ts-loader.js +27 -11
- package/dist/wave-runtime.mjs +292 -291
- package/dist/workspace/capabilities-contract.d.ts +15 -5
- package/dist/workspace/capabilities-contract.js +7 -4
- package/dist/workspace/capabilities.schema.json +45 -1
- package/dist/workspace/catalog-edges.d.ts +22 -0
- package/dist/workspace/catalog-edges.js +23 -0
- package/dist/workspace/release-changed.d.ts +2 -0
- package/dist/workspace/release-changed.js +7 -2
- package/dist/workspace/release-steps/doctor.js +2 -1
- package/dist/workspace/release-steps/goreleaser.d.ts +6 -3
- package/dist/workspace/release-steps/goreleaser.js +12 -6
- package/dist/workspace/release-toolchains.d.ts +6 -0
- package/dist/workspace/release-toolchains.js +8 -0
- package/dist/workspace/release-train-workflow.d.ts +18 -0
- package/dist/workspace/release-train-workflow.js +135 -7
- package/dist/workspace/release-train.js +1 -1
- package/dist/workspace/release-workflow.d.ts +26 -0
- package/dist/workspace/release-workflow.js +60 -12
- package/dist/workspace/train-artifacts.js +3 -4
- package/dist/workspace/train-cut.d.ts +22 -1
- package/dist/workspace/train-cut.js +80 -16
- package/package.json +2 -2
|
@@ -37,7 +37,13 @@
|
|
|
37
37
|
* the commit. A workflow on that tag publishes the train.
|
|
38
38
|
*
|
|
39
39
|
* Without `--yes` it plans: it prints the members and labels, runs each
|
|
40
|
-
* cut's dry run, and cuts, records, tags and pushes nothing.
|
|
40
|
+
* cut's dry run, and cuts, records, tags and pushes nothing. `--plan-only`
|
|
41
|
+
* (#5237) prints the members and labels and runs no member's dry run: what
|
|
42
|
+
* a workflow's gate reads to give each per-platform build job its member's
|
|
43
|
+
* label. `--planned "<member>=<label> ..."` (or `none`) then makes the cut
|
|
44
|
+
* refuse (`train-plan-changed`) unless it plans exactly those members at
|
|
45
|
+
* those labels, so the files the build jobs made carry the labels the cut
|
|
46
|
+
* records.
|
|
41
47
|
*/
|
|
42
48
|
import { execFileSync, spawnSync } from "node:child_process";
|
|
43
49
|
import { runToStderr } from "./train-shell.js";
|
|
@@ -50,6 +56,8 @@ import { readDeclaration } from "./declaration.js";
|
|
|
50
56
|
import { bumpLabel, parseVersion, RELEASE_BUMPS } from "./release-changed.js";
|
|
51
57
|
import { appendReleaseTrain, pickTrain, readMemberReleases, readReleaseTrains, trainDigest } from "./release-train.js";
|
|
52
58
|
import { locateWorkspace } from "./which-chant.js";
|
|
59
|
+
/** The first chant with `chant workspace train cut --plan-only` and `--planned` (#5237): what the train workflow's gate and cut jobs run when a member declares `release.workflow.builds`. */
|
|
60
|
+
export const TRAIN_BUILDS_FLOOR = "0.124.104";
|
|
53
61
|
/** Why a train cut stopped. */
|
|
54
62
|
export class TrainCutError extends Error {
|
|
55
63
|
constructor(code, message, fix) {
|
|
@@ -346,15 +354,63 @@ export const spawnMemberCut = async (m, commit, o) => {
|
|
|
346
354
|
};
|
|
347
355
|
// A check's stdout goes to stderr: under --json, stdout is the cut's JSON document alone.
|
|
348
356
|
const defaultCheck = (line, o) => runToStderr(line, o);
|
|
349
|
-
/** This chant's `release doctor` in a member's directory, its stdout sent to stderr. */
|
|
357
|
+
/** This chant's `release doctor` in a member's directory, its stdout sent to stderr. In CI it is the train's cut job, which has no OIDC token (`--from cut`). */
|
|
350
358
|
const defaultDoctor = (dir) => {
|
|
351
359
|
const [bin, ...pre] = ownChant();
|
|
352
|
-
return spawnSync(bin, [...pre, "release", "doctor"], { cwd: dir, stdio: ["ignore", 2, 2] }).status ?? 1;
|
|
360
|
+
return spawnSync(bin, [...pre, "release", "doctor", ...(process.env.CI ? ["--from", "cut"] : [])], { cwd: dir, stdio: ["ignore", 2, 2] }).status ?? 1;
|
|
353
361
|
};
|
|
362
|
+
/**
|
|
363
|
+
* Parse `--planned` (#5237): `<member>=<label>` words separated by spaces or
|
|
364
|
+
* commas, as a plan's members give them, or `none` for a plan of nothing.
|
|
365
|
+
*/
|
|
366
|
+
export function parseTrainPlanned(text) {
|
|
367
|
+
const out = {};
|
|
368
|
+
const words = text.split(/[\s,]+/).filter(Boolean);
|
|
369
|
+
if (words.length === 1 && words[0] === "none")
|
|
370
|
+
return out;
|
|
371
|
+
if (words.length === 0)
|
|
372
|
+
throw new TrainCutError("train-planned-invalid", "--planned names no member", 'Give the plan\'s members as <member>=<label>, separated by spaces, or none for a plan of nothing.');
|
|
373
|
+
for (const word of words) {
|
|
374
|
+
const at = word.indexOf("=");
|
|
375
|
+
if (at <= 0 || at === word.length - 1)
|
|
376
|
+
throw new TrainCutError("train-planned-invalid", `--planned ${JSON.stringify(word)}: each word is <member>=<label>`);
|
|
377
|
+
const m = word.slice(0, at);
|
|
378
|
+
if (out[m] !== undefined)
|
|
379
|
+
throw new TrainCutError("train-planned-invalid", `--planned names ${m} twice`);
|
|
380
|
+
out[m] = word.slice(at + 1);
|
|
381
|
+
}
|
|
382
|
+
return out;
|
|
383
|
+
}
|
|
384
|
+
/** The members and labels of a plan, as `--planned` takes them: `none` for a plan of nothing. */
|
|
385
|
+
export function plannedText(plan) {
|
|
386
|
+
return plan.members.map((m) => `${m.member}=${m.label}`).join(",") || "none";
|
|
387
|
+
}
|
|
388
|
+
/** Refuse a plan that differs from the one `--planned` gave (#5237). */
|
|
389
|
+
function checkPlanned(plan, planned) {
|
|
390
|
+
const got = new Map(plan.members.map((m) => [m.member, m.label]));
|
|
391
|
+
const diffs = [];
|
|
392
|
+
for (const [m, label] of Object.entries(planned)) {
|
|
393
|
+
const now = got.get(m);
|
|
394
|
+
if (now === undefined)
|
|
395
|
+
diffs.push(`${m} was planned at ${label} and is not in the train now`);
|
|
396
|
+
else if (now !== label)
|
|
397
|
+
diffs.push(`${m} was planned at ${label} and is labelled ${now} now`);
|
|
398
|
+
}
|
|
399
|
+
for (const [m, label] of got)
|
|
400
|
+
if (planned[m] === undefined)
|
|
401
|
+
diffs.push(`${m} is in the train now at ${label}, and was not planned`);
|
|
402
|
+
if (plan.released !== null && Object.keys(planned).length > 0)
|
|
403
|
+
diffs.unshift(`${plan.commit.slice(0, 12)} is released now as ${plan.released}`);
|
|
404
|
+
if (diffs.length > 0) {
|
|
405
|
+
throw new TrainCutError("train-plan-changed", `the train differs from the plan the build jobs built for: ${diffs.join("; ")}`, "Nothing was cut. A release or a tag landed between the plan and the cut; start the train again, so the builds run with the labels it cuts.");
|
|
406
|
+
}
|
|
407
|
+
}
|
|
354
408
|
/** Plan, and with `yes` cut, record, tag and push, a release train (#5154). */
|
|
355
409
|
export async function cutTrain(q) {
|
|
356
410
|
const root = locateWorkspace(q.cwd).rootOnDisk;
|
|
357
411
|
const plan = await planTrainCut(q);
|
|
412
|
+
if (q.planned !== undefined)
|
|
413
|
+
checkPlanned(plan, q.planned);
|
|
358
414
|
const say = q.say ?? (() => undefined);
|
|
359
415
|
const base = { ...plan, tags: {}, train: null, trainTag: null, pushed: false };
|
|
360
416
|
if (plan.released !== null || plan.members.length === 0)
|
|
@@ -453,7 +509,7 @@ export async function cutTrain(q) {
|
|
|
453
509
|
}
|
|
454
510
|
return { ...out, pushed: true };
|
|
455
511
|
}
|
|
456
|
-
const CUT_USAGE = "chant workspace train cut <env> [--at <sha>] [--levels <levels>] [--doctor] [--yes] [--no-push] [--json]";
|
|
512
|
+
const CUT_USAGE = "chant workspace train cut <env> [--at <sha>] [--levels <levels>] [--plan-only] [--planned <member=label ...|none>] [--doctor] [--yes] [--no-push] [--json]";
|
|
457
513
|
/** `chant workspace train cut <env>` (#5154). */
|
|
458
514
|
export async function runTrainCut(ctx, words) {
|
|
459
515
|
const { formatError, formatSuccess, formatWarning } = await import("../cli/format.js");
|
|
@@ -471,18 +527,22 @@ export async function runTrainCut(ctx, words) {
|
|
|
471
527
|
await fetchLifecycle({ cwd }).catch(() => false);
|
|
472
528
|
spawnSync("git", ["fetch", "--quiet", "origin", "refs/tags/*:refs/tags/*"], { cwd, stdio: "ignore" });
|
|
473
529
|
let outcome;
|
|
530
|
+
const planOnly = args.planOnly === true;
|
|
474
531
|
try {
|
|
475
|
-
|
|
476
|
-
|
|
477
|
-
|
|
478
|
-
|
|
479
|
-
|
|
480
|
-
|
|
481
|
-
|
|
482
|
-
|
|
483
|
-
|
|
484
|
-
|
|
485
|
-
|
|
532
|
+
if (planOnly && (args.yes === true || args.planned !== undefined))
|
|
533
|
+
throw new TrainCutError("train-plan-only", `--plan-only prints the plan and cuts nothing, so it takes no ${args.yes === true ? "--yes" : "--planned"}`, CUT_USAGE);
|
|
534
|
+
const query = { cwd, env, ...(args.at ? { at: args.at } : {}), levels: parseTrainLevels(args.levels) };
|
|
535
|
+
outcome = planOnly
|
|
536
|
+
? { ...(await planTrainCut(query)), tags: {}, train: null, trainTag: null, pushed: false }
|
|
537
|
+
: await cutTrain({
|
|
538
|
+
...query,
|
|
539
|
+
...(args.planned !== undefined ? { planned: parseTrainPlanned(args.planned) } : {}),
|
|
540
|
+
yes: args.yes === true && args.dryRun !== true,
|
|
541
|
+
noPush: args.noPush === true,
|
|
542
|
+
doctor: args.doctor === true,
|
|
543
|
+
...(args.actor ? { actor: args.actor } : {}),
|
|
544
|
+
say: (line) => (json ? undefined : console.error(line)),
|
|
545
|
+
});
|
|
486
546
|
}
|
|
487
547
|
catch (err) {
|
|
488
548
|
if (err instanceof TrainCutError) {
|
|
@@ -498,7 +558,7 @@ export async function runTrainCut(ctx, words) {
|
|
|
498
558
|
throw err;
|
|
499
559
|
}
|
|
500
560
|
if (json) {
|
|
501
|
-
console.log(JSON.stringify({ dryRun: args.yes !== true || args.dryRun === true, ...outcome }, null, 2));
|
|
561
|
+
console.log(JSON.stringify({ dryRun: planOnly || args.yes !== true || args.dryRun === true, ...(planOnly ? { planOnly: true, planned: plannedText(outcome) } : {}), ...outcome }, null, 2));
|
|
502
562
|
return 0;
|
|
503
563
|
}
|
|
504
564
|
const short = outcome.commit.slice(0, 12);
|
|
@@ -513,6 +573,10 @@ export async function runTrainCut(ctx, words) {
|
|
|
513
573
|
console.log(`Release train for ${env} from ${short}${outcome.first ? " (the first: every member at one label)" : ""}:`);
|
|
514
574
|
for (const m of outcome.members)
|
|
515
575
|
console.log(` ${m.member.padEnd(24)} ${m.label.padEnd(12)} ${m.why}${m.bump ? `; ${m.bump} from ${m.bumpFrom}` : ""}${m.floor ? `; floor ${m.floor}` : ""}`);
|
|
576
|
+
if (planOnly) {
|
|
577
|
+
console.error(`Plan only: no member's dry run ran, and nothing was cut. Cut it as planned with --planned ${JSON.stringify(plannedText(outcome))}.`);
|
|
578
|
+
return 0;
|
|
579
|
+
}
|
|
516
580
|
if (args.yes !== true || args.dryRun === true) {
|
|
517
581
|
console.error("Dry run: nothing was cut, recorded, tagged or pushed. Run again with --yes to cut the train.");
|
|
518
582
|
return 0;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@intentius/chant",
|
|
3
|
-
"version": "0.124.
|
|
3
|
+
"version": "0.124.105",
|
|
4
4
|
"description": "Declarative infrastructure-as-code toolkit — TypeScript on Node.js",
|
|
5
5
|
"license": "Apache-2.0",
|
|
6
6
|
"homepage": "https://intentius.io/chant",
|
|
@@ -175,7 +175,7 @@
|
|
|
175
175
|
},
|
|
176
176
|
"scripts": {
|
|
177
177
|
"build": "../../scripts/tsc7.sh -p tsconfig.build.json --sourceMap false && tsc-alias -p tsconfig.build.json && node scripts/copy-assets.mjs && node scripts/build-wave-runtime.mjs",
|
|
178
|
-
"prepack": "npm run build"
|
|
178
|
+
"prepack": "tsx ../../scripts/release-floors.ts --pack npm run build"
|
|
179
179
|
},
|
|
180
180
|
"dependencies": {
|
|
181
181
|
"@dagrejs/dagre": "^3.0.0",
|