@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
|
@@ -28,9 +28,10 @@ export interface ReleaseChangelog {
|
|
|
28
28
|
/** The entries of each group, in the order given. */
|
|
29
29
|
groups: Record<ChangelogKind, CatalogChangelogEntry[]>;
|
|
30
30
|
}
|
|
31
|
-
/** The group, scope and description of one commit message. A subject that is not conventional is `other`, kept whole. */
|
|
31
|
+
/** The group, type, scope and description of one commit message. A subject that is not conventional is `other`, kept whole, with no type. */
|
|
32
32
|
export declare function classifyCommit(message: string): {
|
|
33
33
|
kind: ChangelogKind;
|
|
34
|
+
type?: string;
|
|
34
35
|
scope?: string;
|
|
35
36
|
subject: string;
|
|
36
37
|
};
|
|
@@ -38,3 +39,14 @@ export declare function classifyCommit(message: string): {
|
|
|
38
39
|
export declare function changelogBump(messages: readonly string[]): ReleaseBump;
|
|
39
40
|
/** Group `commits` and name their bump. */
|
|
40
41
|
export declare function releaseChangelog(commits: readonly ChangelogCommit[]): ReleaseChangelog;
|
|
42
|
+
/** The commit types a forge release's notes generated from commits list when none are declared (#5153). */
|
|
43
|
+
export declare const DEFAULT_NOTES_TYPES: readonly string[];
|
|
44
|
+
/**
|
|
45
|
+
* Release notes from `commits` (#5153), newest first as `git log` lists
|
|
46
|
+
* them: the commits whose conventional type is in `types`, grouped by
|
|
47
|
+
* {@link releaseChangelog} under a `###` heading each, one line per commit
|
|
48
|
+
* with its scope and short sha. A breaking change is listed whatever its
|
|
49
|
+
* type; `*` in `types` lists every commit, conventional or not. Empty when
|
|
50
|
+
* no commit is listed.
|
|
51
|
+
*/
|
|
52
|
+
export declare function changelogNotes(commits: readonly ChangelogCommit[], types?: readonly string[]): string;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
const HEADER = /^(\w+)(?:\(([^)]*)\))?(!)?:\s*(.*)$/;
|
|
2
2
|
const BREAKING_FOOTER = /^BREAKING[ -]CHANGE:/m;
|
|
3
|
-
/** The group, scope and description of one commit message. A subject that is not conventional is `other`, kept whole. */
|
|
3
|
+
/** The group, type, scope and description of one commit message. A subject that is not conventional is `other`, kept whole, with no type. */
|
|
4
4
|
export function classifyCommit(message) {
|
|
5
5
|
const subject = message.split("\n", 1)[0].trim();
|
|
6
6
|
const m = HEADER.exec(subject);
|
|
@@ -10,7 +10,7 @@ export function classifyCommit(message) {
|
|
|
10
10
|
const type = m[1];
|
|
11
11
|
const scope = m[2] ? m[2].trim() : undefined;
|
|
12
12
|
const kind = breaking ? "breaking" : type === "feat" ? "feat" : type === "fix" ? "fix" : "other";
|
|
13
|
-
return { kind, ...(scope ? { scope } : {}), subject: m[4].trim() || subject };
|
|
13
|
+
return { kind, type, ...(scope ? { scope } : {}), subject: m[4].trim() || subject };
|
|
14
14
|
}
|
|
15
15
|
/** The bump a set of commit messages implies, as terragucci's `bumpFor` decides it. */
|
|
16
16
|
export function changelogBump(messages) {
|
|
@@ -36,3 +36,36 @@ export function releaseChangelog(commits) {
|
|
|
36
36
|
}
|
|
37
37
|
return { bump: changelogBump(commits.map((c) => c.message)), entries, groups };
|
|
38
38
|
}
|
|
39
|
+
/** The commit types a forge release's notes generated from commits list when none are declared (#5153). */
|
|
40
|
+
export const DEFAULT_NOTES_TYPES = ["feat", "fix", "perf"];
|
|
41
|
+
const NOTES_GROUPS = [
|
|
42
|
+
["breaking", "Breaking changes"],
|
|
43
|
+
["feat", "Features"],
|
|
44
|
+
["fix", "Fixes"],
|
|
45
|
+
["other", "Other changes"],
|
|
46
|
+
];
|
|
47
|
+
/**
|
|
48
|
+
* Release notes from `commits` (#5153), newest first as `git log` lists
|
|
49
|
+
* them: the commits whose conventional type is in `types`, grouped by
|
|
50
|
+
* {@link releaseChangelog} under a `###` heading each, one line per commit
|
|
51
|
+
* with its scope and short sha. A breaking change is listed whatever its
|
|
52
|
+
* type; `*` in `types` lists every commit, conventional or not. Empty when
|
|
53
|
+
* no commit is listed.
|
|
54
|
+
*/
|
|
55
|
+
export function changelogNotes(commits, types = DEFAULT_NOTES_TYPES) {
|
|
56
|
+
const all = types.includes("*");
|
|
57
|
+
const listed = commits.filter((c) => {
|
|
58
|
+
const { kind, type } = classifyCommit(c.message);
|
|
59
|
+
return all || kind === "breaking" || (type !== undefined && types.includes(type));
|
|
60
|
+
});
|
|
61
|
+
const { groups } = releaseChangelog(listed);
|
|
62
|
+
const out = [];
|
|
63
|
+
for (const [kind, title] of NOTES_GROUPS) {
|
|
64
|
+
if (groups[kind].length === 0)
|
|
65
|
+
continue;
|
|
66
|
+
if (out.length > 0)
|
|
67
|
+
out.push("");
|
|
68
|
+
out.push(`### ${title}`, "", ...groups[kind].map((e) => `- ${e.scope ? `${e.scope}: ` : ""}${e.subject} (${e.sha.slice(0, 7)})`));
|
|
69
|
+
}
|
|
70
|
+
return out.join("\n");
|
|
71
|
+
}
|
|
@@ -36,7 +36,10 @@
|
|
|
36
36
|
* in `identity.gates`, a cut must be signed (`--sign`), its signature must
|
|
37
37
|
* verify for the actor against the signers at base, and when the gate names
|
|
38
38
|
* a class the actor must be in it. A cut signed without that gate is signed
|
|
39
|
-
* all the same, and readers report whether the signature verifies.
|
|
39
|
+
* all the same, and readers report whether the signature verifies. The
|
|
40
|
+
* signature covers the gate the cut line records (`green`, `override`,
|
|
41
|
+
* `lane`) as well as the release digest (#5177), so a reader can trust the
|
|
42
|
+
* gate a signed cut claims. With
|
|
40
43
|
* `ci.green.signedSince` declared, a green tag counts only with a valid
|
|
41
44
|
* statement (`../workspace/ci-green.ts`), so a hand-pushed tag cuts nothing.
|
|
42
45
|
*
|
|
@@ -55,8 +58,10 @@
|
|
|
55
58
|
* which `chant approve policy-override` answers. A revoked commit is never
|
|
56
59
|
* cut, override or not.
|
|
57
60
|
*/
|
|
58
|
-
import { type Release, type ReleaseArtifact, type ReleaseCut, type ReleaseCutOverride, type ReleaseTarget } from "./release-store.js";
|
|
61
|
+
import { type Release, type ReleaseArtifact, type ReleaseCut, type ReleaseCutGreen, type ReleaseCutIntent, type ReleaseCutOverride, type ReleasePublish, type ReleaseTarget } from "./release-store.js";
|
|
59
62
|
import type { CompiledTarget, TargetCompiler } from "../components/release-compile.js";
|
|
63
|
+
import type { ForgeChecksReader, ReleaseGreenSource } from "./release-green.js";
|
|
64
|
+
import type { NpmPublishedLookup } from "./publish-npm.js";
|
|
60
65
|
/** The first chant that cuts from a lane's green tag and writes `lane` on the cut line (#4692). */
|
|
61
66
|
export declare const RELEASE_CUT_LANE_FLOOR = "0.124.64";
|
|
62
67
|
/** The first chant that cuts a commit that is not green under an override and writes `override` on the cut line (#4693). */
|
|
@@ -66,9 +71,19 @@ export declare function greenOverrideSubject(commit: string): string;
|
|
|
66
71
|
/** The rule an override of a cut names (#4693): `ci-green`, or `ci-green-<lane>` for a lane's tag. */
|
|
67
72
|
export declare function greenOverrideRule(lane: string | null): string;
|
|
68
73
|
/** The stable codes a cut refuses with. */
|
|
69
|
-
export type ReleaseCutCode = "not-a-git-repository" | "release-commit-not-green" | "release-commit-revoked"
|
|
74
|
+
export type ReleaseCutCode = "not-a-git-repository" | "release-commit-not-green" | "release-commit-revoked"
|
|
75
|
+
/** #5149: `release.green: "none"` under a security group or release gate that needs a green commit. */
|
|
76
|
+
| "release-green-none-refused"
|
|
77
|
+
/** #5149: `release.green: "forge-checks"`, and the forge could not be asked. */
|
|
78
|
+
| "release-forge-checks-unavailable" | "release-worktree-dirty" | "release-no-environments" | "release-no-components" | "release-build-inputs-differ" | "release-image-invalid" | "release-image-unknown-component" | "release-image-name-taken" | "release-image-build-failed"
|
|
79
|
+
/** #5151: `release.artifacts`, as ./release-artifacts.ts refuses it. */
|
|
80
|
+
| "release-artifact-invalid" | "release-artifact-name-invalid" | "release-artifact-name-taken" | "release-artifact-outside" | "release-artifact-build-failed" | "release-artifact-no-output" | "release-artifact-output-taken" | "release-artifact-no-label" | "release-artifact-version-mismatch" | "release-artifact-checksums-name-taken"
|
|
81
|
+
/** #5183: an entry with no build command whose files are not there, or are read from a checkout of another commit. */
|
|
82
|
+
| "release-artifact-not-built" | "release-artifact-wrong-commit" | "release-version-no-label" | "release-version-label-invalid" | "release-version-no-package" | "release-version-invalid" | "release-version-no-file" | "release-version-no-field" | "release-version-format-unknown" | "release-unsigned" | "release-signer-refused" | "declaration-invalid"
|
|
70
83
|
/** #4941: the npm target's image check, run by the cut (./publish-npm.ts `checkPackageImages`). */
|
|
71
|
-
| "publish-npm-carries-image" | "publish-npm-pack-failed"
|
|
84
|
+
| "publish-npm-carries-image" | "publish-npm-pack-failed"
|
|
85
|
+
/** #5230: an npm target names a package the registry has never published, or the registry can't say. */
|
|
86
|
+
| "publish-npm-never-published" | "publish-npm-registry-unreadable";
|
|
72
87
|
export declare class ReleaseCutError extends Error {
|
|
73
88
|
readonly code: ReleaseCutCode;
|
|
74
89
|
readonly fix?: string | undefined;
|
|
@@ -87,6 +102,21 @@ export interface CutRequest {
|
|
|
87
102
|
actor: string;
|
|
88
103
|
/** The environments in promotion order. Read from the member's `chant.config.ts` when absent. */
|
|
89
104
|
environments?: readonly string[];
|
|
105
|
+
/**
|
|
106
|
+
* `release.green` (#5149): what says the commit may be released. Absent:
|
|
107
|
+
* `chant` when the declaration at base has `ci.green`, else `forge-checks`.
|
|
108
|
+
*/
|
|
109
|
+
green?: ReleaseGreenSource;
|
|
110
|
+
/** Reads the forge's checks on the commit under `forge-checks` (#5149). Default: the forge the job or the origin remote names. */
|
|
111
|
+
forgeChecks?: ForgeChecksReader;
|
|
112
|
+
/**
|
|
113
|
+
* The `release.publish` targets (#5149). A member with no environments is
|
|
114
|
+
* cut as an artifact release, which records these in place of compile
|
|
115
|
+
* targets; with none, and no `release.images`, it has nothing to release.
|
|
116
|
+
*/
|
|
117
|
+
publishes?: readonly ReleasePublish[];
|
|
118
|
+
/** Whether the registry has ever published a package, for the cut's first-publish check (#5230). Default: `npm view`. */
|
|
119
|
+
npmPublished?: NpmPublishedLookup;
|
|
90
120
|
now?: () => Date;
|
|
91
121
|
/** The process environment the CI run is read from. */
|
|
92
122
|
env?: NodeJS.ProcessEnv;
|
|
@@ -130,12 +160,26 @@ export interface CutRequest {
|
|
|
130
160
|
* Given the commit being cut; returns each as an image artifact.
|
|
131
161
|
*/
|
|
132
162
|
buildImages?: (commit: string) => Promise<ReleaseArtifact[]> | ReleaseArtifact[];
|
|
163
|
+
/**
|
|
164
|
+
* Build the files `release.artifacts` declares (#5151), once the images
|
|
165
|
+
* are built and before the build command. Given the commit being cut;
|
|
166
|
+
* returns each file as an asset artifact.
|
|
167
|
+
*/
|
|
168
|
+
buildArtifacts?: (commit: string) => Promise<ReleaseArtifact[]> | ReleaseArtifact[];
|
|
133
169
|
/**
|
|
134
170
|
* Stamp the label into the files `release.version` names (#4840), once the
|
|
135
171
|
* tree is found clean and before the images are built or any environment
|
|
136
172
|
* compiled. The caller puts the files back after the cut.
|
|
137
173
|
*/
|
|
138
174
|
stamp?: () => void | Promise<void>;
|
|
175
|
+
/**
|
|
176
|
+
* Run the build command of an artifact release (#5149), once the images
|
|
177
|
+
* are built: what a compile runs first for a release cut from
|
|
178
|
+
* environments, so a commit that does not build is not cut.
|
|
179
|
+
*/
|
|
180
|
+
build?: () => void | Promise<void>;
|
|
181
|
+
/** The intent files the cut consumes (#5159), recorded on its cut line. */
|
|
182
|
+
intents?: readonly ReleaseCutIntent[];
|
|
139
183
|
}
|
|
140
184
|
export interface CutResult {
|
|
141
185
|
release: Release;
|
|
@@ -185,6 +229,18 @@ export declare function differingBuildSteps(targets: readonly CompiledTarget[]):
|
|
|
185
229
|
component: string;
|
|
186
230
|
envs: string[];
|
|
187
231
|
}>;
|
|
232
|
+
/**
|
|
233
|
+
* Every cut release of this member from `commit` or an ancestor of it, the
|
|
234
|
+
* nearest commit first and the newest cut of one commit first, each with
|
|
235
|
+
* the label its cuts give it (#5159). Read from the member's ledger only:
|
|
236
|
+
* no tag is read.
|
|
237
|
+
*/
|
|
238
|
+
export declare function ancestorReleases(top: string, commit: string, cwd: string): Promise<Array<{
|
|
239
|
+
release: Release;
|
|
240
|
+
label: string | null;
|
|
241
|
+
}>>;
|
|
242
|
+
/** The earlier release of this member cut from the nearest ancestor of `commit`. */
|
|
243
|
+
export declare function previousRelease(top: string, commit: string, cwd: string): Promise<Release | undefined>;
|
|
188
244
|
/** What a dry run of the cut found (#4027): what the cut would do, with nothing built, signed or written. */
|
|
189
245
|
export interface CutPlan {
|
|
190
246
|
commit: string;
|
|
@@ -226,6 +282,10 @@ export interface CutPlan {
|
|
|
226
282
|
lane: string | null;
|
|
227
283
|
/** The override the cut would run under and spend (#4693), when the commit is not green; null when it is. */
|
|
228
284
|
override: ReleaseCutOverride | null;
|
|
285
|
+
/** The green gate the commit passed (#5149), or null under an override. */
|
|
286
|
+
green: ReleaseCutGreen | null;
|
|
287
|
+
/** An artifact release's targets (#5149), or null for a release cut from environments. */
|
|
288
|
+
publishes: ReleasePublish[] | null;
|
|
229
289
|
}
|
|
230
290
|
/**
|
|
231
291
|
* The dry run of {@link cutRelease} (#4027): the same checks and compile,
|
|
@@ -36,7 +36,10 @@
|
|
|
36
36
|
* in `identity.gates`, a cut must be signed (`--sign`), its signature must
|
|
37
37
|
* verify for the actor against the signers at base, and when the gate names
|
|
38
38
|
* a class the actor must be in it. A cut signed without that gate is signed
|
|
39
|
-
* all the same, and readers report whether the signature verifies.
|
|
39
|
+
* all the same, and readers report whether the signature verifies. The
|
|
40
|
+
* signature covers the gate the cut line records (`green`, `override`,
|
|
41
|
+
* `lane`) as well as the release digest (#5177), so a reader can trust the
|
|
42
|
+
* gate a signed cut claims. With
|
|
40
43
|
* `ci.green.signedSince` declared, a green tag counts only with a valid
|
|
41
44
|
* statement (`../workspace/ci-green.ts`), so a hand-pushed tag cuts nothing.
|
|
42
45
|
*
|
|
@@ -115,6 +118,14 @@ function tryGit(top, args) {
|
|
|
115
118
|
return null;
|
|
116
119
|
}
|
|
117
120
|
}
|
|
121
|
+
/** The branch `origin/HEAD` names, else the checkout's, for the forge's required checks; null when neither is known. */
|
|
122
|
+
function trunkBranch(top) {
|
|
123
|
+
const head = tryGit(top, ["symbolic-ref", "--quiet", "--short", "refs/remotes/origin/HEAD"]);
|
|
124
|
+
if (head)
|
|
125
|
+
return head.replace(/^origin\//, "");
|
|
126
|
+
const branch = tryGit(top, ["symbolic-ref", "--quiet", "--short", "HEAD"]);
|
|
127
|
+
return branch || null;
|
|
128
|
+
}
|
|
118
129
|
/**
|
|
119
130
|
* Whether `sha` has a green tag and no revoked tag, read from local tags,
|
|
120
131
|
* and the tags on it that were ignored for want of a valid statement
|
|
@@ -156,21 +167,31 @@ export function differingBuildSteps(targets) {
|
|
|
156
167
|
}
|
|
157
168
|
return out.sort((a, b) => (a.component < b.component ? -1 : 1));
|
|
158
169
|
}
|
|
159
|
-
/**
|
|
160
|
-
|
|
170
|
+
/**
|
|
171
|
+
* Every cut release of this member from `commit` or an ancestor of it, the
|
|
172
|
+
* nearest commit first and the newest cut of one commit first, each with
|
|
173
|
+
* the label its cuts give it (#5159). Read from the member's ledger only:
|
|
174
|
+
* no tag is read.
|
|
175
|
+
*/
|
|
176
|
+
export async function ancestorReleases(top, commit, cwd) {
|
|
161
177
|
const { releases } = await readAllReleases({ cwd });
|
|
162
178
|
const { cuts } = await readCuts({ cwd });
|
|
163
179
|
const cutAt = new Map();
|
|
164
180
|
for (const c of cuts)
|
|
165
181
|
if (!cutAt.has(c.releaseDigest) || c.timestamp > cutAt.get(c.releaseDigest))
|
|
166
182
|
cutAt.set(c.releaseDigest, c.timestamp);
|
|
167
|
-
const
|
|
168
|
-
|
|
169
|
-
.filter((r) =>
|
|
183
|
+
const labels = labelsByDigest(cuts);
|
|
184
|
+
return (releases
|
|
185
|
+
.filter((r) => cutAt.has(r.releaseDigest))
|
|
186
|
+
.filter((r) => r.commit === commit || tryGit(top, ["merge-base", "--is-ancestor", r.commit, commit]) !== null)
|
|
170
187
|
.map((r) => ({ r, depth: Number(tryGit(top, ["rev-list", "--count", r.commit]) ?? 0), at: cutAt.get(r.releaseDigest) }))
|
|
171
188
|
// The nearest ancestor first, then the newest cut of it.
|
|
172
|
-
.sort((a, b) => b.depth - a.depth || (b.at < a.at ? -1 : b.at > a.at ? 1 : 0))
|
|
173
|
-
|
|
189
|
+
.sort((a, b) => b.depth - a.depth || (b.at < a.at ? -1 : b.at > a.at ? 1 : 0))
|
|
190
|
+
.map(({ r }) => ({ release: r, label: labels.get(r.releaseDigest) ?? null })));
|
|
191
|
+
}
|
|
192
|
+
/** The earlier release of this member cut from the nearest ancestor of `commit`. */
|
|
193
|
+
export async function previousRelease(top, commit, cwd) {
|
|
194
|
+
return (await ancestorReleases(top, commit, cwd)).find((a) => a.release.commit !== commit)?.release;
|
|
174
195
|
}
|
|
175
196
|
/**
|
|
176
197
|
* Decide the override of a cut of `commit`, which has no green tag that
|
|
@@ -272,33 +293,83 @@ async function prepare(req, record = false) {
|
|
|
272
293
|
const { releaseRuleFrom } = await import("../workspace/identity.js");
|
|
273
294
|
const source = scopeSource(cwd);
|
|
274
295
|
const green = source.declaration?.ci?.green ?? null;
|
|
275
|
-
const
|
|
276
|
-
const
|
|
296
|
+
const { resolveGreenSource } = await import("./release-green.js");
|
|
297
|
+
const gate = resolveGreenSource(req.green, green !== null, req.green === undefined && green === null && (tryGit(top, ["tag", "--list", "ci/green/*", "ci/green-*/*"]) ?? "") !== "");
|
|
277
298
|
// Who may cut is the declaration's identity.gates.release, read at base.
|
|
278
299
|
const releaseRule = releaseRuleFrom(source);
|
|
300
|
+
if (gate !== "chant" && req.lane !== undefined) {
|
|
301
|
+
throw new ReleaseCutError("declaration-invalid", `the cut asks for lane ${JSON.stringify(req.lane)}, and a lane is a ci.green lane, which release.green ${JSON.stringify(gate)} does not read`, 'Drop --lane and release.lane, or set release.green to "chant".');
|
|
302
|
+
}
|
|
303
|
+
const lane = req.lane !== undefined ? await declaredLane(green, req.lane) : null;
|
|
279
304
|
let override = null;
|
|
280
|
-
|
|
281
|
-
|
|
305
|
+
let passed = null;
|
|
306
|
+
/** Why the commit is not green, and the tag (or check) an override stands in for; null when it is. */
|
|
307
|
+
let notGreen = null;
|
|
308
|
+
if (gate === "none") {
|
|
309
|
+
// #5149: a workspace that asks for verified or supply-chain releases, or gates who cuts, needs a green commit.
|
|
310
|
+
const { securityGroupsIn } = await import("../workspace/security.js");
|
|
311
|
+
const groups = securityGroupsIn(source, cwd);
|
|
312
|
+
const why = [
|
|
313
|
+
...["supply-chain", "verified-releases"].filter((g) => groups.has(g)).map((g) => `the ${g} security group`),
|
|
314
|
+
...(releaseRule.requirement ? ["the release gate in identity.gates"] : []),
|
|
315
|
+
];
|
|
316
|
+
if (why.length > 0) {
|
|
317
|
+
throw new ReleaseCutError("release-green-none-refused", `release.green is "none", and chant.workspace.json at base turns on ${why.join(" and ")}, which releases only a commit a green gate passed`, 'Set release.green in chant.config.ts to "forge-checks" (the forge\'s checks on the commit) or "chant" (ci/green tags).');
|
|
318
|
+
}
|
|
319
|
+
passed = { source: "none" };
|
|
320
|
+
}
|
|
321
|
+
else if (gate === "forge-checks") {
|
|
322
|
+
const { forgeChecksReader, forgeChecksTarget, ForgeChecksUnavailableError } = await import("./release-green.js");
|
|
323
|
+
let verdict;
|
|
324
|
+
try {
|
|
325
|
+
const read = req.forgeChecks ?? forgeChecksReader(await forgeChecksTarget(cwd, req.env ?? process.env), req.env ?? process.env);
|
|
326
|
+
verdict = await read(commit, green?.branch ?? trunkBranch(top));
|
|
327
|
+
}
|
|
328
|
+
catch (err) {
|
|
329
|
+
if (err instanceof ForgeChecksUnavailableError)
|
|
330
|
+
throw new ReleaseCutError("release-forge-checks-unavailable", `no release was cut: ${err.message}`, err.fix);
|
|
331
|
+
throw err;
|
|
332
|
+
}
|
|
333
|
+
if (verdict.green)
|
|
334
|
+
passed = { source: "forge-checks", forge: verdict.forge, checks: verdict.checks };
|
|
335
|
+
else {
|
|
336
|
+
notGreen = {
|
|
337
|
+
message: `commit ${commit.slice(0, 12)} is not green: ${verdict.why}, so no release is cut from it`,
|
|
338
|
+
fix: "Cut once its checks have passed, or check out a commit whose checks passed.",
|
|
339
|
+
tag: `forge-checks/${commit}`,
|
|
340
|
+
};
|
|
341
|
+
}
|
|
342
|
+
}
|
|
343
|
+
else {
|
|
344
|
+
const { state, ignored } = await greenState(top, commit, green, lane ?? undefined);
|
|
282
345
|
// #4692: a lane's tags are ci/green-<lane>/ and ci/revoked-<lane>/.
|
|
283
346
|
const greenTag = lane !== null ? `ci/green-${lane}` : "ci/green";
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
: ignored.
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
347
|
+
if (state === "green")
|
|
348
|
+
passed = { source: "chant", tag: `${greenTag}/${commit}` };
|
|
349
|
+
else {
|
|
350
|
+
const why = ignored.length > 0 ? `; ignored: ${ignored.map((t) => `${t.tag} (${t.status}): ${t.reason}`).join("; ")}` : "";
|
|
351
|
+
const revokedTag = lane !== null ? `ci/revoked-${lane}` : "ci/revoked";
|
|
352
|
+
const message = state === "revoked"
|
|
353
|
+
? `commit ${commit.slice(0, 12)} has a ${revokedTag} tag: it went red after it was green, so no release is cut from it`
|
|
354
|
+
: ignored.some((t) => t.tag.startsWith(`${greenTag}/`))
|
|
355
|
+
? `commit ${commit.slice(0, 12)} has no ${greenTag} tag that counts, so no release is cut from it${why}`
|
|
356
|
+
: `commit ${commit.slice(0, 12)} has no ${greenTag} tag, so no release is cut from it`;
|
|
357
|
+
const fix = `Check out a green commit (\`chant ci last-green${lane !== null ? ` --lane ${lane}` : ""}\` names the newest) after fetching the tags: git fetch origin --tags`;
|
|
358
|
+
if (state === "revoked") {
|
|
359
|
+
throw new ReleaseCutError("release-commit-revoked", req.overrideGreen ? `${message}, and an override does not cut a revoked commit` : message, fix);
|
|
360
|
+
}
|
|
361
|
+
notGreen = { message, fix, tag: `${greenTag}/${commit}` };
|
|
293
362
|
}
|
|
363
|
+
}
|
|
364
|
+
if (notGreen) {
|
|
294
365
|
if (!req.overrideGreen)
|
|
295
|
-
throw new ReleaseCutError("release-commit-not-green", message, fix);
|
|
366
|
+
throw new ReleaseCutError("release-commit-not-green", notGreen.message, notGreen.fix);
|
|
296
367
|
// #4693: a person's override of this commit lets it through.
|
|
297
368
|
const now = (req.now ?? (() => new Date()))().toISOString();
|
|
298
369
|
const decided = await greenOverride({ top, cwd, commit, lane, sealed: releaseRule.requirement !== null, record, now });
|
|
299
370
|
if (decided.override === null)
|
|
300
|
-
throw new ReleaseCutError("release-commit-not-green", `${message}; ${decided.why}`, decided.fix, decided.recorded);
|
|
301
|
-
override = { green: false, tag:
|
|
371
|
+
throw new ReleaseCutError("release-commit-not-green", `${notGreen.message}; ${decided.why}`, decided.fix, decided.recorded);
|
|
372
|
+
override = { green: false, tag: notGreen.tag, ...decided.override };
|
|
302
373
|
}
|
|
303
374
|
if (releaseRule.requirement && req.sign === undefined) {
|
|
304
375
|
throw new ReleaseCutError("release-unsigned", `chant.workspace.json at base names a release gate in identity.gates${releaseRule.requirement.class !== null ? `, from the class ${releaseRule.requirement.class}` : ""}, and this cut is not signed`, `chant release cut <label> --actor <principal> --sign [<key file>], with a key ${releaseRule.rule.signers.signersPath} at base lists for that principal.`);
|
|
@@ -313,17 +384,38 @@ async function prepare(req, record = false) {
|
|
|
313
384
|
const { readMemberPromotionOrder } = await import("../workspace/promotion-order.js");
|
|
314
385
|
envs = ((await readMemberPromotionOrder(cwd)) ?? []).map((s) => s.name);
|
|
315
386
|
}
|
|
316
|
-
|
|
317
|
-
|
|
387
|
+
// #5149: with no environments the release is what release.publish publishes and release.images builds, and nothing is compiled.
|
|
388
|
+
const artifactRelease = envs.length === 0;
|
|
389
|
+
if (artifactRelease && (req.publishes ?? []).length === 0 && !req.buildImages && !req.buildArtifacts) {
|
|
390
|
+
throw new ReleaseCutError("release-no-environments", "this member's chant.config.ts declares no environments and no release.publish target, so there is nothing to release", "Declare where the release publishes (release.publish: [{ type: \"npm\", packages: [\".\"] }]), or the environments it is compiled for in promotion order (environments: [\"dev\", \"staging\", \"prod\"]).");
|
|
391
|
+
}
|
|
392
|
+
// #5230: a package npm has never had can't be published by trusted publishing, so the cut stops before the label is spent.
|
|
393
|
+
// The config is loaded fresh through the normal loader every time, so a target that comes from an imported preset is seen too.
|
|
394
|
+
{
|
|
395
|
+
const { loadChantConfig } = await import("../config.js");
|
|
396
|
+
const { checkPackagesPublished, npmPublishedLookup } = await import("./publish-npm.js");
|
|
397
|
+
const { PublishTargetError } = await import("./release-publish.js");
|
|
398
|
+
try {
|
|
399
|
+
checkPackagesPublished((await loadChantConfig(cwd, { fresh: true })).config.release?.publish ?? [], cwd, req.npmPublished ?? npmPublishedLookup());
|
|
400
|
+
}
|
|
401
|
+
catch (err) {
|
|
402
|
+
if (err instanceof PublishTargetError)
|
|
403
|
+
throw new ReleaseCutError(err.code, `no release was cut: ${err.message}`, err.fix);
|
|
404
|
+
throw err;
|
|
405
|
+
}
|
|
318
406
|
}
|
|
319
407
|
// #4657: the images first, so the build command that packs a package can pin their digests.
|
|
320
408
|
const builtImages = req.buildImages ? await req.buildImages(commit) : [];
|
|
409
|
+
// #5151: the files, after the images and before the build command.
|
|
410
|
+
const builtFiles = req.buildArtifacts ? await req.buildArtifacts(commit) : [];
|
|
411
|
+
if (artifactRelease)
|
|
412
|
+
await req.build?.();
|
|
321
413
|
const compiled = [];
|
|
322
414
|
for (const env of envs)
|
|
323
415
|
compiled.push(await req.compiler.compile(env));
|
|
324
416
|
// A project with no components compiles to its build output (#4046), so only a target with neither is empty.
|
|
325
|
-
if (compiled.every((t) => t.components.length === 0 && t.templates.length === 0)) {
|
|
326
|
-
throw new ReleaseCutError("release-no-components", "no component is enabled in any environment and nothing was compiled, so there is nothing to release", "Enable a component under one environment's parameters, or remove the component files so the project's build output is released.");
|
|
417
|
+
if (!artifactRelease && compiled.every((t) => t.components.length === 0 && t.templates.length === 0)) {
|
|
418
|
+
throw new ReleaseCutError("release-no-components", "no component is enabled in any environment and nothing was compiled, so there is nothing to release", "Enable a component under one environment's parameters, or remove the component files so the project's build output is released. A project that only publishes packages or files drops environments from chant.config.ts, and its release records what release.publish publishes.");
|
|
327
419
|
}
|
|
328
420
|
const differing = differingBuildSteps(compiled);
|
|
329
421
|
if (differing.length > 0) {
|
|
@@ -348,6 +440,11 @@ async function prepare(req, record = false) {
|
|
|
348
440
|
throw new ReleaseCutError("release-image-name-taken", `release.images names "${image.component}", which is also a component of this member, and a release records one image per name`, "Rename the image in release.images.");
|
|
349
441
|
}
|
|
350
442
|
}
|
|
443
|
+
for (const name of new Set(builtFiles.map((f) => f.component))) {
|
|
444
|
+
if (enabled.has(name) || handedTo.has(name)) {
|
|
445
|
+
throw new ReleaseCutError("release-artifact-name-taken", `release.artifacts names "${name}", which is also a component of this member, and a release records each name once`, "Rename the entry in release.artifacts.");
|
|
446
|
+
}
|
|
447
|
+
}
|
|
351
448
|
// Which environment each component's artifacts are built in: the first one it is enabled in.
|
|
352
449
|
const firstEnv = new Map();
|
|
353
450
|
for (const t of compiled) {
|
|
@@ -359,7 +456,7 @@ async function prepare(req, record = false) {
|
|
|
359
456
|
const realCwd = realpathSync(cwd);
|
|
360
457
|
const previous = firstEnv.size > 0 ? await previousRelease(top, commit, cwd) : undefined;
|
|
361
458
|
const reused = [];
|
|
362
|
-
const artifacts = [...handedArtifacts, ...builtImages];
|
|
459
|
+
const artifacts = [...handedArtifacts, ...builtImages, ...builtFiles];
|
|
363
460
|
const toBuild = new Map();
|
|
364
461
|
for (const [component, target] of firstEnv) {
|
|
365
462
|
const prior = previous?.artifactDigests.filter((a) => a.component === component) ?? [];
|
|
@@ -392,6 +489,8 @@ async function prepare(req, record = false) {
|
|
|
392
489
|
member: ledger.members.length > 0 ? ledger.members.join("/") : null,
|
|
393
490
|
lane,
|
|
394
491
|
override,
|
|
492
|
+
green: passed,
|
|
493
|
+
publishes: artifactRelease ? [...(req.publishes ?? [])] : undefined,
|
|
395
494
|
};
|
|
396
495
|
}
|
|
397
496
|
/**
|
|
@@ -434,7 +533,7 @@ export async function planRelease(req) {
|
|
|
434
533
|
for (const env of p.envs)
|
|
435
534
|
for (const component of p.toBuild.get(env) ?? [])
|
|
436
535
|
build.push({ component, env });
|
|
437
|
-
const releaseDigest = build.length === 0 ? makeRelease({ member: p.member, commit: p.commit, artifactDigests: p.carried, targets }).releaseDigest : null;
|
|
536
|
+
const releaseDigest = build.length === 0 ? makeRelease({ member: p.member, commit: p.commit, artifactDigests: p.carried, targets, ...(p.publishes ? { publishes: p.publishes } : {}) }).releaseDigest : null;
|
|
438
537
|
const { cuts } = await readCuts({ cwd: p.cwd });
|
|
439
538
|
const labels = labelsByDigest(cuts);
|
|
440
539
|
let alreadyCut = null;
|
|
@@ -487,6 +586,8 @@ export async function planRelease(req) {
|
|
|
487
586
|
signatureRequired: p.releaseRule.requirement !== null,
|
|
488
587
|
lane: p.lane,
|
|
489
588
|
override: p.override,
|
|
589
|
+
green: p.green,
|
|
590
|
+
publishes: p.publishes ?? null,
|
|
490
591
|
};
|
|
491
592
|
}
|
|
492
593
|
/**
|
|
@@ -513,7 +614,7 @@ export async function cutRelease(req) {
|
|
|
513
614
|
artifacts.push(...(await req.compiler.buildArtifacts(env, names)));
|
|
514
615
|
}
|
|
515
616
|
const { targets, templates } = targetsOf(compiled);
|
|
516
|
-
const release = makeRelease({ member: p.member, commit, artifactDigests: artifacts, targets });
|
|
617
|
+
const release = makeRelease({ member: p.member, commit, artifactDigests: artifacts, targets, ...(p.publishes ? { publishes: p.publishes } : {}) });
|
|
517
618
|
// #4941: an npm package that would carry an image archive stops the cut here, before anything is recorded or
|
|
518
619
|
// tagged, rather than the publish job once the label is spent. The check is the npm target's own plan check.
|
|
519
620
|
if (release.artifactDigests.some((a) => a.kind === "image" && a.path !== "")) {
|
|
@@ -530,7 +631,16 @@ export async function cutRelease(req) {
|
|
|
530
631
|
}
|
|
531
632
|
}
|
|
532
633
|
const timestamp = (req.now ?? (() => new Date()))().toISOString();
|
|
533
|
-
|
|
634
|
+
// #5177: the signature covers the gate the cut line records, beside the digest, which stays the release file's.
|
|
635
|
+
const signed = {
|
|
636
|
+
releaseDigest: release.releaseDigest,
|
|
637
|
+
label: req.label,
|
|
638
|
+
actor: req.actor,
|
|
639
|
+
timestamp,
|
|
640
|
+
...(p.lane !== null ? { lane: p.lane } : {}),
|
|
641
|
+
...(p.override ? { override: p.override } : {}),
|
|
642
|
+
...(p.green ? { green: p.green } : {}),
|
|
643
|
+
};
|
|
534
644
|
let signature = null;
|
|
535
645
|
if (req.sign !== undefined) {
|
|
536
646
|
const { resolveSigningKey, sealReleaseCut, SealError } = await import("../workspace/trust/seal.js");
|
|
@@ -550,8 +660,8 @@ export async function cutRelease(req) {
|
|
|
550
660
|
}
|
|
551
661
|
}
|
|
552
662
|
if (releaseRule.requirement) {
|
|
553
|
-
const { admitReleaseCut } = await import("../workspace/identity-gate-rule.js");
|
|
554
|
-
const why = admitReleaseCut(releaseRule.rule, { ...signed, signature });
|
|
663
|
+
const { admitReleaseCut, RELEASE_CUT_SEAL_VERSION } = await import("../workspace/identity-gate-rule.js");
|
|
664
|
+
const why = admitReleaseCut(releaseRule.rule, { ...signed, signature, ...(signature !== null ? { sealVersion: RELEASE_CUT_SEAL_VERSION } : {}) });
|
|
555
665
|
if (why !== null) {
|
|
556
666
|
throw new ReleaseCutError("release-signer-refused", `no release was cut: ${why}`, `identity.gates.release in chant.workspace.json at base counts only a cut signed by a key ${releaseRule.rule.signers.signersPath} lists for the actor` +
|
|
557
667
|
(releaseRule.requirement.class !== null ? `, who holds the role of the class ${releaseRule.requirement.class}` : "") +
|
|
@@ -575,10 +685,13 @@ export async function cutRelease(req) {
|
|
|
575
685
|
runId,
|
|
576
686
|
runOrigin: ci?.runOrigin ?? { forge: "local" },
|
|
577
687
|
signature,
|
|
688
|
+
...(signature !== null ? { sealVersion: 2 } : {}),
|
|
578
689
|
...(req.composed ? { composed: req.composed } : {}),
|
|
579
690
|
...(req.channel ? { channel: req.channel } : {}),
|
|
580
691
|
...(p.lane !== null ? { lane: p.lane } : {}),
|
|
581
692
|
...(p.override ? { override: p.override } : {}),
|
|
693
|
+
...(p.green ? { green: p.green } : {}),
|
|
694
|
+
...(req.intents && req.intents.length > 0 ? { intents: [...req.intents] } : {}),
|
|
582
695
|
}, { cwd });
|
|
583
696
|
return {
|
|
584
697
|
release,
|
|
@@ -0,0 +1,113 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* `chant release doctor` (#5161): before anything is cut, ask each target
|
|
3
|
+
* `release.publish` declares whether a publish from this environment can
|
|
4
|
+
* succeed, without changing anything on any registry.
|
|
5
|
+
*
|
|
6
|
+
* Each check ends in one of four states:
|
|
7
|
+
*
|
|
8
|
+
* - `ok`: the registry or forge said yes.
|
|
9
|
+
* - `fail`: it said no, or a credential the publish needs is not here. In CI
|
|
10
|
+
* a missing credential fails; on a workstation it is a warning, since the
|
|
11
|
+
* release job's environment is not this one.
|
|
12
|
+
* - `warn`: something the publish can live with, or evidence that points the
|
|
13
|
+
* wrong way without proving it, such as the workflow the last version was
|
|
14
|
+
* published from.
|
|
15
|
+
* - `unknown`: what can't be observed from here. npm matches a trusted
|
|
16
|
+
* publisher against the workflow that asks, so only a run of the release
|
|
17
|
+
* workflow can test the record; whether a record allows `npm dist-tag`, and
|
|
18
|
+
* what a job token may do, are not shown to anyone. The doctor says so
|
|
19
|
+
* rather than guessing.
|
|
20
|
+
*
|
|
21
|
+
* The probes are reads, apart from two exchanges that hand back a short-lived
|
|
22
|
+
* publishing token, which is masked and dropped: npm's OIDC exchange and Open
|
|
23
|
+
* VSX's trusted-publishing exchange, the same requests a publish makes first.
|
|
24
|
+
*
|
|
25
|
+
* Under `release.green: "forge-checks"` (#5149) the cut asks the forge for the
|
|
26
|
+
* commit's checks, so the doctor reads the checks of the checked-out commit
|
|
27
|
+
* with the token the cut would use (`green-forge-checks`). Whether that
|
|
28
|
+
* commit is green is the cut's question; the doctor only asks whether the
|
|
29
|
+
* forge answers.
|
|
30
|
+
*
|
|
31
|
+
* When the publish signs with Sigstore (#5164, ./publish-signing.ts), the
|
|
32
|
+
* doctor checks what signing needs from the job it runs in: the OIDC token
|
|
33
|
+
* cosign signs with (`signing-oidc`) and cosign 3 (`signing-cosign`).
|
|
34
|
+
*/
|
|
35
|
+
import type { PublishDeclaration } from "./publish-declaration.js";
|
|
36
|
+
import type { PublishFetch } from "./release-publish.js";
|
|
37
|
+
/** The first chant with `chant release doctor`, which checks each `release.publish` target before a cut, and whose `chant release workflow` runs it in a dispatched release's cut job (`release.workflow.doctor`) (#5161). */
|
|
38
|
+
export declare const RELEASE_DOCTOR_FLOOR = "0.124.101";
|
|
39
|
+
export type DoctorStatus = "ok" | "warn" | "fail" | "unknown";
|
|
40
|
+
export interface DoctorCheck {
|
|
41
|
+
/** What was checked, such as `npm-trusted-publisher`. */
|
|
42
|
+
check: string;
|
|
43
|
+
status: DoctorStatus;
|
|
44
|
+
/** What the check found, or why it can't tell. */
|
|
45
|
+
message: string;
|
|
46
|
+
fix?: string;
|
|
47
|
+
}
|
|
48
|
+
export interface DoctorTarget {
|
|
49
|
+
kind: string;
|
|
50
|
+
/** For messages, such as `npm @acme/core` or `oci ghcr.io/acme/api`. */
|
|
51
|
+
name: string;
|
|
52
|
+
checks: DoctorCheck[];
|
|
53
|
+
}
|
|
54
|
+
/** Where the doctor runs, which decides what it can observe. */
|
|
55
|
+
export interface DoctorEnvironment {
|
|
56
|
+
/** `github`, `gitlab`, another CI, or null on a workstation. */
|
|
57
|
+
ci: "github" | "gitlab" | "other" | null;
|
|
58
|
+
/** Whether the run can get an OIDC ID token. */
|
|
59
|
+
oidc: boolean;
|
|
60
|
+
/** The workflow file this run is, from the repository root, when the CI says (GitHub: `GITHUB_WORKFLOW_REF`). */
|
|
61
|
+
workflow: string | null;
|
|
62
|
+
/** `owner/name` of the repository, from the CI or the `origin` remote. */
|
|
63
|
+
repository: string | null;
|
|
64
|
+
/** The release workflow file, from the repository root: `release.workflow.file` or the forge's default. */
|
|
65
|
+
releaseWorkflow: string | null;
|
|
66
|
+
}
|
|
67
|
+
export interface DoctorReport {
|
|
68
|
+
environment: DoctorEnvironment;
|
|
69
|
+
targets: DoctorTarget[];
|
|
70
|
+
counts: Record<DoctorStatus, number>;
|
|
71
|
+
}
|
|
72
|
+
/** A command run for a check: npm or vsce. */
|
|
73
|
+
export type DoctorRun = (bin: string, args: string[], opts: {
|
|
74
|
+
cwd: string;
|
|
75
|
+
env: NodeJS.ProcessEnv;
|
|
76
|
+
}) => Promise<{
|
|
77
|
+
code: number;
|
|
78
|
+
stdout: string;
|
|
79
|
+
stderr: string;
|
|
80
|
+
}>;
|
|
81
|
+
export interface DoctorDeps {
|
|
82
|
+
fetch?: PublishFetch;
|
|
83
|
+
run?: DoctorRun;
|
|
84
|
+
/** The npm executable. Default `npm`. */
|
|
85
|
+
npm?: string;
|
|
86
|
+
/** The vsce executable. Default `vsce`. */
|
|
87
|
+
vsce?: string;
|
|
88
|
+
/** What would sign with Sigstore (#5164). Default: cosign, as the publish runs it. */
|
|
89
|
+
signer?: Pick<import("./publish-signing.js").Signer, "name" | "unavailable">;
|
|
90
|
+
/** The cargo executable. Default `cargo`. */
|
|
91
|
+
cargo?: string;
|
|
92
|
+
}
|
|
93
|
+
export declare const DEFAULT_NPM_REGISTRY = "https://registry.npmjs.org";
|
|
94
|
+
/** The CI this process runs in, and whether it can get an OIDC token, from its environment. */
|
|
95
|
+
export declare function doctorEnvironment(env: NodeJS.ProcessEnv, req: {
|
|
96
|
+
cwd: string;
|
|
97
|
+
releaseWorkflow: string | null;
|
|
98
|
+
}): DoctorEnvironment;
|
|
99
|
+
/** Check every declared target. Nothing is published, tagged or changed. */
|
|
100
|
+
export declare function releaseDoctor(req: {
|
|
101
|
+
cwd: string;
|
|
102
|
+
publish: readonly PublishDeclaration[];
|
|
103
|
+
env?: NodeJS.ProcessEnv;
|
|
104
|
+
releaseWorkflow: string | null;
|
|
105
|
+
/** The cut's green gate (#5149); `forge-checks` adds the check that the forge answers for the commit's checks. */
|
|
106
|
+
green?: import("./release-green.js").ReleaseGreenSource;
|
|
107
|
+
/** The commit whose checks are read under `forge-checks`. Default: HEAD of `cwd`. */
|
|
108
|
+
commit?: string;
|
|
109
|
+
/** `release.signing` (#5164), and the workspace's security groups, which decide whether the publish signs. */
|
|
110
|
+
signing?: import("./publish-signing.js").SigningConfig;
|
|
111
|
+
groups?: ReadonlySet<import("../workspace/security.js").SecurityGroup>;
|
|
112
|
+
deps?: DoctorDeps;
|
|
113
|
+
}): Promise<DoctorReport>;
|