@intentius/chant 0.124.29 → 0.124.31
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/build.d.ts.map +1 -1
- package/dist/cli/handlers/build.js +4 -1
- package/dist/cli/handlers/fan-out.d.ts.map +1 -1
- package/dist/cli/handlers/fan-out.js +27 -5
- package/dist/cli/handlers/pr.d.ts.map +1 -1
- package/dist/cli/main.d.ts.map +1 -1
- package/dist/cli/main.js +64 -0
- package/dist/cli/parse-args.d.ts.map +1 -1
- package/dist/cli/parse-args.js +99 -0
- package/dist/cli/registry.d.ts +35 -1
- package/dist/cli/registry.d.ts.map +1 -1
- package/dist/components/pr-pipeline.d.ts +24 -0
- package/dist/components/pr-pipeline.d.ts.map +1 -1
- package/dist/components/pr-pipeline.js +16 -0
- package/dist/components/pr-run.d.ts +20 -2
- package/dist/components/pr-run.d.ts.map +1 -1
- package/dist/components/pr-run.js +26 -13
- package/dist/components/wave-plan.d.ts +11 -0
- package/dist/components/wave-plan.d.ts.map +1 -1
- package/dist/components/wave-plan.js +26 -0
- package/dist/lifecycle/release-ledger.d.ts +8 -3
- package/dist/lifecycle/release-ledger.d.ts.map +1 -1
- package/dist/lifecycle/release-ledger.js +2 -0
- package/dist/lifecycle/run-ledger.d.ts +1 -1
- package/dist/lifecycle/run-ledger.d.ts.map +1 -1
- package/dist/lifecycle/run-ledger.js +9 -0
- package/dist/op/activities/activity-contracts.d.ts +1 -0
- package/dist/op/activities/activity-contracts.d.ts.map +1 -1
- package/dist/op/activities/activity-contracts.js +1 -0
- package/dist/op/activities/shell.d.ts +6 -0
- package/dist/op/activities/shell.d.ts.map +1 -1
- package/dist/op/activities/shell.js +1 -1
- package/dist/op/local-executor.d.ts +35 -1
- package/dist/op/local-executor.d.ts.map +1 -1
- package/dist/op/local-executor.js +31 -6
- package/dist/op/redact.d.ts +34 -0
- package/dist/op/redact.d.ts.map +1 -0
- package/dist/op/redact.js +94 -0
- package/dist/op/runtime.d.ts +27 -0
- package/dist/op/runtime.d.ts.map +1 -1
- package/dist/op/runtime.js +20 -0
- package/dist/op/step-console.d.ts +2 -0
- package/dist/op/step-console.d.ts.map +1 -1
- package/dist/op/step-console.js +5 -2
- package/dist/pr-forge.d.ts +40 -0
- package/dist/pr-forge.d.ts.map +1 -1
- package/dist/pr-forge.js +56 -6
- package/dist/pr-loop.d.ts +10 -0
- package/dist/pr-loop.d.ts.map +1 -1
- package/dist/pr-loop.js +7 -0
- package/dist/pr-report-url.d.ts +8 -0
- package/dist/pr-report-url.d.ts.map +1 -1
- package/dist/pr-report-url.js +47 -1
- package/dist/run-event-stream.d.ts +2 -2
- package/dist/run-event-stream.d.ts.map +1 -1
- package/dist/run-event-stream.js +2 -2
- package/dist/run-event.d.ts +15 -0
- package/dist/run-event.d.ts.map +1 -1
- package/dist/run-event.js +2 -0
- package/dist/wave-runtime.mjs +171 -171
- package/dist/workspace/ci-green-forge.d.ts +2 -0
- package/dist/workspace/ci-green-forge.d.ts.map +1 -1
- package/dist/workspace/ci-green.d.ts +2 -0
- package/dist/workspace/ci-green.d.ts.map +1 -1
- package/dist/workspace/ci-green.js +4 -2
- package/dist/workspace/ci-run-index.d.ts +96 -0
- package/dist/workspace/ci-run-index.d.ts.map +1 -0
- package/dist/workspace/ci-run-index.js +162 -0
- package/dist/workspace/ci-run-index.schema.json +50 -0
- package/dist/workspace/ci-run.d.ts +299 -0
- package/dist/workspace/ci-run.d.ts.map +1 -0
- package/dist/workspace/ci-run.js +691 -0
- package/dist/workspace/ci-runner-key.d.ts +120 -0
- package/dist/workspace/ci-runner-key.d.ts.map +1 -0
- package/dist/workspace/ci-runner-key.js +217 -0
- package/dist/workspace/ci-secrets.d.ts +65 -0
- package/dist/workspace/ci-secrets.d.ts.map +1 -0
- package/dist/workspace/ci-secrets.js +211 -0
- package/dist/workspace/ci-serve.d.ts +227 -0
- package/dist/workspace/ci-serve.d.ts.map +1 -0
- package/dist/workspace/ci-serve.js +468 -0
- package/dist/workspace/pr-report.schema.json +5 -0
- package/dist/workspace/reason-codes.d.ts +6 -2
- package/dist/workspace/reason-codes.d.ts.map +1 -1
- package/dist/workspace/reason-codes.js +7 -2
- package/dist/workspace/run-event.schema.json +14 -3
- package/dist/workspace/status-stewards.d.ts +2 -0
- package/dist/workspace/status-stewards.d.ts.map +1 -1
- package/dist/workspace/status-stewards.js +1 -0
- package/dist/workspace/status.schema.json +12 -1
- package/dist/workspace/trust/trust-write.d.ts +109 -0
- package/dist/workspace/trust/trust-write.d.ts.map +1 -0
- package/dist/workspace/trust/trust-write.js +320 -0
- package/dist/workspace/trust-write.schema.json +265 -0
- package/package.json +1 -1
- package/src/cli/handlers/build.test.ts +15 -0
- package/src/cli/handlers/build.ts +4 -1
- package/src/cli/handlers/fan-out.test.ts +82 -0
- package/src/cli/handlers/fan-out.ts +34 -5
- package/src/cli/handlers/pr.ts +5 -0
- package/src/cli/main.test.ts +1 -0
- package/src/cli/main.ts +64 -0
- package/src/cli/parse-args.ts +71 -0
- package/src/cli/registry.ts +35 -1
- package/src/components/pr-pipeline.ts +32 -0
- package/src/components/pr-run.test.ts +127 -0
- package/src/components/pr-run.ts +32 -12
- package/src/components/wave-plan.ts +30 -0
- package/src/lifecycle/release-ledger.ts +9 -3
- package/src/lifecycle/run-ledger.ts +7 -1
- package/src/op/activities/activity-contracts.ts +1 -0
- package/src/op/activities/shell.ts +7 -1
- package/src/op/local-executor.ts +58 -7
- package/src/op/redact.ts +93 -0
- package/src/op/runtime.ts +42 -0
- package/src/op/step-console.ts +7 -2
- package/src/pr-forge.test.ts +54 -0
- package/src/pr-forge.ts +92 -6
- package/src/pr-loop.test.ts +13 -1
- package/src/pr-loop.ts +16 -0
- package/src/pr-report-url.ts +53 -1
- package/src/run-event-stream.ts +4 -3
- package/src/run-event.ts +17 -0
- package/src/workspace/ci-green-forge.ts +2 -0
- package/src/workspace/ci-green.ts +6 -2
- package/src/workspace/ci-run-index.schema.json +50 -0
- package/src/workspace/ci-run-index.test.ts +353 -0
- package/src/workspace/ci-run-index.ts +192 -0
- package/src/workspace/ci-run.test.ts +716 -0
- package/src/workspace/ci-run.ts +833 -0
- package/src/workspace/ci-runner-key.test.ts +166 -0
- package/src/workspace/ci-runner-key.ts +250 -0
- package/src/workspace/ci-secrets.test.ts +106 -0
- package/src/workspace/ci-secrets.ts +213 -0
- package/src/workspace/ci-serve.test.ts +367 -0
- package/src/workspace/ci-serve.ts +574 -0
- package/src/workspace/pr-report.schema.json +5 -0
- package/src/workspace/reason-codes.test.ts +2 -0
- package/src/workspace/reason-codes.ts +7 -2
- package/src/workspace/run-event.schema.json +14 -3
- package/src/workspace/status-stewards.ts +3 -0
- package/src/workspace/status.schema.json +12 -1
- package/src/workspace/trust/trust-write.test.ts +179 -0
- package/src/workspace/trust/trust-write.ts +377 -0
- package/src/workspace/trust-write.schema.json +265 -0
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"pr-run.d.ts","sourceRoot":"","sources":["../../src/components/pr-run.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"pr-run.d.ts","sourceRoot":"","sources":["../../src/components/pr-run.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA2CG;AAEH,OAAO,EAA2C,KAAK,iBAAiB,EAA2C,MAAM,eAAe,CAAC;AACzI,OAAO,EAAgB,KAAK,SAAS,EAAE,KAAK,cAAc,EAAE,MAAM,YAAY,CAAC;AAC/E,OAAO,EAIL,KAAK,UAAU,EACf,KAAK,QAAQ,EACb,KAAK,SAAS,EACd,KAAK,QAAQ,EACb,KAAK,QAAQ,EACd,MAAM,YAAY,CAAC;AACpB,OAAO,EAAiB,KAAK,eAAe,EAAE,KAAK,qBAAqB,EAAE,MAAM,UAAU,CAAC;AAE3F,OAAO,EAAa,KAAK,eAAe,EAAE,MAAM,eAAe,CAAC;AAChE,OAAO,EAAmB,KAAK,qBAAqB,EAAE,KA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C;IAClB,KAAK,CAAC,EAAE,SAAS,CAAC;CACnB,CAAC;AAEN;;;;;;;;;;;;;;GAcG;AACH,wBAAsB,WAAW,CAAC,OAAO,EAAE,eAAe,GAAG,OAAO,CAAC,QAAQ,CAAC,CA8B7E;AAED,MAAM,WAAW,aAAa;IAC5B,KAAK,EAAE,MAAM,GAAG,OAAO,CAAC;IACxB,EAAE,EAAE,MAAM,GAAG,IAAI,CAAC;IAClB,GAAG,EAAE,MAAM,CAAC;IACZ,kEAAkE;IAClE,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,EAAE,MAAM,CAAC;IACb,EAAE,EAAE,MAAM,CAAC;IACX,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,EAAE,UAAU,CAAC;IACjB,MAAM,EAAE,qBAAqB,CAAC;IAC9B,GAAG,EAAE,SAAS,CAAC;IACf,QAAQ,EAAE,UAAU,CAAC;IACrB,MAAM,EAAE,QAAQ,CAAC;IACjB,OAAO,CAAC,EAAE,QAAQ,EAAE,CAAC;IACrB,OAAO,CAAC,EAAE,SAAS,CAAC;IACpB,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,yEAAyE;IACzE,OAAO,CAAC,EAAE,MAAM,EAAE,CAAC;CACpB;AAED,iCAAiC;AACjC,wBAAgB,QAAQ,CAAC,KAAK,EAAE,aAAa,GAAG,QAAQ,CA8BvD"}
|
|
@@ -19,6 +19,16 @@
|
|
|
19
19
|
* its dependents in one rollout is what gated waves are for (#3049): each
|
|
20
20
|
* wave is planned after the one before it applied.
|
|
21
21
|
*
|
|
22
|
+
* A dependency the change did not select is read the same way (#4104), so
|
|
23
|
+
* a change to one cluster plans it against the network it sits on. That is
|
|
24
|
+
* why `components` is every component in the project and not the selection.
|
|
25
|
+
* `--seed-outputs` wins over a read, and a dependency whose steps cannot say
|
|
26
|
+
* leaves its dependents' references unresolved. The apply stage's plan reads
|
|
27
|
+
* the same dependencies, so on the same estate it gets the digest the plan
|
|
28
|
+
* stage showed, and it applies against the outputs its plans read
|
|
29
|
+
* (`set.outputs`). A resume plans against the outputs the approved plans
|
|
30
|
+
* read, from the record (`planOutputs`), and reads nothing those cover.
|
|
31
|
+
*
|
|
22
32
|
* ## Finishing an apply that failed partway
|
|
23
33
|
*
|
|
24
34
|
* {@link resumePrSet} (#3464) is fan-out's resume (#2417, #3049) for a pull
|
|
@@ -39,7 +49,7 @@ import { deployContext } from "./driver.js";
|
|
|
39
49
|
import { deployUnits } from "./deploy-units.js";
|
|
40
50
|
import { runFanOut } from "./fan-out-run.js";
|
|
41
51
|
import { remainingFanOut } from "./fan-out.js";
|
|
42
|
-
import { planWaveComponent,
|
|
52
|
+
import { planWaveComponent, readDeployedOutputs } from "./wave-plan.js";
|
|
43
53
|
/** The phase a pull request's planning is, in its run's events. */
|
|
44
54
|
export const PR_PLAN_PHASE = "plan";
|
|
45
55
|
/** A failed component's members: the units its steps target, else the component itself. */
|
|
@@ -53,12 +63,15 @@ function failedParts(component, error) {
|
|
|
53
63
|
/**
|
|
54
64
|
* Plan every component in `plan.order`, a wave at a time, each against the
|
|
55
65
|
* outputs its dependencies have now. Never throws for a component that fails
|
|
56
|
-
* to plan: it becomes a failed member, and `failed` is set.
|
|
66
|
+
* to plan: it becomes a failed member, and `failed` is set. Throws when a
|
|
67
|
+
* planned member's dependency is not among `components`, which means the
|
|
68
|
+
* caller passed the selection where the whole graph belongs.
|
|
57
69
|
*/
|
|
58
70
|
export async function planPrSet(options) {
|
|
59
71
|
const byName = new Map(options.components.map((c) => [c.name, c]));
|
|
60
72
|
const outputs = { ...(options.seededOutputs ?? {}) };
|
|
61
73
|
const read = new Set(Object.keys(outputs));
|
|
74
|
+
const deployed = {};
|
|
62
75
|
const parts = [];
|
|
63
76
|
const componentOf = new Map();
|
|
64
77
|
const plans = {};
|
|
@@ -68,17 +81,15 @@ export async function planPrSet(options) {
|
|
|
68
81
|
for (const wave of options.plan.waves) {
|
|
69
82
|
// The dependencies' outputs first, each read once. A dependency that
|
|
70
83
|
// cannot say leaves its references unresolved, which its dependent's
|
|
71
|
-
// plan reports if it needs them.
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
if (found)
|
|
79
|
-
outputs[dep] = found;
|
|
80
|
-
}
|
|
84
|
+
// plan reports if it needs them. A dependency outside the selection is
|
|
85
|
+
// read the same way (#4104).
|
|
86
|
+
const deps = [...new Set(wave.flatMap((name) => byName.get(name)?.dependsOn ?? []))].filter((dep) => !read.has(dep));
|
|
87
|
+
for (const dep of deps) {
|
|
88
|
+
read.add(dep);
|
|
89
|
+
if (!byName.has(dep))
|
|
90
|
+
throw new Error(`planPrSet: ${dep}, a dependency of a planned member, is not among the components; pass every component in the project`);
|
|
81
91
|
}
|
|
92
|
+
Object.assign(deployed, await readDeployedOutputs(deps, byName, options.registry, (dep) => deployContext(options, dep), outputs));
|
|
82
93
|
const planned = await Promise.all(wave.map(async (name) => {
|
|
83
94
|
const at = { component: name, phase: PR_PLAN_PHASE, step: "plan" };
|
|
84
95
|
emit?.({ type: "step-start", ...at });
|
|
@@ -120,7 +131,8 @@ export async function planPrSet(options) {
|
|
|
120
131
|
counts: memberCounts(doc, m.member),
|
|
121
132
|
...(m.error ? { error: m.error } : {}),
|
|
122
133
|
}));
|
|
123
|
-
|
|
134
|
+
const deployedOutputs = Object.fromEntries(Object.entries(deployed).sort(([a], [b]) => a.localeCompare(b)));
|
|
135
|
+
return { doc, members, plans, outputs, failed, ...(Object.keys(deployedOutputs).length > 0 ? { deployedOutputs } : {}) };
|
|
124
136
|
}
|
|
125
137
|
/**
|
|
126
138
|
* A ledger that reads the real one and records nothing. The plan stage
|
|
@@ -368,6 +380,7 @@ export function prReport(input) {
|
|
|
368
380
|
...(input.refusal ? { refusal: input.refusal } : {}),
|
|
369
381
|
...(input.message ? { message: input.message } : {}),
|
|
370
382
|
...(input.resumed ? { resumed: { applied: [...input.resumed].sort() } } : {}),
|
|
383
|
+
...(input.set.deployedOutputs ? { deployedOutputs: input.set.deployedOutputs } : {}),
|
|
371
384
|
approval: input.approval,
|
|
372
385
|
selection: {
|
|
373
386
|
changed: input.plan.order.filter((c) => changed.has(c)),
|
|
@@ -53,4 +53,15 @@ export declare function planWaveComponent(component: DriverComponent, registry:
|
|
|
53
53
|
* the components a planned one depends on, before anything has applied.
|
|
54
54
|
*/
|
|
55
55
|
export declare function readComponentOutputs(component: DriverComponent, registry: CapabilityRegistry, ctx: DeployContext, componentOutputs: Record<string, Record<string, unknown>>): Promise<Record<string, unknown> | undefined>;
|
|
56
|
+
/**
|
|
57
|
+
* Read the deployed outputs of each of `names` that `outputs` holds nothing
|
|
58
|
+
* for yet (#4104), through {@link readComponentOutputs}, and add them to
|
|
59
|
+
* `outputs`. A name that is not among `components`, or whose steps cannot
|
|
60
|
+
* say, is left out, so its dependents' references stay unresolved. Returns,
|
|
61
|
+
* per component read, the names of the outputs the read gave, sorted.
|
|
62
|
+
*
|
|
63
|
+
* `components` must be the whole graph, not the selection: the dependency a
|
|
64
|
+
* selected member reads is often one the change did not select.
|
|
65
|
+
*/
|
|
66
|
+
export declare function readDeployedOutputs(names: readonly string[], components: ReadonlyMap<string, DriverComponent>, registry: CapabilityRegistry, ctxOf: (component: string) => DeployContext, outputs: Record<string, Record<string, unknown>>): Promise<Record<string, string[]>>;
|
|
56
67
|
//# sourceMappingURL=wave-plan.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"wave-plan.d.ts","sourceRoot":"","sources":["../../src/components/wave-plan.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;GAmBG;AAEH,OAAO,EAA6C,KAAK,eAAe,EAAE,KAAK,WAAW,EAAE,KAAK,UAAU,EAAE,MAAM,UAAU,CAAC;AAE9H,OAAO,KAAK,EAAE,kBAAkB,EAAE,aAAa,EAAE,MAAM,cAAc,CAAC;AACtE,OAAO,KAAK,EAAE,UAAU,EA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;GAKG;AACH,wBAAsB,oBAAoB,CACxC,SAAS,EAAE,eAAe,EAC1B,QAAQ,EAAE,kBAAkB,EAC5B,GAAG,EAAE,aAAa,EAClB,gBAAgB,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC,GACxD,OAAO,CAAC,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,SAAS,CAAC,CAU9C;AAED;;;;;;;;;GASG;AACH,wBAAsB,mBAAmB,CACvC,KAAK,EAAE,SAAS,MAAM,EAAE,EACxB,UAAU,EAAE,WAAW,CAAC,MAAM,EAAE,eAAe,CAAC,EAChD,QAAQ,EAAE,kBAAkB,EAC5B,KAAK,EAAE,CAAC,SAAS,EAAE,MAAM,KAAK,aAAa,EAC3C,OAAO,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC,GAC/C,OAAO,CAAC,MAAM,CAAC,MAAM,EAAE,MAAM,EAAE,CAAC,CAAC,CAYnC"}
|
|
@@ -108,3 +108,29 @@ export async function readComponentOutputs(component, registry, ctx, componentOu
|
|
|
108
108
|
}
|
|
109
109
|
return found;
|
|
110
110
|
}
|
|
111
|
+
/**
|
|
112
|
+
* Read the deployed outputs of each of `names` that `outputs` holds nothing
|
|
113
|
+
* for yet (#4104), through {@link readComponentOutputs}, and add them to
|
|
114
|
+
* `outputs`. A name that is not among `components`, or whose steps cannot
|
|
115
|
+
* say, is left out, so its dependents' references stay unresolved. Returns,
|
|
116
|
+
* per component read, the names of the outputs the read gave, sorted.
|
|
117
|
+
*
|
|
118
|
+
* `components` must be the whole graph, not the selection: the dependency a
|
|
119
|
+
* selected member reads is often one the change did not select.
|
|
120
|
+
*/
|
|
121
|
+
export async function readDeployedOutputs(names, components, registry, ctxOf, outputs) {
|
|
122
|
+
const read = {};
|
|
123
|
+
for (const name of names) {
|
|
124
|
+
if (name in outputs || name in read)
|
|
125
|
+
continue;
|
|
126
|
+
const component = components.get(name);
|
|
127
|
+
if (!component)
|
|
128
|
+
continue;
|
|
129
|
+
const found = await readComponentOutputs(component, registry, ctxOf(name), outputs);
|
|
130
|
+
if (!found)
|
|
131
|
+
continue;
|
|
132
|
+
outputs[name] = found;
|
|
133
|
+
read[name] = Object.keys(found).sort();
|
|
134
|
+
}
|
|
135
|
+
return read;
|
|
136
|
+
}
|
|
@@ -41,15 +41,20 @@ export interface RunOrigin {
|
|
|
41
41
|
* Which id space minted `runId`: `github` (a GitHub Actions run id — also
|
|
42
42
|
* the spelling Forgejo Actions uses, since it implements the same env
|
|
43
43
|
* contract; `url` disambiguates the actual host), `gitlab` (a CI pipeline
|
|
44
|
-
* id), `op` (an orchestrator/Op run id),
|
|
45
|
-
* that ran the deploy, resolvable nowhere)
|
|
44
|
+
* id), `op` (an orchestrator/Op run id), `local` (minted on the machine
|
|
45
|
+
* that ran the deploy, resolvable nowhere), or `chant` (a job the chant
|
|
46
|
+
* runner ran, `chant ci run`, #4094, named by its Op run id). `chant` was
|
|
47
|
+
* added within contract 1 by {@link RUN_ORIGIN_CHANT_FLOOR}, so a reader
|
|
48
|
+
* that switches on `forge` keeps a case for a value it does not know.
|
|
46
49
|
*/
|
|
47
|
-
forge: "github" | "gitlab" | "op" | "local";
|
|
50
|
+
forge: "github" | "gitlab" | "op" | "local" | "chant";
|
|
48
51
|
/** Repo/project slug on the forge (`GITHUB_REPOSITORY` / `CI_PROJECT_PATH`), when the environment named one. */
|
|
49
52
|
repo?: string;
|
|
50
53
|
/** Resolved link to the run, when the environment provided enough to build one. */
|
|
51
54
|
url?: string;
|
|
52
55
|
}
|
|
56
|
+
/** The first chant that writes `runOrigin.forge: "chant"`, for a job `chant ci run` ran (#4094). */
|
|
57
|
+
export declare const RUN_ORIGIN_CHANT_FLOOR = "0.124.30";
|
|
53
58
|
/**
|
|
54
59
|
* The gate resolution that admitted a deploy (#4020): the gate's address in the
|
|
55
60
|
* gate ledger (`_gates/<op>.jsonl`, `op` and `gate`) and when the resolution
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"release-ledger.d.ts","sourceRoot":"","sources":["../../src/lifecycle/release-ledger.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA4BG;AAGH,OAAO,EAAyC,KAAK,gBAAgB,EAAE,MAAM,iBAAiB,CAAC;AAC/F,OAAO,EAAwG,KAAK,cAAc,EAAE,MAAM,OAAO,CAAC;AAElJ,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,eAAe,CAAC;AAG1D,OAAO,EAAE,qBAAqB,EAAE,kBAAkB,EAAE,kBAAkB,EAAE,kBAAkB,EAAE,yBAAyB,EAAE,MAAM,gBAAgB,CAAC;AAC9I,YAAY,EAAE,cAAc,EAAE,MAAM,eAAe,CAAC;AAEpD;;;GAGG;AACH,MAAM,WAAW,SAAS;IACxB
|
|
1
|
+
{"version":3,"file":"release-ledger.d.ts","sourceRoot":"","sources":["../../src/lifecycle/release-ledger.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA4BG;AAGH,OAAO,EAAyC,KAAK,gBAAgB,EAAE,MAAM,iBAAiB,CAAC;AAC/F,OAAO,EAAwG,KAAK,cAAc,EAAE,MAAM,OAAO,CAAC;AAElJ,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,eAAe,CAAC;AAG1D,OAAO,EAAE,qBAAqB,EAAE,kBAAkB,EAAE,kBAAkB,EAAE,kBAAkB,EAAE,yBAAyB,EAAE,MAAM,gBAAgB,CAAC;AAC9I,YAAY,EAAE,cAAc,EAAE,MAAM,eAAe,CAAC;AAEpD;;;GAGG;AACH,MAAM,WAAW,SAAS;IACxB;;;;;;;;;OASG;IACH,KAAK,EAAE,QAAQ,GAAG,QAAQ,GAAG,IAAI,GAAG,OAAO,GAAG,OAAO,CAAC;IACtD,gHAAgH;IAChH,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,mFAAmF;IACnF,GA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CAAA;CAAE,GACtB,OAAO,CAAC;IAAE,MAAM,EAAE,MAAM,CAAC;IAAC,MAAM,EAAE,aAAa,CAAA;CAAE,CAAC,CASpD;AAED;;;;;GAKG;AACH,wBAAsB,iBAAiB,CACrC,WAAW,EAAE,MAAM,EACnB,IAAI,CAAC,EAAE,cAAc,GACpB,OAAO,CAAC;IAAE,OAAO,EAAE,aAAa,EAAE,CAAC;IAAC,SAAS,EAAE,MAAM,CAAA;CAAE,CAAC,CAS1D;AAED;;;;GAIG;AACH,wBAAsB,uBAAuB,CAAC,IAAI,CAAC,EAAE,cAAc,GAAG,OAAO,CAAC,MAAM,EAAE,CAAC,CAEtF;AAED;;;;;GAKG;AACH,wBAAgB,kBAAkB,CAAC,OAAO,EAAE,aAAa,EAAE,GAAG,GAAG,CAAC,MAAM,EAAE,aAAa,CAAC,CASvF;AAED;;;;;GAKG;AACH,wBAAgB,gBAAgB,CAAC,OAAO,EAAE,aAAa,EAAE,EAAE,MAAM,EAAE,MAAM,GAAG,aAAa,EAAE,CAE1F"}
|
|
@@ -33,6 +33,8 @@ import { appendReleaseRecordLine, readReleaseLedgerLines, listLedgerEnvironments
|
|
|
33
33
|
import { parseReleaseLedger, validateReleaseRecord } from "./release-read.js";
|
|
34
34
|
// The pure readers live apart, so a bundle can import them without git (#3865).
|
|
35
35
|
export { validateReleaseRecord, parseReleaseLedger, releaseLedgerLines, readReleaseRecords, listReleaseEnvironmentsOn } from "./release-read.js";
|
|
36
|
+
/** The first chant that writes `runOrigin.forge: "chant"`, for a job `chant ci run` ran (#4094). */
|
|
37
|
+
export const RUN_ORIGIN_CHANT_FLOOR = "0.124.30";
|
|
36
38
|
/**
|
|
37
39
|
* The approver and admission a release records for the resolutions of its gate
|
|
38
40
|
* (#4020): those of `gate` on `op` bound to `planDigest`. The approver is the
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import type { OpConfig } from "../op/types.js";
|
|
2
2
|
import type { StepRecord } from "../op/local-executor.js";
|
|
3
|
-
import type
|
|
3
|
+
import { type OpRunRecord, type OpRunRecordInput } from "../op/runtime.js";
|
|
4
4
|
/** The env a run records against when its Op declares no `labels.Env`. */
|
|
5
5
|
export declare const DEFAULT_RUN_ENV = "local";
|
|
6
6
|
/** The env a run records against: the Op's own `labels.Env`, else {@link DEFAULT_RUN_ENV}. */
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"run-ledger.d.ts","sourceRoot":"","sources":["../../src/lifecycle/run-ledger.ts"],"names":[],"mappings":"AAsCA,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,aAAa,CAAC;AAC5C,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,sBAAsB,CAAC;AACvD,OAAO,KAAK,
|
|
1
|
+
{"version":3,"file":"run-ledger.d.ts","sourceRoot":"","sources":["../../src/lifecycle/run-ledger.ts"],"names":[],"mappings":"AAsCA,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,aAAa,CAAC;AAC5C,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,sBAAsB,CAAC;AACvD,OAAO,EAAkB,KAAK,WAAW,EAAE,KAAK,gBAAgB,EAA+C,MAAM,eAAe,CAAC;AASrI,0EAA0E;AAC1E,eAAO,MAAM,eAAe,UAAU,CAAC;AAMvC,8FAA8F;AAC9F,wBAAgB,QAAQ,CAAC,MAAM,EAAE,IAAI,CAAC,QAAQ,EAAE,QAAQ,CAAC,GAAG,MAAM,CAEjE;AAQD;;;;;;;;;;GAUG;AACH,wBAAgB,cAAc,CAC5B,MAAM,EAAE,IAAI,CAAC,QAAQ,EAAE,MAAM,GAAG,QAAQ,CAAC,EACzC,OAAO,EAAE,SAAS,UAAU,EAAE,EAC9B,KAAK,EAAE;IACL,OAAO,EAAE,MAAM,CAAC;IAChB,KAAK,EAAE,MAAM,CAAC;IACd,MAAM,EAAE,WAAW,CAAC,QAAQ,CAAC,CAAC;IAC9B,EAAE,CAAC,EAAE,MAAM,CAAC;IACZ,IAAI,CAAC,EAAE,WAAW,CAAC,MAAM,CAAC,CAAC;IAC3B,KAAK,CAAC,EAAE,WAAW,CAAC,OAAO,CAAC,CAAC;IAC7B,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,mEAAmE;IACnE,OAAO,CAAC,EAAE,WAAW,CAAC,SAAS,CAAC,CAAC;IACjC,6CAA6C;IAC7C,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,2DAA2D;IAC3D,SAAS,CAAC,EAAE,WAAW,CAAC,WAAW,CAAC,CAAC;IACrC,0EAA0E;IAC1E,cAAc,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;CACzC,GACA,gBAAgB,CAiDlB;AAED;;;;;;;;;GASG;AACH,wBAAsB,eAAe,CACnC,KAAK,EAAE,gBAAgB,EACvB,IAAI,CAAC,EAAE;IAAE,GAAG,CAAC,EAAE,MAAM,CAAA;CAAE,GACtB,OAAO,CAAC;IAAE,MAAM,EAAE,MAAM,CAAC;IAAC,MAAM,EAAE,WAAW,CAAA;CAAE,CAAC,CAsBlD;AAED;;;;GAIG;AACH,wBAAsB,aAAa,CACjC,WAAW,EAAE,MAAM,EACnB,EAAE,EAAE,MAAM,EACV,IAAI,CAAC,EAAE;IAAE,GAAG,CAAC,EAAE,MAAM,CAAA;CAAE,GACtB,OAAO,CAAC;IAAE,OAAO,EAAE,WAAW,EAAE,CAAC;IAAC,SAAS,EAAE,MAAM,CAAA;CAAE,CAAC,CAkCxD"}
|
|
@@ -36,6 +36,7 @@
|
|
|
36
36
|
*/
|
|
37
37
|
import { randomUUID } from "node:crypto";
|
|
38
38
|
import { sortedJsonReplacer } from "../utils.js";
|
|
39
|
+
import { opRunFailureOf } from "../op/runtime.js";
|
|
39
40
|
import { readBlobFromPath, readPathSha, readBlobBySha, writeBlobToPath, RefCASConflictError } from "./git.js";
|
|
40
41
|
/** Prefix folding the per-op run ledgers into one flat name under `<env>/`. See the module doc. */
|
|
41
42
|
const PREFIX = "runs__";
|
|
@@ -177,6 +178,14 @@ export async function readRunLedger(environment, op, opts) {
|
|
|
177
178
|
malformed++;
|
|
178
179
|
continue;
|
|
179
180
|
}
|
|
181
|
+
// A `failure` (#4094) that is not one is dropped and the line kept, as a gate line's wrong-typed `gitSha` is.
|
|
182
|
+
if ("failure" in parsed) {
|
|
183
|
+
const failure = opRunFailureOf(parsed.failure);
|
|
184
|
+
if (failure)
|
|
185
|
+
parsed.failure = failure;
|
|
186
|
+
else
|
|
187
|
+
delete parsed.failure;
|
|
188
|
+
}
|
|
180
189
|
records.push(parsed);
|
|
181
190
|
}
|
|
182
191
|
catch {
|
|
@@ -47,6 +47,7 @@ export declare const shellCmdContract: import("../index.js").ActivityContract<{
|
|
|
47
47
|
cmd: string;
|
|
48
48
|
env?: Record<string, string> | undefined;
|
|
49
49
|
cwd?: string | undefined;
|
|
50
|
+
inheritEnv?: boolean | undefined;
|
|
50
51
|
okExit?: number[] | undefined;
|
|
51
52
|
gatedExit?: number | undefined;
|
|
52
53
|
gate?: {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"activity-contracts.d.ts","sourceRoot":"","sources":["../../../src/op/activities/activity-contracts.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;GAuBG;AAMH,eAAO,MAAM,yBAAyB;;SAGrC,CAAC;AAEF,eAAO,MAAM,qBAAqB;;;;;;;EAIjC,CAAC;AAEF;;;;;;;;;GASG;AACH,eAAO,MAAM,gBAAgB
|
|
1
|
+
{"version":3,"file":"activity-contracts.d.ts","sourceRoot":"","sources":["../../../src/op/activities/activity-contracts.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;GAuBG;AAMH,eAAO,MAAM,yBAAyB;;SAGrC,CAAC;AAEF,eAAO,MAAM,qBAAqB;;;;;;;EAIjC,CAAC;AAEF;;;;;;;;;GASG;AACH,eAAO,MAAM,gBAAgB;;;;;;;;;;;;;;;;;EAgB5B,CAAC;AAEF,eAAO,MAAM,iBAAi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AIhC,CAAC;AAEF,eAAO,MAAM,oBAAoB;;;;;;;;;;;;EAIhC,CAAC;AAEF,eAAO,MAAM,qBAAqB;;;;;;;;;;;;;;;EASjC,CAAC"}
|
|
@@ -41,6 +41,7 @@ export const shellCmdContract = activityContract("shellCmd", z.strictObject({
|
|
|
41
41
|
cmd: z.string(),
|
|
42
42
|
env: z.record(z.string(), z.string()).optional(),
|
|
43
43
|
cwd: z.string().optional(),
|
|
44
|
+
inheritEnv: z.boolean().optional(),
|
|
44
45
|
okExit: z.array(z.number()).optional(),
|
|
45
46
|
gatedExit: z.number().optional(),
|
|
46
47
|
gate: z.strictObject({ op: z.string(), gate: z.string() }).optional(),
|
|
@@ -4,6 +4,12 @@ export interface ShellCmdArgs {
|
|
|
4
4
|
env?: Record<string, string>;
|
|
5
5
|
/** Working directory. Default: process.cwd(). */
|
|
6
6
|
cwd?: string;
|
|
7
|
+
/**
|
|
8
|
+
* Whether the command sees this process's environment. Default true. With
|
|
9
|
+
* false it sees `env` alone, plus the in-flight record's variable, so a job
|
|
10
|
+
* the chant runner runs (`chant ci run`, #4094) gets a clean environment.
|
|
11
|
+
*/
|
|
12
|
+
inheritEnv?: boolean;
|
|
7
13
|
/**
|
|
8
14
|
* Exit codes that count as success. Default `[0]`.
|
|
9
15
|
*
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"shell.d.ts","sourceRoot":"","sources":["../../../src/op/activities/shell.ts"],"names":[],"mappings":"AASA,MAAM,WAAW,YAAY;IAC3B,GAAG,EAAE,MAAM,CAAC;IACZ,wCAAwC;IACxC,GAAG,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IAC7B,iDAAiD;IACjD,GAAG,CAAC,EAAE,MAAM,CAAC;IACb;;;;;;;;OAQG;IACH,MAAM,CAAC,EAAE,MAAM,EAAE,CAAC;IAClB;;;;;;;;;;;OAWG;IACH,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB;;;;OAIG;IACH,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EAAuE;IACvE,IAAI,CAAC,EAAE,OAAO,CAAC;CAChB;AAuBD;;;;;GAKG;AACH,wBAAsB,QAAQ,CAAC,IAAI,EAAE,YAAY,EAAE,MAAM,CAAC,EAAE,WAAW,GAAG,OAAO,CAAC,cAAc,CAAC,CA0DhG"}
|
|
@@ -54,7 +54,7 @@ export async function shellCmd(args, signal) {
|
|
|
54
54
|
cwd: args.cwd,
|
|
55
55
|
// In a run that keeps an in-flight record, CHANT_RUN_ACTIVITY names the
|
|
56
56
|
// file the command appends activity lines to (../run-live.ts).
|
|
57
|
-
env: { ...process.env, ...liveRunEnv(), ...args.env },
|
|
57
|
+
env: { ...(args.inheritEnv === false ? {} : process.env), ...liveRunEnv(), ...args.env },
|
|
58
58
|
maxBuffer: MAX_STDOUT_BYTES,
|
|
59
59
|
signal,
|
|
60
60
|
});
|
|
@@ -33,7 +33,8 @@ import { type WaitingPoint } from "./steward-points.js";
|
|
|
33
33
|
import type { OpRunRecord } from "./runtime.js";
|
|
34
34
|
import { type WorkLeaseRunResult } from "./work-lease-run.js";
|
|
35
35
|
import { type RunOrigin } from "../lifecycle/release-ledger.js";
|
|
36
|
-
import { type
|
|
36
|
+
import { type Redact } from "./redact.js";
|
|
37
|
+
import { type RunEventKind, type RunEventRuntime } from "../run-event.js";
|
|
37
38
|
import type { ActivityContract } from "./activity-contract.js";
|
|
38
39
|
export { parseDuration } from "./duration.js";
|
|
39
40
|
/**
|
|
@@ -268,6 +269,28 @@ export interface RunOpOptions {
|
|
|
268
269
|
runtime?: RunEventRuntime;
|
|
269
270
|
runOrigin?: RunOrigin;
|
|
270
271
|
};
|
|
272
|
+
/**
|
|
273
|
+
* What ran the Op, when a runner says so itself (#4094): `chant ci run`
|
|
274
|
+
* runs a pull-request job as an Op and passes `kind: "pipeline"`,
|
|
275
|
+
* `runtime: "ci"` and `runOrigin: { forge: "chant" }`. The run's events
|
|
276
|
+
* carry all three, kept on this host as well as written to
|
|
277
|
+
* {@link runEvents}, and the run record carries `runOrigin` in place of
|
|
278
|
+
* the CI run the environment names. Omitted, the run is an `op` run named
|
|
279
|
+
* as described on {@link runEvents}.
|
|
280
|
+
*/
|
|
281
|
+
runner?: {
|
|
282
|
+
kind: RunEventKind;
|
|
283
|
+
runtime: RunEventRuntime;
|
|
284
|
+
runOrigin: RunOrigin;
|
|
285
|
+
};
|
|
286
|
+
/**
|
|
287
|
+
* Says why a failed run failed (#4094), given the run's step records once
|
|
288
|
+
* it has settled `fail`. What it returns is stored on the record as
|
|
289
|
+
* `failure`, before the record is signed, and carried on the `run-settle`
|
|
290
|
+
* event. `chant ci run` reads the job's pull-request report here, while
|
|
291
|
+
* the checkout it ran in still exists.
|
|
292
|
+
*/
|
|
293
|
+
describeFailure?: (records: readonly StepRecord[]) => OpRunRecord["failure"];
|
|
271
294
|
/**
|
|
272
295
|
* Append the run's {@link OpRunRecord} to the run ledger
|
|
273
296
|
* (`../lifecycle/run-ledger.ts`) when the run settles (#2118). Opt-in on
|
|
@@ -332,6 +355,17 @@ export interface RunOpOptions {
|
|
|
332
355
|
* needs one. The local runtime passes the configured lexicons' contracts.
|
|
333
356
|
*/
|
|
334
357
|
contracts?: ReadonlyMap<string, ActivityContract>;
|
|
358
|
+
/**
|
|
359
|
+
* Redacts secret values (#4096) from what the run writes about itself:
|
|
360
|
+
* each {@link runEvents} line and each line kept on this host, each
|
|
361
|
+
* {@link stepOutput} line and step label, and the run record, its step
|
|
362
|
+
* records and its `failure`, before {@link signRecord} signs it and the
|
|
363
|
+
* ledger stores it. The step records on the result are redacted too. This
|
|
364
|
+
* is the one place a run's writes pass through, so a writer added here
|
|
365
|
+
* later is redacted with the rest. `chant ci run` passes one built from
|
|
366
|
+
* the host's secrets file (../workspace/ci-secrets.ts).
|
|
367
|
+
*/
|
|
368
|
+
redact?: Redact;
|
|
335
369
|
}
|
|
336
370
|
/**
|
|
337
371
|
* Execute an Op locally.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"local-executor.d.ts","sourceRoot":"","sources":["../../src/op/local-executor.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;GAyBG;AAGH,OAAO,KAAK,EAAE,QAAQ,EAAmB,YAAY,EAAwC,MAAM,SAAS,CAAC;AAC7G,OAAO,EAAmB,KAAK,UAAU,EAAE,KAAK,eAAe,EAAE,MAAM,qBAAqB,CAAC;AAQ7F,OAAO,EAAuF,KAAK,cAAc,EAAE,MAAM,QAAQ,CAAC;AAIlI,OAAO,EAA8C,KAAK,cAAc,EAAE,MAAM,kBAAkB,CAAC;AAInG,OAAO,KAAK,EAAE,aAAa,EAAE,iBAAiB,EAAE,MAAM,0BAA0B,CAAC;AACjF,OAAO,EAAe,KAAK,YAAY,EAAE,MAAM,kBAAkB,CAAC;AAIlE,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,WAAW,CAAC;AAE7C,OAAO,EAAsE,KAAK,kBAAkB,EAAE,MAAM,kBAAkB,CAAC;AAK/H,OAAO,EAAgB,KAAK,SAAS,EAAE,MAAM,6BAA6B,CAAC;AAC3E,OAAO,EAAyB,KAAK,eAAe,EAA2B,MAAM,cAAc,CAAC;
|
|
1
|
+
{"version":3,"file":"local-executor.d.ts","sourceRoot":"","sources":["../../src/op/local-executor.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;GAyBG;AAGH,OAAO,KAAK,EAAE,QAAQ,EAAmB,YAAY,EAAwC,MAAM,SAAS,CAAC;AAC7G,OAAO,EAAmB,KAAK,UAAU,EAAE,KAAK,eAAe,EAAE,MAAM,qBAAqB,CAAC;AAQ7F,OAAO,EAAuF,KAAK,cAAc,EAAE,MAAM,QAAQ,CAAC;AAIlI,OAAO,EAA8C,KAAK,cAAc,EAAE,MAAM,kBAAkB,CAAC;AAInG,OAAO,KAAK,EAAE,aAAa,EAAE,iBAAiB,EAAE,MAAM,0BAA0B,CAAC;AACjF,OAAO,EAAe,KAAK,YAAY,EAAE,MAAM,kBAAkB,CAAC;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,UAAU,CAAC,EACnC,QAAQ,EAAE,MAAM,CAAC,MAAM,EAAE,eAAe,CAAC,EACzC,MAAM,CAAC,EAAE,WAAW,EACpB,OAAO,GAAE,YAAiB,GACzB,OAAO,CAAC,WAAW,CAAC,CAsDtB"}
|
|
@@ -50,6 +50,7 @@ import { LiveRun, currentLiveRun, withLiveRun } from "./run-live.js";
|
|
|
50
50
|
import { runEnvOf } from "../lifecycle/run-ledger.js";
|
|
51
51
|
import { resolveCommitSha } from "../lifecycle/commit-sha.js";
|
|
52
52
|
import { resolveCiRun } from "../lifecycle/release-ledger.js";
|
|
53
|
+
import { redactDeep, redactText } from "./redact.js";
|
|
53
54
|
import { runEventsOfStepRecord } from "../run-event.js";
|
|
54
55
|
import { openRunEventStore, teeLines } from "../run-event-store.js";
|
|
55
56
|
import { openRunEventStream, runEventRunOf } from "../run-event-stream.js";
|
|
@@ -1015,7 +1016,11 @@ export async function runOpLocally(config, activities, profiles, signal, options
|
|
|
1015
1016
|
const events = {};
|
|
1016
1017
|
try {
|
|
1017
1018
|
const stepConsole = options.stepOutput
|
|
1018
|
-
? {
|
|
1019
|
+
? {
|
|
1020
|
+
write: options.stepOutput,
|
|
1021
|
+
...(options.stepHeartbeatMs !== undefined ? { heartbeatMs: options.stepHeartbeatMs } : {}),
|
|
1022
|
+
...(options.redact ? { redact: options.redact } : {}),
|
|
1023
|
+
}
|
|
1019
1024
|
: undefined;
|
|
1020
1025
|
return await withLiveRun(live, () => withRunConsole(stepConsole, () => withOpRunContext(run, () => runOpInTurn(config, activities, profiles, signal, { ...options, runId, ...(steward ? { steward } : {}) }, run, events))));
|
|
1021
1026
|
}
|
|
@@ -1043,10 +1048,13 @@ async function runOpInTurn(config, activities, profiles, signal, options, run, e
|
|
|
1043
1048
|
const store = options.ledger
|
|
1044
1049
|
? await openRunEventStore(options.ledger.cwd ?? options.cwd ?? process.cwd(), runId)
|
|
1045
1050
|
: undefined;
|
|
1046
|
-
const
|
|
1051
|
+
const teed = teeLines(options.runEvents?.write, store?.write.bind(store));
|
|
1052
|
+
// #4096: every event line, to the caller and to this host's store alike, is redacted once, here.
|
|
1053
|
+
const redact = options.redact;
|
|
1054
|
+
const eventsWrite = teed && redact ? (line) => teed(redactText(line, redact)) : teed;
|
|
1047
1055
|
const stream = eventsWrite
|
|
1048
1056
|
? openRunEventStream(runEventRunOf({
|
|
1049
|
-
kind: "op",
|
|
1057
|
+
kind: options.runner?.kind ?? "op",
|
|
1050
1058
|
name: config.name,
|
|
1051
1059
|
runId,
|
|
1052
1060
|
...(commit ? { gitSha: commit } : {}),
|
|
@@ -1054,6 +1062,7 @@ async function runOpInTurn(config, activities, profiles, signal, options, run, e
|
|
|
1054
1062
|
steward: options.steward !== undefined,
|
|
1055
1063
|
...(options.runEvents?.runtime ? { runtime: options.runEvents.runtime } : {}),
|
|
1056
1064
|
...(options.runEvents?.runOrigin ? { runOrigin: options.runEvents.runOrigin } : {}),
|
|
1065
|
+
...(options.runner ? { runtime: options.runner.runtime, runOrigin: options.runner.runOrigin } : {}),
|
|
1057
1066
|
}), eventsWrite)
|
|
1058
1067
|
: undefined;
|
|
1059
1068
|
events.stream = stream;
|
|
@@ -1167,7 +1176,7 @@ async function runOpInTurn(config, activities, profiles, signal, options, run, e
|
|
|
1167
1176
|
*/
|
|
1168
1177
|
const settle = async (settled, status, gate, point) => {
|
|
1169
1178
|
const ended = options.now ?? new Date().toISOString();
|
|
1170
|
-
|
|
1179
|
+
let input = buildRunRecord(config, settled, {
|
|
1171
1180
|
started: startedAt,
|
|
1172
1181
|
ended,
|
|
1173
1182
|
status,
|
|
@@ -1178,9 +1187,25 @@ async function runOpInTurn(config, activities, profiles, signal, options, run, e
|
|
|
1178
1187
|
...(options.steward ? { steward: options.steward } : {}),
|
|
1179
1188
|
...(resumed ? { resumed } : {}),
|
|
1180
1189
|
...(commit ? { gitSha: commit } : {}),
|
|
1181
|
-
...(ciRun ? { runOrigin: ciRun.runOrigin } : {}),
|
|
1190
|
+
...(options.runner ? { runOrigin: options.runner.runOrigin } : ciRun ? { runOrigin: ciRun.runOrigin } : {}),
|
|
1182
1191
|
phaseDurations,
|
|
1183
1192
|
});
|
|
1193
|
+
if (status === "fail" && options.describeFailure) {
|
|
1194
|
+
const failure = options.describeFailure(settled);
|
|
1195
|
+
if (failure)
|
|
1196
|
+
input.failure = failure;
|
|
1197
|
+
}
|
|
1198
|
+
// #4096: the record is redacted before it is signed, so the stored record is the one the statement covers.
|
|
1199
|
+
// The step records on the result are redacted in place, so a caller printing them prints no secret.
|
|
1200
|
+
if (redact) {
|
|
1201
|
+
input = redactDeep(input, redact);
|
|
1202
|
+
for (const r of settled) {
|
|
1203
|
+
if (r.error !== undefined)
|
|
1204
|
+
r.error = redact(r.error);
|
|
1205
|
+
if (r.args)
|
|
1206
|
+
r.args = redactDeep(r.args, redact);
|
|
1207
|
+
}
|
|
1208
|
+
}
|
|
1184
1209
|
let record = { version: 1, ...input, id: runId };
|
|
1185
1210
|
if (options.signRecord) {
|
|
1186
1211
|
try {
|
|
@@ -1194,7 +1219,7 @@ async function runOpInTurn(config, activities, profiles, signal, options, run, e
|
|
|
1194
1219
|
}
|
|
1195
1220
|
// The stream settles as the run does, with the first failing step's error.
|
|
1196
1221
|
const firstError = status === "fail" ? settled.find((r) => r.status === "fail")?.error : undefined;
|
|
1197
|
-
stream?.settle(status === "fail" ? "failed" : status, firstError);
|
|
1222
|
+
stream?.settle(status === "fail" ? "failed" : status, firstError, input.failure);
|
|
1198
1223
|
if (!options.ledger)
|
|
1199
1224
|
return record;
|
|
1200
1225
|
try {
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Redaction of secret values (#4096): what a run writes about itself, with
|
|
3
|
+
* each secret value replaced by `***`.
|
|
4
|
+
*
|
|
5
|
+
* The executor (./local-executor.ts) takes a {@link Redact} and applies it
|
|
6
|
+
* where a run writes: each run-event line, each line a step prints, and the
|
|
7
|
+
* run record before it is signed and stored. `chant ci run` builds one from
|
|
8
|
+
* the host's secrets file and the job's secret-looking variables
|
|
9
|
+
* (../workspace/ci-secrets.ts).
|
|
10
|
+
*
|
|
11
|
+
* A value shorter than {@link REDACT_MIN_LENGTH} characters is not
|
|
12
|
+
* redacted: a two- or three-character value matches too much ordinary text.
|
|
13
|
+
*/
|
|
14
|
+
/** What every redacted value is replaced with. */
|
|
15
|
+
export declare const REDACTED = "***";
|
|
16
|
+
/** The shortest value redacted. Shorter values are left as they are. */
|
|
17
|
+
export declare const REDACT_MIN_LENGTH = 4;
|
|
18
|
+
/** A text with every secret value it contains replaced by {@link REDACTED}. */
|
|
19
|
+
export type Redact = (text: string) => string;
|
|
20
|
+
/**
|
|
21
|
+
* The redactor for `values`, or undefined when none is long enough to
|
|
22
|
+
* redact. A value that spans lines is also redacted line by line, since
|
|
23
|
+
* step output reaches a reader one line at a time.
|
|
24
|
+
*/
|
|
25
|
+
export declare function redactorOf(values: Iterable<string>): Redact | undefined;
|
|
26
|
+
/** `value` with `redact` applied to every string in it, keys included. Numbers, booleans and nulls are kept. */
|
|
27
|
+
export declare function redactDeep<T>(value: T, redact: Redact): T;
|
|
28
|
+
/**
|
|
29
|
+
* A file's or line's text redacted: a JSON document as JSON, each line of a
|
|
30
|
+
* JSON Lines text as JSON, and any other text, or line, as text. The text
|
|
31
|
+
* comes back unchanged when it holds no secret.
|
|
32
|
+
*/
|
|
33
|
+
export declare function redactText(text: string, redact: Redact): string;
|
|
34
|
+
//# sourceMappingURL=redact.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"redact.d.ts","sourceRoot":"","sources":["../../src/op/redact.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;GAYG;AAEH,kDAAkD;AAClD,eAAO,MAAM,QAAQ,QAAQ,CAAC;AAE9B,wEAAwE;AACxE,eAAO,MAAM,iBAAiB,IAAI,CAAC;AAEnC,+EAA+E;AAC/E,MAAM,MAAM,MAAM,GAAG,CAAC,IAAI,EAAE,MAAM,KAAK,MAAM,CAAC;AAI9C;;;;GAIG;AACH,wBAAgB,UAAU,CAAC,MAAM,EAAE,QAAQ,CAAC,MAAM,CAAC,GAAG,MAAM,GAAG,SAAS,CAgBvE;AAED,gHAAgH;AAChH,wBAAgB,UAAU,CAAC,CAAC,EAAE,KAAK,EAAE,CAAC,EAAE,MAAM,EAAE,MAAM,GAAG,CAAC,CASzD;AAqBD;;;;GAIG;AACH,wBAAgB,UAAU,CAAC,IAAI,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,GAAG,MAAM,CAQ/D"}
|
|
@@ -0,0 +1,94 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Redaction of secret values (#4096): what a run writes about itself, with
|
|
3
|
+
* each secret value replaced by `***`.
|
|
4
|
+
*
|
|
5
|
+
* The executor (./local-executor.ts) takes a {@link Redact} and applies it
|
|
6
|
+
* where a run writes: each run-event line, each line a step prints, and the
|
|
7
|
+
* run record before it is signed and stored. `chant ci run` builds one from
|
|
8
|
+
* the host's secrets file and the job's secret-looking variables
|
|
9
|
+
* (../workspace/ci-secrets.ts).
|
|
10
|
+
*
|
|
11
|
+
* A value shorter than {@link REDACT_MIN_LENGTH} characters is not
|
|
12
|
+
* redacted: a two- or three-character value matches too much ordinary text.
|
|
13
|
+
*/
|
|
14
|
+
/** What every redacted value is replaced with. */
|
|
15
|
+
export const REDACTED = "***";
|
|
16
|
+
/** The shortest value redacted. Shorter values are left as they are. */
|
|
17
|
+
export const REDACT_MIN_LENGTH = 4;
|
|
18
|
+
const escapeRegExp = (s) => s.replace(/[.*+?^${}()|[\]\\]/g, "\\$&");
|
|
19
|
+
/**
|
|
20
|
+
* The redactor for `values`, or undefined when none is long enough to
|
|
21
|
+
* redact. A value that spans lines is also redacted line by line, since
|
|
22
|
+
* step output reaches a reader one line at a time.
|
|
23
|
+
*/
|
|
24
|
+
export function redactorOf(values) {
|
|
25
|
+
const all = new Set();
|
|
26
|
+
const add = (v) => {
|
|
27
|
+
if (v.length < REDACT_MIN_LENGTH)
|
|
28
|
+
return;
|
|
29
|
+
all.add(v);
|
|
30
|
+
// As a JSON string spells it, for a value with a quote, a backslash or a control character in it.
|
|
31
|
+
all.add(JSON.stringify(v).slice(1, -1));
|
|
32
|
+
};
|
|
33
|
+
for (const value of values) {
|
|
34
|
+
add(value);
|
|
35
|
+
if (value.includes("\n"))
|
|
36
|
+
for (const line of value.split(/\r?\n/))
|
|
37
|
+
add(line.trim());
|
|
38
|
+
}
|
|
39
|
+
if (all.size === 0)
|
|
40
|
+
return undefined;
|
|
41
|
+
// Longest first, so a value that contains another is replaced whole.
|
|
42
|
+
const pattern = new RegExp([...all].sort((a, b) => b.length - a.length).map(escapeRegExp).join("|"), "g");
|
|
43
|
+
return (text) => (typeof text === "string" && text.length >= REDACT_MIN_LENGTH ? text.replace(pattern, REDACTED) : text);
|
|
44
|
+
}
|
|
45
|
+
/** `value` with `redact` applied to every string in it, keys included. Numbers, booleans and nulls are kept. */
|
|
46
|
+
export function redactDeep(value, redact) {
|
|
47
|
+
if (typeof value === "string")
|
|
48
|
+
return redact(value);
|
|
49
|
+
if (Array.isArray(value))
|
|
50
|
+
return value.map((v) => redactDeep(v, redact));
|
|
51
|
+
if (value !== null && typeof value === "object") {
|
|
52
|
+
const out = {};
|
|
53
|
+
for (const [k, v] of Object.entries(value))
|
|
54
|
+
out[redact(k)] = redactDeep(v, redact);
|
|
55
|
+
return out;
|
|
56
|
+
}
|
|
57
|
+
return value;
|
|
58
|
+
}
|
|
59
|
+
/**
|
|
60
|
+
* A JSON value's text, as `JSON.stringify` wrote it, with `redact` applied to
|
|
61
|
+
* its strings: parsed, redacted and written again, so a short value such as
|
|
62
|
+
* `true` that is also a secret doesn't break the document. Undefined when
|
|
63
|
+
* `text` is not JSON.
|
|
64
|
+
*/
|
|
65
|
+
function redactJsonText(text, redact) {
|
|
66
|
+
let parsed;
|
|
67
|
+
try {
|
|
68
|
+
parsed = JSON.parse(text);
|
|
69
|
+
}
|
|
70
|
+
catch {
|
|
71
|
+
return undefined;
|
|
72
|
+
}
|
|
73
|
+
if (parsed === null || typeof parsed !== "object")
|
|
74
|
+
return undefined;
|
|
75
|
+
const indent = /^[[{]\r?\n(\s+)/.exec(text)?.[1]?.length;
|
|
76
|
+
const trailing = /\s*$/.exec(text)?.[0] ?? "";
|
|
77
|
+
return `${JSON.stringify(redactDeep(parsed, redact), null, indent)}${trailing}`;
|
|
78
|
+
}
|
|
79
|
+
/**
|
|
80
|
+
* A file's or line's text redacted: a JSON document as JSON, each line of a
|
|
81
|
+
* JSON Lines text as JSON, and any other text, or line, as text. The text
|
|
82
|
+
* comes back unchanged when it holds no secret.
|
|
83
|
+
*/
|
|
84
|
+
export function redactText(text, redact) {
|
|
85
|
+
if (redact(text) === text)
|
|
86
|
+
return text;
|
|
87
|
+
const whole = redactJsonText(text, redact);
|
|
88
|
+
if (whole !== undefined)
|
|
89
|
+
return whole;
|
|
90
|
+
return text
|
|
91
|
+
.split("\n")
|
|
92
|
+
.map((line) => (redact(line) === line ? line : (redactJsonText(line, redact) ?? redact(line))))
|
|
93
|
+
.join("\n");
|
|
94
|
+
}
|