@intentius/chant 0.124.102 → 0.124.104
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/cli/commands/import-index.d.ts +15 -0
- package/dist/cli/commands/import-index.js +37 -3
- package/dist/cli/commands/onboard.js +8 -8
- 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-init.js +3 -1
- package/dist/cli/handlers/release.js +36 -3
- package/dist/cli/main.js +24 -3
- package/dist/cli/parse-args.js +12 -0
- package/dist/cli/registry.d.ts +4 -0
- package/dist/cli/release-commands/cut.js +3 -0
- package/dist/cloud-lister/kubernetes-components.js +1 -2
- package/dist/config-import.js +26 -4
- package/dist/config.d.ts +14 -0
- package/dist/config.js +4 -0
- package/dist/floor-table.data.js +13 -11
- package/dist/floor-table.js +3 -1
- package/dist/graph-refs.d.ts +9 -0
- package/dist/graph-refs.js +9 -7
- package/dist/lifecycle/cloud-index.d.ts +6 -0
- package/dist/lifecycle/cloud-index.js +32 -5
- 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 +15 -0
- package/dist/lifecycle/index-import.js +25 -2
- 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 +19 -3
- package/dist/lifecycle/publish-forge.d.ts +2 -0
- package/dist/lifecycle/publish-forge.js +3 -1
- package/dist/lifecycle/publish-helm.js +1 -2
- package/dist/lifecycle/publish-maven.js +1 -2
- package/dist/lifecycle/publish-npm.js +1 -1
- package/dist/lifecycle/publish-nuget.js +1 -2
- package/dist/lifecycle/publish-oci.d.ts +27 -0
- package/dist/lifecycle/publish-oci.js +63 -8
- package/dist/lifecycle/publish-rubygems.js +1 -2
- package/dist/lifecycle/release-artifacts.js +1 -2
- 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-images.d.ts +32 -2
- package/dist/lifecycle/release-images.js +70 -2
- 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 +22 -0
- package/dist/lifecycle/release-init.js +96 -16
- 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 +291 -290
- package/dist/workspace/catalog-edges.d.ts +22 -0
- package/dist/workspace/catalog-edges.js +23 -0
- 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 +39 -3
- package/dist/workspace/release-train-workflow.js +258 -9
- package/dist/workspace/release-train.js +5 -1
- package/dist/workspace/release-workflow.d.ts +37 -0
- package/dist/workspace/release-workflow.js +97 -16
- package/dist/workspace/train-artifacts.d.ts +107 -0
- package/dist/workspace/train-artifacts.js +238 -0
- package/dist/workspace/train-cut.d.ts +34 -1
- package/dist/workspace/train-cut.js +98 -14
- package/dist/workspace/train-publish.d.ts +9 -0
- package/dist/workspace/train-publish.js +27 -1
- package/package.json +2 -2
|
@@ -26,6 +26,8 @@
|
|
|
26
26
|
* 4. `release.train.check`: shell lines run once the labels are known and
|
|
27
27
|
* before anything is cut, with `CHANT_RELEASE_COMMIT`, `CHANT_TRAIN_ENV`
|
|
28
28
|
* and `CHANT_TRAIN_PLAN` (a JSON file of the members and labels).
|
|
29
|
+
* With `--doctor` (#5216), `chant release doctor` then runs in each
|
|
30
|
+
* member, and a failed check stops the train with nothing cut.
|
|
29
31
|
* 5. `chant release cut <label> --at <commit> --yes` in each member's
|
|
30
32
|
* directory, in publish order. Each cut pushes its record and tags the
|
|
31
33
|
* commit locally.
|
|
@@ -35,9 +37,17 @@
|
|
|
35
37
|
* the commit. A workflow on that tag publishes the train.
|
|
36
38
|
*
|
|
37
39
|
* Without `--yes` it plans: it prints the members and labels, runs each
|
|
38
|
-
* 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.
|
|
39
47
|
*/
|
|
40
48
|
import { type ReleaseBump } from "./release-changed.js";
|
|
49
|
+
/** 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`. */
|
|
50
|
+
export declare const TRAIN_BUILDS_FLOOR = "0.124.104";
|
|
41
51
|
/** `release.train` in a workspace root's `chant.config.ts` (#5154). */
|
|
42
52
|
export interface ReleaseTrainConfig {
|
|
43
53
|
/** The environment the train is recorded for, and the middle of its tag `release-train/<env>/<id>`. */
|
|
@@ -124,6 +134,12 @@ export interface TrainCutQuery {
|
|
|
124
134
|
/** The commit; the trunk's tip without it. */
|
|
125
135
|
at?: string;
|
|
126
136
|
levels?: TrainLevels;
|
|
137
|
+
/**
|
|
138
|
+
* The members and labels a plan made earlier gave (#5237), by member: the
|
|
139
|
+
* cut refuses (`train-plan-changed`) unless its own plan names exactly
|
|
140
|
+
* these, before any check, doctor or cut runs. Empty for a plan of nothing.
|
|
141
|
+
*/
|
|
142
|
+
planned?: Record<string, string>;
|
|
127
143
|
/** Reads the registry's versions. Default: {@link npmVersions}. */
|
|
128
144
|
registry?: NpmVersionsReader;
|
|
129
145
|
}
|
|
@@ -141,6 +157,8 @@ export type MemberCutter = (m: TrainCutMember, commit: string, o: {
|
|
|
141
157
|
root: string;
|
|
142
158
|
yes: boolean;
|
|
143
159
|
}) => Promise<MemberCutResult>;
|
|
160
|
+
/** The chant this process runs, as a command line. */
|
|
161
|
+
export declare function ownChant(): string[];
|
|
144
162
|
/** The default {@link MemberCutter}: this chant's `release cut` in the member's directory. */
|
|
145
163
|
export declare const spawnMemberCut: MemberCutter;
|
|
146
164
|
export interface TrainCutRun extends TrainCutQuery {
|
|
@@ -152,6 +170,14 @@ export interface TrainCutRun extends TrainCutQuery {
|
|
|
152
170
|
remote?: string;
|
|
153
171
|
actor?: string;
|
|
154
172
|
cutter?: MemberCutter;
|
|
173
|
+
/**
|
|
174
|
+
* Run `chant release doctor` in each member of the train before anything is
|
|
175
|
+
* cut (#5216): a target that can't publish from here stops the train with
|
|
176
|
+
* nothing cut, tagged or pushed.
|
|
177
|
+
*/
|
|
178
|
+
doctor?: boolean;
|
|
179
|
+
/** Runs the doctor in a member's directory and returns its exit code. Default: this chant's `release doctor`, its stdout sent to stderr. */
|
|
180
|
+
runDoctor?: (dir: string) => number | Promise<number>;
|
|
155
181
|
/** Runs the `release.train.check` lines. Default: `sh -c` each one, its stdout sent to stderr. */
|
|
156
182
|
runCheck?: (line: string, o: {
|
|
157
183
|
cwd: string;
|
|
@@ -175,6 +201,13 @@ export interface TrainCutOutcome extends TrainCutPlan {
|
|
|
175
201
|
/** Why the record did not reach the remote, when it did not. */
|
|
176
202
|
pushWarning?: string;
|
|
177
203
|
}
|
|
204
|
+
/**
|
|
205
|
+
* Parse `--planned` (#5237): `<member>=<label>` words separated by spaces or
|
|
206
|
+
* commas, as a plan's members give them, or `none` for a plan of nothing.
|
|
207
|
+
*/
|
|
208
|
+
export declare function parseTrainPlanned(text: string): Record<string, string>;
|
|
209
|
+
/** The members and labels of a plan, as `--planned` takes them: `none` for a plan of nothing. */
|
|
210
|
+
export declare function plannedText(plan: Pick<TrainCutPlan, "members">): string;
|
|
178
211
|
/** Plan, and with `yes` cut, record, tag and push, a release train (#5154). */
|
|
179
212
|
export declare function cutTrain(q: TrainCutRun): Promise<TrainCutOutcome>;
|
|
180
213
|
/** `chant workspace train cut <env>` (#5154). */
|
|
@@ -26,6 +26,8 @@
|
|
|
26
26
|
* 4. `release.train.check`: shell lines run once the labels are known and
|
|
27
27
|
* before anything is cut, with `CHANT_RELEASE_COMMIT`, `CHANT_TRAIN_ENV`
|
|
28
28
|
* and `CHANT_TRAIN_PLAN` (a JSON file of the members and labels).
|
|
29
|
+
* With `--doctor` (#5216), `chant release doctor` then runs in each
|
|
30
|
+
* member, and a failed check stops the train with nothing cut.
|
|
29
31
|
* 5. `chant release cut <label> --at <commit> --yes` in each member's
|
|
30
32
|
* directory, in publish order. Each cut pushes its record and tags the
|
|
31
33
|
* commit locally.
|
|
@@ -35,7 +37,13 @@
|
|
|
35
37
|
* the commit. A workflow on that tag publishes the train.
|
|
36
38
|
*
|
|
37
39
|
* Without `--yes` it plans: it prints the members and labels, runs each
|
|
38
|
-
* 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.
|
|
39
47
|
*/
|
|
40
48
|
import { execFileSync, spawnSync } from "node:child_process";
|
|
41
49
|
import { runToStderr } from "./train-shell.js";
|
|
@@ -48,6 +56,8 @@ import { readDeclaration } from "./declaration.js";
|
|
|
48
56
|
import { bumpLabel, parseVersion, RELEASE_BUMPS } from "./release-changed.js";
|
|
49
57
|
import { appendReleaseTrain, pickTrain, readMemberReleases, readReleaseTrains, trainDigest } from "./release-train.js";
|
|
50
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";
|
|
51
61
|
/** Why a train cut stopped. */
|
|
52
62
|
export class TrainCutError extends Error {
|
|
53
63
|
constructor(code, message, fix) {
|
|
@@ -317,7 +327,7 @@ export async function planTrainCut(q) {
|
|
|
317
327
|
return { env: q.env, commit, first: false, released: null, members: out };
|
|
318
328
|
}
|
|
319
329
|
/** The chant this process runs, as a command line. */
|
|
320
|
-
function ownChant() {
|
|
330
|
+
export function ownChant() {
|
|
321
331
|
return [process.execPath, ...process.execArgv, process.argv[1]];
|
|
322
332
|
}
|
|
323
333
|
/** The default {@link MemberCutter}: this chant's `release cut` in the member's directory. */
|
|
@@ -344,10 +354,63 @@ export const spawnMemberCut = async (m, commit, o) => {
|
|
|
344
354
|
};
|
|
345
355
|
// A check's stdout goes to stderr: under --json, stdout is the cut's JSON document alone.
|
|
346
356
|
const defaultCheck = (line, o) => runToStderr(line, o);
|
|
357
|
+
/** This chant's `release doctor` in a member's directory, its stdout sent to stderr. */
|
|
358
|
+
const defaultDoctor = (dir) => {
|
|
359
|
+
const [bin, ...pre] = ownChant();
|
|
360
|
+
return spawnSync(bin, [...pre, "release", "doctor"], { cwd: dir, stdio: ["ignore", 2, 2] }).status ?? 1;
|
|
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
|
+
}
|
|
347
408
|
/** Plan, and with `yes` cut, record, tag and push, a release train (#5154). */
|
|
348
409
|
export async function cutTrain(q) {
|
|
349
410
|
const root = locateWorkspace(q.cwd).rootOnDisk;
|
|
350
411
|
const plan = await planTrainCut(q);
|
|
412
|
+
if (q.planned !== undefined)
|
|
413
|
+
checkPlanned(plan, q.planned);
|
|
351
414
|
const say = q.say ?? (() => undefined);
|
|
352
415
|
const base = { ...plan, tags: {}, train: null, trainTag: null, pushed: false };
|
|
353
416
|
if (plan.released !== null || plan.members.length === 0)
|
|
@@ -385,6 +448,18 @@ export async function cutTrain(q) {
|
|
|
385
448
|
}
|
|
386
449
|
}
|
|
387
450
|
}
|
|
451
|
+
// #5216: each member's doctor, after the checks and before the first cut.
|
|
452
|
+
if (q.doctor) {
|
|
453
|
+
const failed = [];
|
|
454
|
+
for (const m of plan.members) {
|
|
455
|
+
say(`doctor: ${m.member}`);
|
|
456
|
+
const code = await (q.runDoctor ?? defaultDoctor)(resolve(root, m.dir));
|
|
457
|
+
if (code !== 0)
|
|
458
|
+
failed.push(m.member);
|
|
459
|
+
}
|
|
460
|
+
if (failed.length > 0)
|
|
461
|
+
throw new TrainCutError("train-doctor-failed", `release doctor found a target that can't publish from here in ${failed.join(", ")}`, "Nothing was cut. Fix what the doctor reports and run the train again.");
|
|
462
|
+
}
|
|
388
463
|
const cutter = q.cutter ?? spawnMemberCut;
|
|
389
464
|
const tags = {};
|
|
390
465
|
for (const m of plan.members) {
|
|
@@ -434,7 +509,7 @@ export async function cutTrain(q) {
|
|
|
434
509
|
}
|
|
435
510
|
return { ...out, pushed: true };
|
|
436
511
|
}
|
|
437
|
-
const CUT_USAGE = "chant workspace train cut <env> [--at <sha>] [--levels <levels>] [--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]";
|
|
438
513
|
/** `chant workspace train cut <env>` (#5154). */
|
|
439
514
|
export async function runTrainCut(ctx, words) {
|
|
440
515
|
const { formatError, formatSuccess, formatWarning } = await import("../cli/format.js");
|
|
@@ -452,17 +527,22 @@ export async function runTrainCut(ctx, words) {
|
|
|
452
527
|
await fetchLifecycle({ cwd }).catch(() => false);
|
|
453
528
|
spawnSync("git", ["fetch", "--quiet", "origin", "refs/tags/*:refs/tags/*"], { cwd, stdio: "ignore" });
|
|
454
529
|
let outcome;
|
|
530
|
+
const planOnly = args.planOnly === true;
|
|
455
531
|
try {
|
|
456
|
-
|
|
457
|
-
|
|
458
|
-
|
|
459
|
-
|
|
460
|
-
|
|
461
|
-
|
|
462
|
-
|
|
463
|
-
|
|
464
|
-
|
|
465
|
-
|
|
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
|
+
});
|
|
466
546
|
}
|
|
467
547
|
catch (err) {
|
|
468
548
|
if (err instanceof TrainCutError) {
|
|
@@ -478,7 +558,7 @@ export async function runTrainCut(ctx, words) {
|
|
|
478
558
|
throw err;
|
|
479
559
|
}
|
|
480
560
|
if (json) {
|
|
481
|
-
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));
|
|
482
562
|
return 0;
|
|
483
563
|
}
|
|
484
564
|
const short = outcome.commit.slice(0, 12);
|
|
@@ -493,6 +573,10 @@ export async function runTrainCut(ctx, words) {
|
|
|
493
573
|
console.log(`Release train for ${env} from ${short}${outcome.first ? " (the first: every member at one label)" : ""}:`);
|
|
494
574
|
for (const m of outcome.members)
|
|
495
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
|
+
}
|
|
496
580
|
if (args.yes !== true || args.dryRun === true) {
|
|
497
581
|
console.error("Dry run: nothing was cut, recorded, tagged or pushed. Run again with --yes to cut the train.");
|
|
498
582
|
return 0;
|
|
@@ -173,5 +173,14 @@ export declare function trainDependencies(members: ReadonlyArray<{
|
|
|
173
173
|
}>): Map<string, string[]>;
|
|
174
174
|
/** Plan, and with `yes` publish, a release train (#5136). */
|
|
175
175
|
export declare function publishTrain(query: TrainPublishQuery): Promise<TrainPublishOutcome>;
|
|
176
|
+
/** The tag `release.tag` gives `label` in the member at `dir`, or null when it can't be told. */
|
|
177
|
+
/**
|
|
178
|
+
* The environment a member's targets run with (#5216): for a member that
|
|
179
|
+
* declares `release.images`, `CHANT_RELEASE_DIGESTS` names a file of the
|
|
180
|
+
* digests its release records, as `chant release images` writes it for one
|
|
181
|
+
* release, so a package it packs pins its own images. Other members get the
|
|
182
|
+
* environment as it is.
|
|
183
|
+
*/
|
|
184
|
+
export declare function memberDigestsEnv(dir: string, release: import("../lifecycle/release-store.js").Release, env: NodeJS.ProcessEnv): Promise<NodeJS.ProcessEnv>;
|
|
176
185
|
/** `chant workspace train publish <env> [<train>] [--yes]` (#5136). */
|
|
177
186
|
export declare function runTrainPublish(ctx: import("../cli/registry.js").CommandContext, words: string[]): Promise<number>;
|
|
@@ -228,7 +228,7 @@ export async function publishTrain(query) {
|
|
|
228
228
|
for (const w of [plan.signatureWarning, plan.warning])
|
|
229
229
|
if (w && !warnings.includes(`${m.member}: ${w}`))
|
|
230
230
|
warnings.push(`${m.member}: ${w}`);
|
|
231
|
-
const ctx = publishContext(plan, { cwd: dir, env, tag: plan.channel, log: memberLog(m.member, plan.redactor) });
|
|
231
|
+
const ctx = publishContext(plan, { cwd: dir, env: await memberDigestsEnv(dir, plan.release, env), tag: plan.channel, log: memberLog(m.member, plan.redactor) });
|
|
232
232
|
prepared.push({ m, dir, plan, ctx });
|
|
233
233
|
}
|
|
234
234
|
const redactor = createRedactor(env, credentialEnv);
|
|
@@ -306,6 +306,32 @@ export async function publishTrain(query) {
|
|
|
306
306
|
return { kind: "published", train, members, warnings, redactor, verify, ...ran, floatingWarnings };
|
|
307
307
|
}
|
|
308
308
|
/** The tag `release.tag` gives `label` in the member at `dir`, or null when it can't be told. */
|
|
309
|
+
/**
|
|
310
|
+
* The environment a member's targets run with (#5216): for a member that
|
|
311
|
+
* declares `release.images`, `CHANT_RELEASE_DIGESTS` names a file of the
|
|
312
|
+
* digests its release records, as `chant release images` writes it for one
|
|
313
|
+
* release, so a package it packs pins its own images. Other members get the
|
|
314
|
+
* environment as it is.
|
|
315
|
+
*/
|
|
316
|
+
export async function memberDigestsEnv(dir, release, env) {
|
|
317
|
+
const { loadChantConfig } = await import("../config.js");
|
|
318
|
+
let images;
|
|
319
|
+
try {
|
|
320
|
+
images = (await loadChantConfig(dir)).config.release?.images ?? [];
|
|
321
|
+
}
|
|
322
|
+
catch {
|
|
323
|
+
return env;
|
|
324
|
+
}
|
|
325
|
+
if (images.length === 0)
|
|
326
|
+
return env;
|
|
327
|
+
const { releaseImageDigests, writeReleaseDigests, RELEASE_DIGESTS_ENV } = await import("../lifecycle/release-images.js");
|
|
328
|
+
const { mkdtempSync } = await import("node:fs");
|
|
329
|
+
const { tmpdir } = await import("node:os");
|
|
330
|
+
const { join } = await import("node:path");
|
|
331
|
+
const file = join(mkdtempSync(join(tmpdir(), "chant-train-digests-")), "release-digests.json");
|
|
332
|
+
writeReleaseDigests(file, releaseImageDigests(release, images.map((i) => i.name)));
|
|
333
|
+
return { ...env, [RELEASE_DIGESTS_ENV]: file };
|
|
334
|
+
}
|
|
309
335
|
async function pinnedReleaseTag(dir, label) {
|
|
310
336
|
try {
|
|
311
337
|
const { memberTags, renderReleaseTag } = await import("../lifecycle/release-tag.js");
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@intentius/chant",
|
|
3
|
-
"version": "0.124.
|
|
3
|
+
"version": "0.124.104",
|
|
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",
|