@intentius/chant 0.124.100 → 0.124.102
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-evidence-claims.d.ts +12 -0
- package/dist/ci-evidence-claims.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 +374 -0
- package/dist/cli/handlers/release.d.ts +43 -2
- package/dist/cli/handlers/release.js +667 -39
- 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 +50 -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 +19 -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 +15 -0
- package/dist/cloud-lister/index.d.ts +4 -1
- package/dist/cloud-lister/index.js +2 -1
- package/dist/cloud-lister/kubernetes-components.d.ts +56 -0
- package/dist/cloud-lister/kubernetes-components.js +642 -0
- package/dist/cloud-lister/kubernetes.d.ts +18 -0
- package/dist/cloud-lister/kubernetes.js +26 -1
- package/dist/cloud-lister/mask.d.ts +5 -1
- package/dist/cloud-lister/mask.js +14 -5
- 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-import.d.ts +1 -1
- package/dist/config-import.js +6 -2
- package/dist/config-sandbox.d.ts +1 -1
- package/dist/config-sandbox.js +3 -3
- package/dist/config.d.ts +369 -10
- package/dist/config.js +127 -7
- package/dist/deep-observation.js +9 -3
- package/dist/floor-table.data.js +21 -1
- package/dist/forge-remote.d.ts +13 -0
- package/dist/forge-remote.js +15 -0
- package/dist/lexicon.d.ts +45 -4
- package/dist/lifecycle/__fixtures__/package-files.d.ts +32 -0
- package/dist/lifecycle/__fixtures__/package-files.js +72 -0
- package/dist/lifecycle/__fixtures__/publish-fakes.d.ts +62 -0
- package/dist/lifecycle/__fixtures__/publish-fakes.js +275 -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 +13 -0
- package/dist/lifecycle/publish-declaration.d.ts +322 -4
- package/dist/lifecycle/publish-declaration.js +340 -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-helm.d.ts +83 -0
- package/dist/lifecycle/publish-helm.js +452 -0
- 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-maven.d.ts +79 -0
- package/dist/lifecycle/publish-maven.js +364 -0
- package/dist/lifecycle/publish-mcp-registry.d.ts +66 -0
- package/dist/lifecycle/publish-mcp-registry.js +305 -0
- package/dist/lifecycle/publish-npm.d.ts +27 -1
- package/dist/lifecycle/publish-npm.js +216 -3
- package/dist/lifecycle/publish-nuget.d.ts +93 -0
- package/dist/lifecycle/publish-nuget.js +377 -0
- package/dist/lifecycle/publish-oci.d.ts +91 -2
- package/dist/lifecycle/publish-oci.js +247 -8
- package/dist/lifecycle/publish-package-files.d.ts +16 -0
- package/dist/lifecycle/publish-package-files.js +39 -0
- package/dist/lifecycle/publish-pypi.d.ts +138 -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-rubygems.d.ts +84 -0
- package/dist/lifecycle/publish-rubygems.js +366 -0
- package/dist/lifecycle/publish-signing.d.ts +147 -0
- package/dist/lifecycle/publish-signing.js +257 -0
- package/dist/lifecycle/publish-targets.d.ts +37 -1
- package/dist/lifecycle/publish-targets.js +102 -0
- package/dist/lifecycle/publish-tauri.js +43 -0
- package/dist/lifecycle/publish-train-names.d.ts +57 -0
- package/dist/lifecycle/publish-train-names.js +123 -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 +290 -0
- package/dist/lifecycle/release-artifacts.js +808 -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 +64 -4
- package/dist/lifecycle/release-cut.js +147 -34
- package/dist/lifecycle/release-doctor.d.ts +113 -0
- package/dist/lifecycle/release-doctor.js +1198 -0
- package/dist/lifecycle/release-green.d.ts +86 -0
- package/dist/lifecycle/release-green.js +286 -0
- package/dist/lifecycle/release-init-registries.d.ts +48 -0
- package/dist/lifecycle/release-init-registries.js +97 -0
- package/dist/lifecycle/release-init.d.ts +275 -0
- package/dist/lifecycle/release-init.js +984 -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 +251 -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 +247 -35
- 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 +322 -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/op/local-executor.d.ts +1 -1
- package/dist/op/local-executor.js +2 -2
- package/dist/op/op-waves-evidence.js +9 -2
- 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/sensitive-key.d.ts +12 -0
- package/dist/sensitive-key.js +52 -0
- package/dist/tool-pins.d.ts +40 -0
- package/dist/tool-pins.js +66 -0
- package/dist/ts-loader.d.ts +8 -0
- package/dist/ts-loader.js +19 -0
- package/dist/wave-runtime.mjs +345 -342
- 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/lexicon-outputs.d.ts +1 -1
- package/dist/workspace/lexicon-outputs.js +1 -1
- 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 +50 -0
- package/dist/workspace/release-steps/nfpm.d.ts +13 -0
- package/dist/workspace/release-steps/nfpm.js +29 -0
- package/dist/workspace/release-steps/nuget.d.ts +14 -0
- package/dist/workspace/release-steps/nuget.js +16 -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 +36 -0
- package/dist/workspace/release-train-workflow.js +121 -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 +183 -59
- package/dist/workspace/release-workflow.js +570 -201
- 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 +504 -0
- package/dist/workspace/train-prepare.d.ts +64 -0
- package/dist/workspace/train-prepare.js +313 -0
- package/dist/workspace/train-publish.d.ts +177 -0
- package/dist/workspace/train-publish.js +574 -0
- package/dist/workspace/train-range-labels.d.ts +33 -0
- package/dist/workspace/train-range-labels.js +109 -0
- package/dist/workspace/train-shell.d.ts +5 -0
- package/dist/workspace/train-shell.js +17 -0
- package/dist/workspace/trust/check-evidence-report.d.ts +3 -7
- package/dist/workspace/trust/check-evidence-report.js +3 -7
- 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;
|
|
@@ -75,10 +83,10 @@ export function nextCommands(req) {
|
|
|
75
83
|
return [publish, ...(deploy ? [deploy] : [])];
|
|
76
84
|
return [...(req.tag ? [`git push origin ${req.tag}`] : []), publish, ...(deploy ? [deploy] : [])];
|
|
77
85
|
}
|
|
78
|
-
/** The command line that ran, without `--json`, with `--yes` added: what a dry run says to run next. */
|
|
86
|
+
/** The command line that ran, without `--json` or `--dry-run`, with `--yes` added: what a dry run says to run next. */
|
|
79
87
|
export function sameWithYes(argv) {
|
|
80
88
|
const quote = (a) => (/^[\w@%+=:,./-]+$/.test(a) ? a : `'${a.replace(/'/g, `'\\''`)}'`);
|
|
81
|
-
return ["chant", ...argv.filter((a) => a !== "--json" && a !== "--yes"), "--yes"].map(quote).join(" ");
|
|
89
|
+
return ["chant", ...argv.filter((a) => a !== "--json" && a !== "--yes" && a !== "--dry-run"), "--yes"].map(quote).join(" ");
|
|
82
90
|
}
|
|
83
91
|
/**
|
|
84
92
|
* The green lane a cut or a candidates read checks (#4692): `--lane`, else
|
|
@@ -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({
|
|
@@ -275,9 +497,10 @@ export async function runReleaseCut(ctx) {
|
|
|
275
497
|
}));
|
|
276
498
|
return 1;
|
|
277
499
|
}
|
|
278
|
-
|
|
500
|
+
// --dry-run is the default without --yes, and keeps a run with --yes a dry run.
|
|
501
|
+
const dryRun = args.yes !== true || args.dryRun === true;
|
|
279
502
|
const cwd = resolve(".");
|
|
280
|
-
const { spawnTargetCompiler, ReleaseCompileError } = await import("../../components/release-compile.js");
|
|
503
|
+
const { spawnTargetCompiler, ReleaseCompileError, RELEASE_LABEL_ENV } = await import("../../components/release-compile.js");
|
|
281
504
|
const { cutRelease, planRelease, ReleaseCutError } = await import("../../lifecycle/release-cut.js");
|
|
282
505
|
const { ReleaseLabelError } = await import("../../lifecycle/release-store.js");
|
|
283
506
|
const { pushLifecycleRebasing, getHeadCommit } = await import("../../lifecycle/git.js");
|
|
@@ -345,6 +568,28 @@ export async function runReleaseCut(ctx) {
|
|
|
345
568
|
const ledger = await resolveMemberLedger(cwd);
|
|
346
569
|
member = ledger.members.length > 0 ? ledger.members.join("/") : null;
|
|
347
570
|
}
|
|
571
|
+
// #5159: `auto` is the label the commits and intent files since the previous release give, and every
|
|
572
|
+
// labelled cut consumes the intent files that name the member.
|
|
573
|
+
let computed = null;
|
|
574
|
+
let intents = [];
|
|
575
|
+
{
|
|
576
|
+
const rn = await import("../../lifecycle/release-next.js");
|
|
577
|
+
try {
|
|
578
|
+
if (label === AUTO_LABEL) {
|
|
579
|
+
computed = await rn.nextRelease({ cwd, ...(commit ? { at: commit } : {}), ...(args.pre !== undefined ? { pre: args.pre } : {}) });
|
|
580
|
+
label = computed.label;
|
|
581
|
+
intents = computed.intents;
|
|
582
|
+
}
|
|
583
|
+
else if (label !== null && top && commit) {
|
|
584
|
+
intents = await rn.memberPendingIntents(cwd, top, commit);
|
|
585
|
+
}
|
|
586
|
+
}
|
|
587
|
+
catch (err) {
|
|
588
|
+
if (err instanceof rn.ReleaseNextError)
|
|
589
|
+
return fail(err.code, `no release was cut: ${err.message}`, err.fix);
|
|
590
|
+
throw err;
|
|
591
|
+
}
|
|
592
|
+
}
|
|
348
593
|
// The signing key is resolved now, so a dry run shows a key that can't be read.
|
|
349
594
|
let publicKey = null;
|
|
350
595
|
if (args.sign !== undefined) {
|
|
@@ -372,7 +617,6 @@ export async function runReleaseCut(ctx) {
|
|
|
372
617
|
return 1;
|
|
373
618
|
}
|
|
374
619
|
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
620
|
const ci = resolveCiRun(process.env);
|
|
377
621
|
const params = parseParamFlags(args.param);
|
|
378
622
|
// #4694: images built elsewhere, handed to the cut by digest, one per component.
|
|
@@ -392,6 +636,13 @@ export async function runReleaseCut(ctx) {
|
|
|
392
636
|
if (args.at !== undefined && top && commit)
|
|
393
637
|
checkout = at.checkoutCommit(top, cwd, commit);
|
|
394
638
|
const cutCwd = checkout?.memberDir ?? cwd;
|
|
639
|
+
// #5150: the tag from release.tag in the commit's own config, refused when another member's template can render it.
|
|
640
|
+
const tagsMod = await import("../../lifecycle/release-tag.js");
|
|
641
|
+
const tags = top ? await tagsMod.memberTags(cwd, { config: await releaseTagOf(cutCwd), top }) : null;
|
|
642
|
+
if (tags)
|
|
643
|
+
await tagsMod.checkTagCollisions(cwd, tags);
|
|
644
|
+
const tagName = (l) => tagsMod.renderReleaseTag(tags.template, tags.place, l);
|
|
645
|
+
const tag = label !== null && commit !== null && top ? { name: tagName(label), state: ws.checkReleaseTag(top, tagName(label), commit) } : null;
|
|
395
646
|
const versionConfig = await releaseVersionOf(cutCwd);
|
|
396
647
|
// #4657: the images release.images declares are built first, and their digests handed to the build command.
|
|
397
648
|
const declaredImages = await releaseImagesOf(cutCwd);
|
|
@@ -413,6 +664,30 @@ export async function runReleaseCut(ctx) {
|
|
|
413
664
|
}
|
|
414
665
|
}
|
|
415
666
|
: undefined;
|
|
667
|
+
// #5151: the files release.artifacts declares, built after the images and recorded as assets.
|
|
668
|
+
const declaredArtifacts = await releaseArtifactsOf(cutCwd);
|
|
669
|
+
const buildJobs = await releaseBuildJobsOf(cutCwd);
|
|
670
|
+
const buildArtifacts = declaredArtifacts.length > 0
|
|
671
|
+
? async (at) => {
|
|
672
|
+
const { buildReleaseArtifacts, isPrebuilt, ReleaseArtifactError } = await import("../../lifecycle/release-artifacts.js");
|
|
673
|
+
// #5183: under --at, files built before the cut are read from this checkout, which must hold the commit cut.
|
|
674
|
+
const prebuilt = declaredArtifacts.filter(isPrebuilt);
|
|
675
|
+
if (checkout && prebuilt.length > 0) {
|
|
676
|
+
const here = await getHeadCommit({ cwd });
|
|
677
|
+
if (here !== at) {
|
|
678
|
+
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}`);
|
|
679
|
+
}
|
|
680
|
+
}
|
|
681
|
+
try {
|
|
682
|
+
return buildReleaseArtifacts({ artifacts: declaredArtifacts, cwd: cutCwd, sourceDateEpoch: commitTime(cutCwd, at), label, imageNames: declaredImages.map((d) => d.name), builds: buildJobs, ...(checkout ? { prebuiltFrom: cwd } : {}) });
|
|
683
|
+
}
|
|
684
|
+
catch (err) {
|
|
685
|
+
if (!(err instanceof ReleaseArtifactError))
|
|
686
|
+
throw err;
|
|
687
|
+
throw new ReleaseCutError(err.code, `no release was cut: ${err.message}`, err.fix);
|
|
688
|
+
}
|
|
689
|
+
}
|
|
690
|
+
: undefined;
|
|
416
691
|
// #4840: release.version stamps the label into package.json once the cut has found the tree clean.
|
|
417
692
|
const stamp = versionConfig
|
|
418
693
|
? async () => {
|
|
@@ -430,6 +705,24 @@ export async function runReleaseCut(ctx) {
|
|
|
430
705
|
: undefined;
|
|
431
706
|
// #4692: the lane is the commit's own config's under --at.
|
|
432
707
|
const lane = await laneOf(ctx, cutCwd);
|
|
708
|
+
// #5149: the green gate, and for a member with no environments what release.publish publishes.
|
|
709
|
+
const greenSource = await greenOf(cutCwd);
|
|
710
|
+
const publishes = await artifactPublishesOf(cutCwd);
|
|
711
|
+
const buildCommand = args.buildCommand;
|
|
712
|
+
const build = publishes !== undefined && buildCommand
|
|
713
|
+
? () => {
|
|
714
|
+
const env = { ...process.env };
|
|
715
|
+
delete env[RELEASE_LABEL_ENV];
|
|
716
|
+
delete env.CHANT_RELEASE_DIGESTS;
|
|
717
|
+
if (label !== null)
|
|
718
|
+
env[RELEASE_LABEL_ENV] = label;
|
|
719
|
+
if (digestsFile)
|
|
720
|
+
env.CHANT_RELEASE_DIGESTS = digestsFile;
|
|
721
|
+
const run = spawnSync(buildCommand, { cwd: cutCwd, shell: true, stdio: ["ignore", 2, 2], env });
|
|
722
|
+
if (run.status !== 0)
|
|
723
|
+
throw new ReleaseCompileError(`the build command exited ${run.status ?? "with a signal"}: ${buildCommand}`);
|
|
724
|
+
}
|
|
725
|
+
: undefined;
|
|
433
726
|
const request = {
|
|
434
727
|
cwd: cutCwd,
|
|
435
728
|
compiler,
|
|
@@ -442,7 +735,12 @@ export async function runReleaseCut(ctx) {
|
|
|
442
735
|
...(args.overrideGreen ? { overrideGreen: true } : {}),
|
|
443
736
|
...(Object.keys(images).length > 0 ? { images } : {}),
|
|
444
737
|
...(buildImages ? { buildImages } : {}),
|
|
738
|
+
...(buildArtifacts ? { buildArtifacts } : {}),
|
|
445
739
|
...(stamp ? { stamp } : {}),
|
|
740
|
+
...(greenSource ? { green: greenSource } : {}),
|
|
741
|
+
...(publishes ? { publishes } : {}),
|
|
742
|
+
...(build ? { build } : {}),
|
|
743
|
+
...(intents.length > 0 ? { intents: intents.map(({ path, added, bump }) => ({ path, added, bump })) } : {}),
|
|
446
744
|
};
|
|
447
745
|
if (dryRun) {
|
|
448
746
|
const plan = await planRelease(request);
|
|
@@ -464,9 +762,12 @@ export async function runReleaseCut(ctx) {
|
|
|
464
762
|
trunk,
|
|
465
763
|
composed: composed ?? null,
|
|
466
764
|
channel: args.channel ?? null,
|
|
765
|
+
prerelease: prereleaseOf(plan.label) !== null,
|
|
467
766
|
at: args.at !== undefined ? { ref: args.at, commit } : null,
|
|
468
767
|
sign: args.sign !== undefined ? { key: publicKey !== null ? publicKey.split(" ")[0] : null, readable: publicKey !== null } : null,
|
|
469
768
|
tag: tag ? { name: tag.name, exists: tag.state === "present" } : null,
|
|
769
|
+
computed: computed ? { from: computed.from, bump: computed.bump, alreadyCut: computed.alreadyCut, commits: computed.commits.length } : null,
|
|
770
|
+
intents: intents.map(({ path, bump }) => ({ path, bump })),
|
|
470
771
|
publish: { targets: Array.isArray(publishTargets) ? publishTargets : [], provenance },
|
|
471
772
|
next: [sameWithYes(process.argv.slice(2))],
|
|
472
773
|
};
|
|
@@ -476,10 +777,14 @@ export async function runReleaseCut(ctx) {
|
|
|
476
777
|
}
|
|
477
778
|
const name = plan.label ? formatBold(plan.label) : "an unlabelled release";
|
|
478
779
|
const greenIn = plan.override
|
|
479
|
-
? `not green: no ${plan.override.tag.slice(0, plan.override.tag.lastIndexOf("/"))} tag`
|
|
780
|
+
? `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
781
|
: plan.lane !== null
|
|
481
782
|
? `green in lane ${plan.lane}`
|
|
482
|
-
:
|
|
783
|
+
: plan.green?.source === "forge-checks"
|
|
784
|
+
? `green by its ${plan.green.forge} checks`
|
|
785
|
+
: plan.green?.source === "none"
|
|
786
|
+
? "no green gate"
|
|
787
|
+
: "green";
|
|
483
788
|
const where = composed
|
|
484
789
|
? ` (on ${trunk.remote}/${composed.branch}, composed on ${composed.base.slice(0, 12)} from ${composed.sources.length} trunk commit(s), ${greenIn})`
|
|
485
790
|
: trunk
|
|
@@ -488,6 +793,18 @@ export async function runReleaseCut(ctx) {
|
|
|
488
793
|
console.log(`Dry run: cut ${name} from commit ${plan.commit.slice(0, 12)}${where}`);
|
|
489
794
|
if (args.channel)
|
|
490
795
|
console.log(` channel ${args.channel}: a publish moves ${args.channel}, not latest`);
|
|
796
|
+
if (prereleaseOf(plan.label))
|
|
797
|
+
console.log(` prerelease: ${prereleaseNote(plan.label, args.channel)}`);
|
|
798
|
+
if (computed && !computed.alreadyCut)
|
|
799
|
+
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`);
|
|
800
|
+
for (const i of intents)
|
|
801
|
+
console.log(` consumes ${i.path} (${i.bump})`);
|
|
802
|
+
if (plan.green)
|
|
803
|
+
console.log(` gate: ${describeGreen(plan.green)}`);
|
|
804
|
+
if (plan.green?.source === "none")
|
|
805
|
+
console.error(formatWarning({ message: GREEN_NONE_WARNING }));
|
|
806
|
+
if (plan.publishes)
|
|
807
|
+
console.log(` an artifact release: no environment is compiled, and it records ${plan.publishes.length} publish target(s)`);
|
|
491
808
|
if (plan.override)
|
|
492
809
|
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
810
|
if (plan.alreadyCut)
|
|
@@ -511,7 +828,7 @@ export async function runReleaseCut(ctx) {
|
|
|
511
828
|
console.log(` ${h.component}: image ${h.ref}, handed to the cut, not built`);
|
|
512
829
|
console.log(` digest ${plan.releaseDigest ?? "decided when the artifacts are built"}`);
|
|
513
830
|
console.log("What will be published where:");
|
|
514
|
-
if (plan.publishSteps.length === 0)
|
|
831
|
+
if (plan.publishSteps.length === 0 && !plan.publishes)
|
|
515
832
|
console.log(" no component declares a publish step");
|
|
516
833
|
for (const p of plan.publishSteps) {
|
|
517
834
|
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 +852,14 @@ export async function runReleaseCut(ctx) {
|
|
|
535
852
|
// publish job) finds them.
|
|
536
853
|
if (checkout && declaredImages.length > 0)
|
|
537
854
|
copyImageArchives((await import("../../lifecycle/release-images.js")).resolveReleaseImages(declaredImages), cutCwd, cwd);
|
|
855
|
+
// #5151: the files too, so `release artifacts -o` in the same job stages them for the publish job. The files
|
|
856
|
+
// built before the cut (#5183) came from here; only what the cut packed from them is copied back.
|
|
857
|
+
if (checkout && declaredArtifacts.length > 0) {
|
|
858
|
+
const { copyArtifactFiles, isPrebuilt, releaseArtifactFiles } = await import("../../lifecycle/release-artifacts.js");
|
|
859
|
+
const asFound = declaredArtifacts.filter((a) => isPrebuilt(a) && a.archive === undefined).map((a) => a.name);
|
|
860
|
+
const copied = declaredArtifacts.map((a) => a.name).filter((n) => !asFound.includes(n));
|
|
861
|
+
copyArtifactFiles(releaseArtifactFiles(result.release, copied), cutCwd, cwd, { missingOk: true });
|
|
862
|
+
}
|
|
538
863
|
// #4965: the record must be on the remote before the release is tagged. The release workflow pushes the tag
|
|
539
864
|
// right after the cut, and a tag whose record never landed spends the label: the publish job finds no release.
|
|
540
865
|
// A refused push is tried again; one that never lands stops the cut here, untagged and non-zero.
|
|
@@ -549,7 +874,7 @@ export async function runReleaseCut(ctx) {
|
|
|
549
874
|
let tagged = null;
|
|
550
875
|
let tagWarning;
|
|
551
876
|
if (result.label !== null && top) {
|
|
552
|
-
const name =
|
|
877
|
+
const name = tagName(result.label);
|
|
553
878
|
try {
|
|
554
879
|
const state = ws.checkReleaseTag(top, name, result.release.commit);
|
|
555
880
|
if (state === "absent")
|
|
@@ -569,7 +894,7 @@ export async function runReleaseCut(ctx) {
|
|
|
569
894
|
noComponents: result.release.targets.every((t) => t.templates.every((tpl) => tpl.component === null)) && result.release.artifactDigests.length === 0,
|
|
570
895
|
});
|
|
571
896
|
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));
|
|
897
|
+
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
898
|
}
|
|
574
899
|
else {
|
|
575
900
|
const name = result.label ? formatBold(result.label) : "unlabelled release";
|
|
@@ -580,11 +905,19 @@ export async function runReleaseCut(ctx) {
|
|
|
580
905
|
console.error(` commit ${result.release.commit}${composed ? `, composed on ${composed.base.slice(0, 12)} on ${composed.branch}` : ""}${lane !== undefined ? `, green in lane ${lane}` : ""}`);
|
|
581
906
|
if (args.channel)
|
|
582
907
|
console.error(` channel ${args.channel}`);
|
|
908
|
+
if (prereleaseOf(result.label))
|
|
909
|
+
console.error(` prerelease: ${prereleaseNote(result.label, args.channel)}`);
|
|
910
|
+
for (const i of result.cut?.intents ?? [])
|
|
911
|
+
console.error(` consumed ${i.path} (${i.bump})`);
|
|
583
912
|
if (result.cut?.override)
|
|
584
913
|
console.error(` not green: cut under the override by ${result.cut.override.by}: ${result.cut.override.reason}`);
|
|
914
|
+
if (result.cut?.green)
|
|
915
|
+
console.error(` gate: ${describeGreen(result.cut.green)}`);
|
|
916
|
+
if (result.release.publishes)
|
|
917
|
+
console.error(` publishes: ${result.release.publishes.map((p) => `${p.kind} to ${p.destination}`).join("; ") || "nothing"}`);
|
|
585
918
|
if (result.cut)
|
|
586
919
|
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(", ")}`);
|
|
920
|
+
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
921
|
for (const r of result.reused)
|
|
589
922
|
console.error(` ${r.component}: artifacts unchanged, carried from ${r.from}`);
|
|
590
923
|
for (const h of result.handed)
|
|
@@ -600,9 +933,13 @@ export async function runReleaseCut(ctx) {
|
|
|
600
933
|
console.error(formatWarning({ message: push.pushWarning }));
|
|
601
934
|
if (tagWarning)
|
|
602
935
|
console.error(formatWarning({ message: tagWarning }));
|
|
936
|
+
if (result.cut?.green?.source === "none")
|
|
937
|
+
console.error(formatWarning({ message: GREEN_NONE_WARNING }));
|
|
603
938
|
return 0;
|
|
604
939
|
}
|
|
605
940
|
catch (err) {
|
|
941
|
+
if (err instanceof (await import("../../lifecycle/release-tag.js")).ReleaseTagError)
|
|
942
|
+
return fail(err.code, `no release was cut: ${err.message}`, err.fix);
|
|
606
943
|
if (err instanceof ws.WorkstationCheckError || err instanceof ReleaseCutError || err instanceof at.CutAtError) {
|
|
607
944
|
// #4693: a request for an override goes where the person who answers it reads.
|
|
608
945
|
if (err instanceof ReleaseCutError && err.recorded) {
|
|
@@ -650,7 +987,8 @@ export async function runReleasePublish(ctx) {
|
|
|
650
987
|
console.error(formatError({ message: "release publish needs a release", hint: USAGE }));
|
|
651
988
|
return 1;
|
|
652
989
|
}
|
|
653
|
-
|
|
990
|
+
// --dry-run is the default without --yes, and keeps a run with --yes a dry run.
|
|
991
|
+
const dryRun = args.yes !== true || args.dryRun === true;
|
|
654
992
|
const cwd = resolve(".");
|
|
655
993
|
const fail = (code, message, fix) => {
|
|
656
994
|
console.error(formatError({ message: `${message} [${code}]`, ...(fix ? { hint: fix } : {}) }));
|
|
@@ -663,7 +1001,7 @@ export async function runReleasePublish(ctx) {
|
|
|
663
1001
|
const prepared = await preparePublish({ cwd, ref, allowUnsigned: args.allowUnsigned === true, requireProvenance: args.requireProvenance === true });
|
|
664
1002
|
if ("refusal" in prepared)
|
|
665
1003
|
return fail(prepared.refusal.code, prepared.refusal.message, prepared.refusal.fix);
|
|
666
|
-
const { release, label, signature, provenance, warning, signatureWarning, targets, redactor } = prepared;
|
|
1004
|
+
const { release, label, signature, provenance, warning, signatureWarning, gateWarning, signingWarning, targets, redactor } = prepared;
|
|
667
1005
|
const name = label ?? release.releaseDigest;
|
|
668
1006
|
const deploySteps = release.targets.map((t) => t.env);
|
|
669
1007
|
const say = (line) => console.error(redactor.redact(line));
|
|
@@ -671,13 +1009,19 @@ export async function runReleasePublish(ctx) {
|
|
|
671
1009
|
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
1010
|
if (!args.json) {
|
|
673
1011
|
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}`}`);
|
|
1012
|
+
say(` ${signature.status === "verified" ? `signed by ${signature.actor}, green gate ${signature.gate}` : signature.status === "unsigned" ? "not signed" : `signature unverified: ${signature.reason}`}`);
|
|
675
1013
|
}
|
|
676
1014
|
// The warnings go to stderr with --json too, before any target runs.
|
|
677
1015
|
if (signatureWarning)
|
|
678
1016
|
console.error(formatWarning({ message: signatureWarning }));
|
|
1017
|
+
if (gateWarning)
|
|
1018
|
+
console.error(formatWarning({ message: gateWarning }));
|
|
679
1019
|
if (warning)
|
|
680
1020
|
console.error(formatWarning({ message: warning }));
|
|
1021
|
+
if (signingWarning)
|
|
1022
|
+
console.error(formatWarning({ message: signingWarning }));
|
|
1023
|
+
if (prepared.signing && !args.json)
|
|
1024
|
+
say(` signing images and forge assets with Sigstore (${prepared.signing.signer.name}) as ${prepared.signing.identity.identity}, issuer ${prepared.signing.identity.issuer}`);
|
|
681
1025
|
// #4168 4.3: a release cut with --channel moves that tag, not latest.
|
|
682
1026
|
const pctx = publishContext(prepared, { cwd, tag: prepared.channel, log: (line) => (args.json ? undefined : console.error(` ${line}`)) });
|
|
683
1027
|
// Every target is planned before any publishes, so a missing file or credential stops the publish with nothing sent.
|
|
@@ -685,7 +1029,7 @@ export async function runReleasePublish(ctx) {
|
|
|
685
1029
|
const planned = [];
|
|
686
1030
|
for (const target of targets) {
|
|
687
1031
|
try {
|
|
688
|
-
planned.push({ kind: target.kind, name: target.name, destination: target.destination, progress: progressOf(progress, target), items: await target.plan(pctx) });
|
|
1032
|
+
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
1033
|
}
|
|
690
1034
|
catch (err) {
|
|
691
1035
|
const e = errorOf(err);
|
|
@@ -700,7 +1044,31 @@ export async function runReleasePublish(ctx) {
|
|
|
700
1044
|
? ` Each environment deploys the files the release recorded: chant release export ${name} --env ${deploySteps[0]}`
|
|
701
1045
|
: ` A component's publish steps run in each environment's deploy of the release: chant components promote --release ${name} --to ${deploySteps[0]}`;
|
|
702
1046
|
};
|
|
703
|
-
const
|
|
1047
|
+
const pre = prereleaseOf(label);
|
|
1048
|
+
if (pre && !args.json)
|
|
1049
|
+
say(` prerelease: ${prereleaseNote(label, prepared.channel ?? undefined)}`);
|
|
1050
|
+
const floating = prepared.floating ?? null;
|
|
1051
|
+
// #5157: release.verify runs between the stages and the reveals; a target whose stage is visible is out of its reach.
|
|
1052
|
+
const verifySteps = targets.length > 0 ? (prepared.verify ?? []) : [];
|
|
1053
|
+
const { unstagedForVerify, unstagedWarning } = await import("../../lifecycle/publish-verify.js");
|
|
1054
|
+
const unstaged = verifySteps.length > 0 ? unstagedForVerify(targets) : [];
|
|
1055
|
+
const verifyWarning = unstaged.length > 0 ? unstagedWarning(unstaged) : null;
|
|
1056
|
+
if (verifyWarning)
|
|
1057
|
+
console.error(formatWarning({ message: verifyWarning }));
|
|
1058
|
+
const base = {
|
|
1059
|
+
releaseDigest: release.releaseDigest,
|
|
1060
|
+
label,
|
|
1061
|
+
prerelease: pre !== null,
|
|
1062
|
+
...(pre ? { distTag: prepared.channel ?? pre.distTag } : {}),
|
|
1063
|
+
commit: release.commit,
|
|
1064
|
+
signature,
|
|
1065
|
+
provenance,
|
|
1066
|
+
warnings: [signatureWarning, gateWarning, warning, signingWarning, verifyWarning].filter((w) => w !== null),
|
|
1067
|
+
signing: prepared.signing ? { identity: prepared.signing.identity, signer: prepared.signing.signer.name } : null,
|
|
1068
|
+
...(floating ? { floating } : {}),
|
|
1069
|
+
...(verifySteps.length > 0 ? { verify: { steps: verifySteps, unstaged } } : {}),
|
|
1070
|
+
};
|
|
1071
|
+
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
1072
|
if (dryRun) {
|
|
705
1073
|
const next = [sameWithYes(process.argv.slice(2))];
|
|
706
1074
|
if (args.json) {
|
|
@@ -711,12 +1079,19 @@ export async function runReleasePublish(ctx) {
|
|
|
711
1079
|
out("What would be published where:");
|
|
712
1080
|
if (planned.length === 0)
|
|
713
1081
|
out(" nothing: this member declares no publish target (release.publish in chant.config.ts)");
|
|
1082
|
+
if (floating)
|
|
1083
|
+
out(floatingLine(floating, false));
|
|
714
1084
|
for (const p of planned) {
|
|
715
1085
|
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}:`);
|
|
1086
|
+
out(` ${p.name}${provenance.oidc && p.kind === "npm" ? ", with --provenance" : ""}${p.revealsLast ? ", revealed after every other target" : ""}${earlier}:`);
|
|
717
1087
|
for (const i of p.items)
|
|
718
1088
|
out(` ${describeItem(i)}`);
|
|
719
1089
|
}
|
|
1090
|
+
if (verifySteps.length > 0) {
|
|
1091
|
+
out(" verify, after every target has staged and before any reveals (release.verify):");
|
|
1092
|
+
for (const v of verifySteps)
|
|
1093
|
+
out(` ${v.name === v.run ? v.run : `${v.name}: ${v.run}`}`);
|
|
1094
|
+
}
|
|
720
1095
|
say(`Dry run: nothing was published. Run again with --yes to publish: ${next[0]}`);
|
|
721
1096
|
const hint = planned.length === 0 ? promoteHint() : null;
|
|
722
1097
|
if (hint)
|
|
@@ -727,24 +1102,36 @@ export async function runReleasePublish(ctx) {
|
|
|
727
1102
|
say(" every target stages first, and none is visible until all have staged");
|
|
728
1103
|
let run;
|
|
729
1104
|
try {
|
|
730
|
-
run = await runPublish({ cwd, release, label, targets, ctx: pctx, say: (line) => (args.json ? undefined : say(line)) });
|
|
1105
|
+
run = await runPublish({ cwd, release, label, targets, ctx: pctx, verify: verifySteps, say: (line) => (args.json ? undefined : say(line)) });
|
|
731
1106
|
}
|
|
732
1107
|
catch (err) {
|
|
733
1108
|
if (err instanceof PublishRunError) {
|
|
734
1109
|
const again = sameWithYes(process.argv.slice(2));
|
|
735
|
-
const where = err.step
|
|
1110
|
+
const where = err.step !== "reveal" && err.revealed.length === 0
|
|
736
1111
|
? `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(", ")}`;
|
|
1112
|
+
: `revealed: ${err.revealed.length > 0 ? err.revealed.join(", ") : "none"}; staged and not yet revealed: ${err.staged.filter((t) => !err.revealed.includes(t)).join(", ") || "none"}`;
|
|
1113
|
+
if (args.json)
|
|
1114
|
+
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
1115
|
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
1116
|
}
|
|
740
1117
|
const e = errorOf(err);
|
|
741
1118
|
return failed(e.code, e.message, e.fix);
|
|
742
1119
|
}
|
|
743
1120
|
const { published } = run;
|
|
1121
|
+
// #5150: the floating tag moves only once every target has revealed; a target that refused with a warning leaves it.
|
|
1122
|
+
let floatingWarning = null;
|
|
1123
|
+
if (floating?.move) {
|
|
1124
|
+
if (published.some((p) => p.warning))
|
|
1125
|
+
floatingWarning = `the floating tag ${floating.name} was not moved, since a target refused the release`;
|
|
1126
|
+
else
|
|
1127
|
+
floatingWarning = (await import("../../lifecycle/release-publish.js")).moveFloatingTag(cwd, floating);
|
|
1128
|
+
}
|
|
1129
|
+
if (floatingWarning)
|
|
1130
|
+
console.error(formatWarning({ message: floatingWarning }));
|
|
744
1131
|
if (run.recordWarning && targets.length > 0)
|
|
745
1132
|
console.error(formatWarning({ message: redactor.redact(`${run.recordWarning}. A resume asks the registries what is already there.`) }));
|
|
746
1133
|
if (args.json) {
|
|
747
|
-
console.log(redactor.redact(JSON.stringify({ dryRun: false, ...base, targets: planned, published, resumed: run.resumed, environments: deploySteps }, null, 2)));
|
|
1134
|
+
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
1135
|
return 0;
|
|
749
1136
|
}
|
|
750
1137
|
if (targets.length === 0) {
|
|
@@ -760,11 +1147,21 @@ export async function runReleasePublish(ctx) {
|
|
|
760
1147
|
const refused = published.filter((p) => p.warning);
|
|
761
1148
|
console.error(formatSuccess(`Published ${name} to ${published.length - refused.length} target(s)${refused.length > 0 ? `; ${refused.length} refused it, with a warning` : ""}`));
|
|
762
1149
|
}
|
|
1150
|
+
if (floating && !floatingWarning)
|
|
1151
|
+
say(floatingLine(floating, true));
|
|
763
1152
|
return 0;
|
|
764
1153
|
}
|
|
765
1154
|
/** One item a target publishes, for a line: what, where, and the SBOM or attachment it is (#4049). */
|
|
766
1155
|
function describeItem(i) {
|
|
767
|
-
const what = i.attachment === "sbom"
|
|
1156
|
+
const what = i.attachment === "sbom"
|
|
1157
|
+
? `${i.name} (SBOM)`
|
|
1158
|
+
: i.attachment === "provenance"
|
|
1159
|
+
? `${i.name} (provenance)`
|
|
1160
|
+
: i.attachment === "signature"
|
|
1161
|
+
? `${i.name} (Sigstore signature)`
|
|
1162
|
+
: i.attachment === "attestation"
|
|
1163
|
+
? `${i.name} (SLSA provenance, Sigstore)`
|
|
1164
|
+
: i.name;
|
|
768
1165
|
if (i.notes !== undefined)
|
|
769
1166
|
return `${i.name} to ${i.destination}:\n${i.notes.trimEnd().split("\n").map((l) => ` ${l}`.trimEnd()).join("\n")}`;
|
|
770
1167
|
return `${what} to ${i.destination}${i.sbom ? `, carrying ${i.sbom}` : ""}`;
|
|
@@ -782,7 +1179,7 @@ export async function runReleaseVerify(ctx) {
|
|
|
782
1179
|
console.error(formatError({ message: "release verify needs a release", hint: USAGE }));
|
|
783
1180
|
return 1;
|
|
784
1181
|
}
|
|
785
|
-
const { verifyRelease, verificationCode } = await import("../../lifecycle/release-verify.js");
|
|
1182
|
+
const { verifyRelease, verificationCode, verifySigstore, recordedSignatures } = await import("../../lifecycle/release-verify.js");
|
|
786
1183
|
const result = await verifyRelease({ cwd: resolve("."), ref });
|
|
787
1184
|
if ("error" in result) {
|
|
788
1185
|
if (args.json)
|
|
@@ -798,22 +1195,43 @@ export async function runReleaseVerify(ctx) {
|
|
|
798
1195
|
code = "release-pin-unknown";
|
|
799
1196
|
result.reason = pins;
|
|
800
1197
|
}
|
|
1198
|
+
// #5164: --sigstore checks the bundles the publish recorded; without it, verify stays offline and says how many there are.
|
|
1199
|
+
const sigstore = args.sigstore ? await verifySigstore({ cwd: resolve("."), releaseDigest: result.releaseDigest, ...(args.assets ? { assetsDir: args.assets } : {}) }) : null;
|
|
1200
|
+
const recorded = sigstore ? sigstore.checks.length : (await recordedSignatures(resolve("."), result.releaseDigest)).length;
|
|
1201
|
+
if (!code && sigstore && sigstore.status !== "verified") {
|
|
1202
|
+
code = sigstore.status === "none" ? "release-sigstore-unsigned" : "release-sigstore-unverified";
|
|
1203
|
+
result.reason = sigstore.reason;
|
|
1204
|
+
}
|
|
801
1205
|
if (args.json) {
|
|
802
|
-
console.log(JSON.stringify({ ...result, ...(code ? { error: { code, message: result.reason } } : {}) }, null, 2));
|
|
1206
|
+
console.log(JSON.stringify({ ...result, ...(sigstore ? { sigstore } : { sigstore: { recorded } }), ...(code ? { error: { code, message: result.reason } } : {}) }, null, 2));
|
|
803
1207
|
return code ? 1 : 0;
|
|
804
1208
|
}
|
|
805
1209
|
const name = result.label ? `${formatBold(result.label)} (${result.releaseDigest})` : result.releaseDigest;
|
|
806
1210
|
for (const c of result.cuts) {
|
|
807
1211
|
console.log(` cut by ${c.actor} at ${c.timestamp}: ${c.signatureCheck.status}${c.signatureCheck.key ? ` (${c.signatureCheck.key})` : ""}`);
|
|
1212
|
+
// #5149: what let the commit be cut; #5177: whether the cut's signature covers it.
|
|
1213
|
+
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
1214
|
}
|
|
1215
|
+
for (const c of sigstore?.checks ?? [])
|
|
1216
|
+
console.log(` ${c.name} (${c.target}): ${c.status}, ${c.reason}`);
|
|
1217
|
+
if (!sigstore && recorded > 0)
|
|
1218
|
+
console.error(` the publish recorded ${recorded} Sigstore signature(s); check them with: chant release verify ${result.label ?? result.releaseDigest} --sigstore`);
|
|
809
1219
|
if (code) {
|
|
810
1220
|
console.error(formatError({
|
|
811
1221
|
message: `${name} does not verify: ${result.reason} [${code}]`,
|
|
812
|
-
hint: code === "release-digest-mismatch"
|
|
1222
|
+
hint: code === "release-digest-mismatch"
|
|
1223
|
+
? "Do not publish or deploy it; cut the release again."
|
|
1224
|
+
: code === "release-sigstore-unsigned"
|
|
1225
|
+
? "Publish it from CI with release.signing on, or drop --sigstore."
|
|
1226
|
+
: code === "release-sigstore-unverified"
|
|
1227
|
+
? "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."
|
|
1228
|
+
: 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
1229
|
}));
|
|
814
1230
|
return 1;
|
|
815
1231
|
}
|
|
816
|
-
console.error(formatSuccess(`Verified ${name}: ${result.reason}`));
|
|
1232
|
+
console.error(formatSuccess(`Verified ${name}: ${result.reason}; green gate ${result.gate.status}${sigstore ? `; ${sigstore.reason}` : ""}`));
|
|
1233
|
+
if (result.gate.status === "unsigned")
|
|
1234
|
+
console.error(` ${result.gate.reason}`);
|
|
817
1235
|
return 0;
|
|
818
1236
|
}
|
|
819
1237
|
/** The first package built here that pins an image digest release `digest` does not record (#4657), said in a sentence, or null. */
|
|
@@ -892,6 +1310,59 @@ export async function runReleaseCandidates(ctx) {
|
|
|
892
1310
|
console.error(`Cut one: chant release cut <label> --at <sha>${doc.lane !== null && ctx.args.lane !== undefined ? ` --lane ${doc.lane}` : ""}`);
|
|
893
1311
|
return 0;
|
|
894
1312
|
}
|
|
1313
|
+
/**
|
|
1314
|
+
* `release next [--at <sha>] [--pre <id>] [--json]` (#5159): the label the
|
|
1315
|
+
* next release of this member carries, from the conventional commits and
|
|
1316
|
+
* the intent files since its previous release. The label alone goes to
|
|
1317
|
+
* stdout, so a script can read it; why goes to stderr.
|
|
1318
|
+
*/
|
|
1319
|
+
export async function runReleaseNext(ctx) {
|
|
1320
|
+
const { args } = ctx;
|
|
1321
|
+
const cwd = resolve(".");
|
|
1322
|
+
const rn = await import("../../lifecycle/release-next.js");
|
|
1323
|
+
const { fetchLifecycle } = await import("../../lifecycle/git.js");
|
|
1324
|
+
await fetchLifecycle({ cwd }).catch(() => false);
|
|
1325
|
+
let doc;
|
|
1326
|
+
try {
|
|
1327
|
+
doc = await rn.nextRelease({ cwd, ...(args.at ? { at: args.at } : {}), ...(args.pre !== undefined ? { pre: args.pre } : {}) });
|
|
1328
|
+
}
|
|
1329
|
+
catch (err) {
|
|
1330
|
+
if (!(err instanceof rn.ReleaseNextError))
|
|
1331
|
+
throw err;
|
|
1332
|
+
if (args.json)
|
|
1333
|
+
console.log(JSON.stringify({ error: { code: err.code, message: err.message, ...(err.fix ? { fix: err.fix } : {}) } }, null, 2));
|
|
1334
|
+
else
|
|
1335
|
+
console.error(formatError({ message: `${err.message} [${err.code}]`, ...(err.fix ? { hint: err.fix } : {}) }));
|
|
1336
|
+
return 1;
|
|
1337
|
+
}
|
|
1338
|
+
let tag = null;
|
|
1339
|
+
try {
|
|
1340
|
+
const t = await import("../../lifecycle/release-tag.js");
|
|
1341
|
+
const tags = await t.memberTags(cwd);
|
|
1342
|
+
tag = t.renderReleaseTag(tags.template, tags.place, doc.label);
|
|
1343
|
+
}
|
|
1344
|
+
catch {
|
|
1345
|
+
tag = null;
|
|
1346
|
+
}
|
|
1347
|
+
if (args.json) {
|
|
1348
|
+
console.log(JSON.stringify({ ...doc, tag }, null, 2));
|
|
1349
|
+
return 0;
|
|
1350
|
+
}
|
|
1351
|
+
console.log(doc.label);
|
|
1352
|
+
if (doc.alreadyCut) {
|
|
1353
|
+
console.error(` ${doc.at.slice(0, 12)} is already released as ${doc.label}`);
|
|
1354
|
+
return 0;
|
|
1355
|
+
}
|
|
1356
|
+
const n = doc.commits.length;
|
|
1357
|
+
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"}` : ""}`);
|
|
1358
|
+
for (const c of doc.commits.filter((c) => c.bump !== "patch"))
|
|
1359
|
+
console.error(` ${c.bump} ${c.sha.slice(0, 7)} ${c.subject}`);
|
|
1360
|
+
for (const i of doc.intents)
|
|
1361
|
+
console.error(` ${i.bump} ${i.path}`);
|
|
1362
|
+
if (tag)
|
|
1363
|
+
console.error(` tag ${tag}`);
|
|
1364
|
+
return 0;
|
|
1365
|
+
}
|
|
895
1366
|
/**
|
|
896
1367
|
* `release changed [--at <sha>] [--bump-member <member>=<level>]... [--json]`
|
|
897
1368
|
* (#5134): the members a release at a commit has to cut, in publish order,
|
|
@@ -919,7 +1390,8 @@ export async function runReleaseChanged(ctx) {
|
|
|
919
1390
|
for (const m of doc.members) {
|
|
920
1391
|
const why = m.reason.member !== null ? `${m.reason.code} ${m.reason.member}` : m.reason.code;
|
|
921
1392
|
const label = m.next !== null ? `${m.last?.label ?? "?"} -> ${m.next}` : "no release yet";
|
|
922
|
-
|
|
1393
|
+
const from = m.next !== null && m.bumpFrom !== "flag" ? `; ${m.bump} from ${m.bumpFrom === "default" ? "no feat or breaking commit" : m.bumpFrom}` : "";
|
|
1394
|
+
console.log(`layer ${m.layer} ${m.member} ${label} (${why}${from})`);
|
|
923
1395
|
}
|
|
924
1396
|
return 0;
|
|
925
1397
|
}
|
|
@@ -940,8 +1412,12 @@ export async function runReleaseList(ctx) {
|
|
|
940
1412
|
console.error("No releases. Cut one from a green commit: chant release cut <label>");
|
|
941
1413
|
return 0;
|
|
942
1414
|
}
|
|
1415
|
+
// #5163: a deprecated or yanked release says so at the end of its line.
|
|
1416
|
+
const { readReleaseStatus, latestReleaseStatus } = await import("../../lifecycle/release-status.js");
|
|
1417
|
+
const statuses = new Map([...latestReleaseStatus((await readReleaseStatus("_releases", { cwd: resolve(".") }).catch(() => ({ records: [] }))).records).values()].map((r) => [r.digest, r]));
|
|
943
1418
|
for (const r of doc.releases) {
|
|
944
1419
|
const where = r.environments.map((e) => e.env).join(", ") || "not deployed from the release";
|
|
1420
|
+
const status = statuses.get(r.releaseDigest);
|
|
945
1421
|
// #4031: the newest cut's signature, as the policy at base judges it.
|
|
946
1422
|
const newest = r.cuts.at(-1);
|
|
947
1423
|
const signature = newest ? (newest.signatureCheck.status === "verified" ? `signed by ${newest.actor}` : newest.signatureCheck.status) : "-";
|
|
@@ -949,7 +1425,9 @@ export async function runReleaseList(ctx) {
|
|
|
949
1425
|
// #4692: a release cut from a lane's green tag names the lane.
|
|
950
1426
|
const lane = r.cuts.find((c) => c.lane !== undefined)?.lane;
|
|
951
1427
|
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" : ""}`);
|
|
1428
|
+
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}` : ""}`);
|
|
1429
|
+
if (status && status.status !== "active")
|
|
1430
|
+
console.error(` ${r.label ?? r.releaseDigest}: ${status.status} by ${status.actor} at ${status.timestamp}${status.reason ? `: ${status.reason}` : ""}${status.replacement ? `; use ${status.replacement}` : ""}`);
|
|
953
1431
|
if (newest?.signatureCheck.status === "unverified")
|
|
954
1432
|
console.error(` ${r.label ?? r.releaseDigest}: ${newest.signatureCheck.reason}`);
|
|
955
1433
|
// #4693: a release cut under an override says the commit was not green.
|
|
@@ -963,6 +1441,156 @@ export async function runReleaseList(ctx) {
|
|
|
963
1441
|
}
|
|
964
1442
|
return 0;
|
|
965
1443
|
}
|
|
1444
|
+
/**
|
|
1445
|
+
* `release deprecate|yank|restore <label|digest> [--yes] ...` (#5163): plan
|
|
1446
|
+
* the status change and what each publish target does about it, print it,
|
|
1447
|
+
* and with `--yes` write the status record and act, resumably. A target that
|
|
1448
|
+
* can't do something says so with a code, as a warning, and the rest go on.
|
|
1449
|
+
*/
|
|
1450
|
+
export async function runReleaseStatusChange(ctx, verb) {
|
|
1451
|
+
const { args } = ctx;
|
|
1452
|
+
const ref = args.extraPositional;
|
|
1453
|
+
const fail = (code, message, fix) => {
|
|
1454
|
+
if (args.json)
|
|
1455
|
+
console.log(JSON.stringify({ ref: ref ?? null, error: { code, message, ...(fix ? { fix } : {}) } }, null, 2));
|
|
1456
|
+
else
|
|
1457
|
+
console.error(formatError({ message: `${message} [${code}]`, ...(fix ? { hint: fix } : {}) }));
|
|
1458
|
+
return 1;
|
|
1459
|
+
};
|
|
1460
|
+
if (!ref)
|
|
1461
|
+
return fail("release-not-named", `release ${verb} needs a release, by label or digest`, USAGE);
|
|
1462
|
+
if (args.forgeRelease !== undefined && verb !== "yank")
|
|
1463
|
+
return fail("release-status-flag-invalid", `--forge-release says how a yank leaves the forge release, and release ${verb} is not a yank`);
|
|
1464
|
+
if (args.replacement !== undefined && verb === "restore")
|
|
1465
|
+
return fail("release-status-flag-invalid", "--replacement names the release to use instead of a deprecated or yanked one, and a restore sets neither");
|
|
1466
|
+
const cwd = resolve(".");
|
|
1467
|
+
// --dry-run is the default without --yes, and keeps a run with --yes a dry run.
|
|
1468
|
+
const dryRun = args.yes !== true || args.dryRun === true;
|
|
1469
|
+
const { fetchLifecycle } = await import("../../lifecycle/git.js");
|
|
1470
|
+
await fetchLifecycle({ cwd }).catch(() => false);
|
|
1471
|
+
// The actor, as a cut finds it: --actor, the signer of --sign's key, the CI's actor, git, $USER.
|
|
1472
|
+
const ws = await import("../../lifecycle/release-workstation.js");
|
|
1473
|
+
const { scopeSource } = await import("../../workspace/write-scope.js");
|
|
1474
|
+
const { releaseRuleFrom } = await import("../../workspace/identity.js");
|
|
1475
|
+
let publicKey = null;
|
|
1476
|
+
if (args.sign !== undefined) {
|
|
1477
|
+
const { resolveSigningKey, SealError } = await import("../../workspace/trust/seal.js");
|
|
1478
|
+
try {
|
|
1479
|
+
const key = resolveSigningKey(args.sign, cwd);
|
|
1480
|
+
try {
|
|
1481
|
+
if (!existsSync(key.file))
|
|
1482
|
+
return fail("release-signer-refused", `nothing was changed: the signing key ${key.file} does not exist`);
|
|
1483
|
+
publicKey = ws.publicKeyOf(key.file);
|
|
1484
|
+
}
|
|
1485
|
+
finally {
|
|
1486
|
+
key.cleanup();
|
|
1487
|
+
}
|
|
1488
|
+
}
|
|
1489
|
+
catch (err) {
|
|
1490
|
+
if (!(err instanceof SealError))
|
|
1491
|
+
throw err;
|
|
1492
|
+
return fail("release-signer-refused", `nothing was changed: ${err.message}`);
|
|
1493
|
+
}
|
|
1494
|
+
}
|
|
1495
|
+
const who = ws.resolveCutActor({ cwd, ...(args.actor ? { explicit: args.actor } : {}), publicKey, signers: releaseRuleFrom(scopeSource(cwd)).rule.signers.signers });
|
|
1496
|
+
if (!who)
|
|
1497
|
+
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.");
|
|
1498
|
+
const { prepareStatusChange, runStatusChange, StatusRunError } = await import("../../lifecycle/release-status-change.js");
|
|
1499
|
+
const { PublishTargetError } = await import("../../lifecycle/release-publish.js");
|
|
1500
|
+
let plan;
|
|
1501
|
+
try {
|
|
1502
|
+
plan = await prepareStatusChange({
|
|
1503
|
+
cwd,
|
|
1504
|
+
ref,
|
|
1505
|
+
verb,
|
|
1506
|
+
actor: who.actor,
|
|
1507
|
+
...(args.reason !== undefined ? { reason: args.reason } : {}),
|
|
1508
|
+
...(args.replacement !== undefined ? { replacement: args.replacement } : {}),
|
|
1509
|
+
...(args.forgeRelease !== undefined ? { forgeYank: args.forgeRelease } : {}),
|
|
1510
|
+
sign: args.sign !== undefined,
|
|
1511
|
+
log: (line) => (args.json ? undefined : console.error(` ${line}`)),
|
|
1512
|
+
});
|
|
1513
|
+
}
|
|
1514
|
+
catch (err) {
|
|
1515
|
+
if (err instanceof PublishTargetError)
|
|
1516
|
+
return fail(err.code, err.message, err.fix);
|
|
1517
|
+
throw err;
|
|
1518
|
+
}
|
|
1519
|
+
if ("refusal" in plan)
|
|
1520
|
+
return fail(plan.refusal.code, plan.refusal.message, plan.refusal.fix);
|
|
1521
|
+
const name = plan.label ?? plan.release.releaseDigest;
|
|
1522
|
+
const say = (line) => console.error(plan.redactor.redact(line));
|
|
1523
|
+
const refusals = (actions) => actions.filter((a) => a.refused);
|
|
1524
|
+
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);
|
|
1525
|
+
const base = {
|
|
1526
|
+
verb,
|
|
1527
|
+
status: plan.status,
|
|
1528
|
+
releaseDigest: plan.release.releaseDigest,
|
|
1529
|
+
label: plan.label,
|
|
1530
|
+
actor: plan.actor,
|
|
1531
|
+
reason: plan.reason,
|
|
1532
|
+
replacement: plan.replacement,
|
|
1533
|
+
current: plan.current.status,
|
|
1534
|
+
resumes: plan.resumes !== null,
|
|
1535
|
+
undeclared: plan.undeclared,
|
|
1536
|
+
};
|
|
1537
|
+
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 }));
|
|
1538
|
+
if (dryRun) {
|
|
1539
|
+
const next = [sameWithYes(process.argv.slice(2))];
|
|
1540
|
+
if (args.json) {
|
|
1541
|
+
console.log(plan.redactor.redact(JSON.stringify({ dryRun: true, ...base, targets: targetsDoc, next }, null, 2)));
|
|
1542
|
+
return 0;
|
|
1543
|
+
}
|
|
1544
|
+
const out = (line) => console.log(plan.redactor.redact(line));
|
|
1545
|
+
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}` : ""}`);
|
|
1546
|
+
out(`The status record: ${plan.status}${plan.reason ? `, because ${plan.reason}` : ""}${plan.replacement ? `, use ${plan.replacement}` : ""}, by ${plan.actor}${plan.signed ? ", signed" : ""}`);
|
|
1547
|
+
out("What each target would do:");
|
|
1548
|
+
if (plan.targets.length === 0)
|
|
1549
|
+
out(" nothing: this member declares no publish target (release.publish in chant.config.ts)");
|
|
1550
|
+
for (const t of plan.targets) {
|
|
1551
|
+
if (t.skip) {
|
|
1552
|
+
out(` ${t.name}: nothing, ${t.skip}`);
|
|
1553
|
+
continue;
|
|
1554
|
+
}
|
|
1555
|
+
out(` ${t.name}${t.done ? " (done by an earlier run; skipped)" : ""}:`);
|
|
1556
|
+
for (const a of t.actions)
|
|
1557
|
+
out(` ${describe(a)}`);
|
|
1558
|
+
}
|
|
1559
|
+
for (const u of plan.undeclared)
|
|
1560
|
+
say(formatWarning({ message: `${name} was published to ${u}, which release.publish no longer declares, so it is not changed there` }));
|
|
1561
|
+
say(`Dry run: nothing was changed. Run again with --yes: ${next[0]}`);
|
|
1562
|
+
return 0;
|
|
1563
|
+
}
|
|
1564
|
+
let run;
|
|
1565
|
+
try {
|
|
1566
|
+
run = await runStatusChange(plan, { cwd, ...(args.sign !== undefined ? { sign: args.sign } : {}), say: (line) => (args.json ? undefined : say(line)) });
|
|
1567
|
+
}
|
|
1568
|
+
catch (err) {
|
|
1569
|
+
if (err instanceof StatusRunError) {
|
|
1570
|
+
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))}`);
|
|
1571
|
+
}
|
|
1572
|
+
if (err instanceof PublishTargetError)
|
|
1573
|
+
return fail(err.code, err.message, err.fix);
|
|
1574
|
+
throw err;
|
|
1575
|
+
}
|
|
1576
|
+
if (run.recordWarning)
|
|
1577
|
+
console.error(formatWarning({ message: plan.redactor.redact(run.recordWarning) }));
|
|
1578
|
+
const refused = run.results.flatMap((r) => refusals(r.actions).map((a) => ({ target: r.name, ...a })));
|
|
1579
|
+
if (args.json) {
|
|
1580
|
+
console.log(plan.redactor.redact(JSON.stringify({ dryRun: false, ...base, record: run.record, written: run.written, targets: targetsDoc, results: run.results }, null, 2)));
|
|
1581
|
+
return 0;
|
|
1582
|
+
}
|
|
1583
|
+
for (const r of run.results)
|
|
1584
|
+
for (const a of r.actions)
|
|
1585
|
+
if (!a.refused)
|
|
1586
|
+
say(` ${r.name}: ${describe(a)}`);
|
|
1587
|
+
for (const a of refused)
|
|
1588
|
+
console.error(formatWarning({ message: plan.redactor.redact(`${a.target}: ${describe(a)}`) }));
|
|
1589
|
+
for (const u of plan.undeclared)
|
|
1590
|
+
console.error(formatWarning({ message: `${name} was published to ${u}, which release.publish no longer declares, so it was not changed there` }));
|
|
1591
|
+
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` : ""}`));
|
|
1592
|
+
return 0;
|
|
1593
|
+
}
|
|
966
1594
|
/**
|
|
967
1595
|
* `release export <label|digest> --env <env> [-o <dir>]` (#4046): write each
|
|
968
1596
|
* file the release's target for <env> records, at the path it was compiled to,
|
|
@@ -1088,14 +1716,14 @@ export async function runReleaseCompose(ctx) {
|
|
|
1088
1716
|
...(args.base !== undefined ? { base: args.base } : {}),
|
|
1089
1717
|
prs: args.prs ?? [],
|
|
1090
1718
|
works: args.works ?? [],
|
|
1091
|
-
yes: args.yes === true,
|
|
1719
|
+
yes: args.yes === true && args.dryRun !== true,
|
|
1092
1720
|
trunk,
|
|
1093
1721
|
});
|
|
1094
1722
|
if (args.json) {
|
|
1095
|
-
console.log(JSON.stringify({ dryRun: args.yes !== true, ...r, next: r.written || r.pushed ? [`chant release cut <label> --at ${r.tip}`] : [sameWithYes(process.argv.slice(2))] }, null, 2));
|
|
1723
|
+
console.log(JSON.stringify({ dryRun: args.yes !== true || args.dryRun === true, ...r, next: r.written || r.pushed ? [`chant release cut <label> --at ${r.tip}`] : [sameWithYes(process.argv.slice(2))] }, null, 2));
|
|
1096
1724
|
return 0;
|
|
1097
1725
|
}
|
|
1098
|
-
const verb = args.yes === true ? "Composed" : "Dry run: would compose";
|
|
1726
|
+
const verb = args.yes === true && args.dryRun !== true ? "Composed" : "Dry run: would compose";
|
|
1099
1727
|
console.log(`${verb} ${formatBold(r.branch)} on ${r.base.slice(0, 12)}${r.from ? `, after ${r.from.slice(0, 12)}` : ""}`);
|
|
1100
1728
|
for (const s of r.picked)
|
|
1101
1729
|
console.log(` pick ${s.commit.slice(0, 12)} ${s.subject} [${s.chosenBy.join(", ")}]`);
|
|
@@ -1104,7 +1732,7 @@ export async function runReleaseCompose(ctx) {
|
|
|
1104
1732
|
if (r.picked.length === 0)
|
|
1105
1733
|
console.log(" nothing new to pick");
|
|
1106
1734
|
console.log(` tip ${r.tip.slice(0, 12)}${r.pushed ? `, pushed to ${trunk.remote}` : ""}`);
|
|
1107
|
-
if (args.yes !== true)
|
|
1735
|
+
if (args.yes !== true || args.dryRun === true)
|
|
1108
1736
|
console.error(`Dry run: no branch was moved or pushed. Run again with --yes: ${sameWithYes(process.argv.slice(2))}`);
|
|
1109
1737
|
else
|
|
1110
1738
|
console.error(`Next: once CI tags ${r.tip.slice(0, 12)} green, cut it: chant release cut <label> --at ${r.tip} --channel <channel>`);
|