@intentius/chant 0.124.100 → 0.124.101
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/action-pins.d.ts +2 -0
- package/dist/action-pins.js +3 -0
- package/dist/ci-detect.d.ts +13 -0
- package/dist/ci-detect.js +12 -0
- package/dist/ci-system.d.ts +66 -0
- package/dist/ci-system.js +61 -0
- package/dist/cli/handlers/build.js +27 -0
- package/dist/cli/handlers/release-doctor.d.ts +12 -0
- package/dist/cli/handlers/release-doctor.js +118 -0
- package/dist/cli/handlers/release-init.d.ts +10 -0
- package/dist/cli/handlers/release-init.js +342 -0
- package/dist/cli/handlers/release.d.ts +42 -1
- package/dist/cli/handlers/release.js +656 -31
- package/dist/cli/handlers/run-generate.js +11 -0
- package/dist/cli/main.d.ts +2 -0
- package/dist/cli/main.js +44 -101
- package/dist/cli/parse-args.js +48 -0
- package/dist/cli/registry.d.ts +16 -0
- package/dist/cli/release-commands/artifacts.d.ts +3 -0
- package/dist/cli/release-commands/artifacts.js +14 -0
- package/dist/cli/release-commands/candidates.d.ts +3 -0
- package/dist/cli/release-commands/candidates.js +16 -0
- package/dist/cli/release-commands/changed.d.ts +3 -0
- package/dist/cli/release-commands/changed.js +14 -0
- package/dist/cli/release-commands/compose.d.ts +3 -0
- package/dist/cli/release-commands/compose.js +16 -0
- package/dist/cli/release-commands/cut.d.ts +3 -0
- package/dist/cli/release-commands/cut.js +49 -0
- package/dist/cli/release-commands/doctor.d.ts +3 -0
- package/dist/cli/release-commands/doctor.js +14 -0
- package/dist/cli/release-commands/export.d.ts +3 -0
- package/dist/cli/release-commands/export.js +12 -0
- package/dist/cli/release-commands/images.d.ts +3 -0
- package/dist/cli/release-commands/images.js +13 -0
- package/dist/cli/release-commands/index.d.ts +8 -0
- package/dist/cli/release-commands/index.js +52 -0
- package/dist/cli/release-commands/init.d.ts +3 -0
- package/dist/cli/release-commands/init.js +16 -0
- package/dist/cli/release-commands/list.d.ts +3 -0
- package/dist/cli/release-commands/list.js +10 -0
- package/dist/cli/release-commands/next.d.ts +3 -0
- package/dist/cli/release-commands/next.js +13 -0
- package/dist/cli/release-commands/publish.d.ts +3 -0
- package/dist/cli/release-commands/publish.js +22 -0
- package/dist/cli/release-commands/stamp.d.ts +3 -0
- package/dist/cli/release-commands/stamp.js +15 -0
- package/dist/cli/release-commands/status.d.ts +3 -0
- package/dist/cli/release-commands/status.js +17 -0
- package/dist/cli/release-commands/tag.d.ts +3 -0
- package/dist/cli/release-commands/tag.js +12 -0
- package/dist/cli/release-commands/types.d.ts +20 -0
- package/dist/cli/release-commands/types.js +1 -0
- package/dist/cli/release-commands/verify.d.ts +3 -0
- package/dist/cli/release-commands/verify.js +15 -0
- package/dist/cli/release-commands/workflow.d.ts +3 -0
- package/dist/cli/release-commands/workflow.js +13 -0
- package/dist/components/cli-support.d.ts +1 -1
- package/dist/components/cli-support.js +1 -1
- package/dist/config-environments.d.ts +8 -1
- package/dist/config-environments.js +2 -0
- package/dist/config.d.ts +294 -9
- package/dist/config.js +100 -5
- package/dist/floor-table.data.js +15 -1
- package/dist/forge-remote.d.ts +13 -0
- package/dist/forge-remote.js +15 -0
- package/dist/lexicon.d.ts +41 -2
- package/dist/lifecycle/__fixtures__/publish-fakes.d.ts +62 -0
- package/dist/lifecycle/__fixtures__/publish-fakes.js +270 -3
- package/dist/lifecycle/publish-attachments.d.ts +2 -1
- package/dist/lifecycle/publish-attachments.js +19 -2
- package/dist/lifecycle/publish-cargo.d.ts +99 -0
- package/dist/lifecycle/publish-cargo.js +412 -0
- package/dist/lifecycle/publish-credentials.d.ts +1 -1
- package/dist/lifecycle/publish-credentials.js +8 -0
- package/dist/lifecycle/publish-declaration.d.ts +199 -4
- package/dist/lifecycle/publish-declaration.js +200 -9
- package/dist/lifecycle/publish-forge.d.ts +45 -2
- package/dist/lifecycle/publish-forge.js +434 -34
- package/dist/lifecycle/publish-git-ssh.d.ts +15 -0
- package/dist/lifecycle/publish-git-ssh.js +30 -4
- package/dist/lifecycle/publish-github.d.ts +40 -2
- package/dist/lifecycle/publish-github.js +100 -3
- package/dist/lifecycle/publish-homebrew.d.ts +7 -9
- package/dist/lifecycle/publish-homebrew.js +34 -197
- package/dist/lifecycle/publish-index.d.ts +141 -0
- package/dist/lifecycle/publish-index.js +719 -0
- package/dist/lifecycle/publish-marketplace.js +77 -0
- package/dist/lifecycle/publish-mcp-registry.d.ts +66 -0
- package/dist/lifecycle/publish-mcp-registry.js +306 -0
- package/dist/lifecycle/publish-npm.js +165 -2
- package/dist/lifecycle/publish-oci.d.ts +34 -1
- package/dist/lifecycle/publish-oci.js +246 -7
- package/dist/lifecycle/publish-pypi.d.ts +136 -0
- package/dist/lifecycle/publish-pypi.js +657 -0
- package/dist/lifecycle/publish-record.d.ts +6 -3
- package/dist/lifecycle/publish-record.js +6 -3
- package/dist/lifecycle/publish-signing.d.ts +147 -0
- package/dist/lifecycle/publish-signing.js +257 -0
- package/dist/lifecycle/publish-targets.d.ts +27 -1
- package/dist/lifecycle/publish-targets.js +80 -0
- package/dist/lifecycle/publish-tauri.js +43 -0
- package/dist/lifecycle/publish-train-names.d.ts +54 -0
- package/dist/lifecycle/publish-train-names.js +118 -0
- package/dist/lifecycle/publish-verify.d.ts +121 -0
- package/dist/lifecycle/publish-verify.js +130 -0
- package/dist/lifecycle/query.js +8 -0
- package/dist/lifecycle/release-artifacts.d.ts +212 -0
- package/dist/lifecycle/release-artifacts.js +571 -0
- package/dist/lifecycle/release-changelog.d.ts +13 -1
- package/dist/lifecycle/release-changelog.js +35 -2
- package/dist/lifecycle/release-cut.d.ts +58 -3
- package/dist/lifecycle/release-cut.js +132 -34
- package/dist/lifecycle/release-doctor.d.ts +113 -0
- package/dist/lifecycle/release-doctor.js +996 -0
- package/dist/lifecycle/release-green.d.ts +86 -0
- package/dist/lifecycle/release-green.js +286 -0
- package/dist/lifecycle/release-init.d.ts +255 -0
- package/dist/lifecycle/release-init.js +859 -0
- package/dist/lifecycle/release-intents.d.ts +73 -0
- package/dist/lifecycle/release-intents.js +128 -0
- package/dist/lifecycle/release-next.d.ts +111 -0
- package/dist/lifecycle/release-next.js +252 -0
- package/dist/lifecycle/release-prerelease.d.ts +19 -0
- package/dist/lifecycle/release-prerelease.js +30 -0
- package/dist/lifecycle/release-publish.d.ts +256 -10
- package/dist/lifecycle/release-publish.js +246 -34
- package/dist/lifecycle/release-status-change.d.ts +226 -0
- package/dist/lifecycle/release-status-change.js +478 -0
- package/dist/lifecycle/release-status.d.ts +11 -0
- package/dist/lifecycle/release-status.js +1 -1
- package/dist/lifecycle/release-store.d.ts +73 -2
- package/dist/lifecycle/release-store.js +32 -1
- package/dist/lifecycle/release-tag.d.ts +142 -0
- package/dist/lifecycle/release-tag.js +323 -0
- package/dist/lifecycle/release-verify.d.ts +73 -1
- package/dist/lifecycle/release-verify.js +117 -2
- package/dist/lifecycle/release-version-formats.d.ts +73 -0
- package/dist/lifecycle/release-version-formats.js +570 -0
- package/dist/lifecycle/release-version.d.ts +58 -10
- package/dist/lifecycle/release-version.js +164 -36
- package/dist/lifecycle/release-workstation.d.ts +3 -2
- package/dist/lifecycle/release-workstation.js +3 -2
- package/dist/op/generate-pipeline.js +1 -1
- package/dist/pr-forge-base.js +4 -2
- package/dist/pr-forge.d.ts +20 -2
- package/dist/pr-forge.js +46 -10
- package/dist/release-floors.d.ts +8 -1
- package/dist/release-floors.js +9 -2
- package/dist/tool-pins.d.ts +38 -0
- package/dist/tool-pins.js +54 -0
- package/dist/wave-runtime.mjs +337 -334
- package/dist/workspace/ci-forge.d.ts +17 -0
- package/dist/workspace/ci-forge.js +17 -0
- package/dist/workspace/ci-init.js +1 -1
- package/dist/workspace/composites.schema.json +1 -0
- package/dist/workspace/declaration.d.ts +8 -0
- package/dist/workspace/declaration.js +12 -0
- package/dist/workspace/declaration.schema.json +8 -0
- package/dist/workspace/environments.d.ts +2 -0
- package/dist/workspace/environments.js +1 -1
- package/dist/workspace/identity-gate-rule.d.ts +61 -5
- package/dist/workspace/identity-gate-rule.js +81 -12
- package/dist/workspace/member-pipeline.d.ts +2 -1
- package/dist/workspace/member-pipeline.js +5 -2
- package/dist/workspace/reason-codes.d.ts +2 -0
- package/dist/workspace/reason-codes.js +3 -1
- package/dist/workspace/release-changed.d.ts +75 -4
- package/dist/workspace/release-changed.js +205 -34
- package/dist/workspace/release-changed.schema.json +20 -2
- package/dist/workspace/release-steps/artifacts.d.ts +7 -0
- package/dist/workspace/release-steps/artifacts.js +45 -0
- package/dist/workspace/release-steps/builds.d.ts +12 -0
- package/dist/workspace/release-steps/builds.js +38 -0
- package/dist/workspace/release-steps/doctor.d.ts +8 -0
- package/dist/workspace/release-steps/doctor.js +14 -0
- package/dist/workspace/release-steps/goreleaser.d.ts +16 -0
- package/dist/workspace/release-steps/goreleaser.js +36 -0
- package/dist/workspace/release-steps/green.d.ts +3 -0
- package/dist/workspace/release-steps/green.js +6 -0
- package/dist/workspace/release-steps/images.d.ts +22 -0
- package/dist/workspace/release-steps/images.js +59 -0
- package/dist/workspace/release-steps/index.d.ts +9 -0
- package/dist/workspace/release-steps/index.js +46 -0
- package/dist/workspace/release-steps/pypi.d.ts +15 -0
- package/dist/workspace/release-steps/pypi.js +21 -0
- package/dist/workspace/release-steps/qemu.d.ts +21 -0
- package/dist/workspace/release-steps/qemu.js +35 -0
- package/dist/workspace/release-steps/signing.d.ts +18 -0
- package/dist/workspace/release-steps/signing.js +30 -0
- package/dist/workspace/release-steps/stamp.d.ts +3 -0
- package/dist/workspace/release-steps/stamp.js +4 -0
- package/dist/workspace/release-steps/targets.d.ts +31 -0
- package/dist/workspace/release-steps/targets.js +40 -0
- package/dist/workspace/release-steps/types.d.ts +104 -0
- package/dist/workspace/release-steps/types.js +2 -0
- package/dist/workspace/release-steps/verify.d.ts +3 -0
- package/dist/workspace/release-steps/verify.js +4 -0
- package/dist/workspace/release-toolchains.d.ts +59 -0
- package/dist/workspace/release-toolchains.js +133 -0
- package/dist/workspace/release-train-workflow.d.ts +29 -0
- package/dist/workspace/release-train-workflow.js +85 -0
- package/dist/workspace/release-train.d.ts +3 -1
- package/dist/workspace/release-train.js +20 -3
- package/dist/workspace/release-workflow.d.ts +160 -61
- package/dist/workspace/release-workflow.js +539 -193
- package/dist/workspace/releases.schema.json +70 -1
- package/dist/workspace/search-contract.d.ts +1 -1
- package/dist/workspace/security.js +9 -2
- package/dist/workspace/train-cut.d.ts +182 -0
- package/dist/workspace/train-cut.js +482 -0
- package/dist/workspace/train-prepare.d.ts +61 -0
- package/dist/workspace/train-prepare.js +267 -0
- package/dist/workspace/train-publish.d.ts +177 -0
- package/dist/workspace/train-publish.js +575 -0
- package/dist/workspace/train-range-labels.d.ts +33 -0
- package/dist/workspace/train-range-labels.js +109 -0
- package/dist/workspace/trust/seal.d.ts +13 -3
- package/dist/workspace/trust/seal.js +14 -4
- package/dist/workspace/work-cli.d.ts +3 -2
- package/dist/workspace/work-cli.js +3 -2
- package/dist/workspace/workspace-ledger.d.ts +14 -1
- package/dist/workspace/workspace-ledger.js +33 -7
- package/package.json +1 -1
|
@@ -16,7 +16,7 @@
|
|
|
16
16
|
* --allow-unsigned (#4049), and with a target a checkout that is not
|
|
17
17
|
* the release's commit; warns with no OIDC provenance, and refuses
|
|
18
18
|
* under --require-provenance; attaches SBOMs and provenance (#4049)
|
|
19
|
-
* release verify <label|digest> [--json]
|
|
19
|
+
* release verify <label|digest> [--sigstore [--assets <dir>]] [--json]
|
|
20
20
|
* check the release's signature offline against .chant/allowed_signers
|
|
21
21
|
* at the release's commit (#4049)
|
|
22
22
|
* release changed [--at <sha>] [--bump-member <member>=<level>]... [--json]
|
|
@@ -34,6 +34,9 @@
|
|
|
34
34
|
* `--json` prints the read contract's `releases` document
|
|
35
35
|
* release export <label|digest> --env <env> [-o <dir>] [--json]
|
|
36
36
|
* write the files the release recorded for <env>, checked against their digests (#4046)
|
|
37
|
+
* release deprecate|yank|restore <label|digest> [--yes] [--reason <text>] [--replacement <label>] [--forge-release prerelease|draft|delete] [--actor <name>] [--sign [<key file>]] [--json]
|
|
38
|
+
* set a published release's status and act on each target that can
|
|
39
|
+
* (#5163, ../../lifecycle/release-status-change.ts): a dry run unless --yes
|
|
37
40
|
* release compile --env <env> [--build <command>] [--artifacts --component <a,b>] --json
|
|
38
41
|
* internal: what the cut runs in a child process per environment
|
|
39
42
|
*
|
|
@@ -42,13 +45,18 @@
|
|
|
42
45
|
* ../../lifecycle/release-publish.ts. A declaration whose `identity.gates`
|
|
43
46
|
* names a `release` gate requires a signed cut by an actor in its class (#4031).
|
|
44
47
|
*/
|
|
45
|
-
import { execFileSync } from "node:child_process";
|
|
48
|
+
import { execFileSync, spawnSync } from "node:child_process";
|
|
46
49
|
import { cpSync, existsSync, mkdirSync, writeFileSync } from "node:fs";
|
|
47
50
|
import { tmpdir } from "node:os";
|
|
48
51
|
import { dirname, join, relative, resolve } from "node:path";
|
|
49
52
|
import { formatBold, formatError, formatSuccess, formatWarning } from "../format.js";
|
|
50
53
|
import { parseParamFlags } from "../build-params-cli.js";
|
|
51
|
-
|
|
54
|
+
import { prereleaseNote, prereleaseOf } from "../../lifecycle/release-prerelease.js";
|
|
55
|
+
import { releaseUsage } from "../release-commands/index.js";
|
|
56
|
+
/** The usage line printed with a refusal, built from ../release-commands (#5196). */
|
|
57
|
+
export const USAGE = releaseUsage();
|
|
58
|
+
/** The label `release cut` takes for the one `release next` computes (#5159). */
|
|
59
|
+
const AUTO_LABEL = "auto";
|
|
52
60
|
/** The build inputs `release cut` and `release compile` share. */
|
|
53
61
|
function compileInputs(ctx, params, projectDir = resolve("."), releaseLabel) {
|
|
54
62
|
const { args } = ctx;
|
|
@@ -99,11 +107,62 @@ async function laneOf(ctx, cwd) {
|
|
|
99
107
|
return undefined;
|
|
100
108
|
}
|
|
101
109
|
}
|
|
110
|
+
/** The member's `release.artifacts` (#5151), or none when the config declares none. */
|
|
111
|
+
async function releaseArtifactsOf(cwd) {
|
|
112
|
+
const { loadChantConfig } = await import("../../config.js");
|
|
113
|
+
return (await loadChantConfig(cwd)).config.release?.artifacts ?? [];
|
|
114
|
+
}
|
|
115
|
+
/** The member's `release.workflow.builds` (#5152), which a `release.artifacts` entry's `builtBy` names (#5183). */
|
|
116
|
+
async function releaseBuildJobsOf(cwd) {
|
|
117
|
+
const { loadChantConfig } = await import("../../config.js");
|
|
118
|
+
return (await loadChantConfig(cwd)).config.release?.workflow?.builds ?? [];
|
|
119
|
+
}
|
|
102
120
|
/** The member's `release.images` (#4657), or none when the config declares none. A Dockerfile entry (#4819) keeps its form, so its prepare command runs. */
|
|
103
121
|
async function releaseImagesOf(cwd) {
|
|
104
122
|
const { loadChantConfig } = await import("../../config.js");
|
|
105
123
|
return (await loadChantConfig(cwd)).config.release?.images ?? [];
|
|
106
124
|
}
|
|
125
|
+
/**
|
|
126
|
+
* The green gate `release.green` names (#5149), or undefined for the default.
|
|
127
|
+
* A config that can't be loaded reads as naming none.
|
|
128
|
+
*/
|
|
129
|
+
async function greenOf(cwd) {
|
|
130
|
+
try {
|
|
131
|
+
const { loadChantConfig } = await import("../../config.js");
|
|
132
|
+
return (await loadChantConfig(cwd)).config.release?.green;
|
|
133
|
+
}
|
|
134
|
+
catch {
|
|
135
|
+
return undefined;
|
|
136
|
+
}
|
|
137
|
+
}
|
|
138
|
+
/**
|
|
139
|
+
* The `release.publish` targets an artifact release records (#5149): read
|
|
140
|
+
* only when the member declares no environments, since a release cut from
|
|
141
|
+
* environments records its compile targets instead.
|
|
142
|
+
*/
|
|
143
|
+
async function artifactPublishesOf(cwd) {
|
|
144
|
+
const { readMemberPromotionOrder } = await import("../../workspace/promotion-order.js");
|
|
145
|
+
if (((await readMemberPromotionOrder(cwd)) ?? []).length > 0)
|
|
146
|
+
return undefined;
|
|
147
|
+
const { releasePublishTargets } = await import("../../lifecycle/release-publish.js");
|
|
148
|
+
return (await releasePublishTargets(cwd)).map((t) => ({ target: t.key, kind: t.kind, destination: t.destination }));
|
|
149
|
+
}
|
|
150
|
+
/** How a cut's green gate reads in a line (#5149). */
|
|
151
|
+
export function describeGreen(green) {
|
|
152
|
+
if (!green)
|
|
153
|
+
return "no green gate recorded";
|
|
154
|
+
if (green.source === "chant")
|
|
155
|
+
return `green by ${green.tag.slice(0, green.tag.lastIndexOf("/"))} tag`;
|
|
156
|
+
if (green.source === "forge-checks")
|
|
157
|
+
return `green by ${green.checks.length} ${green.forge} check(s): ${green.checks.join(", ")}`;
|
|
158
|
+
return "no green gate (release.green: none)";
|
|
159
|
+
}
|
|
160
|
+
/** The warning a cut under `release.green: "none"` prints (#5149). */
|
|
161
|
+
const GREEN_NONE_WARNING = 'release.green is "none": this cut checked no CI result for the commit, and the release records that it had no green gate';
|
|
162
|
+
async function releaseTagOf(cwd) {
|
|
163
|
+
const { loadChantConfig } = await import("../../config.js");
|
|
164
|
+
return (await loadChantConfig(cwd)).config.release?.tag;
|
|
165
|
+
}
|
|
107
166
|
async function releaseVersionOf(cwd) {
|
|
108
167
|
const { loadChantConfig } = await import("../../config.js");
|
|
109
168
|
return (await loadChantConfig(cwd)).config.release?.version;
|
|
@@ -193,6 +252,87 @@ export async function runReleaseImages(ctx) {
|
|
|
193
252
|
}
|
|
194
253
|
return 0;
|
|
195
254
|
}
|
|
255
|
+
/**
|
|
256
|
+
* `release artifacts <label|digest> [--no-build] [--from <dir>] [-o <dir>] [--json]`
|
|
257
|
+
* (#5151): the files `release.artifacts` declares, checked against the
|
|
258
|
+
* digests the release records, from the release's commit checked out here.
|
|
259
|
+
* Without a flag it builds them again; `--no-build` checks the files on
|
|
260
|
+
* disk; `--from <dir>` first copies them from a directory where the cut job
|
|
261
|
+
* staged them. `-o <dir>` stages the checked files in a directory, at their
|
|
262
|
+
* paths in the member, for the next job. A file missing or with another
|
|
263
|
+
* digest is refused.
|
|
264
|
+
*/
|
|
265
|
+
export async function runReleaseArtifacts(ctx) {
|
|
266
|
+
const { args } = ctx;
|
|
267
|
+
const ref = args.extraPositional;
|
|
268
|
+
const fail = (code, message, fix) => {
|
|
269
|
+
if (args.json)
|
|
270
|
+
console.log(JSON.stringify({ ref: ref ?? null, error: { code, message, ...(fix ? { fix } : {}) } }, null, 2));
|
|
271
|
+
else
|
|
272
|
+
console.error(formatError({ message: `${message} [${code}]`, ...(fix ? { hint: fix } : {}) }));
|
|
273
|
+
return 1;
|
|
274
|
+
};
|
|
275
|
+
if (!ref)
|
|
276
|
+
return fail("release-not-named", "release artifacts needs a release, by label or digest", USAGE);
|
|
277
|
+
const cwd = resolve(".");
|
|
278
|
+
const { resolveRelease } = await import("../../lifecycle/release-store.js");
|
|
279
|
+
const { artifactFileProblems, buildReleaseArtifacts, copyArtifactFiles, releaseArtifactFiles, ReleaseArtifactError } = await import("../../lifecycle/release-artifacts.js");
|
|
280
|
+
const { getHeadCommit } = await import("../../lifecycle/git.js");
|
|
281
|
+
const found = await resolveRelease(ref, { cwd });
|
|
282
|
+
if (!found)
|
|
283
|
+
return fail("release-not-found", `no release is labelled or digested "${ref}" in this member`, "Fetch chant/lifecycle (git fetch origin chant/lifecycle:chant/lifecycle), then list them with: chant release list");
|
|
284
|
+
const { release, label } = found;
|
|
285
|
+
const head = await getHeadCommit({ cwd });
|
|
286
|
+
if (head !== release.commit)
|
|
287
|
+
return fail("release-artifacts-wrong-commit", `the release was cut from ${release.commit.slice(0, 12)}, and this checkout is at ${head.slice(0, 12)}, so its files would not be the release's`, `Check out the release's commit: git checkout ${release.commit}`);
|
|
288
|
+
const declared = await releaseArtifactsOf(cwd);
|
|
289
|
+
if (declared.length === 0)
|
|
290
|
+
return fail("release-artifacts-not-declared", "this member's chant.config.ts has no release.artifacts, so there is nothing to check", "Declare the files the cut builds: release: { artifacts: [{ name: \"cli\", build: \"make dist\", outputs: [\"dist/cli\"] }] }");
|
|
291
|
+
const files = releaseArtifactFiles(release, declared.map((d) => d.name));
|
|
292
|
+
const recordedNames = new Set(files.map((f) => f.component));
|
|
293
|
+
const missing = declared.filter((d) => !recordedNames.has(d.name)).map((d) => d.name);
|
|
294
|
+
if (missing.length > 0)
|
|
295
|
+
return fail("release-artifact-not-recorded", `release.artifacts names ${missing.join(", ")}, which release ${release.releaseDigest} does not record`, "Cut a new release, so its cut builds every file the config declares.");
|
|
296
|
+
const from = args.migrateFrom;
|
|
297
|
+
try {
|
|
298
|
+
if (from !== undefined)
|
|
299
|
+
copyArtifactFiles(files, resolve(from), cwd);
|
|
300
|
+
else if (!args.noBuild) {
|
|
301
|
+
const images = await releaseImagesOf(cwd);
|
|
302
|
+
const built = buildReleaseArtifacts({ artifacts: declared, cwd, sourceDateEpoch: commitTime(cwd, release.commit), label, imageNames: images.map((i) => i.name), builds: await releaseBuildJobsOf(cwd) });
|
|
303
|
+
const recorded = new Set(files.map((f) => f.path));
|
|
304
|
+
const extra = built.filter((b) => !recorded.has(b.path)).map((b) => b.path);
|
|
305
|
+
if (extra.length > 0)
|
|
306
|
+
return fail("release-artifact-digest-mismatch", `the build wrote ${extra.join(", ")}, which release ${release.releaseDigest} does not record`, "A build of the release's commit must write the files the cut wrote. Cut a new release.");
|
|
307
|
+
}
|
|
308
|
+
}
|
|
309
|
+
catch (err) {
|
|
310
|
+
if (err instanceof ReleaseArtifactError)
|
|
311
|
+
return fail(err.code, err.message, err.fix);
|
|
312
|
+
throw err;
|
|
313
|
+
}
|
|
314
|
+
const problems = artifactFileProblems(cwd, files);
|
|
315
|
+
const absent = problems.filter((p) => p.problem === "missing");
|
|
316
|
+
if (absent.length > 0)
|
|
317
|
+
return fail("release-artifact-missing", `${absent.map((p) => p.path).join(", ")} ${absent.length === 1 ? "is" : "are"} not here`, "Hand this job the files the cut staged (--from <dir>), or run without --no-build to build them again.");
|
|
318
|
+
if (problems.length > 0) {
|
|
319
|
+
return fail("release-artifact-digest-mismatch", problems.map((p) => `${p.path} is ${p.digest}, and the release records ${p.recorded}`).join("; "), args.noBuild || from !== undefined ? "Publish the files the cut built: hand them over unchanged, or cut a new release." : "A build of the same commit must write the same bytes: set every timestamp from SOURCE_DATE_EPOCH and leave out build paths (go build -trimpath).");
|
|
320
|
+
}
|
|
321
|
+
let staged = null;
|
|
322
|
+
if (args.output) {
|
|
323
|
+
staged = resolve(args.output);
|
|
324
|
+
copyArtifactFiles(files, cwd, staged);
|
|
325
|
+
}
|
|
326
|
+
if (args.json)
|
|
327
|
+
console.log(JSON.stringify({ releaseDigest: release.releaseDigest, label, files: files.map((f) => ({ name: f.component, path: f.path, digest: f.digest })), staged }, null, 2));
|
|
328
|
+
else {
|
|
329
|
+
for (const f of files)
|
|
330
|
+
console.error(` ${f.component} ${f.path} ${f.digest}`);
|
|
331
|
+
const how = from !== undefined ? `Copied from ${from} and checked` : args.noBuild ? "Checked" : "Built and checked";
|
|
332
|
+
console.error(formatSuccess(`${how} ${files.length} file(s) against release ${label ?? release.releaseDigest}${staged ? `, and staged them in ${relative(cwd, staged) || staged}` : ""}`));
|
|
333
|
+
}
|
|
334
|
+
return 0;
|
|
335
|
+
}
|
|
196
336
|
/**
|
|
197
337
|
* `release stamp <label> [--json]` (#4840): write the label into the files
|
|
198
338
|
* `release.version` names, as the cut does before its build, and leave them
|
|
@@ -215,11 +355,25 @@ export async function runReleaseStamp(ctx) {
|
|
|
215
355
|
const cwd = resolve(".");
|
|
216
356
|
const config = await releaseVersionOf(cwd);
|
|
217
357
|
if (!config)
|
|
218
|
-
return fail("release-version-not-declared", "this member's chant.config.ts has no release.version, so there is nothing to stamp", "Name the package directories: release: { version: { packages: [\"packages/cli\"] } }");
|
|
219
|
-
const { stampReleaseVersion, ReleaseVersionError } = await import("../../lifecycle/release-version.js");
|
|
358
|
+
return fail("release-version-not-declared", "this member's chant.config.ts has no release.version, so there is nothing to stamp", "Name the package directories or the files: release: { version: { packages: [\"packages/cli\"] } } or { version: { files: [\"Cargo.toml\"] } }");
|
|
359
|
+
const { stampReleaseVersion, ReleaseVersionError, ownNames } = await import("../../lifecycle/release-version.js");
|
|
360
|
+
if (args.train !== undefined && config.ranges !== "train")
|
|
361
|
+
return fail("release-ranges-not-train", `--train names a train, and this member's release.version.ranges is ${config.ranges ?? "unset"}`, 'Set release.version.ranges to "train", or leave --train out.');
|
|
220
362
|
let files;
|
|
221
363
|
try {
|
|
222
|
-
|
|
364
|
+
let train;
|
|
365
|
+
if (args.train !== undefined) {
|
|
366
|
+
const { trainLabels, TrainLabelsError } = await import("../../workspace/train-range-labels.js");
|
|
367
|
+
try {
|
|
368
|
+
train = await trainLabels(cwd, args.train, ownNames(cwd, config), label);
|
|
369
|
+
}
|
|
370
|
+
catch (err) {
|
|
371
|
+
if (err instanceof TrainLabelsError)
|
|
372
|
+
return fail(err.code, err.message, err.fix);
|
|
373
|
+
throw err;
|
|
374
|
+
}
|
|
375
|
+
}
|
|
376
|
+
files = stampReleaseVersion({ cwd, config, label, ...(train ? { train } : {}) }).files;
|
|
223
377
|
}
|
|
224
378
|
catch (err) {
|
|
225
379
|
if (err instanceof ReleaseVersionError)
|
|
@@ -232,6 +386,70 @@ export async function runReleaseStamp(ctx) {
|
|
|
232
386
|
console.error(formatSuccess(`Stamped ${label} into ${files.join(", ")}`));
|
|
233
387
|
return 0;
|
|
234
388
|
}
|
|
389
|
+
/**
|
|
390
|
+
* `release tag <label|digest|tag> [--json]` (#5150): the tag `release.tag`
|
|
391
|
+
* gives a release of this member, found by its label, its digest, or the tag
|
|
392
|
+
* itself. The ledger names the release: a tag is matched by rendering the
|
|
393
|
+
* template for each label the member's ledger holds, never parsed. The
|
|
394
|
+
* publish job of `chant release workflow` reads the label of the tag that
|
|
395
|
+
* started it this way.
|
|
396
|
+
*/
|
|
397
|
+
export async function runReleaseTag(ctx) {
|
|
398
|
+
const { args } = ctx;
|
|
399
|
+
const ref = args.extraPositional ?? null;
|
|
400
|
+
const fail = (code, message, fix) => {
|
|
401
|
+
if (args.json)
|
|
402
|
+
console.log(JSON.stringify({ ref, error: { code, message, ...(fix ? { fix } : {}) } }, null, 2));
|
|
403
|
+
else
|
|
404
|
+
console.error(formatError({ message: `${message} [${code}]`, ...(fix ? { hint: fix } : {}) }));
|
|
405
|
+
return 1;
|
|
406
|
+
};
|
|
407
|
+
if (ref === null)
|
|
408
|
+
return fail("release-not-named", "release tag needs a release, by label, digest or tag", "chant release tag <label|digest|tag> [--json]");
|
|
409
|
+
const cwd = resolve(".");
|
|
410
|
+
const { fetchLifecycle } = await import("../../lifecycle/git.js");
|
|
411
|
+
const { resolveRelease, readCuts } = await import("../../lifecycle/release-store.js");
|
|
412
|
+
const t = await import("../../lifecycle/release-tag.js");
|
|
413
|
+
await fetchLifecycle({ cwd }).catch(() => false);
|
|
414
|
+
let tags;
|
|
415
|
+
try {
|
|
416
|
+
tags = await t.memberTags(cwd);
|
|
417
|
+
}
|
|
418
|
+
catch (err) {
|
|
419
|
+
if (err instanceof t.ReleaseTagError)
|
|
420
|
+
return fail(err.code, err.message, err.fix);
|
|
421
|
+
throw err;
|
|
422
|
+
}
|
|
423
|
+
let found = await resolveRelease(ref, { cwd });
|
|
424
|
+
if (!found) {
|
|
425
|
+
const labels = (await readCuts({ cwd })).cuts.map((c) => c.label).filter((l) => l !== null);
|
|
426
|
+
const label = t.labelOfTag(tags.template, tags.place, ref, new Set(labels));
|
|
427
|
+
if (label !== null)
|
|
428
|
+
found = await resolveRelease(label, { cwd });
|
|
429
|
+
}
|
|
430
|
+
if (!found)
|
|
431
|
+
return fail("release-not-found", `no release of this member is labelled, digested or tagged "${ref}"`, "Fetch chant/lifecycle (git fetch origin chant/lifecycle:chant/lifecycle), then list them with: chant release list");
|
|
432
|
+
const { release, label } = found;
|
|
433
|
+
let tag;
|
|
434
|
+
let floating;
|
|
435
|
+
try {
|
|
436
|
+
tag = label !== null ? t.renderReleaseTag(tags.template, tags.place, label) : null;
|
|
437
|
+
floating = label !== null ? t.renderFloatingTag(tags.template, tags.place, label) : null;
|
|
438
|
+
}
|
|
439
|
+
catch (err) {
|
|
440
|
+
if (err instanceof t.ReleaseTagError)
|
|
441
|
+
return fail(err.code, err.message, err.fix);
|
|
442
|
+
throw err;
|
|
443
|
+
}
|
|
444
|
+
if (args.json) {
|
|
445
|
+
console.log(JSON.stringify({ releaseDigest: release.releaseDigest, label, commit: release.commit, tag, floating, template: tags.template.name }, null, 2));
|
|
446
|
+
return 0;
|
|
447
|
+
}
|
|
448
|
+
if (tag === null)
|
|
449
|
+
return fail("release-no-label", `${release.releaseDigest} has no label, so it has no tag`);
|
|
450
|
+
console.log(tag);
|
|
451
|
+
return 0;
|
|
452
|
+
}
|
|
235
453
|
function describeActorSource(source) {
|
|
236
454
|
switch (source) {
|
|
237
455
|
case "flag":
|
|
@@ -266,7 +484,11 @@ export async function runReleaseCut(ctx) {
|
|
|
266
484
|
console.error(formatError({ message: `the label is given twice, as "${positional}" and --label "${args.label}"`, hint: USAGE }));
|
|
267
485
|
return 1;
|
|
268
486
|
}
|
|
269
|
-
|
|
487
|
+
let label = positional ?? args.label ?? null;
|
|
488
|
+
if (args.pre !== undefined && label !== AUTO_LABEL) {
|
|
489
|
+
console.error(formatError({ message: "--pre names the prerelease id of a computed label, and the cut is given its label", hint: "Cut auto --pre <id>, or give the prerelease label itself, such as 1.5.0-rc.0." }));
|
|
490
|
+
return 1;
|
|
491
|
+
}
|
|
270
492
|
// #4693: the reason is the override's, written by the person who overrides.
|
|
271
493
|
if (args.reason !== undefined) {
|
|
272
494
|
console.error(formatError({
|
|
@@ -277,7 +499,7 @@ export async function runReleaseCut(ctx) {
|
|
|
277
499
|
}
|
|
278
500
|
const dryRun = args.yes !== true;
|
|
279
501
|
const cwd = resolve(".");
|
|
280
|
-
const { spawnTargetCompiler, ReleaseCompileError } = await import("../../components/release-compile.js");
|
|
502
|
+
const { spawnTargetCompiler, ReleaseCompileError, RELEASE_LABEL_ENV } = await import("../../components/release-compile.js");
|
|
281
503
|
const { cutRelease, planRelease, ReleaseCutError } = await import("../../lifecycle/release-cut.js");
|
|
282
504
|
const { ReleaseLabelError } = await import("../../lifecycle/release-store.js");
|
|
283
505
|
const { pushLifecycleRebasing, getHeadCommit } = await import("../../lifecycle/git.js");
|
|
@@ -345,6 +567,28 @@ export async function runReleaseCut(ctx) {
|
|
|
345
567
|
const ledger = await resolveMemberLedger(cwd);
|
|
346
568
|
member = ledger.members.length > 0 ? ledger.members.join("/") : null;
|
|
347
569
|
}
|
|
570
|
+
// #5159: `auto` is the label the commits and intent files since the previous release give, and every
|
|
571
|
+
// labelled cut consumes the intent files that name the member.
|
|
572
|
+
let computed = null;
|
|
573
|
+
let intents = [];
|
|
574
|
+
{
|
|
575
|
+
const rn = await import("../../lifecycle/release-next.js");
|
|
576
|
+
try {
|
|
577
|
+
if (label === AUTO_LABEL) {
|
|
578
|
+
computed = await rn.nextRelease({ cwd, ...(commit ? { at: commit } : {}), ...(args.pre !== undefined ? { pre: args.pre } : {}) });
|
|
579
|
+
label = computed.label;
|
|
580
|
+
intents = computed.intents;
|
|
581
|
+
}
|
|
582
|
+
else if (label !== null && top && commit) {
|
|
583
|
+
intents = await rn.memberPendingIntents(cwd, top, commit);
|
|
584
|
+
}
|
|
585
|
+
}
|
|
586
|
+
catch (err) {
|
|
587
|
+
if (err instanceof rn.ReleaseNextError)
|
|
588
|
+
return fail(err.code, `no release was cut: ${err.message}`, err.fix);
|
|
589
|
+
throw err;
|
|
590
|
+
}
|
|
591
|
+
}
|
|
348
592
|
// The signing key is resolved now, so a dry run shows a key that can't be read.
|
|
349
593
|
let publicKey = null;
|
|
350
594
|
if (args.sign !== undefined) {
|
|
@@ -372,7 +616,6 @@ export async function runReleaseCut(ctx) {
|
|
|
372
616
|
return 1;
|
|
373
617
|
}
|
|
374
618
|
const actor = who.actor;
|
|
375
|
-
const tag = label !== null && commit !== null && top ? { name: ws.releaseTagName(member, label), state: ws.checkReleaseTag(top, ws.releaseTagName(member, label), commit) } : null;
|
|
376
619
|
const ci = resolveCiRun(process.env);
|
|
377
620
|
const params = parseParamFlags(args.param);
|
|
378
621
|
// #4694: images built elsewhere, handed to the cut by digest, one per component.
|
|
@@ -392,6 +635,13 @@ export async function runReleaseCut(ctx) {
|
|
|
392
635
|
if (args.at !== undefined && top && commit)
|
|
393
636
|
checkout = at.checkoutCommit(top, cwd, commit);
|
|
394
637
|
const cutCwd = checkout?.memberDir ?? cwd;
|
|
638
|
+
// #5150: the tag from release.tag in the commit's own config, refused when another member's template can render it.
|
|
639
|
+
const tagsMod = await import("../../lifecycle/release-tag.js");
|
|
640
|
+
const tags = top ? await tagsMod.memberTags(cwd, { config: await releaseTagOf(cutCwd), top }) : null;
|
|
641
|
+
if (tags)
|
|
642
|
+
await tagsMod.checkTagCollisions(cwd, tags);
|
|
643
|
+
const tagName = (l) => tagsMod.renderReleaseTag(tags.template, tags.place, l);
|
|
644
|
+
const tag = label !== null && commit !== null && top ? { name: tagName(label), state: ws.checkReleaseTag(top, tagName(label), commit) } : null;
|
|
395
645
|
const versionConfig = await releaseVersionOf(cutCwd);
|
|
396
646
|
// #4657: the images release.images declares are built first, and their digests handed to the build command.
|
|
397
647
|
const declaredImages = await releaseImagesOf(cutCwd);
|
|
@@ -413,6 +663,30 @@ export async function runReleaseCut(ctx) {
|
|
|
413
663
|
}
|
|
414
664
|
}
|
|
415
665
|
: undefined;
|
|
666
|
+
// #5151: the files release.artifacts declares, built after the images and recorded as assets.
|
|
667
|
+
const declaredArtifacts = await releaseArtifactsOf(cutCwd);
|
|
668
|
+
const buildJobs = await releaseBuildJobsOf(cutCwd);
|
|
669
|
+
const buildArtifacts = declaredArtifacts.length > 0
|
|
670
|
+
? async (at) => {
|
|
671
|
+
const { buildReleaseArtifacts, isPrebuilt, ReleaseArtifactError } = await import("../../lifecycle/release-artifacts.js");
|
|
672
|
+
// #5183: under --at, files built before the cut are read from this checkout, which must hold the commit cut.
|
|
673
|
+
const prebuilt = declaredArtifacts.filter(isPrebuilt);
|
|
674
|
+
if (checkout && prebuilt.length > 0) {
|
|
675
|
+
const here = await getHeadCommit({ cwd });
|
|
676
|
+
if (here !== at) {
|
|
677
|
+
throw new ReleaseCutError("release-artifact-wrong-commit", `no release was cut: release.artifacts ${prebuilt.map((a) => `"${a.name}"`).join(", ")} ${prebuilt.length === 1 ? "is" : "are"} read from this checkout, which is at ${here.slice(0, 12)}, and the cut is of ${at.slice(0, 12)}, so the files might not be that commit's`, `Check out the commit being cut and build the files there: git checkout ${at}`);
|
|
678
|
+
}
|
|
679
|
+
}
|
|
680
|
+
try {
|
|
681
|
+
return buildReleaseArtifacts({ artifacts: declaredArtifacts, cwd: cutCwd, sourceDateEpoch: commitTime(cutCwd, at), label, imageNames: declaredImages.map((d) => d.name), builds: buildJobs, ...(checkout ? { prebuiltFrom: cwd } : {}) });
|
|
682
|
+
}
|
|
683
|
+
catch (err) {
|
|
684
|
+
if (!(err instanceof ReleaseArtifactError))
|
|
685
|
+
throw err;
|
|
686
|
+
throw new ReleaseCutError(err.code, `no release was cut: ${err.message}`, err.fix);
|
|
687
|
+
}
|
|
688
|
+
}
|
|
689
|
+
: undefined;
|
|
416
690
|
// #4840: release.version stamps the label into package.json once the cut has found the tree clean.
|
|
417
691
|
const stamp = versionConfig
|
|
418
692
|
? async () => {
|
|
@@ -430,6 +704,24 @@ export async function runReleaseCut(ctx) {
|
|
|
430
704
|
: undefined;
|
|
431
705
|
// #4692: the lane is the commit's own config's under --at.
|
|
432
706
|
const lane = await laneOf(ctx, cutCwd);
|
|
707
|
+
// #5149: the green gate, and for a member with no environments what release.publish publishes.
|
|
708
|
+
const greenSource = await greenOf(cutCwd);
|
|
709
|
+
const publishes = await artifactPublishesOf(cutCwd);
|
|
710
|
+
const buildCommand = args.buildCommand;
|
|
711
|
+
const build = publishes !== undefined && buildCommand
|
|
712
|
+
? () => {
|
|
713
|
+
const env = { ...process.env };
|
|
714
|
+
delete env[RELEASE_LABEL_ENV];
|
|
715
|
+
delete env.CHANT_RELEASE_DIGESTS;
|
|
716
|
+
if (label !== null)
|
|
717
|
+
env[RELEASE_LABEL_ENV] = label;
|
|
718
|
+
if (digestsFile)
|
|
719
|
+
env.CHANT_RELEASE_DIGESTS = digestsFile;
|
|
720
|
+
const run = spawnSync(buildCommand, { cwd: cutCwd, shell: true, stdio: ["ignore", 2, 2], env });
|
|
721
|
+
if (run.status !== 0)
|
|
722
|
+
throw new ReleaseCompileError(`the build command exited ${run.status ?? "with a signal"}: ${buildCommand}`);
|
|
723
|
+
}
|
|
724
|
+
: undefined;
|
|
433
725
|
const request = {
|
|
434
726
|
cwd: cutCwd,
|
|
435
727
|
compiler,
|
|
@@ -442,7 +734,12 @@ export async function runReleaseCut(ctx) {
|
|
|
442
734
|
...(args.overrideGreen ? { overrideGreen: true } : {}),
|
|
443
735
|
...(Object.keys(images).length > 0 ? { images } : {}),
|
|
444
736
|
...(buildImages ? { buildImages } : {}),
|
|
737
|
+
...(buildArtifacts ? { buildArtifacts } : {}),
|
|
445
738
|
...(stamp ? { stamp } : {}),
|
|
739
|
+
...(greenSource ? { green: greenSource } : {}),
|
|
740
|
+
...(publishes ? { publishes } : {}),
|
|
741
|
+
...(build ? { build } : {}),
|
|
742
|
+
...(intents.length > 0 ? { intents: intents.map(({ path, added, bump }) => ({ path, added, bump })) } : {}),
|
|
446
743
|
};
|
|
447
744
|
if (dryRun) {
|
|
448
745
|
const plan = await planRelease(request);
|
|
@@ -464,9 +761,12 @@ export async function runReleaseCut(ctx) {
|
|
|
464
761
|
trunk,
|
|
465
762
|
composed: composed ?? null,
|
|
466
763
|
channel: args.channel ?? null,
|
|
764
|
+
prerelease: prereleaseOf(plan.label) !== null,
|
|
467
765
|
at: args.at !== undefined ? { ref: args.at, commit } : null,
|
|
468
766
|
sign: args.sign !== undefined ? { key: publicKey !== null ? publicKey.split(" ")[0] : null, readable: publicKey !== null } : null,
|
|
469
767
|
tag: tag ? { name: tag.name, exists: tag.state === "present" } : null,
|
|
768
|
+
computed: computed ? { from: computed.from, bump: computed.bump, alreadyCut: computed.alreadyCut, commits: computed.commits.length } : null,
|
|
769
|
+
intents: intents.map(({ path, bump }) => ({ path, bump })),
|
|
470
770
|
publish: { targets: Array.isArray(publishTargets) ? publishTargets : [], provenance },
|
|
471
771
|
next: [sameWithYes(process.argv.slice(2))],
|
|
472
772
|
};
|
|
@@ -476,10 +776,14 @@ export async function runReleaseCut(ctx) {
|
|
|
476
776
|
}
|
|
477
777
|
const name = plan.label ? formatBold(plan.label) : "an unlabelled release";
|
|
478
778
|
const greenIn = plan.override
|
|
479
|
-
? `not green: no ${plan.override.tag.slice(0, plan.override.tag.lastIndexOf("/"))} tag`
|
|
779
|
+
? `not green: ${plan.override.tag.startsWith("forge-checks/") ? "its forge checks did not pass" : `no ${plan.override.tag.slice(0, plan.override.tag.lastIndexOf("/"))} tag`}`
|
|
480
780
|
: plan.lane !== null
|
|
481
781
|
? `green in lane ${plan.lane}`
|
|
482
|
-
:
|
|
782
|
+
: plan.green?.source === "forge-checks"
|
|
783
|
+
? `green by its ${plan.green.forge} checks`
|
|
784
|
+
: plan.green?.source === "none"
|
|
785
|
+
? "no green gate"
|
|
786
|
+
: "green";
|
|
483
787
|
const where = composed
|
|
484
788
|
? ` (on ${trunk.remote}/${composed.branch}, composed on ${composed.base.slice(0, 12)} from ${composed.sources.length} trunk commit(s), ${greenIn})`
|
|
485
789
|
: trunk
|
|
@@ -488,6 +792,18 @@ export async function runReleaseCut(ctx) {
|
|
|
488
792
|
console.log(`Dry run: cut ${name} from commit ${plan.commit.slice(0, 12)}${where}`);
|
|
489
793
|
if (args.channel)
|
|
490
794
|
console.log(` channel ${args.channel}: a publish moves ${args.channel}, not latest`);
|
|
795
|
+
if (prereleaseOf(plan.label))
|
|
796
|
+
console.log(` prerelease: ${prereleaseNote(plan.label, args.channel)}`);
|
|
797
|
+
if (computed && !computed.alreadyCut)
|
|
798
|
+
console.log(` label from release next: ${computed.bump ?? "the prerelease's version"} from ${computed.from.label}, ${computed.commits.length} commit(s) and ${computed.intents.length} intent file(s) since`);
|
|
799
|
+
for (const i of intents)
|
|
800
|
+
console.log(` consumes ${i.path} (${i.bump})`);
|
|
801
|
+
if (plan.green)
|
|
802
|
+
console.log(` gate: ${describeGreen(plan.green)}`);
|
|
803
|
+
if (plan.green?.source === "none")
|
|
804
|
+
console.error(formatWarning({ message: GREEN_NONE_WARNING }));
|
|
805
|
+
if (plan.publishes)
|
|
806
|
+
console.log(` an artifact release: no environment is compiled, and it records ${plan.publishes.length} publish target(s)`);
|
|
491
807
|
if (plan.override)
|
|
492
808
|
console.log(` under the override by ${plan.override.by} at ${plan.override.at}${plan.override.sealed ? ", sealed" : ""}: ${plan.override.reason}; the cut spends it`);
|
|
493
809
|
if (plan.alreadyCut)
|
|
@@ -511,7 +827,7 @@ export async function runReleaseCut(ctx) {
|
|
|
511
827
|
console.log(` ${h.component}: image ${h.ref}, handed to the cut, not built`);
|
|
512
828
|
console.log(` digest ${plan.releaseDigest ?? "decided when the artifacts are built"}`);
|
|
513
829
|
console.log("What will be published where:");
|
|
514
|
-
if (plan.publishSteps.length === 0)
|
|
830
|
+
if (plan.publishSteps.length === 0 && !plan.publishes)
|
|
515
831
|
console.log(" no component declares a publish step");
|
|
516
832
|
for (const p of plan.publishSteps) {
|
|
517
833
|
console.log(` ${p.component}: ${p.kind}${p.to ? ` to ${p.to}` : ""} in ${p.envs.join(", ")}, by that environment's deploy (chant components promote --release ${deployRef})`);
|
|
@@ -535,6 +851,14 @@ export async function runReleaseCut(ctx) {
|
|
|
535
851
|
// publish job) finds them.
|
|
536
852
|
if (checkout && declaredImages.length > 0)
|
|
537
853
|
copyImageArchives((await import("../../lifecycle/release-images.js")).resolveReleaseImages(declaredImages), cutCwd, cwd);
|
|
854
|
+
// #5151: the files too, so `release artifacts -o` in the same job stages them for the publish job. The files
|
|
855
|
+
// built before the cut (#5183) came from here; only what the cut packed from them is copied back.
|
|
856
|
+
if (checkout && declaredArtifacts.length > 0) {
|
|
857
|
+
const { copyArtifactFiles, isPrebuilt, releaseArtifactFiles } = await import("../../lifecycle/release-artifacts.js");
|
|
858
|
+
const asFound = declaredArtifacts.filter((a) => isPrebuilt(a) && a.archive === undefined).map((a) => a.name);
|
|
859
|
+
const copied = declaredArtifacts.map((a) => a.name).filter((n) => !asFound.includes(n));
|
|
860
|
+
copyArtifactFiles(releaseArtifactFiles(result.release, copied), cutCwd, cwd, { missingOk: true });
|
|
861
|
+
}
|
|
538
862
|
// #4965: the record must be on the remote before the release is tagged. The release workflow pushes the tag
|
|
539
863
|
// right after the cut, and a tag whose record never landed spends the label: the publish job finds no release.
|
|
540
864
|
// A refused push is tried again; one that never lands stops the cut here, untagged and non-zero.
|
|
@@ -549,7 +873,7 @@ export async function runReleaseCut(ctx) {
|
|
|
549
873
|
let tagged = null;
|
|
550
874
|
let tagWarning;
|
|
551
875
|
if (result.label !== null && top) {
|
|
552
|
-
const name =
|
|
876
|
+
const name = tagName(result.label);
|
|
553
877
|
try {
|
|
554
878
|
const state = ws.checkReleaseTag(top, name, result.release.commit);
|
|
555
879
|
if (state === "absent")
|
|
@@ -569,7 +893,7 @@ export async function runReleaseCut(ctx) {
|
|
|
569
893
|
noComponents: result.release.targets.every((t) => t.templates.every((tpl) => tpl.component === null)) && result.release.artifactDigests.length === 0,
|
|
570
894
|
});
|
|
571
895
|
if (args.json) {
|
|
572
|
-
console.log(JSON.stringify({ dryRun: false, release: result.release, label: result.label, cut: result.cut, stored: result.stored, reused: result.reused, handed: result.handed, actor, actorSource: who.source, tag: tagged, composed: composed ?? null, channel: args.channel ?? null, lane: lane ?? null, next }, null, 2));
|
|
896
|
+
console.log(JSON.stringify({ dryRun: false, release: result.release, label: result.label, cut: result.cut, stored: result.stored, reused: result.reused, handed: result.handed, actor, actorSource: who.source, tag: tagged, composed: composed ?? null, channel: args.channel ?? null, prerelease: prereleaseOf(result.label) !== null, lane: lane ?? null, next }, null, 2));
|
|
573
897
|
}
|
|
574
898
|
else {
|
|
575
899
|
const name = result.label ? formatBold(result.label) : "unlabelled release";
|
|
@@ -580,11 +904,19 @@ export async function runReleaseCut(ctx) {
|
|
|
580
904
|
console.error(` commit ${result.release.commit}${composed ? `, composed on ${composed.base.slice(0, 12)} on ${composed.branch}` : ""}${lane !== undefined ? `, green in lane ${lane}` : ""}`);
|
|
581
905
|
if (args.channel)
|
|
582
906
|
console.error(` channel ${args.channel}`);
|
|
907
|
+
if (prereleaseOf(result.label))
|
|
908
|
+
console.error(` prerelease: ${prereleaseNote(result.label, args.channel)}`);
|
|
909
|
+
for (const i of result.cut?.intents ?? [])
|
|
910
|
+
console.error(` consumed ${i.path} (${i.bump})`);
|
|
583
911
|
if (result.cut?.override)
|
|
584
912
|
console.error(` not green: cut under the override by ${result.cut.override.by}: ${result.cut.override.reason}`);
|
|
913
|
+
if (result.cut?.green)
|
|
914
|
+
console.error(` gate: ${describeGreen(result.cut.green)}`);
|
|
915
|
+
if (result.release.publishes)
|
|
916
|
+
console.error(` publishes: ${result.release.publishes.map((p) => `${p.kind} to ${p.destination}`).join("; ") || "nothing"}`);
|
|
585
917
|
if (result.cut)
|
|
586
918
|
console.error(` ${result.cut.signature ? `signed by ${result.cut.actor}` : `not signed; actor ${result.cut.actor}`}, run ${result.cut.runId}`);
|
|
587
|
-
console.error(` artifacts ${result.release.artifactDigests.length}, targets ${result.release.targets.map((t) => `${t.env} (${t.templates.length} template${t.templates.length === 1 ? "" : "s"})`).join(", ")}`);
|
|
919
|
+
console.error(` artifacts ${result.release.artifactDigests.length}, ${result.release.publishes ? "no environment (an artifact release)" : `targets ${result.release.targets.map((t) => `${t.env} (${t.templates.length} template${t.templates.length === 1 ? "" : "s"})`).join(", ")}`}`);
|
|
588
920
|
for (const r of result.reused)
|
|
589
921
|
console.error(` ${r.component}: artifacts unchanged, carried from ${r.from}`);
|
|
590
922
|
for (const h of result.handed)
|
|
@@ -600,9 +932,13 @@ export async function runReleaseCut(ctx) {
|
|
|
600
932
|
console.error(formatWarning({ message: push.pushWarning }));
|
|
601
933
|
if (tagWarning)
|
|
602
934
|
console.error(formatWarning({ message: tagWarning }));
|
|
935
|
+
if (result.cut?.green?.source === "none")
|
|
936
|
+
console.error(formatWarning({ message: GREEN_NONE_WARNING }));
|
|
603
937
|
return 0;
|
|
604
938
|
}
|
|
605
939
|
catch (err) {
|
|
940
|
+
if (err instanceof (await import("../../lifecycle/release-tag.js")).ReleaseTagError)
|
|
941
|
+
return fail(err.code, `no release was cut: ${err.message}`, err.fix);
|
|
606
942
|
if (err instanceof ws.WorkstationCheckError || err instanceof ReleaseCutError || err instanceof at.CutAtError) {
|
|
607
943
|
// #4693: a request for an override goes where the person who answers it reads.
|
|
608
944
|
if (err instanceof ReleaseCutError && err.recorded) {
|
|
@@ -663,7 +999,7 @@ export async function runReleasePublish(ctx) {
|
|
|
663
999
|
const prepared = await preparePublish({ cwd, ref, allowUnsigned: args.allowUnsigned === true, requireProvenance: args.requireProvenance === true });
|
|
664
1000
|
if ("refusal" in prepared)
|
|
665
1001
|
return fail(prepared.refusal.code, prepared.refusal.message, prepared.refusal.fix);
|
|
666
|
-
const { release, label, signature, provenance, warning, signatureWarning, targets, redactor } = prepared;
|
|
1002
|
+
const { release, label, signature, provenance, warning, signatureWarning, gateWarning, signingWarning, targets, redactor } = prepared;
|
|
667
1003
|
const name = label ?? release.releaseDigest;
|
|
668
1004
|
const deploySteps = release.targets.map((t) => t.env);
|
|
669
1005
|
const say = (line) => console.error(redactor.redact(line));
|
|
@@ -671,13 +1007,19 @@ export async function runReleasePublish(ctx) {
|
|
|
671
1007
|
const errorOf = (err) => err instanceof PublishTargetError ? { code: err.code, message: err.message, ...(err.fix ? { fix: err.fix } : {}) } : { code: "publish-failed", message: err instanceof Error ? err.message : String(err) };
|
|
672
1008
|
if (!args.json) {
|
|
673
1009
|
say(`${dryRun ? "Dry run: publish" : "Publishing"} ${formatBold(name)} (${release.releaseDigest}) from commit ${release.commit.slice(0, 12)}`);
|
|
674
|
-
say(` ${signature.status === "verified" ? `signed by ${signature.actor}` : signature.status === "unsigned" ? "not signed" : `signature unverified: ${signature.reason}`}`);
|
|
1010
|
+
say(` ${signature.status === "verified" ? `signed by ${signature.actor}, green gate ${signature.gate}` : signature.status === "unsigned" ? "not signed" : `signature unverified: ${signature.reason}`}`);
|
|
675
1011
|
}
|
|
676
1012
|
// The warnings go to stderr with --json too, before any target runs.
|
|
677
1013
|
if (signatureWarning)
|
|
678
1014
|
console.error(formatWarning({ message: signatureWarning }));
|
|
1015
|
+
if (gateWarning)
|
|
1016
|
+
console.error(formatWarning({ message: gateWarning }));
|
|
679
1017
|
if (warning)
|
|
680
1018
|
console.error(formatWarning({ message: warning }));
|
|
1019
|
+
if (signingWarning)
|
|
1020
|
+
console.error(formatWarning({ message: signingWarning }));
|
|
1021
|
+
if (prepared.signing && !args.json)
|
|
1022
|
+
say(` signing images and forge assets with Sigstore (${prepared.signing.signer.name}) as ${prepared.signing.identity.identity}, issuer ${prepared.signing.identity.issuer}`);
|
|
681
1023
|
// #4168 4.3: a release cut with --channel moves that tag, not latest.
|
|
682
1024
|
const pctx = publishContext(prepared, { cwd, tag: prepared.channel, log: (line) => (args.json ? undefined : console.error(` ${line}`)) });
|
|
683
1025
|
// Every target is planned before any publishes, so a missing file or credential stops the publish with nothing sent.
|
|
@@ -685,7 +1027,7 @@ export async function runReleasePublish(ctx) {
|
|
|
685
1027
|
const planned = [];
|
|
686
1028
|
for (const target of targets) {
|
|
687
1029
|
try {
|
|
688
|
-
planned.push({ kind: target.kind, name: target.name, destination: target.destination, progress: progressOf(progress, target), items: await target.plan(pctx) });
|
|
1030
|
+
planned.push({ kind: target.kind, name: target.name, destination: target.destination, progress: progressOf(progress, target), ...(target.revealsLast ? { revealsLast: true } : {}), items: await target.plan(pctx) });
|
|
689
1031
|
}
|
|
690
1032
|
catch (err) {
|
|
691
1033
|
const e = errorOf(err);
|
|
@@ -700,7 +1042,31 @@ export async function runReleasePublish(ctx) {
|
|
|
700
1042
|
? ` Each environment deploys the files the release recorded: chant release export ${name} --env ${deploySteps[0]}`
|
|
701
1043
|
: ` A component's publish steps run in each environment's deploy of the release: chant components promote --release ${name} --to ${deploySteps[0]}`;
|
|
702
1044
|
};
|
|
703
|
-
const
|
|
1045
|
+
const pre = prereleaseOf(label);
|
|
1046
|
+
if (pre && !args.json)
|
|
1047
|
+
say(` prerelease: ${prereleaseNote(label, prepared.channel ?? undefined)}`);
|
|
1048
|
+
const floating = prepared.floating ?? null;
|
|
1049
|
+
// #5157: release.verify runs between the stages and the reveals; a target whose stage is visible is out of its reach.
|
|
1050
|
+
const verifySteps = targets.length > 0 ? (prepared.verify ?? []) : [];
|
|
1051
|
+
const { unstagedForVerify, unstagedWarning } = await import("../../lifecycle/publish-verify.js");
|
|
1052
|
+
const unstaged = verifySteps.length > 0 ? unstagedForVerify(targets) : [];
|
|
1053
|
+
const verifyWarning = unstaged.length > 0 ? unstagedWarning(unstaged) : null;
|
|
1054
|
+
if (verifyWarning)
|
|
1055
|
+
console.error(formatWarning({ message: verifyWarning }));
|
|
1056
|
+
const base = {
|
|
1057
|
+
releaseDigest: release.releaseDigest,
|
|
1058
|
+
label,
|
|
1059
|
+
prerelease: pre !== null,
|
|
1060
|
+
...(pre ? { distTag: prepared.channel ?? pre.distTag } : {}),
|
|
1061
|
+
commit: release.commit,
|
|
1062
|
+
signature,
|
|
1063
|
+
provenance,
|
|
1064
|
+
warnings: [signatureWarning, gateWarning, warning, signingWarning, verifyWarning].filter((w) => w !== null),
|
|
1065
|
+
signing: prepared.signing ? { identity: prepared.signing.identity, signer: prepared.signing.signer.name } : null,
|
|
1066
|
+
...(floating ? { floating } : {}),
|
|
1067
|
+
...(verifySteps.length > 0 ? { verify: { steps: verifySteps, unstaged } } : {}),
|
|
1068
|
+
};
|
|
1069
|
+
const floatingLine = (f, done) => f.move ? ` floating tag ${f.name}: ${done ? "moved" : "moves"} to ${f.commit.slice(0, 12)} once every target has revealed` : ` floating tag ${f.name}: left where it is, since ${f.reason}`;
|
|
704
1070
|
if (dryRun) {
|
|
705
1071
|
const next = [sameWithYes(process.argv.slice(2))];
|
|
706
1072
|
if (args.json) {
|
|
@@ -711,12 +1077,19 @@ export async function runReleasePublish(ctx) {
|
|
|
711
1077
|
out("What would be published where:");
|
|
712
1078
|
if (planned.length === 0)
|
|
713
1079
|
out(" nothing: this member declares no publish target (release.publish in chant.config.ts)");
|
|
1080
|
+
if (floating)
|
|
1081
|
+
out(floatingLine(floating, false));
|
|
714
1082
|
for (const p of planned) {
|
|
715
1083
|
const earlier = p.progress === "revealed" ? " (published by an earlier run; skipped)" : p.progress === "staged" ? " (staged by an earlier run; only revealed)" : "";
|
|
716
|
-
out(` ${p.name}${provenance.oidc && p.kind === "npm" ? ", with --provenance" : ""}${earlier}:`);
|
|
1084
|
+
out(` ${p.name}${provenance.oidc && p.kind === "npm" ? ", with --provenance" : ""}${p.revealsLast ? ", revealed after every other target" : ""}${earlier}:`);
|
|
717
1085
|
for (const i of p.items)
|
|
718
1086
|
out(` ${describeItem(i)}`);
|
|
719
1087
|
}
|
|
1088
|
+
if (verifySteps.length > 0) {
|
|
1089
|
+
out(" verify, after every target has staged and before any reveals (release.verify):");
|
|
1090
|
+
for (const v of verifySteps)
|
|
1091
|
+
out(` ${v.name === v.run ? v.run : `${v.name}: ${v.run}`}`);
|
|
1092
|
+
}
|
|
720
1093
|
say(`Dry run: nothing was published. Run again with --yes to publish: ${next[0]}`);
|
|
721
1094
|
const hint = planned.length === 0 ? promoteHint() : null;
|
|
722
1095
|
if (hint)
|
|
@@ -727,24 +1100,36 @@ export async function runReleasePublish(ctx) {
|
|
|
727
1100
|
say(" every target stages first, and none is visible until all have staged");
|
|
728
1101
|
let run;
|
|
729
1102
|
try {
|
|
730
|
-
run = await runPublish({ cwd, release, label, targets, ctx: pctx, say: (line) => (args.json ? undefined : say(line)) });
|
|
1103
|
+
run = await runPublish({ cwd, release, label, targets, ctx: pctx, verify: verifySteps, say: (line) => (args.json ? undefined : say(line)) });
|
|
731
1104
|
}
|
|
732
1105
|
catch (err) {
|
|
733
1106
|
if (err instanceof PublishRunError) {
|
|
734
1107
|
const again = sameWithYes(process.argv.slice(2));
|
|
735
|
-
const where = err.step
|
|
1108
|
+
const where = err.step !== "reveal" && err.revealed.length === 0
|
|
736
1109
|
? `nothing is visible yet${err.staged.length > 0 ? `; staged: ${err.staged.join(", ")}` : ""}`
|
|
737
|
-
: `revealed: ${err.revealed.length > 0 ? err.revealed.join(", ") : "none"}; staged and not yet revealed: ${err.staged.filter((t) => !err.revealed.includes(t)).join(", ")}`;
|
|
1110
|
+
: `revealed: ${err.revealed.length > 0 ? err.revealed.join(", ") : "none"}; staged and not yet revealed: ${err.staged.filter((t) => !err.revealed.includes(t)).join(", ") || "none"}`;
|
|
1111
|
+
if (args.json)
|
|
1112
|
+
console.log(redactor.redact(JSON.stringify({ dryRun: false, ...base, status: "failed", code: err.code, step: err.step, staged: err.staged, revealed: err.revealed }, null, 2)));
|
|
738
1113
|
return failed(err.code, `${err.message}; ${where}`, `${err.fix ? `${err.fix} ` : ""}Run the same command again to resume; what went out is not published again: ${again}`);
|
|
739
1114
|
}
|
|
740
1115
|
const e = errorOf(err);
|
|
741
1116
|
return failed(e.code, e.message, e.fix);
|
|
742
1117
|
}
|
|
743
1118
|
const { published } = run;
|
|
1119
|
+
// #5150: the floating tag moves only once every target has revealed; a target that refused with a warning leaves it.
|
|
1120
|
+
let floatingWarning = null;
|
|
1121
|
+
if (floating?.move) {
|
|
1122
|
+
if (published.some((p) => p.warning))
|
|
1123
|
+
floatingWarning = `the floating tag ${floating.name} was not moved, since a target refused the release`;
|
|
1124
|
+
else
|
|
1125
|
+
floatingWarning = (await import("../../lifecycle/release-publish.js")).moveFloatingTag(cwd, floating);
|
|
1126
|
+
}
|
|
1127
|
+
if (floatingWarning)
|
|
1128
|
+
console.error(formatWarning({ message: floatingWarning }));
|
|
744
1129
|
if (run.recordWarning && targets.length > 0)
|
|
745
1130
|
console.error(formatWarning({ message: redactor.redact(`${run.recordWarning}. A resume asks the registries what is already there.`) }));
|
|
746
1131
|
if (args.json) {
|
|
747
|
-
console.log(redactor.redact(JSON.stringify({ dryRun: false, ...base, targets: planned, published, resumed: run.resumed, environments: deploySteps }, null, 2)));
|
|
1132
|
+
console.log(redactor.redact(JSON.stringify({ dryRun: false, ...base, targets: planned, published, resumed: run.resumed, ...(run.verify ? { verified: run.verify } : {}), environments: deploySteps, ...(floating ? { floatingMoved: floating.move && floatingWarning === null } : {}) }, null, 2)));
|
|
748
1133
|
return 0;
|
|
749
1134
|
}
|
|
750
1135
|
if (targets.length === 0) {
|
|
@@ -760,11 +1145,21 @@ export async function runReleasePublish(ctx) {
|
|
|
760
1145
|
const refused = published.filter((p) => p.warning);
|
|
761
1146
|
console.error(formatSuccess(`Published ${name} to ${published.length - refused.length} target(s)${refused.length > 0 ? `; ${refused.length} refused it, with a warning` : ""}`));
|
|
762
1147
|
}
|
|
1148
|
+
if (floating && !floatingWarning)
|
|
1149
|
+
say(floatingLine(floating, true));
|
|
763
1150
|
return 0;
|
|
764
1151
|
}
|
|
765
1152
|
/** One item a target publishes, for a line: what, where, and the SBOM or attachment it is (#4049). */
|
|
766
1153
|
function describeItem(i) {
|
|
767
|
-
const what = i.attachment === "sbom"
|
|
1154
|
+
const what = i.attachment === "sbom"
|
|
1155
|
+
? `${i.name} (SBOM)`
|
|
1156
|
+
: i.attachment === "provenance"
|
|
1157
|
+
? `${i.name} (provenance)`
|
|
1158
|
+
: i.attachment === "signature"
|
|
1159
|
+
? `${i.name} (Sigstore signature)`
|
|
1160
|
+
: i.attachment === "attestation"
|
|
1161
|
+
? `${i.name} (SLSA provenance, Sigstore)`
|
|
1162
|
+
: i.name;
|
|
768
1163
|
if (i.notes !== undefined)
|
|
769
1164
|
return `${i.name} to ${i.destination}:\n${i.notes.trimEnd().split("\n").map((l) => ` ${l}`.trimEnd()).join("\n")}`;
|
|
770
1165
|
return `${what} to ${i.destination}${i.sbom ? `, carrying ${i.sbom}` : ""}`;
|
|
@@ -782,7 +1177,7 @@ export async function runReleaseVerify(ctx) {
|
|
|
782
1177
|
console.error(formatError({ message: "release verify needs a release", hint: USAGE }));
|
|
783
1178
|
return 1;
|
|
784
1179
|
}
|
|
785
|
-
const { verifyRelease, verificationCode } = await import("../../lifecycle/release-verify.js");
|
|
1180
|
+
const { verifyRelease, verificationCode, verifySigstore, recordedSignatures } = await import("../../lifecycle/release-verify.js");
|
|
786
1181
|
const result = await verifyRelease({ cwd: resolve("."), ref });
|
|
787
1182
|
if ("error" in result) {
|
|
788
1183
|
if (args.json)
|
|
@@ -798,22 +1193,43 @@ export async function runReleaseVerify(ctx) {
|
|
|
798
1193
|
code = "release-pin-unknown";
|
|
799
1194
|
result.reason = pins;
|
|
800
1195
|
}
|
|
1196
|
+
// #5164: --sigstore checks the bundles the publish recorded; without it, verify stays offline and says how many there are.
|
|
1197
|
+
const sigstore = args.sigstore ? await verifySigstore({ cwd: resolve("."), releaseDigest: result.releaseDigest, ...(args.assets ? { assetsDir: args.assets } : {}) }) : null;
|
|
1198
|
+
const recorded = sigstore ? sigstore.checks.length : (await recordedSignatures(resolve("."), result.releaseDigest)).length;
|
|
1199
|
+
if (!code && sigstore && sigstore.status !== "verified") {
|
|
1200
|
+
code = sigstore.status === "none" ? "release-sigstore-unsigned" : "release-sigstore-unverified";
|
|
1201
|
+
result.reason = sigstore.reason;
|
|
1202
|
+
}
|
|
801
1203
|
if (args.json) {
|
|
802
|
-
console.log(JSON.stringify({ ...result, ...(code ? { error: { code, message: result.reason } } : {}) }, null, 2));
|
|
1204
|
+
console.log(JSON.stringify({ ...result, ...(sigstore ? { sigstore } : { sigstore: { recorded } }), ...(code ? { error: { code, message: result.reason } } : {}) }, null, 2));
|
|
803
1205
|
return code ? 1 : 0;
|
|
804
1206
|
}
|
|
805
1207
|
const name = result.label ? `${formatBold(result.label)} (${result.releaseDigest})` : result.releaseDigest;
|
|
806
1208
|
for (const c of result.cuts) {
|
|
807
1209
|
console.log(` cut by ${c.actor} at ${c.timestamp}: ${c.signatureCheck.status}${c.signatureCheck.key ? ` (${c.signatureCheck.key})` : ""}`);
|
|
1210
|
+
// #5149: what let the commit be cut; #5177: whether the cut's signature covers it.
|
|
1211
|
+
console.log(` ${c.override ? `not green: cut under the override by ${c.override.by}: ${c.override.reason}` : describeGreen(c.green)} (gate ${c.signatureCheck.status === "verified" ? c.signatureCheck.gate : "unsigned"})`);
|
|
808
1212
|
}
|
|
1213
|
+
for (const c of sigstore?.checks ?? [])
|
|
1214
|
+
console.log(` ${c.name} (${c.target}): ${c.status}, ${c.reason}`);
|
|
1215
|
+
if (!sigstore && recorded > 0)
|
|
1216
|
+
console.error(` the publish recorded ${recorded} Sigstore signature(s); check them with: chant release verify ${result.label ?? result.releaseDigest} --sigstore`);
|
|
809
1217
|
if (code) {
|
|
810
1218
|
console.error(formatError({
|
|
811
1219
|
message: `${name} does not verify: ${result.reason} [${code}]`,
|
|
812
|
-
hint: code === "release-digest-mismatch"
|
|
1220
|
+
hint: code === "release-digest-mismatch"
|
|
1221
|
+
? "Do not publish or deploy it; cut the release again."
|
|
1222
|
+
: code === "release-sigstore-unsigned"
|
|
1223
|
+
? "Publish it from CI with release.signing on, or drop --sigstore."
|
|
1224
|
+
: code === "release-sigstore-unverified"
|
|
1225
|
+
? "Download the release's assets into a directory and pass it as --assets; install cosign 3 or set CHANT_COSIGN; a bundle that failed was not signed by the identity shown."
|
|
1226
|
+
: code === "release-pin-unknown" ? "Build the package from the digests the release records: chant release images <label>, then the build with CHANT_RELEASE_DIGESTS set." : `Cut it again signed with a key ${result.signers.path} lists: chant release cut ${result.label ?? "<label>"} --sign --yes`,
|
|
813
1227
|
}));
|
|
814
1228
|
return 1;
|
|
815
1229
|
}
|
|
816
|
-
console.error(formatSuccess(`Verified ${name}: ${result.reason}`));
|
|
1230
|
+
console.error(formatSuccess(`Verified ${name}: ${result.reason}; green gate ${result.gate.status}${sigstore ? `; ${sigstore.reason}` : ""}`));
|
|
1231
|
+
if (result.gate.status === "unsigned")
|
|
1232
|
+
console.error(` ${result.gate.reason}`);
|
|
817
1233
|
return 0;
|
|
818
1234
|
}
|
|
819
1235
|
/** The first package built here that pins an image digest release `digest` does not record (#4657), said in a sentence, or null. */
|
|
@@ -892,6 +1308,59 @@ export async function runReleaseCandidates(ctx) {
|
|
|
892
1308
|
console.error(`Cut one: chant release cut <label> --at <sha>${doc.lane !== null && ctx.args.lane !== undefined ? ` --lane ${doc.lane}` : ""}`);
|
|
893
1309
|
return 0;
|
|
894
1310
|
}
|
|
1311
|
+
/**
|
|
1312
|
+
* `release next [--at <sha>] [--pre <id>] [--json]` (#5159): the label the
|
|
1313
|
+
* next release of this member carries, from the conventional commits and
|
|
1314
|
+
* the intent files since its previous release. The label alone goes to
|
|
1315
|
+
* stdout, so a script can read it; why goes to stderr.
|
|
1316
|
+
*/
|
|
1317
|
+
export async function runReleaseNext(ctx) {
|
|
1318
|
+
const { args } = ctx;
|
|
1319
|
+
const cwd = resolve(".");
|
|
1320
|
+
const rn = await import("../../lifecycle/release-next.js");
|
|
1321
|
+
const { fetchLifecycle } = await import("../../lifecycle/git.js");
|
|
1322
|
+
await fetchLifecycle({ cwd }).catch(() => false);
|
|
1323
|
+
let doc;
|
|
1324
|
+
try {
|
|
1325
|
+
doc = await rn.nextRelease({ cwd, ...(args.at ? { at: args.at } : {}), ...(args.pre !== undefined ? { pre: args.pre } : {}) });
|
|
1326
|
+
}
|
|
1327
|
+
catch (err) {
|
|
1328
|
+
if (!(err instanceof rn.ReleaseNextError))
|
|
1329
|
+
throw err;
|
|
1330
|
+
if (args.json)
|
|
1331
|
+
console.log(JSON.stringify({ error: { code: err.code, message: err.message, ...(err.fix ? { fix: err.fix } : {}) } }, null, 2));
|
|
1332
|
+
else
|
|
1333
|
+
console.error(formatError({ message: `${err.message} [${err.code}]`, ...(err.fix ? { hint: err.fix } : {}) }));
|
|
1334
|
+
return 1;
|
|
1335
|
+
}
|
|
1336
|
+
let tag = null;
|
|
1337
|
+
try {
|
|
1338
|
+
const t = await import("../../lifecycle/release-tag.js");
|
|
1339
|
+
const tags = await t.memberTags(cwd);
|
|
1340
|
+
tag = t.renderReleaseTag(tags.template, tags.place, doc.label);
|
|
1341
|
+
}
|
|
1342
|
+
catch {
|
|
1343
|
+
tag = null;
|
|
1344
|
+
}
|
|
1345
|
+
if (args.json) {
|
|
1346
|
+
console.log(JSON.stringify({ ...doc, tag }, null, 2));
|
|
1347
|
+
return 0;
|
|
1348
|
+
}
|
|
1349
|
+
console.log(doc.label);
|
|
1350
|
+
if (doc.alreadyCut) {
|
|
1351
|
+
console.error(` ${doc.at.slice(0, 12)} is already released as ${doc.label}`);
|
|
1352
|
+
return 0;
|
|
1353
|
+
}
|
|
1354
|
+
const n = doc.commits.length;
|
|
1355
|
+
console.error(` ${doc.bump ?? "the prerelease's version"} from ${doc.from.label} (${doc.from.source === "tag" ? `the tag ${doc.from.tag}, ` : ""}${doc.from.commit.slice(0, 12)}): ${n} commit${n === 1 ? "" : "s"}${doc.intents.length > 0 ? `, ${doc.intents.length} intent file${doc.intents.length === 1 ? "" : "s"}` : ""}`);
|
|
1356
|
+
for (const c of doc.commits.filter((c) => c.bump !== "patch"))
|
|
1357
|
+
console.error(` ${c.bump} ${c.sha.slice(0, 7)} ${c.subject}`);
|
|
1358
|
+
for (const i of doc.intents)
|
|
1359
|
+
console.error(` ${i.bump} ${i.path}`);
|
|
1360
|
+
if (tag)
|
|
1361
|
+
console.error(` tag ${tag}`);
|
|
1362
|
+
return 0;
|
|
1363
|
+
}
|
|
895
1364
|
/**
|
|
896
1365
|
* `release changed [--at <sha>] [--bump-member <member>=<level>]... [--json]`
|
|
897
1366
|
* (#5134): the members a release at a commit has to cut, in publish order,
|
|
@@ -919,7 +1388,8 @@ export async function runReleaseChanged(ctx) {
|
|
|
919
1388
|
for (const m of doc.members) {
|
|
920
1389
|
const why = m.reason.member !== null ? `${m.reason.code} ${m.reason.member}` : m.reason.code;
|
|
921
1390
|
const label = m.next !== null ? `${m.last?.label ?? "?"} -> ${m.next}` : "no release yet";
|
|
922
|
-
|
|
1391
|
+
const from = m.next !== null && m.bumpFrom !== "flag" ? `; ${m.bump} from ${m.bumpFrom === "default" ? "no feat or breaking commit" : m.bumpFrom}` : "";
|
|
1392
|
+
console.log(`layer ${m.layer} ${m.member} ${label} (${why}${from})`);
|
|
923
1393
|
}
|
|
924
1394
|
return 0;
|
|
925
1395
|
}
|
|
@@ -940,8 +1410,12 @@ export async function runReleaseList(ctx) {
|
|
|
940
1410
|
console.error("No releases. Cut one from a green commit: chant release cut <label>");
|
|
941
1411
|
return 0;
|
|
942
1412
|
}
|
|
1413
|
+
// #5163: a deprecated or yanked release says so at the end of its line.
|
|
1414
|
+
const { readReleaseStatus, latestReleaseStatus } = await import("../../lifecycle/release-status.js");
|
|
1415
|
+
const statuses = new Map([...latestReleaseStatus((await readReleaseStatus("_releases", { cwd: resolve(".") }).catch(() => ({ records: [] }))).records).values()].map((r) => [r.digest, r]));
|
|
943
1416
|
for (const r of doc.releases) {
|
|
944
1417
|
const where = r.environments.map((e) => e.env).join(", ") || "not deployed from the release";
|
|
1418
|
+
const status = statuses.get(r.releaseDigest);
|
|
945
1419
|
// #4031: the newest cut's signature, as the policy at base judges it.
|
|
946
1420
|
const newest = r.cuts.at(-1);
|
|
947
1421
|
const signature = newest ? (newest.signatureCheck.status === "verified" ? `signed by ${newest.actor}` : newest.signatureCheck.status) : "-";
|
|
@@ -949,7 +1423,9 @@ export async function runReleaseList(ctx) {
|
|
|
949
1423
|
// #4692: a release cut from a lane's green tag names the lane.
|
|
950
1424
|
const lane = r.cuts.find((c) => c.lane !== undefined)?.lane;
|
|
951
1425
|
const overridden = r.cuts.some((c) => c.override !== undefined);
|
|
952
|
-
console.log(`${(r.label ?? "-").padEnd(16)} ${r.releaseDigest} ${r.commit.slice(0, 12)} ${signature} ${where}${lane !== undefined ? ` lane ${lane}` : ""}${overridden ? " not green" : ""}${r.revoked ? " revoked" : ""}`);
|
|
1426
|
+
console.log(`${(r.label ?? "-").padEnd(16)} ${r.releaseDigest} ${r.commit.slice(0, 12)} ${signature} ${where}${lane !== undefined ? ` lane ${lane}` : ""}${overridden ? " not green" : ""}${r.revoked ? " revoked" : ""}${status && status.status !== "active" ? ` ${status.status}` : ""}`);
|
|
1427
|
+
if (status && status.status !== "active")
|
|
1428
|
+
console.error(` ${r.label ?? r.releaseDigest}: ${status.status} by ${status.actor} at ${status.timestamp}${status.reason ? `: ${status.reason}` : ""}${status.replacement ? `; use ${status.replacement}` : ""}`);
|
|
953
1429
|
if (newest?.signatureCheck.status === "unverified")
|
|
954
1430
|
console.error(` ${r.label ?? r.releaseDigest}: ${newest.signatureCheck.reason}`);
|
|
955
1431
|
// #4693: a release cut under an override says the commit was not green.
|
|
@@ -963,6 +1439,155 @@ export async function runReleaseList(ctx) {
|
|
|
963
1439
|
}
|
|
964
1440
|
return 0;
|
|
965
1441
|
}
|
|
1442
|
+
/**
|
|
1443
|
+
* `release deprecate|yank|restore <label|digest> [--yes] ...` (#5163): plan
|
|
1444
|
+
* the status change and what each publish target does about it, print it,
|
|
1445
|
+
* and with `--yes` write the status record and act, resumably. A target that
|
|
1446
|
+
* can't do something says so with a code, as a warning, and the rest go on.
|
|
1447
|
+
*/
|
|
1448
|
+
export async function runReleaseStatusChange(ctx, verb) {
|
|
1449
|
+
const { args } = ctx;
|
|
1450
|
+
const ref = args.extraPositional;
|
|
1451
|
+
const fail = (code, message, fix) => {
|
|
1452
|
+
if (args.json)
|
|
1453
|
+
console.log(JSON.stringify({ ref: ref ?? null, error: { code, message, ...(fix ? { fix } : {}) } }, null, 2));
|
|
1454
|
+
else
|
|
1455
|
+
console.error(formatError({ message: `${message} [${code}]`, ...(fix ? { hint: fix } : {}) }));
|
|
1456
|
+
return 1;
|
|
1457
|
+
};
|
|
1458
|
+
if (!ref)
|
|
1459
|
+
return fail("release-not-named", `release ${verb} needs a release, by label or digest`, USAGE);
|
|
1460
|
+
if (args.forgeRelease !== undefined && verb !== "yank")
|
|
1461
|
+
return fail("release-status-flag-invalid", `--forge-release says how a yank leaves the forge release, and release ${verb} is not a yank`);
|
|
1462
|
+
if (args.replacement !== undefined && verb === "restore")
|
|
1463
|
+
return fail("release-status-flag-invalid", "--replacement names the release to use instead of a deprecated or yanked one, and a restore sets neither");
|
|
1464
|
+
const cwd = resolve(".");
|
|
1465
|
+
const dryRun = args.yes !== true;
|
|
1466
|
+
const { fetchLifecycle } = await import("../../lifecycle/git.js");
|
|
1467
|
+
await fetchLifecycle({ cwd }).catch(() => false);
|
|
1468
|
+
// The actor, as a cut finds it: --actor, the signer of --sign's key, the CI's actor, git, $USER.
|
|
1469
|
+
const ws = await import("../../lifecycle/release-workstation.js");
|
|
1470
|
+
const { scopeSource } = await import("../../workspace/write-scope.js");
|
|
1471
|
+
const { releaseRuleFrom } = await import("../../workspace/identity.js");
|
|
1472
|
+
let publicKey = null;
|
|
1473
|
+
if (args.sign !== undefined) {
|
|
1474
|
+
const { resolveSigningKey, SealError } = await import("../../workspace/trust/seal.js");
|
|
1475
|
+
try {
|
|
1476
|
+
const key = resolveSigningKey(args.sign, cwd);
|
|
1477
|
+
try {
|
|
1478
|
+
if (!existsSync(key.file))
|
|
1479
|
+
return fail("release-signer-refused", `nothing was changed: the signing key ${key.file} does not exist`);
|
|
1480
|
+
publicKey = ws.publicKeyOf(key.file);
|
|
1481
|
+
}
|
|
1482
|
+
finally {
|
|
1483
|
+
key.cleanup();
|
|
1484
|
+
}
|
|
1485
|
+
}
|
|
1486
|
+
catch (err) {
|
|
1487
|
+
if (!(err instanceof SealError))
|
|
1488
|
+
throw err;
|
|
1489
|
+
return fail("release-signer-refused", `nothing was changed: ${err.message}`);
|
|
1490
|
+
}
|
|
1491
|
+
}
|
|
1492
|
+
const who = ws.resolveCutActor({ cwd, ...(args.actor ? { explicit: args.actor } : {}), publicKey, signers: releaseRuleFrom(scopeSource(cwd)).rule.signers.signers });
|
|
1493
|
+
if (!who)
|
|
1494
|
+
return fail("release-actor-unknown", "nothing was changed: no actor could be found", "Pass --actor explicitly, or set git's user.email, GITHUB_ACTOR, GITLAB_USER_LOGIN or USER.");
|
|
1495
|
+
const { prepareStatusChange, runStatusChange, StatusRunError } = await import("../../lifecycle/release-status-change.js");
|
|
1496
|
+
const { PublishTargetError } = await import("../../lifecycle/release-publish.js");
|
|
1497
|
+
let plan;
|
|
1498
|
+
try {
|
|
1499
|
+
plan = await prepareStatusChange({
|
|
1500
|
+
cwd,
|
|
1501
|
+
ref,
|
|
1502
|
+
verb,
|
|
1503
|
+
actor: who.actor,
|
|
1504
|
+
...(args.reason !== undefined ? { reason: args.reason } : {}),
|
|
1505
|
+
...(args.replacement !== undefined ? { replacement: args.replacement } : {}),
|
|
1506
|
+
...(args.forgeRelease !== undefined ? { forgeYank: args.forgeRelease } : {}),
|
|
1507
|
+
sign: args.sign !== undefined,
|
|
1508
|
+
log: (line) => (args.json ? undefined : console.error(` ${line}`)),
|
|
1509
|
+
});
|
|
1510
|
+
}
|
|
1511
|
+
catch (err) {
|
|
1512
|
+
if (err instanceof PublishTargetError)
|
|
1513
|
+
return fail(err.code, err.message, err.fix);
|
|
1514
|
+
throw err;
|
|
1515
|
+
}
|
|
1516
|
+
if ("refusal" in plan)
|
|
1517
|
+
return fail(plan.refusal.code, plan.refusal.message, plan.refusal.fix);
|
|
1518
|
+
const name = plan.label ?? plan.release.releaseDigest;
|
|
1519
|
+
const say = (line) => console.error(plan.redactor.redact(line));
|
|
1520
|
+
const refusals = (actions) => actions.filter((a) => a.refused);
|
|
1521
|
+
const describe = (a) => (a.refused ? `refused: ${a.what}: ${a.refused.message} [${a.refused.code}]${a.refused.fix ? ` ${a.refused.fix}` : ""}` : a.already ? `already so: ${a.what}` : a.what);
|
|
1522
|
+
const base = {
|
|
1523
|
+
verb,
|
|
1524
|
+
status: plan.status,
|
|
1525
|
+
releaseDigest: plan.release.releaseDigest,
|
|
1526
|
+
label: plan.label,
|
|
1527
|
+
actor: plan.actor,
|
|
1528
|
+
reason: plan.reason,
|
|
1529
|
+
replacement: plan.replacement,
|
|
1530
|
+
current: plan.current.status,
|
|
1531
|
+
resumes: plan.resumes !== null,
|
|
1532
|
+
undeclared: plan.undeclared,
|
|
1533
|
+
};
|
|
1534
|
+
const targetsDoc = plan.targets.map((t) => ({ kind: t.kind, name: t.name, destination: t.destination, ...(t.skip ? { skip: t.skip } : {}), done: t.done, head: t.head ? { releaseDigest: t.head.releaseDigest, label: t.head.label } : null, actions: t.actions }));
|
|
1535
|
+
if (dryRun) {
|
|
1536
|
+
const next = [sameWithYes(process.argv.slice(2))];
|
|
1537
|
+
if (args.json) {
|
|
1538
|
+
console.log(plan.redactor.redact(JSON.stringify({ dryRun: true, ...base, targets: targetsDoc, next }, null, 2)));
|
|
1539
|
+
return 0;
|
|
1540
|
+
}
|
|
1541
|
+
const out = (line) => console.log(plan.redactor.redact(line));
|
|
1542
|
+
say(`Dry run: ${verb} ${formatBold(name)} (${plan.release.releaseDigest}), now ${plan.current.status}${plan.resumes ? `; resumes the change ${plan.resumes.actor} recorded at ${plan.resumes.timestamp}` : ""}`);
|
|
1543
|
+
out(`The status record: ${plan.status}${plan.reason ? `, because ${plan.reason}` : ""}${plan.replacement ? `, use ${plan.replacement}` : ""}, by ${plan.actor}${plan.signed ? ", signed" : ""}`);
|
|
1544
|
+
out("What each target would do:");
|
|
1545
|
+
if (plan.targets.length === 0)
|
|
1546
|
+
out(" nothing: this member declares no publish target (release.publish in chant.config.ts)");
|
|
1547
|
+
for (const t of plan.targets) {
|
|
1548
|
+
if (t.skip) {
|
|
1549
|
+
out(` ${t.name}: nothing, ${t.skip}`);
|
|
1550
|
+
continue;
|
|
1551
|
+
}
|
|
1552
|
+
out(` ${t.name}${t.done ? " (done by an earlier run; skipped)" : ""}:`);
|
|
1553
|
+
for (const a of t.actions)
|
|
1554
|
+
out(` ${describe(a)}`);
|
|
1555
|
+
}
|
|
1556
|
+
for (const u of plan.undeclared)
|
|
1557
|
+
say(formatWarning({ message: `${name} was published to ${u}, which release.publish no longer declares, so it is not changed there` }));
|
|
1558
|
+
say(`Dry run: nothing was changed. Run again with --yes: ${next[0]}`);
|
|
1559
|
+
return 0;
|
|
1560
|
+
}
|
|
1561
|
+
let run;
|
|
1562
|
+
try {
|
|
1563
|
+
run = await runStatusChange(plan, { cwd, ...(args.sign !== undefined ? { sign: args.sign } : {}), say: (line) => (args.json ? undefined : say(line)) });
|
|
1564
|
+
}
|
|
1565
|
+
catch (err) {
|
|
1566
|
+
if (err instanceof StatusRunError) {
|
|
1567
|
+
return fail(err.code, `${err.message}; done: ${err.done.length > 0 ? err.done.join(", ") : "none"}`, `${err.fix ? `${err.fix} ` : ""}Run the same command again to resume; a target already done is skipped: ${sameWithYes(process.argv.slice(2))}`);
|
|
1568
|
+
}
|
|
1569
|
+
if (err instanceof PublishTargetError)
|
|
1570
|
+
return fail(err.code, err.message, err.fix);
|
|
1571
|
+
throw err;
|
|
1572
|
+
}
|
|
1573
|
+
if (run.recordWarning)
|
|
1574
|
+
console.error(formatWarning({ message: plan.redactor.redact(run.recordWarning) }));
|
|
1575
|
+
const refused = run.results.flatMap((r) => refusals(r.actions).map((a) => ({ target: r.name, ...a })));
|
|
1576
|
+
if (args.json) {
|
|
1577
|
+
console.log(plan.redactor.redact(JSON.stringify({ dryRun: false, ...base, record: run.record, written: run.written, targets: targetsDoc, results: run.results }, null, 2)));
|
|
1578
|
+
return 0;
|
|
1579
|
+
}
|
|
1580
|
+
for (const r of run.results)
|
|
1581
|
+
for (const a of r.actions)
|
|
1582
|
+
if (!a.refused)
|
|
1583
|
+
say(` ${r.name}: ${describe(a)}`);
|
|
1584
|
+
for (const a of refused)
|
|
1585
|
+
console.error(formatWarning({ message: plan.redactor.redact(`${a.target}: ${describe(a)}`) }));
|
|
1586
|
+
for (const u of plan.undeclared)
|
|
1587
|
+
console.error(formatWarning({ message: `${name} was published to ${u}, which release.publish no longer declares, so it was not changed there` }));
|
|
1588
|
+
console.error(formatSuccess(`${name} is ${plan.status}${run.written ? "" : " (the change recorded earlier, resumed)"}; ${run.results.length} target(s) acted on${refused.length > 0 ? `, ${refused.length} action(s) refused` : ""}`));
|
|
1589
|
+
return 0;
|
|
1590
|
+
}
|
|
966
1591
|
/**
|
|
967
1592
|
* `release export <label|digest> --env <env> [-o <dir>]` (#4046): write each
|
|
968
1593
|
* file the release's target for <env> records, at the path it was compiled to,
|