@intentius/chant 0.124.39 → 0.124.41
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/__fixtures__/oidc-emulator.d.ts +49 -0
- package/dist/__fixtures__/oidc-emulator.d.ts.map +1 -0
- package/dist/__fixtures__/oidc-emulator.js +89 -0
- package/dist/ci-handover.d.ts +117 -0
- package/dist/ci-handover.d.ts.map +1 -0
- package/dist/ci-handover.js +217 -0
- package/dist/ci-identity.d.ts +190 -0
- package/dist/ci-identity.d.ts.map +1 -0
- package/dist/ci-identity.js +219 -0
- package/dist/cli/component-endpoint.d.ts +20 -0
- package/dist/cli/component-endpoint.d.ts.map +1 -0
- package/dist/cli/component-endpoint.js +36 -0
- package/dist/cli/handlers/approve.d.ts +2 -1
- package/dist/cli/handlers/approve.d.ts.map +1 -1
- package/dist/cli/handlers/approve.js +20 -6
- package/dist/cli/handlers/build.d.ts.map +1 -1
- package/dist/cli/handlers/build.js +15 -1
- package/dist/cli/handlers/fan-out.d.ts.map +1 -1
- package/dist/cli/handlers/fan-out.js +26 -4
- package/dist/cli/handlers/gate-resume.d.ts +3 -0
- package/dist/cli/handlers/gate-resume.d.ts.map +1 -1
- package/dist/cli/handlers/gate-resume.js +15 -2
- package/dist/cli/handlers/lock.d.ts +8 -0
- package/dist/cli/handlers/lock.d.ts.map +1 -0
- package/dist/cli/handlers/lock.js +197 -0
- package/dist/cli/handlers/pr-env.d.ts +34 -0
- package/dist/cli/handlers/pr-env.d.ts.map +1 -0
- package/dist/cli/handlers/pr-env.js +436 -0
- package/dist/cli/handlers/pr.d.ts +74 -0
- package/dist/cli/handlers/pr.d.ts.map +1 -1
- package/dist/cli/handlers/pr.js +514 -58
- package/dist/cli/handlers/promote.d.ts.map +1 -1
- package/dist/cli/handlers/promote.js +16 -2
- package/dist/cli/handlers/query.d.ts +6 -0
- package/dist/cli/handlers/query.d.ts.map +1 -0
- package/dist/cli/handlers/query.js +80 -0
- package/dist/cli/handlers/run.d.ts +4 -1
- package/dist/cli/handlers/run.d.ts.map +1 -1
- package/dist/cli/handlers/run.js +17 -6
- package/dist/cli/main.d.ts.map +1 -1
- package/dist/cli/main.js +41 -2
- package/dist/cli/parse-args.d.ts.map +1 -1
- package/dist/cli/parse-args.js +31 -2
- package/dist/cli/registry.d.ts +12 -2
- package/dist/cli/registry.d.ts.map +1 -1
- package/dist/components/auto-release.d.ts +35 -3
- package/dist/components/auto-release.d.ts.map +1 -1
- package/dist/components/auto-release.js +29 -2
- package/dist/components/cli-support.d.ts +2 -0
- package/dist/components/cli-support.d.ts.map +1 -1
- package/dist/components/cli-support.js +2 -0
- package/dist/components/deploy-units.d.ts.map +1 -1
- package/dist/components/deploy-units.js +5 -0
- package/dist/components/fan-out-run.d.ts +28 -0
- package/dist/components/fan-out-run.d.ts.map +1 -1
- package/dist/components/fan-out-run.js +27 -3
- package/dist/components/pr-environment.d.ts +298 -0
- package/dist/components/pr-environment.d.ts.map +1 -0
- package/dist/components/pr-environment.js +406 -0
- package/dist/components/pr-hooks.d.ts +66 -0
- package/dist/components/pr-hooks.d.ts.map +1 -0
- package/dist/components/pr-hooks.js +119 -0
- package/dist/components/pr-pipeline.d.ts +72 -2
- package/dist/components/pr-pipeline.d.ts.map +1 -1
- package/dist/components/pr-pipeline.js +96 -5
- package/dist/components/pr-policy.d.ts +109 -0
- package/dist/components/pr-policy.d.ts.map +1 -0
- package/dist/components/pr-policy.js +150 -0
- package/dist/components/pr-run.d.ts.map +1 -1
- package/dist/components/pr-run.js +5 -3
- package/dist/components/promote.d.ts.map +1 -1
- package/dist/components/promote.js +39 -16
- package/dist/gate-decision.d.ts +15 -2
- package/dist/gate-decision.d.ts.map +1 -1
- package/dist/gate-decision.js +17 -2
- package/dist/gate-policy.d.ts +140 -0
- package/dist/gate-policy.d.ts.map +1 -0
- package/dist/gate-policy.js +242 -0
- package/dist/lifecycle/__fixtures__/publish-fakes.d.ts.map +1 -1
- package/dist/lifecycle/__fixtures__/publish-fakes.js +6 -1
- package/dist/lifecycle/gate-checkpoint.d.ts +1 -1
- package/dist/lifecycle/gate-checkpoint.js +1 -1
- package/dist/{workspace/trust → lifecycle}/gate-seal.d.ts +1 -1
- package/dist/lifecycle/gate-seal.d.ts.map +1 -0
- package/dist/lifecycle/publish-declaration.d.ts.map +1 -1
- package/dist/lifecycle/publish-declaration.js +4 -3
- package/dist/lifecycle/publish-npm.d.ts +2 -2
- package/dist/lifecycle/publish-npm.d.ts.map +1 -1
- package/dist/lifecycle/publish-npm.js +31 -8
- package/dist/lifecycle/query.d.ts +68 -0
- package/dist/lifecycle/query.d.ts.map +1 -0
- package/dist/lifecycle/query.js +246 -0
- package/dist/lifecycle/release-ledger.d.ts +31 -0
- package/dist/lifecycle/release-ledger.d.ts.map +1 -1
- package/dist/lifecycle/release-ledger.js +19 -1
- package/dist/lifecycle/run-ledger.d.ts +13 -0
- package/dist/lifecycle/run-ledger.d.ts.map +1 -1
- package/dist/lifecycle/run-ledger.js +16 -0
- package/dist/lifecycle/status.d.ts +5 -1
- package/dist/lifecycle/status.d.ts.map +1 -1
- package/dist/lifecycle/status.js +10 -5
- package/dist/lifecycle/target-lock.d.ts +97 -0
- package/dist/lifecycle/target-lock.d.ts.map +1 -0
- package/dist/lifecycle/target-lock.js +286 -0
- package/dist/live-endpoint.d.ts +18 -0
- package/dist/live-endpoint.d.ts.map +1 -1
- package/dist/live-endpoint.js +27 -0
- package/dist/op/activities/activity-contracts.d.ts +30 -0
- package/dist/op/activities/activity-contracts.d.ts.map +1 -1
- package/dist/op/activities/activity-contracts.js +26 -0
- package/dist/op/activities/index.d.ts +2 -0
- package/dist/op/activities/index.d.ts.map +1 -1
- package/dist/op/activities/index.js +4 -0
- package/dist/op/activities/review-agent.d.ts +137 -0
- package/dist/op/activities/review-agent.d.ts.map +1 -0
- package/dist/op/activities/review-agent.js +266 -0
- package/dist/op/builders.d.ts +9 -0
- package/dist/op/builders.d.ts.map +1 -1
- package/dist/op/builders.js +11 -0
- package/dist/op/cron.d.ts +8 -0
- package/dist/op/cron.d.ts.map +1 -1
- package/dist/op/cron.js +51 -0
- package/dist/op/gate-approval.d.ts +20 -13
- package/dist/op/gate-approval.d.ts.map +1 -1
- package/dist/op/gate-approval.js +13 -18
- package/dist/op/gate-quorum.d.ts +131 -0
- package/dist/op/gate-quorum.d.ts.map +1 -0
- package/dist/op/gate-quorum.js +183 -0
- package/dist/op/gate-resume.d.ts +4 -2
- package/dist/op/gate-resume.d.ts.map +1 -1
- package/dist/op/gate-resume.js +5 -4
- package/dist/op/gate-review.js +1 -1
- package/dist/op/gate.d.ts +32 -4
- package/dist/op/gate.d.ts.map +1 -1
- package/dist/op/gate.js +40 -24
- package/dist/op/index.d.ts +6 -4
- package/dist/op/index.d.ts.map +1 -1
- package/dist/op/index.js +4 -3
- package/dist/op/local-executor.d.ts.map +1 -1
- package/dist/op/local-executor.js +9 -3
- package/dist/op/op-waves-run.d.ts +62 -1
- package/dist/op/op-waves-run.d.ts.map +1 -1
- package/dist/op/op-waves-run.js +190 -11
- package/dist/op/op-waves.d.ts +55 -3
- package/dist/op/op-waves.d.ts.map +1 -1
- package/dist/op/op-waves.js +63 -8
- package/dist/op/schedule-overdue.d.ts +57 -0
- package/dist/op/schedule-overdue.d.ts.map +1 -0
- package/dist/op/schedule-overdue.js +138 -0
- package/dist/override-gate.d.ts +2 -2
- package/dist/override-gate.d.ts.map +1 -1
- package/dist/override-gate.js +1 -1
- package/dist/pr-forge.d.ts +36 -0
- package/dist/pr-forge.d.ts.map +1 -1
- package/dist/pr-forge.js +82 -0
- package/dist/pr-loop.d.ts +90 -1
- package/dist/pr-loop.d.ts.map +1 -1
- package/dist/pr-loop.js +77 -3
- package/dist/pr-post.d.ts +72 -0
- package/dist/pr-post.d.ts.map +1 -0
- package/dist/pr-post.js +134 -0
- package/dist/wave-blocked.d.ts +79 -0
- package/dist/wave-blocked.d.ts.map +1 -0
- package/dist/wave-blocked.js +245 -0
- package/dist/wave-engine.d.ts +6 -0
- package/dist/wave-engine.d.ts.map +1 -1
- package/dist/wave-engine.js +2 -0
- package/dist/wave-runtime.mjs +239 -239
- package/dist/workspace/__fixtures__/two-member-workspace.d.ts +1 -0
- package/dist/workspace/__fixtures__/two-member-workspace.d.ts.map +1 -1
- package/dist/workspace/__fixtures__/two-member-workspace.js +1 -1
- package/dist/workspace/ci-branches.d.ts +51 -0
- package/dist/workspace/ci-branches.d.ts.map +1 -0
- package/dist/workspace/ci-branches.js +69 -0
- package/dist/workspace/ci-cloud-identity.d.ts +11 -0
- package/dist/workspace/ci-cloud-identity.d.ts.map +1 -0
- package/dist/workspace/ci-cloud-identity.js +24 -0
- package/dist/workspace/ci-locks.d.ts +12 -0
- package/dist/workspace/ci-locks.d.ts.map +1 -0
- package/dist/workspace/ci-locks.js +6 -0
- package/dist/workspace/ci-run.d.ts +24 -1
- package/dist/workspace/ci-run.d.ts.map +1 -1
- package/dist/workspace/ci-run.js +85 -6
- package/dist/workspace/declaration.d.ts +63 -0
- package/dist/workspace/declaration.d.ts.map +1 -1
- package/dist/workspace/declaration.js +72 -1
- package/dist/workspace/declaration.schema.json +147 -0
- package/dist/workspace/identity-gate-rule.d.ts +1 -1
- package/dist/workspace/identity-gate-rule.d.ts.map +1 -1
- package/dist/workspace/identity-gate-rule.js +1 -1
- package/dist/workspace/identity.d.ts +1 -1
- package/dist/workspace/identity.d.ts.map +1 -1
- package/dist/workspace/lineage-upgrade.d.ts.map +1 -1
- package/dist/workspace/lineage-upgrade.js +8 -5
- package/dist/workspace/member-pipeline.d.ts +6 -0
- package/dist/workspace/member-pipeline.d.ts.map +1 -1
- package/dist/workspace/member-pipeline.js +23 -0
- package/dist/workspace/pr-report.schema.json +73 -2
- package/dist/workspace/security.d.ts.map +1 -1
- package/dist/workspace/security.js +4 -0
- package/dist/workspace/status-gates.d.ts +3 -2
- package/dist/workspace/status-gates.d.ts.map +1 -1
- package/dist/workspace/status-gates.js +8 -7
- package/dist/workspace/status.d.ts +3 -1
- package/dist/workspace/status.d.ts.map +1 -1
- package/dist/workspace/status.js +7 -3
- package/dist/workspace/status.schema.json +1 -0
- package/dist/workspace/trust/seal.d.ts +2 -2
- package/dist/workspace/trust/seal.d.ts.map +1 -1
- package/dist/workspace/trust/seal.js +2 -2
- package/package.json +1 -1
- package/src/__fixtures__/oidc-emulator.ts +118 -0
- package/src/ci-handover.test.ts +209 -0
- package/src/ci-handover.ts +237 -0
- package/src/ci-identity.test.ts +201 -0
- package/src/ci-identity.ts +310 -0
- package/src/cli/component-endpoint.ts +43 -0
- package/src/cli/handlers/approve.ts +18 -5
- package/src/cli/handlers/build.ts +15 -1
- package/src/cli/handlers/fan-out.test.ts +10 -0
- package/src/cli/handlers/fan-out.ts +29 -4
- package/src/cli/handlers/gate-resume.ts +16 -2
- package/src/cli/handlers/lock.test.ts +98 -0
- package/src/cli/handlers/lock.ts +202 -0
- package/src/cli/handlers/operator.test.ts +3 -1
- package/src/cli/handlers/pr-endpoint.test.ts +169 -0
- package/src/cli/handlers/pr-env.ts +462 -0
- package/src/cli/handlers/pr-waves-blocked.test.ts +247 -0
- package/src/cli/handlers/pr.test.ts +184 -0
- package/src/cli/handlers/pr.ts +508 -64
- package/src/cli/handlers/promote.ts +25 -2
- package/src/cli/handlers/query.ts +78 -0
- package/src/cli/handlers/run.test.ts +2 -1
- package/src/cli/handlers/run.ts +16 -5
- package/src/cli/main.ts +41 -2
- package/src/cli/parse-args.ts +23 -2
- package/src/cli/registry.ts +12 -2
- package/src/components/auto-release-infra.test.ts +131 -0
- package/src/components/auto-release.test.ts +40 -1
- package/src/components/auto-release.ts +50 -4
- package/src/components/cli-support.ts +4 -0
- package/src/components/deploy-units.ts +5 -0
- package/src/components/fan-out-run.ts +39 -2
- package/src/components/fan-out-waves.test.ts +45 -1
- package/src/components/pr-environment.test.ts +249 -0
- package/src/components/pr-environment.ts +538 -0
- package/src/components/pr-hooks.test.ts +118 -0
- package/src/components/pr-hooks.ts +157 -0
- package/src/components/pr-pipeline.ts +130 -5
- package/src/components/pr-policy.test.ts +145 -0
- package/src/components/pr-policy.ts +211 -0
- package/src/components/pr-run.ts +5 -2
- package/src/components/promote.test.ts +39 -0
- package/src/components/promote.ts +38 -14
- package/src/gate-decision-bundle.test.ts +4 -3
- package/src/gate-decision.ts +39 -2
- package/src/gate-policy-bundle.test.ts +28 -0
- package/src/gate-policy.test.ts +162 -0
- package/src/gate-policy.ts +298 -0
- package/src/lifecycle/__fixtures__/publish-fakes.ts +6 -1
- package/src/lifecycle/gate-checkpoint.ts +1 -1
- package/src/{workspace/trust → lifecycle}/gate-seal.ts +1 -1
- package/src/lifecycle/publish-declaration.ts +4 -3
- package/src/lifecycle/publish-npm.ts +33 -8
- package/src/lifecycle/publish-targets.test.ts +36 -3
- package/src/lifecycle/query.test.ts +91 -0
- package/src/lifecycle/query.ts +315 -0
- package/src/lifecycle/release-ledger.ts +42 -1
- package/src/lifecycle/run-ledger.ts +18 -0
- package/src/lifecycle/status.test.ts +19 -0
- package/src/lifecycle/status.ts +14 -6
- package/src/lifecycle/target-lock.test.ts +195 -0
- package/src/lifecycle/target-lock.ts +347 -0
- package/src/live-endpoint.ts +31 -0
- package/src/op/activities/activity-contracts.ts +31 -0
- package/src/op/activities/index.ts +6 -0
- package/src/op/activities/review-agent.test.ts +240 -0
- package/src/op/activities/review-agent.ts +355 -0
- package/src/op/builders.ts +13 -0
- package/src/op/cron.ts +44 -0
- package/src/op/gate-alias.test.ts +2 -2
- package/src/op/gate-approval.test.ts +30 -9
- package/src/op/gate-approval.ts +23 -26
- package/src/op/gate-quorum.test.ts +139 -0
- package/src/op/gate-quorum.ts +248 -0
- package/src/op/gate-resume.ts +6 -3
- package/src/op/gate-review.ts +1 -1
- package/src/op/gate.ts +64 -23
- package/src/op/index.ts +13 -1
- package/src/op/local-executor.ts +9 -2
- package/src/op/op-waves-hook-targets.test.ts +126 -0
- package/src/op/op-waves-policy-hold.test.ts +66 -0
- package/src/op/op-waves-quorum.test.ts +101 -0
- package/src/op/op-waves-run.ts +233 -11
- package/src/op/op-waves.ts +83 -10
- package/src/op/schedule-overdue.test.ts +220 -0
- package/src/op/schedule-overdue.ts +161 -0
- package/src/override-gate-bundle.test.ts +1 -1
- package/src/override-gate.ts +2 -2
- package/src/pr-forge-bundle.test.ts +2 -2
- package/src/pr-forge.test.ts +33 -0
- package/src/pr-forge.ts +114 -0
- package/src/pr-loop-bundle.test.ts +2 -2
- package/src/pr-loop.test.ts +58 -0
- package/src/pr-loop.ts +146 -4
- package/src/pr-post.test.ts +141 -0
- package/src/pr-post.ts +159 -0
- package/src/wave-blocked-bundle.test.ts +25 -0
- package/src/wave-blocked.test.ts +146 -0
- package/src/wave-blocked.ts +271 -0
- package/src/wave-engine.ts +8 -0
- package/src/workspace/__fixtures__/two-member-workspace.ts +2 -2
- package/src/workspace/ci-branches.test.ts +62 -0
- package/src/workspace/ci-branches.ts +79 -0
- package/src/workspace/ci-cloud-identity.test.ts +53 -0
- package/src/workspace/ci-cloud-identity.ts +23 -0
- package/src/workspace/ci-locks.ts +16 -0
- package/src/workspace/ci-run-index.test.ts +2 -1
- package/src/workspace/ci-run.test.ts +133 -8
- package/src/workspace/ci-run.ts +92 -7
- package/src/workspace/declaration.schema.json +147 -0
- package/src/workspace/declaration.test.ts +76 -0
- package/src/workspace/declaration.ts +134 -2
- package/src/workspace/identity-gate-rule.ts +1 -1
- package/src/workspace/identity.ts +1 -1
- package/src/workspace/lineage-upgrade.ts +11 -8
- package/src/workspace/member-pipeline.test.ts +29 -0
- package/src/workspace/member-pipeline.ts +30 -0
- package/src/workspace/pr-report.schema.json +73 -2
- package/src/workspace/security.ts +4 -0
- package/src/workspace/status-gates.ts +9 -6
- package/src/workspace/status.schema.json +1 -0
- package/src/workspace/status.ts +11 -4
- package/src/workspace/trust/gate-seal.test.ts +1 -1
- package/src/workspace/trust/seal.ts +2 -2
- package/dist/workspace/trust/gate-seal.d.ts.map +0 -1
- /package/dist/{workspace/trust → lifecycle}/gate-seal.js +0 -0
|
@@ -18,12 +18,16 @@
|
|
|
18
18
|
import { RETENTION_KINDS } from "../lifecycle/retention-policy.js";
|
|
19
19
|
import { parseReportUrl } from "../pr-report-url.js";
|
|
20
20
|
import schema from "./declaration.schema.json" with { type: "json" };
|
|
21
|
+
import { routeConflicts } from "./ci-branches.js";
|
|
22
|
+
import { cloudIdentityProblems, CLOUDS } from "../ci-identity.js";
|
|
21
23
|
import { expandGlob } from "./glob.js";
|
|
22
24
|
import { EXAMPLES_KIND, holdsChantProject } from "./kinds.js";
|
|
23
25
|
import { parseJsonText, pointerToken } from "./jsonc.js";
|
|
24
26
|
import { joinPath } from "./tree.js";
|
|
25
27
|
import { loadAjv2020 } from "./ajv2020.js";
|
|
26
28
|
import { readChantPackageVersion } from "../package-version.js";
|
|
29
|
+
import { assertPrLoopHooks } from "../op/op-waves.js";
|
|
30
|
+
import { assertGatePolicySettings } from "../gate-policy.js";
|
|
27
31
|
export const DECLARATION_SCHEMA_ID = schema.$id;
|
|
28
32
|
export const DECLARATION_FILES = ["chant.workspace.json", "chant.workspace.jsonc"];
|
|
29
33
|
export const DECLARATION_SCHEMA_VERSION = 1;
|
|
@@ -74,6 +78,8 @@ export const PRINCIPAL_CLASSES = ["human", "agent", "runner", "service"];
|
|
|
74
78
|
export const WRITE_VERBS = ["new", "amend", "review", "close"];
|
|
75
79
|
/** The default `ci.green.window`. */
|
|
76
80
|
export const DEFAULT_CI_WINDOW = "24h";
|
|
81
|
+
/** The default `ci.prEnvironment.ttl`. */
|
|
82
|
+
export const DEFAULT_PR_ENVIRONMENT_TTL = "72h";
|
|
77
83
|
/** A renderer a diagram is pinned to (#2764): a closed list of tools chant does not run. */
|
|
78
84
|
export const DIAGRAM_TOOLS = ["d2", "mermaid", "graphviz", "excalidraw"];
|
|
79
85
|
/** The gate a ship Op stops at when the block names none (ws-100). */
|
|
@@ -282,6 +288,7 @@ export function parseDeclaration(text, file, reader = readerVersion(), options =
|
|
|
282
288
|
travel: e.travel === true,
|
|
283
289
|
security: [...(e.security ?? [])],
|
|
284
290
|
ciWorkflow: (e.ci?.workflow) ?? null,
|
|
291
|
+
ciHooks: ciHooksOf(e.ci?.hooks, `${pointer}/ci/hooks`, at),
|
|
285
292
|
suppress,
|
|
286
293
|
pointer,
|
|
287
294
|
};
|
|
@@ -386,6 +393,11 @@ export function parseDeclaration(text, file, reader = readerVersion(), options =
|
|
|
386
393
|
if (tierSession)
|
|
387
394
|
throw new WorkspaceReadError("declaration-invalid", tierSession.message, at(tierSession.pointer));
|
|
388
395
|
const ci = ciOf(obj.ci, at);
|
|
396
|
+
// #4292: a member applies from one branch, so two branches may not both route it.
|
|
397
|
+
const [conflict] = routeConflicts(ci?.branches, members.map((m) => m.name));
|
|
398
|
+
if (conflict) {
|
|
399
|
+
throw new WorkspaceReadError("declaration-invalid", `ci.branches routes member ${conflict.member} to both ${conflict.branches.join(" and ")}; a member applies from one branch`, at(`/ci/branches/${pointerToken(conflict.branches[1])}`));
|
|
400
|
+
}
|
|
389
401
|
const pins = (obj.pins ?? []).map((p) => ({
|
|
390
402
|
package: p.package ?? null,
|
|
391
403
|
version: p.version ?? null,
|
|
@@ -500,11 +512,70 @@ function retentionOf(raw) {
|
|
|
500
512
|
}
|
|
501
513
|
return out;
|
|
502
514
|
}
|
|
515
|
+
/** A `ci.hooks` block (#4288), refused when a pull-request job could not run it. Null when absent. */
|
|
516
|
+
function ciHooksOf(raw, pointer, at) {
|
|
517
|
+
if (raw === undefined)
|
|
518
|
+
return null;
|
|
519
|
+
try {
|
|
520
|
+
assertPrLoopHooks(pointer.slice(1).replace(/\//g, "."), raw);
|
|
521
|
+
}
|
|
522
|
+
catch (err) {
|
|
523
|
+
throw new WorkspaceReadError("declaration-invalid", err instanceof Error ? err.message : String(err), at(pointer));
|
|
524
|
+
}
|
|
525
|
+
return structuredClone(raw);
|
|
526
|
+
}
|
|
527
|
+
/** A `ci.branches` or `ci.labels` map, copied without its `x-` keys. */
|
|
528
|
+
function globMap(raw) {
|
|
529
|
+
return Object.fromEntries(Object.entries(raw).filter(([k]) => !k.startsWith("x-")).map(([k, v]) => [k, [...v]]));
|
|
530
|
+
}
|
|
531
|
+
/** A `ci.policy` block (#4294), refused when the pull-request jobs could not run it. Null when absent. */
|
|
532
|
+
function ciPolicyOf(raw, at) {
|
|
533
|
+
if (raw === undefined)
|
|
534
|
+
return null;
|
|
535
|
+
try {
|
|
536
|
+
assertGatePolicySettings("ci.policy", raw);
|
|
537
|
+
}
|
|
538
|
+
catch (err) {
|
|
539
|
+
throw new WorkspaceReadError("declaration-invalid", err instanceof Error ? err.message : String(err), at("/ci/policy"));
|
|
540
|
+
}
|
|
541
|
+
return structuredClone(raw);
|
|
542
|
+
}
|
|
543
|
+
/**
|
|
544
|
+
* `ci.identity.cloud` (#4296), copied without its `x-` keys. A rule that
|
|
545
|
+
* plans as an identity some rule applies as is refused: the plan runs the
|
|
546
|
+
* pull request's code.
|
|
547
|
+
*/
|
|
548
|
+
function cloudIdentityOf(raw, at) {
|
|
549
|
+
const out = {};
|
|
550
|
+
for (const cloud of CLOUDS) {
|
|
551
|
+
const c = raw[cloud];
|
|
552
|
+
if (c === undefined)
|
|
553
|
+
continue;
|
|
554
|
+
const kept = Object.fromEntries(Object.entries(c).filter(([k]) => !k.startsWith("x-")));
|
|
555
|
+
const rules = c.rules.map((r) => Object.fromEntries(Object.entries(r).filter(([k]) => !k.startsWith("x-")).map(([k, v]) => [k, Array.isArray(v) ? [...v] : v])));
|
|
556
|
+
out[cloud] = { ...kept, rules };
|
|
557
|
+
}
|
|
558
|
+
const [problem] = cloudIdentityProblems(out);
|
|
559
|
+
if (problem)
|
|
560
|
+
throw new WorkspaceReadError("declaration-invalid", problem.message, at(problem.pointer));
|
|
561
|
+
return out;
|
|
562
|
+
}
|
|
503
563
|
function ciOf(raw, at) {
|
|
504
564
|
if (raw === undefined)
|
|
505
565
|
return null;
|
|
506
566
|
const block = raw;
|
|
507
|
-
const
|
|
567
|
+
const hooks = ciHooksOf(block.hooks, "/ci/hooks", at);
|
|
568
|
+
const policy = ciPolicyOf(block.policy, at);
|
|
569
|
+
const workflow = {
|
|
570
|
+
...(block.workflow !== undefined ? { workflow: block.workflow } : {}),
|
|
571
|
+
...(hooks ? { hooks } : {}),
|
|
572
|
+
...(block.branches !== undefined ? { branches: globMap(block.branches) } : {}),
|
|
573
|
+
...(block.labels !== undefined ? { labels: globMap(block.labels) } : {}),
|
|
574
|
+
...(block.locks !== undefined ? { locks: block.locks } : {}),
|
|
575
|
+
...(policy ? { policy } : {}),
|
|
576
|
+
...(block.identity?.cloud !== undefined ? { identity: { cloud: cloudIdentityOf(block.identity.cloud, at) } } : {}),
|
|
577
|
+
...(block.prEnvironment !== undefined ? { prEnvironment: { template: block.prEnvironment.template, ttl: block.prEnvironment.ttl ?? DEFAULT_PR_ENVIRONMENT_TTL } } : {}),
|
|
578
|
+
};
|
|
508
579
|
let reportUrl = null;
|
|
509
580
|
if (block.reportUrl !== undefined) {
|
|
510
581
|
// #4160: refused here as pr-plan and ci run refuse the flag, so a reader never gets a URL no job can write to.
|
|
@@ -181,10 +181,116 @@
|
|
|
181
181
|
"workflow": {
|
|
182
182
|
"$ref": "#/$defs/ciWorkflow"
|
|
183
183
|
},
|
|
184
|
+
"hooks": {
|
|
185
|
+
"$ref": "#/$defs/ciHooks"
|
|
186
|
+
},
|
|
187
|
+
"locks": {
|
|
188
|
+
"enum": ["apply", "plan"],
|
|
189
|
+
"description": "When a pull request takes its target locks, _locks/<gate>.json on chant/lifecycle (#4293). apply: the pull request's apply takes them, and chant lock takes them by hand. plan: its plan takes them too, through chant lock --stage plan in a job that runs the target branch's code. Under either, chant components pr-apply refuses a target that another open pull request holds, and a lock whose pull request merged or closed reads as released. Absent: nothing is locked. Read from the declaration at base. Added in schema 1 by chant 0.124.41, so a declaration that uses it sets minReader to 0.124.41 or newer."
|
|
190
|
+
},
|
|
191
|
+
"policy": {
|
|
192
|
+
"$ref": "#/$defs/ciPolicy"
|
|
193
|
+
},
|
|
184
194
|
"reportUrl": {
|
|
185
195
|
"type": "string",
|
|
186
196
|
"minLength": 1,
|
|
187
197
|
"description": "Where the pull-request jobs copy their reports and events, and where chant ci run keeps the run index, <reportUrl>/runs/index.json (#4160): an s3://<bucket>/<prefix> or file://<directory> URL, as --report-url takes. chant build --pr-loop, chant ci run, chant ci serve and chant ci runs use it when --report-url is not given, and the flag wins. Readers find it in chant workspace ls --json as ci.reportUrl. Added in schema 1 by chant 0.124.32, so a declaration that uses it sets minReader to 0.124.32 or newer."
|
|
198
|
+
},
|
|
199
|
+
"branches": {
|
|
200
|
+
"type": "object",
|
|
201
|
+
"description": "Branch routing (#4292): a branch name to member-name globs. A member a glob matches applies from that branch alone: chant build --pr-loop targets its pipeline at the branch, and its record and apply jobs plan nothing on a push to any other branch. A member no glob matches applies from every branch the map does not name. One member may not be matched by two branches. Added in schema 1 by chant 0.124.41, so a declaration that uses it sets minReader to 0.124.41 or newer.",
|
|
202
|
+
"patternProperties": {
|
|
203
|
+
"^x-": true,
|
|
204
|
+
"^(?!x-)[^\\s]+$": { "$ref": "#/$defs/ciMemberGlobs" }
|
|
205
|
+
},
|
|
206
|
+
"additionalProperties": false
|
|
207
|
+
},
|
|
208
|
+
"labels": {
|
|
209
|
+
"type": "object",
|
|
210
|
+
"description": "Label filters (#4292): a pull request label to member-name globs. When a pull request carries one of these labels, its plan jobs plan only the members those labels match. A label never gates: the record and apply jobs never read labels, and an apply still needs an approval of the digest it plans. Added in schema 1 by chant 0.124.41, so a declaration that uses it sets minReader to 0.124.41 or newer.",
|
|
211
|
+
"patternProperties": {
|
|
212
|
+
"^x-": true,
|
|
213
|
+
"^(?!x-).+$": { "$ref": "#/$defs/ciMemberGlobs" }
|
|
214
|
+
},
|
|
215
|
+
"additionalProperties": false
|
|
216
|
+
},
|
|
217
|
+
"identity": {
|
|
218
|
+
"type": "object",
|
|
219
|
+
"additionalProperties": false,
|
|
220
|
+
"patternProperties": { "^x-": true },
|
|
221
|
+
"description": "Cloud identities for the pull-request jobs (#4296). Added in schema 1 by chant 0.124.41, so a declaration that uses it sets minReader to 0.124.41 or newer.",
|
|
222
|
+
"properties": {
|
|
223
|
+
"cloud": {
|
|
224
|
+
"type": "object",
|
|
225
|
+
"additionalProperties": false,
|
|
226
|
+
"patternProperties": { "^x-": true },
|
|
227
|
+
"description": "Each cloud's plan and apply identities, as rules over environment and member globs. chant build --pr-loop takes the first rule that matches the pipeline's environment and member. The plan job trades its OIDC token for the plan identity before the change is checked out, the record job takes the plan identity, and the apply jobs the apply identity. A rule may not plan as an identity any rule applies as.",
|
|
228
|
+
"properties": {
|
|
229
|
+
"aws": {
|
|
230
|
+
"type": "object",
|
|
231
|
+
"additionalProperties": false,
|
|
232
|
+
"patternProperties": { "^x-": true },
|
|
233
|
+
"required": ["rules"],
|
|
234
|
+
"description": "AWS roles, assumed through STS AssumeRoleWithWebIdentity.",
|
|
235
|
+
"properties": {
|
|
236
|
+
"region": { "type": "string", "minLength": 1, "description": "The STS region. Default us-east-1." },
|
|
237
|
+
"audience": { "type": "string", "minLength": 1, "description": "The OIDC token's audience. Default sts.amazonaws.com." },
|
|
238
|
+
"endpoint": { "type": "string", "pattern": "^https?://", "description": "The STS endpoint, for an emulator. Default the region's, or AWS_ENDPOINT_URL_STS in the job." },
|
|
239
|
+
"rules": { "$ref": "#/$defs/ciCloudIdentityRules" }
|
|
240
|
+
}
|
|
241
|
+
},
|
|
242
|
+
"gcp": {
|
|
243
|
+
"type": "object",
|
|
244
|
+
"additionalProperties": false,
|
|
245
|
+
"patternProperties": { "^x-": true },
|
|
246
|
+
"required": ["provider", "rules"],
|
|
247
|
+
"description": "GCP service accounts, reached through a workload identity provider and impersonated with IAM generateAccessToken.",
|
|
248
|
+
"properties": {
|
|
249
|
+
"provider": { "type": "string", "pattern": "^(//iam\\.googleapis\\.com/)?projects/[^/]+/locations/global/workloadIdentityPools/[^/]+/providers/[^/]+$", "description": "The workload identity provider: projects/<number>/locations/global/workloadIdentityPools/<pool>/providers/<provider>." },
|
|
250
|
+
"audience": { "type": "string", "minLength": 1, "description": "The OIDC token's audience. Default https://iam.googleapis.com/<provider>." },
|
|
251
|
+
"stsEndpoint": { "type": "string", "pattern": "^https?://", "description": "Google's STS, for an emulator. Default https://sts.googleapis.com." },
|
|
252
|
+
"iamEndpoint": { "type": "string", "pattern": "^https?://", "description": "IAM credentials, for an emulator. Default https://iamcredentials.googleapis.com." },
|
|
253
|
+
"rules": { "$ref": "#/$defs/ciCloudIdentityRules" }
|
|
254
|
+
}
|
|
255
|
+
},
|
|
256
|
+
"azure": {
|
|
257
|
+
"type": "object",
|
|
258
|
+
"additionalProperties": false,
|
|
259
|
+
"patternProperties": { "^x-": true },
|
|
260
|
+
"required": ["tenantId", "rules"],
|
|
261
|
+
"description": "Entra application clients, each with a federated credential for the forge's tokens. The rules' identities are client ids.",
|
|
262
|
+
"properties": {
|
|
263
|
+
"tenantId": { "type": "string", "minLength": 1, "description": "The Entra tenant." },
|
|
264
|
+
"subscriptionId": { "type": "string", "minLength": 1, "description": "Set as AZURE_SUBSCRIPTION_ID and ARM_SUBSCRIPTION_ID when given." },
|
|
265
|
+
"audience": { "type": "string", "minLength": 1, "description": "The OIDC token's audience. Default api://AzureADTokenExchange." },
|
|
266
|
+
"authority": { "type": "string", "pattern": "^https?://", "description": "The Entra authority host, for an emulator. Default https://login.microsoftonline.com." },
|
|
267
|
+
"rules": { "$ref": "#/$defs/ciCloudIdentityRules" }
|
|
268
|
+
}
|
|
269
|
+
}
|
|
270
|
+
}
|
|
271
|
+
}
|
|
272
|
+
}
|
|
273
|
+
},
|
|
274
|
+
"prEnvironment": {
|
|
275
|
+
"type": "object",
|
|
276
|
+
"description": "An environment per open pull request (#4298): chant components pr-env up applies the pull request's components to pr-<number>, which takes the template environment's declared endpoint, and pr-env down tears down only what carries that environment's ownership marker. A pull request's environment is never a release target. Read from the declaration at base, so a pull request cannot change its own template or TTL. Added in schema 1 by chant 0.124.42, so a declaration that uses it sets minReader to 0.124.42 or newer.",
|
|
277
|
+
"required": ["template"],
|
|
278
|
+
"additionalProperties": false,
|
|
279
|
+
"patternProperties": {
|
|
280
|
+
"^x-": true
|
|
281
|
+
},
|
|
282
|
+
"properties": {
|
|
283
|
+
"template": {
|
|
284
|
+
"type": "string",
|
|
285
|
+
"pattern": "^[a-z0-9][a-z0-9-]*$",
|
|
286
|
+
"description": "The declared environment a pull request's environment is derived from: pr-<number> takes its endpoint unless a pr-* entry declares one."
|
|
287
|
+
},
|
|
288
|
+
"ttl": {
|
|
289
|
+
"type": "string",
|
|
290
|
+
"pattern": "^[1-9][0-9]*(m|h|d)$",
|
|
291
|
+
"description": "How long a pull request's environment lives after its last apply, such as 72h, 90m or 7d. chant components pr-env sweep tears down one whose TTL passed. 72h when absent."
|
|
292
|
+
}
|
|
293
|
+
}
|
|
188
294
|
}
|
|
189
295
|
}
|
|
190
296
|
},
|
|
@@ -254,6 +360,36 @@
|
|
|
254
360
|
},
|
|
255
361
|
"additionalProperties": false,
|
|
256
362
|
"$defs": {
|
|
363
|
+
"ciCloudIdentityRules": {
|
|
364
|
+
"type": "array",
|
|
365
|
+
"minItems": 1,
|
|
366
|
+
"description": "Rules, first match wins: a rule matches a pipeline when its environments match the pipeline's environment and its members match the pipeline's member. A rule with no environments matches every environment, and one with no members every member and a pipeline outside a member.",
|
|
367
|
+
"items": {
|
|
368
|
+
"type": "object",
|
|
369
|
+
"additionalProperties": false,
|
|
370
|
+
"patternProperties": { "^x-": true },
|
|
371
|
+
"required": ["plan", "apply"],
|
|
372
|
+
"properties": {
|
|
373
|
+
"environments": {
|
|
374
|
+
"type": "array",
|
|
375
|
+
"minItems": 1,
|
|
376
|
+
"uniqueItems": true,
|
|
377
|
+
"items": { "type": "string", "minLength": 1 },
|
|
378
|
+
"description": "Environment-name globs, such as prod or staging-*."
|
|
379
|
+
},
|
|
380
|
+
"members": { "$ref": "#/$defs/ciMemberGlobs" },
|
|
381
|
+
"plan": { "type": "string", "minLength": 1, "description": "The identity the plan and record jobs take: a role ARN, a service account email or a client id." },
|
|
382
|
+
"apply": { "type": "string", "minLength": 1, "description": "The identity the apply jobs take." }
|
|
383
|
+
}
|
|
384
|
+
}
|
|
385
|
+
},
|
|
386
|
+
"ciMemberGlobs": {
|
|
387
|
+
"type": "array",
|
|
388
|
+
"minItems": 1,
|
|
389
|
+
"uniqueItems": true,
|
|
390
|
+
"items": { "type": "string", "minLength": 1, "pattern": "^[a-z0-9*?\\[\\]{},!-]+$" },
|
|
391
|
+
"description": "Globs over member names, such as prod-* or [\"api\", \"web\"]: * and ? within the name, [...] classes, {a,b} alternatives."
|
|
392
|
+
},
|
|
257
393
|
"retentionDays": {
|
|
258
394
|
"type": "integer",
|
|
259
395
|
"minimum": 0,
|
|
@@ -504,6 +640,9 @@
|
|
|
504
640
|
"properties": {
|
|
505
641
|
"workflow": {
|
|
506
642
|
"$ref": "#/$defs/ciWorkflow"
|
|
643
|
+
},
|
|
644
|
+
"hooks": {
|
|
645
|
+
"$ref": "#/$defs/ciHooks"
|
|
507
646
|
}
|
|
508
647
|
}
|
|
509
648
|
},
|
|
@@ -1582,6 +1721,14 @@
|
|
|
1582
1721
|
"enum": ["trunk-curated", "trunk-curated+apply-on-merge"],
|
|
1583
1722
|
"description": "A prescribed delivery workflow (#4168). trunk-curated: a merge records the plan and deploys nothing; releases are cut from green commits and promoted through each member's environments, gated in the last. trunk-curated+apply-on-merge: the same, with the apply on merge turned back on. chant workspace check reports what a member under one still lacks (WSP151), and chant ci init writes it. At the top level for every member, or on a member, which wins. Added in schema 1 by chant 0.124.34, so a declaration that uses it sets minReader to 0.124.34 or newer."
|
|
1584
1723
|
},
|
|
1724
|
+
"ciHooks": {
|
|
1725
|
+
"type": "object",
|
|
1726
|
+
"description": "Stage hooks the pull-request jobs run (#4288), in the shape an Op waves spec's hooks take: before.observe, before.plan, after.plan, before.apply and after.apply, each a list of { command, name?, onFailure?, perRun?, targets? }. targets are component names or patterns. chant components pr-plan, pr-record and pr-apply read them from the declaration at base, the top level's first and then the member's. after.gate and apply.runBy are refused. Added in schema 1 by chant 0.124.41, so a declaration that uses it sets minReader to 0.124.41 or newer."
|
|
1727
|
+
},
|
|
1728
|
+
"ciPolicy": {
|
|
1729
|
+
"type": "object",
|
|
1730
|
+
"description": "Gate-time policy on the pull-request jobs (#4294): a policy engine run over the change set, with the policy read at base. engine names the result shape the command prints, conftest (the default) or opa. path is the policy directory, relative to the declaration (default policy). namespace is the package to read. command replaces the engine's own argv, with {policy} for the policy directory exported from base and {input} for the input file. deny rules refuse the apply unless an override counts; hold rules make the plan wait for a person's approval; warn rules are advice. There is no unattended outcome. Added in schema 1 by chant 0.124.41, so a declaration that uses it sets minReader to 0.124.41 or newer."
|
|
1731
|
+
},
|
|
1585
1732
|
"ciPhaseName": {
|
|
1586
1733
|
"type": "string",
|
|
1587
1734
|
"pattern": "^[A-Za-z0-9][A-Za-z0-9_.-]{0,63}$"
|
|
@@ -13,7 +13,7 @@
|
|
|
13
13
|
* The module imports node:crypto through `./trust/gate-seal.ts` and nothing
|
|
14
14
|
* else: no zod, no ajv, no package loading, so it bundles small.
|
|
15
15
|
*/
|
|
16
|
-
import { type SealedGateApproval } from "
|
|
16
|
+
import { type SealedGateApproval } from "../lifecycle/gate-seal.js";
|
|
17
17
|
import type { Signer } from "./trust/trust-files.js";
|
|
18
18
|
/** The core classes, in the order a principal's roles are tried; `human` holds no role and is the rest. */
|
|
19
19
|
export declare const CORE_PRINCIPAL_CLASSES: readonly ["human", "agent", "runner", "service"];
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"identity-gate-rule.d.ts","sourceRoot":"","sources":["../../src/workspace/identity-gate-rule.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAEH,OAAO,EAAsH,KAAK,kBAAkB,EAAE,MAAM,
|
|
1
|
+
{"version":3,"file":"identity-gate-rule.d.ts","sourceRoot":"","sources":["../../src/workspace/identity-gate-rule.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;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/gate-seal.ts` and nothing
|
|
14
14
|
* else: no zod, no ajv, no package loading, so it bundles small.
|
|
15
15
|
*/
|
|
16
|
-
import { GATE_SEAL_NAMESPACE, gateSealPayload, namespaceAllowed, sshKeyFingerprint, sshSignatureKey, verifySshSignatureWith } from "
|
|
16
|
+
import { GATE_SEAL_NAMESPACE, gateSealPayload, namespaceAllowed, sshKeyFingerprint, sshSignatureKey, verifySshSignatureWith } from "../lifecycle/gate-seal.js";
|
|
17
17
|
/** The core classes, in the order a principal's roles are tried; `human` holds no role and is the rest. */
|
|
18
18
|
export const CORE_PRINCIPAL_CLASSES = ["human", "agent", "runner", "service"];
|
|
19
19
|
export const CORE_CLASSES = [
|
|
@@ -28,7 +28,7 @@ import type { Declaration, SignedGate } from "./declaration.js";
|
|
|
28
28
|
import { type GateAdmissionRule } from "./identity-gate-rule.js";
|
|
29
29
|
import { type ClassRegistry } from "./principal-classes.js";
|
|
30
30
|
import type { TrustPolicy } from "./trust/policy.js";
|
|
31
|
-
import type { SealedGateApproval } from "
|
|
31
|
+
import type { SealedGateApproval } from "../lifecycle/gate-seal.js";
|
|
32
32
|
/** The forges a forge identity can name. */
|
|
33
33
|
export declare const FORGES: readonly ["github", "gitlab", "forgejo", "gitea"];
|
|
34
34
|
export type Forge = (typeof FORGES)[number];
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"identity.d.ts","sourceRoot":"","sources":["../../src/workspace/identity.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;GAyBG;AAEH,OAAO,KAAK,EAAE,WAAW,EAAE,UAAU,EAAE,MAAM,eAAe,CAAC;AAC7D,OAAO,EAA+B,KAAK,iBAAiB,EAAE,MAAM,sBAAsB,CAAC;AAC3F,OAAO,EAA4C,KAAK,aAAa,EAAE,MAAM,qBAAqB,CAAC;AAGnG,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,gBAAgB,CAAC;AAClD,OAAO,KAAK,EAAE,kBAAkB,EAAE,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AA;CAAE,CAInH;AAED;;;;;;GAMG;AACH,wBAAgB,aAAa,CAAC,GAAG,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,EAAE,IAAI,CAAC,EAAE,MAAM,GAAG,aAAa,GAAG,IAAI,CAE5F"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"lineage-upgrade.d.ts","sourceRoot":"","sources":["../../src/workspace/lineage-upgrade.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAoCG;AAOH,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,qBAAqB,CAAC;
|
|
1
|
+
{"version":3,"file":"lineage-upgrade.d.ts","sourceRoot":"","sources":["../../src/workspace/lineage-upgrade.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAoCG;AAOH,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,qBAAqB,CAAC;AAIhE,OAAO,EAEL,SAAS,EAOT,KAAK,OAAO,EAGZ,KAAK,UAAU,EAChB,MAAM,gBAAgB,CAAC;AAExB,OAAO,EAAkC,KAAK,oBAAoB,EAAE,MAAM,oBAAoB,CAAC;AAG/F,OAAO,EAAiB,KAAK,YAAY,EAAE,MAAM,kBAAkB,CAAC;AAOpE,gGAAgG;AAChG,eAAO,MAAM,iBAAiB,sBAAsB,CAAC;AAErD,kEAAkE;AAClE,eAAO,MAAM,WAAW,mBAAmB,CAAC;AAE5C,qBAAa,YAAa,SAAQ,SAAS;IAChC,IAAI,SAAkB;CAChC;AAID,MAAM,WAAW,YAAY;IAC3B,IAAI,EAAE,OAAO,GAAG,MAAM,GAAG,iBAAiB,GAAG,WAAW,CAAC;IACzD,MAAM,EAAE,QAAQ,GAAG,QAAQ,GAAG,SAAS,CAAC;IACxC,yEAAyE;IACzE,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,uGAAuG;IACvG,MAAM,CAAC,EAAE,MAAM,CAAC;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AM,CAAC;IACb,IAAI,EAAE,MAAM,CAAC;IACb,4DAA4D;IAC5D,QAAQ,EAAE,MAAM,CAAC;IACjB,eAAe,EAAE,MAAM,CAAC;IACxB,+CAA+C;IAC/C,OAAO,IAAI,IAAI,CAAC;CACjB;AA+OD,mGAAmG;AACnG,wBAAgB,gBAAgB,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAEtD;AAsFD;;;;;;GAMG;AACH,wBAAgB,oBAAoB,CAAC,IAAI,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,GAAG,SAAS,GAAG;IAAE,IAAI,EAAE,MAAM,CAAC;IAAC,KAAK,EAAE,MAAM,CAAC;IAAC,MAAM,CAAC,EAAE,MAAM,CAAA;CAAE,CAyBjI;AAED;;;;;GAKG;AACH,wBAAsB,YAAY,CAAC,OAAO,EAAE,cAAc,GAAG,OAAO,CAAC,aAAa,CAAC,CA0QlF;AAyBD,2EAA2E;AAC3E,wBAAgB,kBAAkB,CAAC,MAAM,EAAE,aAAa,GAAG,IAAI,CAa9D;AAED;;;GAGG;AACH,wBAAgB,mBAAmB,CAAC,MAAM,EAAE,aAAa,EAAE,MAAM,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,GAAG,MAAM,CAiBlG;AAED,sEAAsE;AACtE,wBAAgB,cAAc,CAAC,MAAM,EAAE,aAAa,GAAG,MAAM,EAAE,CAmC9D"}
|
|
@@ -40,6 +40,7 @@ import { chmodSync, existsSync, lstatSync, mkdirSync, mkdtempSync, readdirSync,
|
|
|
40
40
|
import { tmpdir } from "node:os";
|
|
41
41
|
import { basename, dirname, join, relative, resolve, sep } from "node:path";
|
|
42
42
|
import { computePlanDigest } from "../lifecycle/plan-digest.js";
|
|
43
|
+
import { quorumRules } from "../op/gate-quorum.js";
|
|
43
44
|
import { checkLineage, findingKey } from "./lineage-check.js";
|
|
44
45
|
import { dirLabel, git, parseDirSpec, parseTemplateSource, portableUrl, readTemplateDir, readTemplateTree, recordedDirPath } from "./lineage-init.js";
|
|
45
46
|
import { LOCK_FILE, LockError, contentDigest, fileHash, readLock, renderLock, scopeKey, writeLock, } from "./lineage-lock.js";
|
|
@@ -419,11 +420,13 @@ async function rulesAtHead(repo, paths) {
|
|
|
419
420
|
const rel = relative(repo, filePath).split(sep).join("/");
|
|
420
421
|
if (!opFiles.has(rel))
|
|
421
422
|
continue;
|
|
423
|
+
// #4290: a quorum may be a list of rules; the strictest count is asked for.
|
|
422
424
|
for (const approval of gateApprovals(config)) {
|
|
423
|
-
const
|
|
424
|
-
|
|
425
|
-
|
|
426
|
-
|
|
425
|
+
for (const rule of quorumRules(approval.quorum)) {
|
|
426
|
+
if (rule.count > count) {
|
|
427
|
+
count = rule.count;
|
|
428
|
+
roles = rule.roles;
|
|
429
|
+
}
|
|
427
430
|
}
|
|
428
431
|
}
|
|
429
432
|
}
|
|
@@ -886,7 +889,7 @@ export function describeStaged(staged) {
|
|
|
886
889
|
for (const s of staged.manualSteps)
|
|
887
890
|
lines.push(` manual step: ${at(s.path)} (${s.reason})`);
|
|
888
891
|
if (staged.governance) {
|
|
889
|
-
const q = staged.governance.approval.quorum;
|
|
892
|
+
const q = quorumRules(staged.governance.approval.quorum)[0];
|
|
890
893
|
lines.push(` governance: ${staged.governance.paths.join(", ")}; needs ${q.count} human approval(s)${q.roles ? ` with a role in ${q.roles.join(", ")}` : ""}, from the rules at ${staged.governance.rules.slice(0, 12)}`);
|
|
891
894
|
}
|
|
892
895
|
for (const c of staged.checks) {
|
|
@@ -98,6 +98,12 @@ export interface MemberComponentPlan {
|
|
|
98
98
|
/** The command that regenerates it, run in the member's directory. */
|
|
99
99
|
command: string;
|
|
100
100
|
env: string;
|
|
101
|
+
/**
|
|
102
|
+
* With `--pr-loop`, the branch the pipeline targets: `--branch`, else the
|
|
103
|
+
* branch `ci.branches` routes the member to (#4292). Undefined for the
|
|
104
|
+
* generator's default.
|
|
105
|
+
*/
|
|
106
|
+
branch?: string;
|
|
101
107
|
}
|
|
102
108
|
export interface ComponentPlanInput {
|
|
103
109
|
projectDir: string;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"member-pipeline.d.ts","sourceRoot":"","sources":["../../src/workspace/member-pipeline.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;GAoBG;AAKH,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,YAAY,CAAC;AACjD,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,iBAAiB,CAAC;AAC3D,OAAO,EAA+E,KAAK,WAAW,EAAE,KAAK,MAAM,EAAE,MAAM,eAAe,CAAC;
|
|
1
|
+
{"version":3,"file":"member-pipeline.d.ts","sourceRoot":"","sources":["../../src/workspace/member-pipeline.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;GAoBG;AAKH,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,YAAY,CAAC;AACjD,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,iBAAiB,CAAC;AAC3D,OAAO,EAA+E,KAAK,WAAW,EAAE,KAAK,MAAM,EAAE,MAAM,eAAe,CAAC;AAI3I;;;;GAIG;AACH,eAAO,MAAM,qBAAqB,0BAA0B,CAAC;AAE7D,wCAAwC;AACxC,MAAM,WAAW,kBAAkB;IACjC,sEAAsE;IACtE,IAAI,EAAE,MAAM,CAAC;IACb,sEAAsE;IACtE,OAAO,EAAE,MAAM,CAAC;IAChB,sEAAsE;IACtE,GAAG,CAAC,EAAE,MAAM,CAAC;CACd;AAED,MAAM,WAAW,eAAe;IAC9B,MAAM,EAAE,CAAC,CAAC;IACV,KAAK,EAAE,kBAAkB,EAAE,CAAC;CAC7B;AAED,0DAA0D;AAC1D,MAAM,WAAW,aAAa;IAC5B,WAAW,EAAE,WAAW,CAAC;IACzB,MAAM,EAAE,MAAM,CAAC;IACf,2CAA2C;IAC3C,aAAa,EAAE,MAAM,CAAC;IACtB,4FAA4F;IAC5F,QAAQ,EAAE,MAAM,CAAC;IACjB,+CAA+C;IAC/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C;CACjB;AAED,uFAAuF;AACvF,wBAAgB,qBAAqB,CAAC,KAAK,EAAE;IAC3C,UAAU,EAAE,MAAM,CAAC;IACnB,KAAK,EAAE,mBAAmB,CAAC;IAC3B,QAAQ,EAAE,MAAM,CAAC;IACjB,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,QAAQ,CAAC,EAAE,MAAM,CAAC;CACnB,GAAG,YAAY,GAAG,SAAS,CAsB3B;AAED,0IAA0I;AAC1I,wBAAgB,sBAAsB,CAAC,IAAI,EAAE,YAAY,EAAE,KAAK,EAAE;IAAE,IAAI,EAAE,MAAM,CAAC;IAAC,IAAI,EAAE,MAAM,CAAA;CAAE,EAAE,GAAG,MAAM,EAAE,CAY5G;AAED,oHAAoH;AACpH,wBAAgB,aAAa,CAAC,GAAG,EAAE,OAAO,GAAG,MAAM,CAGlD"}
|
|
@@ -23,6 +23,7 @@ import { existsSync, mkdirSync, readFileSync, realpathSync, writeFileSync } from
|
|
|
23
23
|
import { dirname, join, relative, resolve, sep } from "node:path";
|
|
24
24
|
import { GENERATED_MARKER } from "../discovery/files.js";
|
|
25
25
|
import { ownerOf, readDeclaration, resolveGroups, rootExclusions, WorkspaceReadError } from "./declaration.js";
|
|
26
|
+
import { routedBranch } from "./ci-branches.js";
|
|
26
27
|
import { gitTop, workingTree } from "./tree.js";
|
|
27
28
|
/**
|
|
28
29
|
* TODO(#2541): the interim home of a member's generated-file list, relative
|
|
@@ -158,6 +159,7 @@ export function planMemberComponentPipeline(input) {
|
|
|
158
159
|
if (!ctx)
|
|
159
160
|
return undefined;
|
|
160
161
|
const env = input.env ?? DEFAULT_ENV;
|
|
162
|
+
const branch = input.prLoop ? prLoopBranch(ctx, input.prLoop.branch) : undefined;
|
|
161
163
|
let target;
|
|
162
164
|
if (input.output) {
|
|
163
165
|
target = resolve(input.output);
|
|
@@ -208,8 +210,29 @@ export function planMemberComponentPipeline(input) {
|
|
|
208
210
|
target,
|
|
209
211
|
command: parts.map(shellArg).join(" "),
|
|
210
212
|
env,
|
|
213
|
+
...(branch !== undefined ? { branch } : {}),
|
|
211
214
|
};
|
|
212
215
|
}
|
|
216
|
+
/**
|
|
217
|
+
* The branch a member's pull-request pipeline targets (#4292): the one
|
|
218
|
+
* `ci.branches` routes it to, which `--branch` may repeat but not change.
|
|
219
|
+
* Without a route, `--branch` as given, which may not name a routed branch
|
|
220
|
+
* whose globs leave the member out.
|
|
221
|
+
*/
|
|
222
|
+
function prLoopBranch(ctx, flag) {
|
|
223
|
+
const branches = ctx.declaration.ci?.branches;
|
|
224
|
+
const own = routedBranch(branches, ctx.member.name);
|
|
225
|
+
if (own !== null) {
|
|
226
|
+
if (flag !== undefined && flag !== own) {
|
|
227
|
+
throw new Error(`--branch ${flag}: ci.branches routes member ${ctx.member.name} to ${own}, so its pull-request pipeline targets ${own}`);
|
|
228
|
+
}
|
|
229
|
+
return own;
|
|
230
|
+
}
|
|
231
|
+
if (flag !== undefined && Object.prototype.hasOwnProperty.call(branches ?? {}, flag)) {
|
|
232
|
+
throw new Error(`--branch ${flag}: ci.branches applies only the members its globs match from ${flag}, and member ${ctx.member.name} is not one`);
|
|
233
|
+
}
|
|
234
|
+
return flag;
|
|
235
|
+
}
|
|
213
236
|
/** Write a member's pipeline with its header and record it as the member's generated file. */
|
|
214
237
|
export function writeMemberComponentPipeline(plan, yaml) {
|
|
215
238
|
mkdirSync(dirname(plan.target), { recursive: true });
|
|
@@ -37,8 +37,8 @@
|
|
|
37
37
|
"description": "planned: every member planned (plan stage). recorded (#4168, chant 0.124.33 and newer): every member planned on the merged commit and the merge record was written (record stage); approval says whether the plan is the approved one, and nothing applied. plan-failed: a member failed to plan, so nothing can apply. nothing: no component deploys what the change touches. applied: every member applied. failed: a member failed to apply and its dependents did not run. wave-applied (#4003, chant 0.124.32 and newer): with --wave-gate and --wave, the wave applied and a later wave is still to run. refused: nothing applied, see refusal. waiting (#3999): the approved plans applied except members held back after an upstream applied, which wait on an approval of the plan the last of rounds made."
|
|
38
38
|
},
|
|
39
39
|
"refusal": {
|
|
40
|
-
"enum": ["not-approved", "plan-changed", "not-a-reviewer", "author-approved", "no-pull-request", "wave-not-approved", "wave-plan-changed", "earlier-wave"],
|
|
41
|
-
"description": "Why an apply refused. plan-changed: an approval stands for another digest, so the plan changed after review. author-approved (#4000): under --require-review, an approval names the pull request's author or an author or committer of one of its commits. With --wave-gate (#4003, chant 0.124.32 and newer): wave-not-approved, a wave's new plan is not covered by the approved one and no approval of its gate stands for it; wave-plan-changed, an approval of its gate stands for another digest; earlier-wave, an earlier wave has work left or no record says it applied. The waves that applied before a wave refused stay applied; waves says which."
|
|
40
|
+
"enum": ["not-approved", "plan-changed", "not-a-reviewer", "author-approved", "no-pull-request", "wave-not-approved", "wave-plan-changed", "earlier-wave", "locked", "policy-denied", "policy-error"],
|
|
41
|
+
"description": "Why an apply refused. plan-changed: an approval stands for another digest, so the plan changed after review. author-approved (#4000): under --require-review, an approval names the pull request's author or an author or committer of one of its commits. With --wave-gate (#4003, chant 0.124.32 and newer): wave-not-approved, a wave's new plan is not covered by the approved one and no approval of its gate stands for it; wave-plan-changed, an approval of its gate stands for another digest; earlier-wave, an earlier wave has work left or no record says it applied. The waves that applied before a wave refused stay applied; waves says which. locked (#4293, chant 0.124.41 and newer): under ci.locks, another open pull request holds a lock on a target the apply reaches, and nothing applied. With ci.policy (#4294, chant 0.124.41 and newer): policy-denied, the policy at base denied the plan and no override counts; policy-error, the policy could not be run or gave no readable answer."
|
|
42
42
|
},
|
|
43
43
|
"message": { "type": "string", "description": "The refusal or failure as printed." },
|
|
44
44
|
"resumed": {
|
|
@@ -77,6 +77,21 @@
|
|
|
77
77
|
}
|
|
78
78
|
}
|
|
79
79
|
},
|
|
80
|
+
"overdue": {
|
|
81
|
+
"type": "array",
|
|
82
|
+
"description": "Added within contract version 1 by #4289, written by chant 0.124.41 and newer. Plan stage: the scheduled watch and reconcile Ops whose cron has fired at least twice since their job last ran, or since their pipeline file was added when no run is on record. Absent when none is overdue or the forge was not asked.",
|
|
83
|
+
"items": {
|
|
84
|
+
"type": "object",
|
|
85
|
+
"required": ["op", "cron", "since", "message"],
|
|
86
|
+
"properties": {
|
|
87
|
+
"op": { "type": "string" },
|
|
88
|
+
"cron": { "type": "string" },
|
|
89
|
+
"since": { "type": "string", "description": "The job's last run, or the pipeline file's first commit when neverRan, ISO 8601." },
|
|
90
|
+
"neverRan": { "type": "boolean" },
|
|
91
|
+
"message": { "type": "string", "description": "The warning as the plan note prints it." }
|
|
92
|
+
}
|
|
93
|
+
}
|
|
94
|
+
},
|
|
80
95
|
"plannedOutputs": {
|
|
81
96
|
"type": "object",
|
|
82
97
|
"description": "Added within contract version 1 by #3999, written by chant 0.124.32 and newer. Per dependency in the change that a member was planned against, the names of the outputs its plan knows, sorted. An output a member reads that is not listed is known only after apply, and the member lists it under unknownInputs. Absent when no member read one.",
|
|
@@ -175,6 +190,62 @@
|
|
|
175
190
|
"changeSet": {
|
|
176
191
|
"type": "object",
|
|
177
192
|
"description": "The change-set document over every member (change-set.schema.json). Its digest equals digest."
|
|
193
|
+
},
|
|
194
|
+
"hooks": {
|
|
195
|
+
"type": "array",
|
|
196
|
+
"description": "Added within contract version 1 by #4288, written by chant 0.124.41 and newer. The stage hooks the job ran, in order, from ci.hooks in the workspace declaration at base. Absent when it ran none.",
|
|
197
|
+
"items": {
|
|
198
|
+
"type": "object",
|
|
199
|
+
"required": ["moment", "name", "exit", "outcome"],
|
|
200
|
+
"additionalProperties": false,
|
|
201
|
+
"properties": {
|
|
202
|
+
"moment": { "enum": ["before-observe", "before-plan", "after-plan", "before-apply", "after-apply"] },
|
|
203
|
+
"name": { "type": "string" },
|
|
204
|
+
"target": { "type": "string", "description": "The component, for a perRun hook." },
|
|
205
|
+
"exit": { "type": "integer" },
|
|
206
|
+
"outcome": { "enum": ["passed", "failed", "held"], "description": "held: an onFailure approve hook failed, which the pull request's gate answers." }
|
|
207
|
+
}
|
|
208
|
+
}
|
|
209
|
+
},
|
|
210
|
+
"policy": {
|
|
211
|
+
"type": "object",
|
|
212
|
+
"description": "Added within contract version 1 by #4294, written by chant 0.124.41 and newer. What ci.policy in the workspace declaration at base said about the change set. Absent when the base sets no policy, or the stage reached no plan to judge.",
|
|
213
|
+
"required": ["result", "engine", "base", "denials", "holds", "warnings"],
|
|
214
|
+
"additionalProperties": false,
|
|
215
|
+
"properties": {
|
|
216
|
+
"result": { "enum": ["passed", "denied", "held", "error"], "description": "denied wins over held. error: the policy did not run or gave no readable answer, and nothing applies." },
|
|
217
|
+
"engine": { "enum": ["conftest", "opa"], "description": "The result shape read." },
|
|
218
|
+
"base": { "type": "string", "description": "The commit the settings and the policy were read at." },
|
|
219
|
+
"denials": { "type": "array", "items": { "$ref": "#/$defs/policyFinding" } },
|
|
220
|
+
"rules": { "type": "array", "items": { "type": "string" }, "description": "The ids of the rules that denied, sorted: what an override names." },
|
|
221
|
+
"holds": { "type": "array", "items": { "$ref": "#/$defs/policyFinding" }, "description": "Rules that hold the plan for a person's approval of its digest." },
|
|
222
|
+
"warnings": { "type": "array", "items": { "type": "string" } },
|
|
223
|
+
"error": { "type": "string" },
|
|
224
|
+
"override": {
|
|
225
|
+
"type": "object",
|
|
226
|
+
"required": ["by", "at", "reason", "digest"],
|
|
227
|
+
"additionalProperties": false,
|
|
228
|
+
"description": "The override on _gates/policy-override.jsonl that lets the denied plan through.",
|
|
229
|
+
"properties": {
|
|
230
|
+
"by": { "type": "string" },
|
|
231
|
+
"at": { "type": "string" },
|
|
232
|
+
"reason": { "type": "string" },
|
|
233
|
+
"digest": { "type": "string", "description": "The override digest: the op, the plan digest and the rules." }
|
|
234
|
+
}
|
|
235
|
+
},
|
|
236
|
+
"overrideCommand": { "type": "string", "description": "While denied: the command that overrides the denial." }
|
|
237
|
+
}
|
|
238
|
+
}
|
|
239
|
+
},
|
|
240
|
+
"$defs": {
|
|
241
|
+
"policyFinding": {
|
|
242
|
+
"type": "object",
|
|
243
|
+
"required": ["rule", "message"],
|
|
244
|
+
"additionalProperties": false,
|
|
245
|
+
"properties": {
|
|
246
|
+
"rule": { "type": "string", "description": "<package>.<rule>, such as main.deny_public_bucket." },
|
|
247
|
+
"message": { "type": "string" }
|
|
248
|
+
}
|
|
178
249
|
}
|
|
179
250
|
}
|
|
180
251
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"security.d.ts","sourceRoot":"","sources":["../../src/workspace/security.ts"],"names":[],"mappings":"AAgCA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,eAAe,CAAC;AAEjD,OAAO,EAAe,KAAK,WAAW,EAAE,MAAM,eAAe,CAAC;AAE9D,eAAO,MAAM,eAAe,YAAI,mBAAmB,EAAE,cAAc,EAAE,YAAY,EAAE,cAAc,EAAE,kBAAkB,CAAU,CAAC;AAEhI,MAAM,MAAM,aAAa,GAAG,CAAC,OAAO,eAAe,CAAC,CAAC,MAAM,CAAC,CAAC;AAE7D;;;;GAIG;AACH,wBAAgB,gBAAgB,CAAC,WAAW,EAAE,IAAI,CAAC,WAAW,EAAE,UAAU,GAAG,SAAS,CAAC,GAAG,IAAI,GAAG,SAAS,EAAE,MAAM,GAAE,MAAM,GAAG,IAAW,GAAG,WAAW,CAAC,aAAa,CAAC,CAGpK;AAED,iFAAiF;AACjF,wBAAgB,WAAW,CAAC,MAAM,EAAE,IAAI,CAAC,WAAW,EAAE,aAAa,GAAG,YAAY,CAAC,EAAE,GAAG,EAAE,MAAM,GAAG,MAAM,GAAG,IAAI,CAW/G;AAED,4HAA4H;AAC5H,wBAAgB,gBAAgB,CAAC,MAAM,EAAE,IAAI,CAAC,WAAW,EAAE,aAAa,GAAG,YAAY,CAAC,EAAE,GAAG,EAAE,MAAM,GAAG,WAAW,CAAC,aAAa,CAAC,CAEjI;AAED;;;;GAIG;AACH,wBAAgB,gBAAgB,CAAC,GAAG,EAAE,MAAM,EAAE,EAAE,CAAC,EAAE,MAAM,GAAG,WAAW,CAAC,aAAa,CAAC,CAErF;AAED,+DAA+D;AAC/D,MAAM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AC,GAAG,EAAE,MAAM,EAAE,EAAE,CAAC,EAAE,MAAM,GAAG,WAAW,CAAC,aAAa,CAAC,CAErF;AAED,+DAA+D;AAC/D,MAAM,WAAW,eAAe;IAC9B,OAAO,EAAE,MAAM,CAAC;IAChB,iDAAiD;IACjD,SAAS,EAAE,MAAM,CAAC;IAClB,8BAA8B;IAC9B,OAAO,EAAE,MAAM,CAAC;IAChB,KAAK,EAAE,aAAa,GAAG,IAAI,CAAC;IAC5B,iFAAiF;IACjF,KAAK,EAAE,SAAS,MAAM,EAAE,CAAC;CAC1B;AAED;;;;GAIG;AACH,eAAO,MAAM,iBAAiB,EAAE,SAAS,eAAe,EAoBvD,CAAC;AAEF,4EAA4E;AAC5E,wBAAgB,oBAAoB,IAAI,MAAM,CAG7C"}
|
|
@@ -91,6 +91,10 @@ export const SECURITY_FEATURES = [
|
|
|
91
91
|
{ feature: "Apply jobs require a runner-start statement", byDefault: "off", setting: "`--require-runner-start`", group: "isolated-runners", codes: ["security-runner-start-no-key", "security-runner-start-no-role", "security-trust-unreadable"] },
|
|
92
92
|
{ feature: "Secrets file", byDefault: "off", setting: "`--secrets`", group: null, codes: [] },
|
|
93
93
|
{ feature: "Env allowlist and log redaction", byDefault: "on: `ci run`'s contract, a listed exception", setting: "`--pass-env`", group: null, codes: [] },
|
|
94
|
+
// #4295: the plan job's steps never hold a forge token; the plan-note job posts. Part of the generated pipeline, so nothing turns it on.
|
|
95
|
+
{ feature: "Plan steps hold no forge token", byDefault: "on: the plan job's contract, a listed exception", setting: "regenerate the pipeline", group: null, codes: [] },
|
|
96
|
+
// #4296: the plan job trades its OIDC token for the plan identity before the checkout, and the apply jobs take the apply identity.
|
|
97
|
+
{ feature: "Separate plan and apply cloud identities", byDefault: "off: no job requests an OIDC token", setting: "`ci.identity.cloud`", group: null, codes: [] },
|
|
94
98
|
];
|
|
95
99
|
/** The reference page's table of {@link SECURITY_FEATURES}, as markdown. */
|
|
96
100
|
export function securityFeatureTable() {
|