@intentius/chant 0.124.63 → 0.124.65
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/cli/handlers/approve.d.ts +8 -0
- package/dist/cli/handlers/approve.d.ts.map +1 -1
- package/dist/cli/handlers/approve.js +27 -4
- package/dist/cli/handlers/pr.d.ts.map +1 -1
- package/dist/cli/handlers/pr.js +2 -1
- package/dist/cli/handlers/release.d.ts +6 -4
- package/dist/cli/handlers/release.d.ts.map +1 -1
- package/dist/cli/handlers/release.js +101 -16
- package/dist/cli/handlers/run.d.ts +30 -1
- package/dist/cli/handlers/run.d.ts.map +1 -1
- package/dist/cli/handlers/run.js +108 -7
- package/dist/cli/main.d.ts.map +1 -1
- package/dist/cli/main.js +34 -7
- package/dist/cli/parse-args.d.ts.map +1 -1
- package/dist/cli/parse-args.js +19 -0
- package/dist/cli/registry.d.ts +10 -2
- package/dist/cli/registry.d.ts.map +1 -1
- package/dist/components/cli-support.d.ts +19 -1
- package/dist/components/cli-support.d.ts.map +1 -1
- package/dist/components/cli-support.js +11 -3
- package/dist/components/component.d.ts +19 -0
- package/dist/components/component.d.ts.map +1 -1
- package/dist/components/component.schema.json +17 -0
- package/dist/components/index.d.ts +1 -1
- package/dist/components/index.d.ts.map +1 -1
- package/dist/components/release-run.d.ts +48 -0
- package/dist/components/release-run.d.ts.map +1 -0
- package/dist/components/release-run.js +166 -0
- package/dist/components/starter-plugin.d.ts +1 -0
- package/dist/components/starter-plugin.d.ts.map +1 -1
- package/dist/components/starter-plugin.js +5 -1
- package/dist/components/unchanged-inputs.d.ts +81 -0
- package/dist/components/unchanged-inputs.d.ts.map +1 -0
- package/dist/components/unchanged-inputs.js +122 -0
- package/dist/components/verbs/index.d.ts +1 -0
- package/dist/components/verbs/index.d.ts.map +1 -1
- package/dist/components/verbs/index.js +1 -0
- package/dist/components/verbs/release-image.d.ts +36 -0
- package/dist/components/verbs/release-image.d.ts.map +1 -0
- package/dist/components/verbs/release-image.js +33 -0
- package/dist/config.d.ts +18 -0
- package/dist/config.d.ts.map +1 -1
- package/dist/config.js +1 -0
- package/dist/gate-statement.schema.json +4 -2
- package/dist/lifecycle/delivery-metrics.d.ts.map +1 -1
- package/dist/lifecycle/delivery-metrics.js +4 -2
- package/dist/lifecycle/gate-ledger.d.ts +11 -2
- package/dist/lifecycle/gate-ledger.d.ts.map +1 -1
- package/dist/lifecycle/gate-ledger.js +6 -0
- package/dist/lifecycle/gate-seal.d.ts +20 -4
- package/dist/lifecycle/gate-seal.d.ts.map +1 -1
- package/dist/lifecycle/gate-seal.js +18 -5
- package/dist/lifecycle/gate-statement.d.ts +27 -2
- package/dist/lifecycle/gate-statement.d.ts.map +1 -1
- package/dist/lifecycle/gate-statement.js +37 -2
- package/dist/lifecycle/git.d.ts.map +1 -1
- package/dist/lifecycle/git.js +6 -1
- package/dist/lifecycle/ledger-read.js +1 -1
- package/dist/lifecycle/plan-stale.d.ts.map +1 -1
- package/dist/lifecycle/plan-stale.js +1 -2
- package/dist/lifecycle/publish-declaration.d.ts +20 -0
- package/dist/lifecycle/publish-declaration.d.ts.map +1 -1
- package/dist/lifecycle/publish-declaration.js +24 -1
- package/dist/lifecycle/publish-forge.d.ts.map +1 -1
- package/dist/lifecycle/publish-forge.js +1 -2
- package/dist/lifecycle/publish-git-ssh.d.ts +82 -0
- package/dist/lifecycle/publish-git-ssh.d.ts.map +1 -0
- package/dist/lifecycle/publish-git-ssh.js +180 -0
- package/dist/lifecycle/publish-homebrew.d.ts +11 -0
- package/dist/lifecycle/publish-homebrew.d.ts.map +1 -1
- package/dist/lifecycle/publish-homebrew.js +96 -5
- package/dist/lifecycle/publish-marketplace.d.ts +36 -2
- package/dist/lifecycle/publish-marketplace.d.ts.map +1 -1
- package/dist/lifecycle/publish-marketplace.js +173 -30
- package/dist/lifecycle/publish-tauri.d.ts.map +1 -1
- package/dist/lifecycle/publish-tauri.js +1 -2
- package/dist/lifecycle/query.d.ts +2 -2
- package/dist/lifecycle/query.d.ts.map +1 -1
- package/dist/lifecycle/query.js +3 -3
- package/dist/lifecycle/release-cut.d.ts +82 -6
- package/dist/lifecycle/release-cut.d.ts.map +1 -1
- package/dist/lifecycle/release-cut.js +209 -20
- package/dist/lifecycle/release-ledger.d.ts +11 -0
- package/dist/lifecycle/release-ledger.d.ts.map +1 -1
- package/dist/lifecycle/release-publish.d.ts +13 -0
- package/dist/lifecycle/release-publish.d.ts.map +1 -1
- package/dist/lifecycle/release-publish.js +5 -0
- package/dist/lifecycle/release-revocation.d.ts +4 -3
- package/dist/lifecycle/release-revocation.d.ts.map +1 -1
- package/dist/lifecycle/release-revocation.js +5 -4
- package/dist/lifecycle/release-store.d.ts +49 -3
- package/dist/lifecycle/release-store.d.ts.map +1 -1
- package/dist/lifecycle/release-store.js +22 -3
- package/dist/op/gate.d.ts +1 -1
- package/dist/op/gate.d.ts.map +1 -1
- package/dist/op/gate.js +2 -1
- package/dist/op/op-waves-run.js +5 -3
- package/dist/pr-forge.d.ts.map +1 -1
- package/dist/pr-forge.js +26 -6
- package/dist/release-floors.d.ts +1 -1
- package/dist/release-floors.js +1 -1
- package/dist/wave-runtime.mjs +284 -283
- package/dist/workspace/ci-green.d.ts.map +1 -1
- package/dist/workspace/ci-green.js +1 -2
- package/dist/workspace/ci-quarantine-report.d.ts.map +1 -1
- package/dist/workspace/ci-quarantine-report.js +1 -2
- package/dist/workspace/ci-quarantine.d.ts.map +1 -1
- package/dist/workspace/ci-quarantine.js +1 -2
- package/dist/workspace/delivery-metrics.schema.json +1 -1
- package/dist/workspace/intent.d.ts.map +1 -1
- package/dist/workspace/intent.js +1 -2
- package/dist/workspace/release-candidates.d.ts +9 -1
- package/dist/workspace/release-candidates.d.ts.map +1 -1
- package/dist/workspace/release-candidates.js +16 -5
- package/dist/workspace/release-candidates.schema.json +7 -0
- package/dist/workspace/releases.schema.json +54 -2
- package/package.json +1 -1
- package/src/cli/handlers/approve-external-signature.test.ts +105 -3
- package/src/cli/handlers/approve.ts +34 -4
- package/src/cli/handlers/pr.ts +2 -1
- package/src/cli/handlers/release.ts +91 -16
- package/src/cli/handlers/run-unchanged.e2e.test.ts +112 -0
- package/src/cli/handlers/run.ts +117 -7
- package/src/cli/main.ts +34 -7
- package/src/cli/parse-args.ts +15 -0
- package/src/cli/registry.ts +10 -2
- package/src/components/cli-support.test.ts +53 -0
- package/src/components/cli-support.ts +26 -4
- package/src/components/component.schema.json +17 -0
- package/src/components/component.ts +20 -0
- package/src/components/index.ts +1 -0
- package/src/components/registry.test.ts +1 -1
- package/src/components/release-run.test.ts +127 -0
- package/src/components/release-run.ts +188 -0
- package/src/components/starter-plugin.ts +5 -0
- package/src/components/unchanged-inputs.test.ts +98 -0
- package/src/components/unchanged-inputs.ts +151 -0
- package/src/components/verbs/index.ts +1 -0
- package/src/components/verbs/release-image.ts +52 -0
- package/src/config.ts +8 -0
- package/src/gate-statement.schema.json +4 -2
- package/src/lifecycle/delivery-metrics.ts +4 -2
- package/src/lifecycle/gate-ledger.ts +17 -2
- package/src/lifecycle/gate-seal.ts +24 -6
- package/src/lifecycle/gate-statement.ts +40 -4
- package/src/lifecycle/git.test.ts +15 -0
- package/src/lifecycle/git.ts +5 -1
- package/src/lifecycle/ledger-read.ts +1 -1
- package/src/lifecycle/plan-stale.test.ts +3 -4
- package/src/lifecycle/plan-stale.ts +1 -2
- package/src/lifecycle/publish-declaration.ts +24 -1
- package/src/lifecycle/publish-forge.ts +1 -2
- package/src/lifecycle/publish-git-ssh.ts +202 -0
- package/src/lifecycle/publish-homebrew.test.ts +181 -2
- package/src/lifecycle/publish-homebrew.ts +101 -6
- package/src/lifecycle/publish-marketplace.test.ts +158 -6
- package/src/lifecycle/publish-marketplace.ts +192 -31
- package/src/lifecycle/publish-resume.test.ts +40 -0
- package/src/lifecycle/publish-tauri.ts +1 -2
- package/src/lifecycle/query.ts +3 -3
- package/src/lifecycle/release-cut-lane.test.ts +195 -0
- package/src/lifecycle/release-cut-override.test.ts +225 -0
- package/src/lifecycle/release-cut.test.ts +45 -0
- package/src/lifecycle/release-cut.ts +262 -21
- package/src/lifecycle/release-ledger.ts +11 -0
- package/src/lifecycle/release-publish.ts +18 -0
- package/src/lifecycle/release-revocation.ts +5 -4
- package/src/lifecycle/release-store.ts +73 -5
- package/src/op/gate.ts +2 -1
- package/src/op/op-waves-run.ts +4 -2
- package/src/pr-forge.ts +25 -6
- package/src/pr-requires.test.ts +9 -0
- package/src/release-floors.ts +1 -1
- package/src/workspace/ci-green.ts +1 -2
- package/src/workspace/ci-quarantine-report.test.ts +2 -3
- package/src/workspace/ci-quarantine-report.ts +1 -2
- package/src/workspace/ci-quarantine.test.ts +2 -3
- package/src/workspace/ci-quarantine.ts +1 -2
- package/src/workspace/delivery-metrics.schema.json +1 -1
- package/src/workspace/delivery-metrics.test.ts +8 -0
- package/src/workspace/intent.ts +1 -2
- package/src/workspace/release-candidates.schema.json +7 -0
- package/src/workspace/release-candidates.ts +19 -5
- package/src/workspace/releases.schema.json +54 -2
- package/src/workspace/trust/gate-seal.test.ts +44 -0
|
@@ -55,6 +55,7 @@ import {
|
|
|
55
55
|
type LedgerLocation,
|
|
56
56
|
} from "./git";
|
|
57
57
|
import type { RunOrigin } from "./release-ledger";
|
|
58
|
+
import { NEXT_RELEASE } from "../release-floors";
|
|
58
59
|
|
|
59
60
|
/** The directory on `chant/lifecycle` that holds releases, cuts and template bytes. */
|
|
60
61
|
export const RELEASES_DIR = "_releases";
|
|
@@ -66,15 +67,30 @@ export const TEMPLATES_SUBDIR = "templates";
|
|
|
66
67
|
/** The `kind` a release digest is computed under, so it can never equal a plan digest of another kind. */
|
|
67
68
|
export const RELEASE_DIGEST_KIND = "release";
|
|
68
69
|
|
|
69
|
-
/**
|
|
70
|
+
/**
|
|
71
|
+
* An artifact built once from the release's commit: an `image` or `asset`
|
|
72
|
+
* archive entry the cut built, or an image built elsewhere and handed to the
|
|
73
|
+
* cut by digest (#4694, `chant release cut --image`).
|
|
74
|
+
*/
|
|
70
75
|
export interface ReleaseArtifact {
|
|
71
76
|
component: string;
|
|
72
77
|
kind: "image" | "asset";
|
|
73
|
-
/** The archive path the build step wrote. */
|
|
78
|
+
/** The archive path the build step wrote. Empty for an image handed to the cut, which no build step wrote. */
|
|
74
79
|
path: string;
|
|
75
80
|
digest: string;
|
|
81
|
+
/**
|
|
82
|
+
* For an image handed to the cut (#4694): where it is, as
|
|
83
|
+
* `<repository>@<digest>`, the reference a deploy under the release runs.
|
|
84
|
+
* Absent on an artifact the cut built. In the release digest when present,
|
|
85
|
+
* so a release that records one is read by chant {@link RELEASE_IMAGE_REF_FLOOR}
|
|
86
|
+
* and newer.
|
|
87
|
+
*/
|
|
88
|
+
ref?: string;
|
|
76
89
|
}
|
|
77
90
|
|
|
91
|
+
/** The first chant that writes and reads an artifact's `ref` (#4694). */
|
|
92
|
+
export const RELEASE_IMAGE_REF_FLOOR = NEXT_RELEASE;
|
|
93
|
+
|
|
78
94
|
/** One template of a target: a file a component's deploy reads, compiled for the target's environment. */
|
|
79
95
|
export interface ReleaseTemplate {
|
|
80
96
|
/** The component whose deploy reads it, or null for a project with no components. */
|
|
@@ -160,6 +176,46 @@ export interface ReleaseCut {
|
|
|
160
176
|
* image tag a publish moves in place of `latest`. Absent for `latest`.
|
|
161
177
|
*/
|
|
162
178
|
channel?: string;
|
|
179
|
+
/**
|
|
180
|
+
* The green lane the cut checked (#4692): the commit carried
|
|
181
|
+
* `ci/green-<lane>/<sha>` and no `ci/revoked-<lane>/<sha>`, in place of
|
|
182
|
+
* `ci/green/<sha>`. Absent on a cut that checked the full green tag.
|
|
183
|
+
*/
|
|
184
|
+
lane?: string;
|
|
185
|
+
/**
|
|
186
|
+
* The commit was not green, and a person's override let the cut through
|
|
187
|
+
* (#4693). Absent on a cut of a green commit.
|
|
188
|
+
*/
|
|
189
|
+
override?: ReleaseCutOverride;
|
|
190
|
+
}
|
|
191
|
+
|
|
192
|
+
/**
|
|
193
|
+
* The override a cut of a commit that was not green ran under (#4693): an
|
|
194
|
+
* override on `_gates/policy-override.jsonl`, written by a person the
|
|
195
|
+
* overriders file at base lists, which the cut spent.
|
|
196
|
+
*/
|
|
197
|
+
export interface ReleaseCutOverride {
|
|
198
|
+
/** Always false: the commit had no green tag that counts. */
|
|
199
|
+
green: false;
|
|
200
|
+
/** The tag it lacked, `ci/green/<sha>` or `ci/green-<lane>/<sha>`. */
|
|
201
|
+
tag: string;
|
|
202
|
+
/** Who wrote the override. */
|
|
203
|
+
by: string;
|
|
204
|
+
/** When they wrote it. */
|
|
205
|
+
at: string;
|
|
206
|
+
/** Why, in their words. */
|
|
207
|
+
reason: string;
|
|
208
|
+
/** The override digest, binding the subject, the commit and the rule. */
|
|
209
|
+
digest: string;
|
|
210
|
+
/** Whether the override was sealed, as a release gate in identity.gates requires. */
|
|
211
|
+
sealed: boolean;
|
|
212
|
+
}
|
|
213
|
+
|
|
214
|
+
/** Whether `v` reads as a {@link ReleaseCutOverride}. */
|
|
215
|
+
function isCutOverride(v: unknown): v is ReleaseCutOverride {
|
|
216
|
+
if (!v || typeof v !== "object") return false;
|
|
217
|
+
const o = v as Record<string, unknown>;
|
|
218
|
+
return o.green === false && typeof o.tag === "string" && typeof o.by === "string" && typeof o.at === "string" && typeof o.reason === "string" && typeof o.digest === "string" && typeof o.sealed === "boolean";
|
|
163
219
|
}
|
|
164
220
|
|
|
165
221
|
/** The parts of a release a digest is computed from. */
|
|
@@ -167,12 +223,12 @@ export type ReleaseSubject = Pick<Release, "member" | "commit" | "artifactDigest
|
|
|
167
223
|
|
|
168
224
|
const byString = (a: string, b: string): number => (a < b ? -1 : a > b ? 1 : 0);
|
|
169
225
|
|
|
170
|
-
/** The same release with every list in the order ws-104 sets: artifacts by component then path, targets by env, templates by component then path, params by name. */
|
|
226
|
+
/** The same release with every list in the order ws-104 sets: artifacts by component then path (a handed image's `ref` kept), targets by env, templates by component then path, params by name. */
|
|
171
227
|
export function normalizeRelease<T extends ReleaseSubject>(release: T): T {
|
|
172
228
|
return {
|
|
173
229
|
...release,
|
|
174
230
|
artifactDigests: [...release.artifactDigests]
|
|
175
|
-
.map(({ component, kind, path, digest }) => ({ component, kind, path, digest }))
|
|
231
|
+
.map(({ component, kind, path, digest, ref }) => ({ component, kind, path, digest, ...(ref !== undefined ? { ref } : {}) }))
|
|
176
232
|
.sort((a, b) => byString(a.component, b.component) || byString(a.path, b.path)),
|
|
177
233
|
targets: [...release.targets]
|
|
178
234
|
.map((t) => ({
|
|
@@ -314,7 +370,15 @@ export function parseRelease(text: string): Release | null {
|
|
|
314
370
|
(r.member === null || typeof r.member === "string") &&
|
|
315
371
|
typeof r.commit === "string" &&
|
|
316
372
|
Array.isArray(r.artifactDigests) &&
|
|
317
|
-
r.artifactDigests.every(
|
|
373
|
+
r.artifactDigests.every(
|
|
374
|
+
(a) =>
|
|
375
|
+
a &&
|
|
376
|
+
typeof a.component === "string" &&
|
|
377
|
+
(a.kind === "image" || a.kind === "asset") &&
|
|
378
|
+
typeof a.path === "string" &&
|
|
379
|
+
typeof a.digest === "string" &&
|
|
380
|
+
(a.ref === undefined || typeof a.ref === "string"),
|
|
381
|
+
) &&
|
|
318
382
|
Array.isArray(r.targets) &&
|
|
319
383
|
r.targets.every(
|
|
320
384
|
(t) =>
|
|
@@ -377,6 +441,8 @@ export function parseCuts(text: string | null): { cuts: ReleaseCut[]; malformed:
|
|
|
377
441
|
(c.signature === null || c.signature === undefined || typeof c.signature === "string") &&
|
|
378
442
|
(c.runId === null || c.runId === undefined || typeof c.runId === "string") &&
|
|
379
443
|
(c.channel === undefined || typeof c.channel === "string") &&
|
|
444
|
+
(c.lane === undefined || typeof c.lane === "string") &&
|
|
445
|
+
(c.override === undefined || isCutOverride(c.override)) &&
|
|
380
446
|
(c.composed === undefined || (typeof c.composed === "object" && c.composed !== null && typeof c.composed.base === "string" && Array.isArray(c.composed.sources)));
|
|
381
447
|
if (!ok) {
|
|
382
448
|
malformed++;
|
|
@@ -459,6 +525,8 @@ export async function appendCut(
|
|
|
459
525
|
signature: input.signature ?? null,
|
|
460
526
|
...(input.composed ? { composed: input.composed } : {}),
|
|
461
527
|
...(input.channel ? { channel: input.channel } : {}),
|
|
528
|
+
...(input.lane ? { lane: input.lane } : {}),
|
|
529
|
+
...(input.override ? { override: input.override } : {}),
|
|
462
530
|
};
|
|
463
531
|
const content = `${existing ? `${existing.replace(/\n$/, "")}\n` : ""}${JSON.stringify(cut, sortedJsonReplacer)}\n`;
|
|
464
532
|
try {
|
package/src/op/gate.ts
CHANGED
|
@@ -736,7 +736,7 @@ export function approvalsAnswering(
|
|
|
736
736
|
/**
|
|
737
737
|
* The line a run writes for an approval it carries from an alias (#3949):
|
|
738
738
|
* the approval under `op`/`gate` at `now`, citing the line it came from.
|
|
739
|
-
* The approver, plan, environment, relay and seal are the original's. A
|
|
739
|
+
* The approver, plan, environment, relay, binding (#4697) and seal are the original's. A
|
|
740
740
|
* policy decision is left behind, since it was evaluated against another
|
|
741
741
|
* gate, and so is a checkpoint digest, which moves onto `carriedFrom`: the
|
|
742
742
|
* approver saw that checkpoint, not one this gate stores, so a carried
|
|
@@ -757,6 +757,7 @@ export function carriedApproval(r: GateResolutionRecord, op: string, gate: strin
|
|
|
757
757
|
...(r.origin ? { origin: r.origin } : {}),
|
|
758
758
|
...(r.sameOriginOverride ? { sameOriginOverride: true } : {}),
|
|
759
759
|
approver: approverOf(r),
|
|
760
|
+
...(r.binding !== undefined ? { binding: r.binding } : {}),
|
|
760
761
|
...(r.seal ? { seal: r.seal } : {}),
|
|
761
762
|
carriedFrom: {
|
|
762
763
|
op: r.op,
|
package/src/op/op-waves-run.ts
CHANGED
|
@@ -4014,10 +4014,12 @@ async function storeHeadChangeSet(doc: ChangeSetDocument, cwd: string): Promise<
|
|
|
4014
4014
|
}
|
|
4015
4015
|
|
|
4016
4016
|
async function writeHeadPlans(plans: HeadPlans, cwd: string): Promise<void> {
|
|
4017
|
-
const {
|
|
4017
|
+
const { pushLifecycleRebasing, requireLifecycleLedger, writeBlobToPath } = await import("../lifecycle/git");
|
|
4018
4018
|
const { headPlansPath } = await import("./gate-review");
|
|
4019
4019
|
await requireLifecycleLedger({ cwd });
|
|
4020
4020
|
const { dir, file } = headPlansPath(plans.name, plans.head);
|
|
4021
4021
|
await writeBlobToPath(dir, file, JSON.stringify(plans, null, 2) + "\n", `Op waves plans of ${plans.name} at ${plans.head.slice(0, 12)}`, { cwd });
|
|
4022
|
-
|
|
4022
|
+
// The preview, its note and the approval status write the ledger at the same head, so a lost race replays rather than fails the job a pull request's checks wait on.
|
|
4023
|
+
const pushed = await pushLifecycleRebasing({ cwd });
|
|
4024
|
+
if (!pushed.pushed) throw new Error(`the plans were recorded locally only: ${pushed.pushWarning ?? "chant/lifecycle has no remote to push to"}`);
|
|
4023
4025
|
}
|
package/src/pr-forge.ts
CHANGED
|
@@ -303,6 +303,13 @@ export interface MergeResult {
|
|
|
303
303
|
/** Statuses a forge answers a refused merge with: not allowed, head moved, conflict, invalid. */
|
|
304
304
|
const MERGE_REFUSED = new Set([405, 406, 409, 422]);
|
|
305
305
|
|
|
306
|
+
/** A status to leave out of `prChecksPassed`: an exact name, or every name under an entry that ends in `/`. */
|
|
307
|
+
function ignoredStatus(ignore: readonly string[]): (name: string) => boolean {
|
|
308
|
+
const exact = new Set(ignore);
|
|
309
|
+
const under = ignore.filter((i) => i.endsWith("/"));
|
|
310
|
+
return (name) => exact.has(name) || under.some((i) => name.startsWith(i));
|
|
311
|
+
}
|
|
312
|
+
|
|
306
313
|
/** A refused merge as a result, any other failure rethrown. */
|
|
307
314
|
function refusedMerge(err: unknown): MergeResult {
|
|
308
315
|
if (err instanceof ForgeApiError && MERGE_REFUSED.has(err.status)) {
|
|
@@ -1098,7 +1105,7 @@ function githubShaped(kind: "github" | "forgejo", opts: GithubForgeOptions): Git
|
|
|
1098
1105
|
return base === tip ? pass(`${short(head)} contains ${into} at ${short(tip)}`) : refuse(`${short(head)} does not contain ${into} at ${short(tip)}`);
|
|
1099
1106
|
},
|
|
1100
1107
|
async prChecksPassed(_pr, head, ignore = []) {
|
|
1101
|
-
const skip =
|
|
1108
|
+
const skip = ignoredStatus(ignore);
|
|
1102
1109
|
const failing: string[] = [];
|
|
1103
1110
|
const waiting: string[] = [];
|
|
1104
1111
|
let count = 0;
|
|
@@ -1106,8 +1113,13 @@ function githubShaped(kind: "github" | "forgejo", opts: GithubForgeOptions): Git
|
|
|
1106
1113
|
const combined = await api.call("GET", `${repo}/commits/${head}/status`);
|
|
1107
1114
|
for (const st of isObject(combined) && Array.isArray(combined.statuses) ? combined.statuses : []) {
|
|
1108
1115
|
const context = isObject(st) ? str(st.context) : undefined;
|
|
1109
|
-
if (!context
|
|
1116
|
+
if (!context) continue;
|
|
1110
1117
|
const state = str(st.state) ?? str(st.status) ?? "";
|
|
1118
|
+
// A status left out still shows the checks reported, unless it is what held them back.
|
|
1119
|
+
if (skip(context)) {
|
|
1120
|
+
if (state === "success") count++;
|
|
1121
|
+
continue;
|
|
1122
|
+
}
|
|
1111
1123
|
count++;
|
|
1112
1124
|
if (state === "failure" || state === "error" || state === "failed") failing.push(context);
|
|
1113
1125
|
else if (state === "pending" || state === "running" || state === "") waiting.push(context);
|
|
@@ -1116,7 +1128,7 @@ function githubShaped(kind: "github" | "forgejo", opts: GithubForgeOptions): Git
|
|
|
1116
1128
|
const runs = await api.call("GET", `${repo}/commits/${head}/check-runs?per_page=100`);
|
|
1117
1129
|
for (const run of isObject(runs) && Array.isArray(runs.check_runs) ? runs.check_runs : []) {
|
|
1118
1130
|
const name = (isObject(run) ? str(run.name) : undefined) ?? "a check";
|
|
1119
|
-
if (skip
|
|
1131
|
+
if (skip(name) || !isObject(run)) continue;
|
|
1120
1132
|
count++;
|
|
1121
1133
|
if (run.status !== "completed") waiting.push(name);
|
|
1122
1134
|
else if (!["success", "neutral", "skipped"].includes(String(run.conclusion))) failing.push(name);
|
|
@@ -1541,23 +1553,30 @@ export function gitlabForge(opts: GitlabForgeOptions): PrForge {
|
|
|
1541
1553
|
return behind === 0 ? pass(`${short(head)} contains ${into}`) : refuse(`${short(head)} is ${behind} commit${behind === 1 ? "" : "s"} behind ${into}`);
|
|
1542
1554
|
},
|
|
1543
1555
|
async prChecksPassed(mr, head, ignore = []) {
|
|
1544
|
-
const skip =
|
|
1556
|
+
const skip = ignoredStatus(ignore);
|
|
1545
1557
|
// Each name's newest status; a job allowed to fail holds nothing back.
|
|
1546
1558
|
const newest = new Map<string, Record<string, unknown>>();
|
|
1547
1559
|
for (const st of await api.list(`${project}/repository/commits/${head}/statuses?all=true`, pageParams, 100)) {
|
|
1548
1560
|
const name = isObject(st) ? str(st.name) : undefined;
|
|
1549
|
-
if (!name ||
|
|
1561
|
+
if (!name || !isObject(st)) continue;
|
|
1550
1562
|
const had = newest.get(name);
|
|
1551
1563
|
if (!had || (num(st.id) ?? 0) > (num(had.id) ?? 0)) newest.set(name, st);
|
|
1552
1564
|
}
|
|
1553
1565
|
const failing: string[] = [];
|
|
1554
1566
|
const waiting: string[] = [];
|
|
1567
|
+
let count = 0;
|
|
1555
1568
|
for (const [name, st] of newest) {
|
|
1556
1569
|
const state = str(st.status) ?? "";
|
|
1570
|
+
// A status left out still shows the checks reported, unless it is what held them back.
|
|
1571
|
+
if (skip(name)) {
|
|
1572
|
+
if (state === "success") count++;
|
|
1573
|
+
continue;
|
|
1574
|
+
}
|
|
1575
|
+
count++;
|
|
1557
1576
|
if ((state === "failed" || state === "canceled") && st.allow_failure !== true) failing.push(name);
|
|
1558
1577
|
else if (GITLAB_RUNNING.has(state)) waiting.push(name);
|
|
1559
1578
|
}
|
|
1560
|
-
return checksVerdict(`merge request !${mr}`, head, failing, waiting,
|
|
1579
|
+
return checksVerdict(`merge request !${mr}`, head, failing, waiting, count);
|
|
1561
1580
|
},
|
|
1562
1581
|
async pullRequestOpen(mr) {
|
|
1563
1582
|
try {
|
package/src/pr-requires.test.ts
CHANGED
|
@@ -106,6 +106,15 @@ describe("github", () => {
|
|
|
106
106
|
expect((await f("success", runs("failure")).prChecksPassed!(7, HEAD, ["chant/apply"])).reason).toBe("lint failed on aaaaaaaa");
|
|
107
107
|
});
|
|
108
108
|
|
|
109
|
+
test("checks: an entry ending in / leaves out every status under it", async () => {
|
|
110
|
+
const f = forge({
|
|
111
|
+
[`GET ${repo}/commits/${HEAD}/status`]: { statuses: [{ context: "plywood/preview/shop/dev", state: "failure" }, { context: "ci/test", state: "success" }] },
|
|
112
|
+
[`GET ${repo}/commits/${HEAD}/check-runs`]: { check_runs: [] },
|
|
113
|
+
});
|
|
114
|
+
expect((await f.prChecksPassed!(7, HEAD, ["plywood/preview/"])).passed).toBe(true);
|
|
115
|
+
expect((await f.prChecksPassed!(7, HEAD, ["plywood/preview"])).passed).toBe(false);
|
|
116
|
+
});
|
|
117
|
+
|
|
109
118
|
test("checks: nothing reported is pending", async () => {
|
|
110
119
|
const f = forge({ [`GET ${repo}/commits/${HEAD}/status`]: { statuses: [] }, [`GET ${repo}/commits/${HEAD}/check-runs`]: { check_runs: [] } });
|
|
111
120
|
expect(await f.prChecksPassed!(7, HEAD)).toMatchObject({ passed: false, pending: true });
|
package/src/release-floors.ts
CHANGED
|
@@ -63,7 +63,6 @@ import type { OpRunRecord } from "../op/runtime";
|
|
|
63
63
|
import { readRunLedger } from "../lifecycle/run-ledger";
|
|
64
64
|
import { fetchLifecycleStatus, listFilesInDir, listLedgerTrees, pushLifecycleStatus, writeLedgerFiles } from "../lifecycle/git";
|
|
65
65
|
import { ledgerRecordingOff } from "../lifecycle/no-record";
|
|
66
|
-
import { NEXT_RELEASE } from "../release-floors";
|
|
67
66
|
import { agedOut, branchRecordPath, buildRequestAnnotation, CI_BUILD_TAG_PREFIX, CI_LEDGER_REF, planBuilds, readBuildRequests, readCiBranchRecord, readCiRecords, recordOf, recordPath, requestedBuild, sameRecord, type BuildRequest, type CiBranchRecord, type CiRecord } from "./ci-builds";
|
|
68
67
|
import { dispatchableWorkflows, MERGE_QUEUE_VERDICT_JOB, readWorkflowSources } from "./ci-green-workflow";
|
|
69
68
|
import { signOpRunRecord, verifyOpRunStatement } from "./trust/op-run-statement";
|
|
@@ -86,7 +85,7 @@ export const CI_GREEN_LANES_FLOOR = "0.124.61";
|
|
|
86
85
|
/** The first chant whose tick sends `ci.red`, `ci.culprit` and `ci.green` through `ci.green.notify` (#4645). */
|
|
87
86
|
export const CI_TICK_NOTIFY_FLOOR = "0.124.61";
|
|
88
87
|
/** The first chant whose tick sends `ci.stale` after `ci.green.notify.staleAfter` hours without a green commit (#4678). */
|
|
89
|
-
export const CI_STALE_NOTIFY_FLOOR =
|
|
88
|
+
export const CI_STALE_NOTIFY_FLOOR = "0.124.63";
|
|
90
89
|
/** How many first-parent commits the tick reads back looking for the newest green one, for `ci.stale` (#4678). */
|
|
91
90
|
export const CI_STALE_WALK = 200;
|
|
92
91
|
/** The first chant that writes a merge queue's trigger and verdict job, and reads `chant ci verdict` (#4644). */
|
|
@@ -7,7 +7,6 @@ import { describe, expect, test, vi } from "vitest";
|
|
|
7
7
|
import Ajv2020 from "ajv/dist/2020";
|
|
8
8
|
import notifySchema from "../notify.schema.json" with { type: "json" };
|
|
9
9
|
import { notifyHeadline, type NotifyEvent } from "../notify";
|
|
10
|
-
import { NEXT_RELEASE } from "../release-floors";
|
|
11
10
|
import { CI_QUARANTINE_NOTIFY_FLOOR, formatQuarantineReport, parseJUnit, quarantineReport } from "./ci-quarantine-report";
|
|
12
11
|
import { parseDeclaration, type CiGreen } from "./declaration";
|
|
13
12
|
|
|
@@ -74,8 +73,8 @@ function greenOf(notify?: unknown): CiGreen {
|
|
|
74
73
|
const NOTIFY = { webhook: "HOOK", key: "HOOK_KEY" };
|
|
75
74
|
|
|
76
75
|
describe("ci quarantine report (#4677)", () => {
|
|
77
|
-
test("its floor is the
|
|
78
|
-
expect(CI_QUARANTINE_NOTIFY_FLOOR).toBe(
|
|
76
|
+
test("its floor is the release it shipped in", () => {
|
|
77
|
+
expect(CI_QUARANTINE_NOTIFY_FLOOR).toBe("0.124.63");
|
|
79
78
|
});
|
|
80
79
|
|
|
81
80
|
test("reads nextest's and Playwright's JUnit, CDATA and entities included", () => {
|
|
@@ -23,13 +23,12 @@ import { resolve } from "node:path";
|
|
|
23
23
|
import { formatError } from "../cli/format";
|
|
24
24
|
import type { CommandContext } from "../cli/registry";
|
|
25
25
|
import { makeNotifyEvent, sendNotify as realSendNotify, type NotifyDelivery, type NotifyEvent } from "../notify";
|
|
26
|
-
import { NEXT_RELEASE } from "../release-floors";
|
|
27
26
|
import { quarantineName } from "./ci-quarantine";
|
|
28
27
|
import { locateWorkspace } from "./which-chant";
|
|
29
28
|
import { readDeclaration, WorkspaceReadError, type CiGreen, type CiQuarantineEntry } from "./declaration";
|
|
30
29
|
|
|
31
30
|
/** The first chant that sends `ci.quarantine-passed` (#4677). */
|
|
32
|
-
export const CI_QUARANTINE_NOTIFY_FLOOR =
|
|
31
|
+
export const CI_QUARANTINE_NOTIFY_FLOOR = "0.124.63";
|
|
33
32
|
|
|
34
33
|
/** One `<testcase>`: its suite's name, its classname and name, and how it ended. */
|
|
35
34
|
export interface JUnitCase {
|
|
@@ -9,7 +9,6 @@ import { tmpdir } from "node:os";
|
|
|
9
9
|
import { join } from "node:path";
|
|
10
10
|
import { afterAll, afterEach, describe, expect, test, vi } from "vitest";
|
|
11
11
|
import { parseArgs } from "../cli/parse-args";
|
|
12
|
-
import { NEXT_RELEASE } from "../release-floors";
|
|
13
12
|
import { CI_QUARANTINE_FLOOR, PLAYWRIGHT_NOTHING, quarantineFilter, quarantineProblems, runCiQuarantine, utcToday } from "./ci-quarantine";
|
|
14
13
|
import { parseDeclaration, WorkspaceReadError, type CiGreen } from "./declaration";
|
|
15
14
|
|
|
@@ -143,8 +142,8 @@ describe("chant ci quarantine (#4677)", () => {
|
|
|
143
142
|
expect(expired.err).toMatch(/^chant\.workspace\.json:\d+:\d+: ci\.green\.quarantine: test: .* expired on /);
|
|
144
143
|
});
|
|
145
144
|
|
|
146
|
-
test("its floor is the
|
|
147
|
-
expect(CI_QUARANTINE_FLOOR).toBe(
|
|
145
|
+
test("its floor is the release it shipped in", () => {
|
|
146
|
+
expect(CI_QUARANTINE_FLOOR).toBe("0.124.63");
|
|
148
147
|
});
|
|
149
148
|
|
|
150
149
|
test("parses --phase, --runner and --only", () => {
|
|
@@ -29,12 +29,11 @@
|
|
|
29
29
|
|
|
30
30
|
import { formatError } from "../cli/format";
|
|
31
31
|
import type { CommandContext } from "../cli/registry";
|
|
32
|
-
import { NEXT_RELEASE } from "../release-floors";
|
|
33
32
|
import { locateWorkspace } from "./which-chant";
|
|
34
33
|
import { quarantineDay, readDeclaration, WorkspaceReadError, type CiGreen, type CiQuarantineEntry } from "./declaration";
|
|
35
34
|
|
|
36
35
|
/** The first chant that reads `ci.green.quarantine` and runs `chant ci quarantine` (#4677). */
|
|
37
|
-
export const CI_QUARANTINE_FLOOR =
|
|
36
|
+
export const CI_QUARANTINE_FLOOR = "0.124.63";
|
|
38
37
|
|
|
39
38
|
export const QUARANTINE_RUNNERS = ["nextest", "playwright", "list"] as const;
|
|
40
39
|
export type QuarantineRunner = (typeof QUARANTINE_RUNNERS)[number];
|
|
@@ -191,7 +191,7 @@
|
|
|
191
191
|
"count": {
|
|
192
192
|
"type": "integer",
|
|
193
193
|
"minimum": 0,
|
|
194
|
-
"description": "Deploy records whose timestamp is in the window, leaving out redeploys. Rollbacks count."
|
|
194
|
+
"description": "Deploy records whose timestamp is in the window, leaving out redeploys. Rollbacks count. A record with unchangedSince (#4695) deployed nothing and is in no metric."
|
|
195
195
|
},
|
|
196
196
|
"redeploys": {
|
|
197
197
|
"type": "integer",
|
|
@@ -229,6 +229,14 @@ describe("environmentMetrics", () => {
|
|
|
229
229
|
expect(m.leadTime.changes).toBe(0);
|
|
230
230
|
});
|
|
231
231
|
|
|
232
|
+
test("a record of a skipped component deployed nothing and is in no metric (#4695)", () => {
|
|
233
|
+
const deploy = record("hub", "06");
|
|
234
|
+
const skip = record("hub", "08", { releaseDigest: "jcs1-sha256:r2", unchangedSince: { env: "prod", runId: deploy.runId, timestamp: deploy.timestamp } });
|
|
235
|
+
const m = environmentMetrics("prod", [deploy, skip], lookups, { since: t("05"), until: NOW });
|
|
236
|
+
expect(m.deployments.count).toBe(1);
|
|
237
|
+
expect(m.deployments.runs).toBe(1);
|
|
238
|
+
});
|
|
239
|
+
|
|
232
240
|
test("a rollback is a record with restores; nothing else is", () => {
|
|
233
241
|
expect(rollbackOf(record("api", "01"))).toBeNull();
|
|
234
242
|
expect(rollbackOf(record("api", "02", { restores: { env: "prod", runId: "x", timestamp: t("01") } }))).toEqual({ env: "prod", runId: "x", timestamp: t("01") });
|
package/src/workspace/intent.ts
CHANGED
|
@@ -60,7 +60,6 @@
|
|
|
60
60
|
import { execFileSync } from "node:child_process";
|
|
61
61
|
import { realpathSync } from "node:fs";
|
|
62
62
|
import { basename, dirname, relative, resolve, sep } from "node:path";
|
|
63
|
-
import { NEXT_RELEASE } from "../release-floors";
|
|
64
63
|
import type { PullRequestCloses } from "./forge-work";
|
|
65
64
|
import { declaredRecordKinds, readDeclaration, readerVersion, resolveGroups, WORKSPACE_ERROR_CODES, WorkspaceReadError, type Declaration } from "./declaration";
|
|
66
65
|
import { declaredKindFile } from "./declared-kinds";
|
|
@@ -91,7 +90,7 @@ import { idList, isDecided, WORK_WARNING_CODES, type WorkLink, type WorkWarningC
|
|
|
91
90
|
/** The version of the `intent` document this chant writes. */
|
|
92
91
|
export const INTENT_CONTRACT_VERSION = 1;
|
|
93
92
|
/** The first chant whose intent graph and record walk carry a commit's `closes`, with `--forge-issues` (#4649). */
|
|
94
|
-
export const INTENT_CLOSES_FLOOR =
|
|
93
|
+
export const INTENT_CLOSES_FLOOR = "0.124.63";
|
|
95
94
|
|
|
96
95
|
/** `$id` of the JSON Schema for the document, shipped beside this file. */
|
|
97
96
|
export const INTENT_OUTPUT_SCHEMA_ID = "https://intentius.io/chant/schemas/workspace/intent/v1/intent.schema.json";
|
|
@@ -49,6 +49,13 @@
|
|
|
49
49
|
"type": "string",
|
|
50
50
|
"description": "The trunk walked: ci.green.branch, else what origin/HEAD names."
|
|
51
51
|
},
|
|
52
|
+
"lane": {
|
|
53
|
+
"type": [
|
|
54
|
+
"string",
|
|
55
|
+
"null"
|
|
56
|
+
],
|
|
57
|
+
"description": "The green lane whose tags were read (#4692), from --lane or release.lane in the member's chant.config.ts: candidates carry ci/green-<lane>/<sha> and skipped commits ci/revoked-<lane>/<sha>. Null when ci/green/<sha> was read. Added by #4692, written by chant 0.124.64 and newer."
|
|
58
|
+
},
|
|
52
59
|
"tip": {
|
|
53
60
|
"type": [
|
|
54
61
|
"string",
|
|
@@ -10,7 +10,9 @@
|
|
|
10
10
|
* latest deploy records name in `releaseDigest`, as the `releases` read
|
|
11
11
|
* (./releases.ts) says.
|
|
12
12
|
*
|
|
13
|
-
* Every green commit that is not revoked is a candidate.
|
|
13
|
+
* Every green commit that is not revoked is a candidate. With a lane (#4692),
|
|
14
|
+
* green and revoked are that lane's tags, `ci/green-<lane>/<sha>` and
|
|
15
|
+
* `ci/revoked-<lane>/<sha>`, as `release cut --lane` checks them. Its `changes` are
|
|
14
16
|
* the first-parent commits after the previous candidate up to and including
|
|
15
17
|
* it, so the candidates partition the walk. A revoked commit is listed under
|
|
16
18
|
* `skipped`, and its changes carry on into the next candidate. Commits after
|
|
@@ -42,7 +44,6 @@
|
|
|
42
44
|
|
|
43
45
|
import { execFileSync } from "node:child_process";
|
|
44
46
|
import { relative, resolve, sep } from "node:path";
|
|
45
|
-
import { NEXT_RELEASE } from "../release-floors";
|
|
46
47
|
import { latestPerComponent, readReleaseLedger } from "../lifecycle/release-ledger";
|
|
47
48
|
import { readAllReleases, readCuts } from "../lifecycle/release-store";
|
|
48
49
|
import { resolveMemberLedger } from "../lifecycle/member-ledger";
|
|
@@ -52,7 +53,9 @@ import type { ForgeWorkOptions, PullRequestCloses } from "./forge-work";
|
|
|
52
53
|
|
|
53
54
|
export const RELEASE_CANDIDATES_CONTRACT_VERSION = 1;
|
|
54
55
|
/** The first chant whose candidates carry `changes[].closes` and `groups[].issue` (#4649). */
|
|
55
|
-
export const RELEASE_CANDIDATES_CLOSES_FLOOR =
|
|
56
|
+
export const RELEASE_CANDIDATES_CLOSES_FLOOR = "0.124.63";
|
|
57
|
+
/** The first chant whose candidates document carries `lane` and reads a lane's tags (#4692). */
|
|
58
|
+
export const RELEASE_CANDIDATES_LANE_FLOOR = "0.124.64";
|
|
56
59
|
export const RELEASE_CANDIDATES_SCHEMA_ID = "https://intentius.io/chant/schemas/workspace/release-candidates/v1/release-candidates.schema.json";
|
|
57
60
|
|
|
58
61
|
/** Why the read stopped. Closed; each code is in `reason-codes.ts`. */
|
|
@@ -150,6 +153,8 @@ export type ReleaseCandidatesDocument =
|
|
|
150
153
|
chant: string;
|
|
151
154
|
member: string | null;
|
|
152
155
|
branch: string;
|
|
156
|
+
/** The green lane whose tags were read (#4692), or null for `ci/green/<sha>`. Added within contract 1 by chant {@link RELEASE_CANDIDATES_LANE_FLOOR}. */
|
|
157
|
+
lane: string | null;
|
|
153
158
|
/** The tip of the branch as this clone knows it. */
|
|
154
159
|
tip: string | null;
|
|
155
160
|
environments: CandidateEnvironment[];
|
|
@@ -171,6 +176,8 @@ export interface ReleaseCandidatesQuery {
|
|
|
171
176
|
limit?: number;
|
|
172
177
|
/** Walk this branch of `ci.green.branch` (#4325) instead of the first. */
|
|
173
178
|
branch?: string;
|
|
179
|
+
/** Read this lane's tags (#4692), one `ci.green.lanes` declares, in place of `ci/green/` and `ci/revoked/`. */
|
|
180
|
+
lane?: string;
|
|
174
181
|
/** Ask the forge which issues each pull request closes (#4649), with these options. Left out, the forge is not read. */
|
|
175
182
|
forgeIssues?: ForgeWorkOptions;
|
|
176
183
|
}
|
|
@@ -259,6 +266,13 @@ export async function releaseCandidatesDocument(query: ReleaseCandidatesQuery):
|
|
|
259
266
|
if (query.branch !== undefined && !(green && greenBranches(green).includes(query.branch))) {
|
|
260
267
|
throw new Error(`--branch ${query.branch} is not a branch ci.green judges${green ? ` (${greenBranches(green).join(", ")})` : ", and the declaration has no ci.green"}`);
|
|
261
268
|
}
|
|
269
|
+
// #4692: an unknown lane, or one with no ci.green, stops the read with the lanes declared.
|
|
270
|
+
let lane: string | null = null;
|
|
271
|
+
if (query.lane !== undefined) {
|
|
272
|
+
if (!green) throw new Error(`--lane ${query.lane} names a ci.green lane, and the declaration has no ci.green`);
|
|
273
|
+
const { laneOf } = await import("./declaration");
|
|
274
|
+
lane = laneOf(green, query.lane).name;
|
|
275
|
+
}
|
|
262
276
|
const trunk = resolveTrunk(top, query.branch ?? green?.branch ?? null);
|
|
263
277
|
const tip =
|
|
264
278
|
tryGit(top, ["rev-parse", "--verify", "--quiet", `refs/remotes/${trunk.remote}/${trunk.branch}^{commit}`]) ??
|
|
@@ -294,7 +308,7 @@ export async function releaseCandidatesDocument(query: ReleaseCandidatesQuery):
|
|
|
294
308
|
environments.push({ env, running });
|
|
295
309
|
}
|
|
296
310
|
|
|
297
|
-
const empty = { ...head, member: ledger.members.length > 0 ? ledger.members.join("/") : null, branch: trunk.branch, tip, environments, since: null, candidates: [], skipped: [], pending: [] };
|
|
311
|
+
const empty = { ...head, member: ledger.members.length > 0 ? ledger.members.join("/") : null, branch: trunk.branch, lane, tip, environments, since: null, candidates: [], skipped: [], pending: [] };
|
|
298
312
|
if (!tip) return empty;
|
|
299
313
|
|
|
300
314
|
// The oldest commit any environment runs bounds the walk, when every environment runs one.
|
|
@@ -313,7 +327,7 @@ export async function releaseCandidatesDocument(query: ReleaseCandidatesQuery):
|
|
|
313
327
|
// An environment's newest running commit on the line, by position (smaller is newer).
|
|
314
328
|
const newestRun = new Map(environments.map((e) => [e.env, Math.min(...runningCommits(e).map((c) => position.get(c)!), Number.POSITIVE_INFINITY)]));
|
|
315
329
|
|
|
316
|
-
const tags = await judgedCiTags(top, green);
|
|
330
|
+
const tags = await judgedCiTags(top, green, lane ?? undefined);
|
|
317
331
|
const details = commitDetails(top, walk);
|
|
318
332
|
const merges = new Map<string, Record<string, unknown>>();
|
|
319
333
|
for (const sha of walk) {
|
|
@@ -113,7 +113,7 @@
|
|
|
113
113
|
},
|
|
114
114
|
"artifactDigests": {
|
|
115
115
|
"type": "array",
|
|
116
|
-
"description": "Each image and asset built once from the commit, sorted by component, then path. A config-only release carries the previous release's entries.",
|
|
116
|
+
"description": "Each image and asset built once from the commit, or handed to the cut by digest, sorted by component, then path. A config-only release carries the previous release's entries.",
|
|
117
117
|
"items": {
|
|
118
118
|
"type": "object",
|
|
119
119
|
"required": [
|
|
@@ -133,11 +133,16 @@
|
|
|
133
133
|
]
|
|
134
134
|
},
|
|
135
135
|
"path": {
|
|
136
|
-
"type": "string"
|
|
136
|
+
"type": "string",
|
|
137
|
+
"description": "The archive path the build step wrote. Empty for an image handed to the cut."
|
|
137
138
|
},
|
|
138
139
|
"digest": {
|
|
139
140
|
"type": "string",
|
|
140
141
|
"minLength": 1
|
|
142
|
+
},
|
|
143
|
+
"ref": {
|
|
144
|
+
"type": "string",
|
|
145
|
+
"description": "An image handed to the cut by digest (chant release cut --image, #4694), as <repository>@<digest>: the image a deploy under the release runs. Absent on an artifact the cut built. Written by chant 0.124.65 and newer."
|
|
141
146
|
}
|
|
142
147
|
}
|
|
143
148
|
}
|
|
@@ -393,6 +398,53 @@
|
|
|
393
398
|
"channel": {
|
|
394
399
|
"type": "string",
|
|
395
400
|
"description": "Added by #4168 4.3, written by chant 0.124.35 and newer. The tag release publish moves in place of latest (an npm dist-tag, an image tag), from release cut --channel. Absent for latest."
|
|
401
|
+
},
|
|
402
|
+
"lane": {
|
|
403
|
+
"type": "string",
|
|
404
|
+
"description": "Added by #4692, written by chant 0.124.64 and newer. The green lane the cut checked, from release cut --lane or release.lane in chant.config.ts: the commit carried ci/green-<lane>/<sha> and no ci/revoked-<lane>/<sha>. Absent on a cut that checked ci/green/<sha>."
|
|
405
|
+
},
|
|
406
|
+
"override": {
|
|
407
|
+
"type": "object",
|
|
408
|
+
"required": [
|
|
409
|
+
"green",
|
|
410
|
+
"tag",
|
|
411
|
+
"by",
|
|
412
|
+
"at",
|
|
413
|
+
"reason",
|
|
414
|
+
"digest",
|
|
415
|
+
"sealed"
|
|
416
|
+
],
|
|
417
|
+
"properties": {
|
|
418
|
+
"green": {
|
|
419
|
+
"const": false,
|
|
420
|
+
"description": "The commit was not green."
|
|
421
|
+
},
|
|
422
|
+
"tag": {
|
|
423
|
+
"type": "string",
|
|
424
|
+
"description": "The green tag it had none of that counts: ci/green/<sha>, or ci/green-<lane>/<sha>."
|
|
425
|
+
},
|
|
426
|
+
"by": {
|
|
427
|
+
"type": "string",
|
|
428
|
+
"description": "Who wrote the override, a person the overriders file at base lists."
|
|
429
|
+
},
|
|
430
|
+
"at": {
|
|
431
|
+
"type": "string",
|
|
432
|
+
"description": "When the override was written."
|
|
433
|
+
},
|
|
434
|
+
"reason": {
|
|
435
|
+
"type": "string",
|
|
436
|
+
"description": "Why, in the overrider's words."
|
|
437
|
+
},
|
|
438
|
+
"digest": {
|
|
439
|
+
"type": "string",
|
|
440
|
+
"description": "The override digest on _gates/policy-override.jsonl, binding the subject release-<sha12>, the commit and the rule."
|
|
441
|
+
},
|
|
442
|
+
"sealed": {
|
|
443
|
+
"type": "boolean",
|
|
444
|
+
"description": "Whether the override was sealed, as a release gate in identity.gates requires."
|
|
445
|
+
}
|
|
446
|
+
},
|
|
447
|
+
"description": "Added by #4693, written by chant 0.124.64 and newer. The commit was not green, and release cut --override-green cut it under a person's override, which it spent. Absent on a cut of a green commit."
|
|
396
448
|
}
|
|
397
449
|
}
|
|
398
450
|
},
|
|
@@ -164,6 +164,50 @@ describe("seal version 2 covers the checkpoint", () => {
|
|
|
164
164
|
});
|
|
165
165
|
});
|
|
166
166
|
|
|
167
|
+
// #4697: seal version 3 signs a relay's binding as the last line, after any
|
|
168
|
+
// checkpoint, and versions 1 and 2 sign what they did.
|
|
169
|
+
describe("seal version 3 covers the relay's binding", () => {
|
|
170
|
+
test("the payload adds a binding line last, only when the approval carries one", () => {
|
|
171
|
+
const a = approval({ relayedBy: "bot" });
|
|
172
|
+
const b = approval({ relayedBy: "bot", binding: "deploy dep_42 until 2026-11-01T12:00:00Z" });
|
|
173
|
+
expect(gateSealVersion(b)).toBe(3);
|
|
174
|
+
expect(gateSealPayload(b).toString()).toBe(`${gateSealPayload(a).toString()}\nbinding deploy dep_42 until 2026-11-01T12:00:00Z`);
|
|
175
|
+
const c = approval({ checkpointDigest: "jcs1-sha256:cp", binding: "x" });
|
|
176
|
+
expect(gateSealVersion(c)).toBe(3);
|
|
177
|
+
expect(gateSealPayload(c).toString()).toBe("migrations\nmigrations-wave-1\n\njcs1-sha256:abc\nalice\n2026-10-11T00:00:00.000Z\ncheckpoint jcs1-sha256:cp\nbinding x");
|
|
178
|
+
expect(gateSealPayload({ ...c, binding: undefined }).toString()).toBe(gateSealPayload(approval({ checkpointDigest: "jcs1-sha256:cp" })).toString());
|
|
179
|
+
});
|
|
180
|
+
|
|
181
|
+
test("a carried approval signs the original's binding", () => {
|
|
182
|
+
const carried = approval({
|
|
183
|
+
gate: "new-name",
|
|
184
|
+
timestamp: "2026-10-12T00:00:00.000Z",
|
|
185
|
+
binding: "deploy dep_42",
|
|
186
|
+
carriedFrom: { op: "migrations", gate: "migrations-wave-1", timestamp: "2026-10-11T00:00:00.000Z", checkpointDigest: "jcs1-sha256:cp" },
|
|
187
|
+
});
|
|
188
|
+
expect(gateSealVersion(carried)).toBe(3);
|
|
189
|
+
expect(gateSealPayload(carried)).toEqual(gateSealPayload(approval({ checkpointDigest: "jcs1-sha256:cp", binding: "deploy dep_42" })));
|
|
190
|
+
});
|
|
191
|
+
|
|
192
|
+
test.skipIf(!hasSshKeygen)("a version 3 seal verifies, and changing, removing or adding a binding stops it", () => {
|
|
193
|
+
const k = key("alice-binding", ["-t", "ed25519"]);
|
|
194
|
+
const a = approval({ binding: "deploy dep_42 until 2026-11-01T12:00:00Z" });
|
|
195
|
+
const seal = { signer: "alice", key: "SHA256:x", signature: sign(k, gateSealPayload(a)), version: 3 };
|
|
196
|
+
const policy = policyOf(`alice ${k.pub}\n`);
|
|
197
|
+
expect(both(policy, { ...a, seal })).toEqual({ ours: null, keygen: true });
|
|
198
|
+
for (const edited of [{ binding: "deploy dep_43 until 2026-11-01T12:00:00Z" }, { binding: undefined }]) {
|
|
199
|
+
const res = both(policy, { ...a, ...edited, seal });
|
|
200
|
+
expect(res.keygen).toBe(false);
|
|
201
|
+
expect(res.ours).toMatch(/does not verify for alice/);
|
|
202
|
+
}
|
|
203
|
+
// A seal made before #4697, with no binding, can't take one on afterwards.
|
|
204
|
+
const plain = approval();
|
|
205
|
+
const old = { signer: "alice", key: "SHA256:x", signature: sign(k, gateSealPayload(plain)) };
|
|
206
|
+
expect(both(policy, { ...plain, seal: old })).toEqual({ ours: null, keygen: true });
|
|
207
|
+
expect(both(policy, { ...plain, binding: "deploy dep_42", seal: old }).ours).toMatch(/does not verify for alice/);
|
|
208
|
+
});
|
|
209
|
+
});
|
|
210
|
+
|
|
167
211
|
describe("the refusals that need no signature", () => {
|
|
168
212
|
const signers = (over: Partial<GateSigners> = {}): GateSigners => ({ base: "a".repeat(40), signersPath: ".chant/allowed_signers", active: true, signers: [], problems: [], ...over });
|
|
169
213
|
|