@intentius/chant 0.124.87 → 0.124.88
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/action-pins.d.ts +1 -0
- package/dist/action-pins.d.ts.map +1 -1
- package/dist/action-pins.js +2 -0
- package/dist/actor.d.ts +12 -0
- package/dist/actor.d.ts.map +1 -0
- package/dist/actor.js +18 -0
- package/dist/bundle-check.d.ts +20 -5
- package/dist/bundle-check.d.ts.map +1 -1
- package/dist/bundle-check.js +20 -5
- package/dist/chant-install.d.ts +98 -0
- package/dist/chant-install.d.ts.map +1 -1
- package/dist/chant-install.js +204 -2
- package/dist/ci-commit.d.ts +1 -1
- package/dist/ci-commit.d.ts.map +1 -1
- package/dist/ci-commit.js +1 -2
- package/dist/ci-control.d.ts +1 -1
- package/dist/ci-control.d.ts.map +1 -1
- package/dist/ci-control.js +1 -1
- package/dist/ci-evidence-claims.d.ts +59 -0
- package/dist/ci-evidence-claims.d.ts.map +1 -0
- package/dist/ci-evidence-claims.js +87 -0
- package/dist/ci-evidence-from-job.d.ts +103 -0
- package/dist/ci-evidence-from-job.d.ts.map +1 -0
- package/dist/ci-evidence-from-job.js +162 -0
- package/dist/ci-evidence-jobs.d.ts +39 -4
- package/dist/ci-evidence-jobs.d.ts.map +1 -1
- package/dist/ci-evidence-jobs.js +38 -4
- package/dist/ci-handover.d.ts +12 -0
- package/dist/ci-handover.d.ts.map +1 -1
- package/dist/ci-handover.js +15 -3
- package/dist/ci-identity.d.ts +32 -6
- package/dist/ci-identity.d.ts.map +1 -1
- package/dist/ci-identity.js +40 -8
- package/dist/ci-image.d.ts +47 -9
- package/dist/ci-image.d.ts.map +1 -1
- package/dist/ci-image.js +45 -18
- package/dist/ci-jobs.d.ts +1 -1
- package/dist/ci-jobs.d.ts.map +1 -1
- package/dist/ci-jobs.js +7 -2
- package/dist/ci-login.d.ts +75 -13
- package/dist/ci-login.d.ts.map +1 -1
- package/dist/ci-login.js +89 -37
- package/dist/ci-product-words.d.ts +20 -1
- package/dist/ci-product-words.d.ts.map +1 -1
- package/dist/ci-product-words.js +27 -1
- package/dist/ci-product.d.ts +21 -2
- package/dist/ci-product.d.ts.map +1 -1
- package/dist/ci-product.js +21 -2
- package/dist/cli/handlers/approve-confirm.d.ts +14 -0
- package/dist/cli/handlers/approve-confirm.d.ts.map +1 -1
- package/dist/cli/handlers/approve-confirm.js +46 -0
- package/dist/cli/handlers/build.d.ts +1 -1
- package/dist/cli/handlers/build.d.ts.map +1 -1
- package/dist/cli/handlers/build.js +22 -1
- package/dist/cli/handlers/ci-check.d.ts.map +1 -1
- package/dist/cli/handlers/ci-check.js +21 -1
- package/dist/cli/handlers/ci-evidence.d.ts.map +1 -1
- package/dist/cli/handlers/ci-evidence.js +227 -18
- package/dist/cli/handlers/ci-forge-check.d.ts.map +1 -1
- package/dist/cli/handlers/ci-forge-check.js +34 -17
- package/dist/cli/handlers/generated-check.d.ts +3 -0
- package/dist/cli/handlers/generated-check.d.ts.map +1 -0
- package/dist/cli/handlers/generated-check.js +41 -0
- package/dist/cli/handlers/lifecycle.d.ts.map +1 -1
- package/dist/cli/handlers/lifecycle.js +3 -0
- package/dist/cli/handlers/local-chant.d.ts +13 -0
- package/dist/cli/handlers/local-chant.d.ts.map +1 -1
- package/dist/cli/handlers/local-chant.js +42 -1
- package/dist/cli/handlers/pr.d.ts.map +1 -1
- package/dist/cli/handlers/pr.js +42 -5
- package/dist/cli/handlers/run-wave.js +8 -0
- package/dist/cli/main.d.ts.map +1 -1
- package/dist/cli/main.js +38 -4
- package/dist/cli/parse-args.d.ts.map +1 -1
- package/dist/cli/parse-args.js +66 -0
- package/dist/cli/registry.d.ts +24 -0
- package/dist/cli/registry.d.ts.map +1 -1
- package/dist/components/check-hooks.d.ts +10 -0
- package/dist/components/check-hooks.d.ts.map +1 -1
- package/dist/components/check-hooks.js +18 -0
- package/dist/components/pr-checks.d.ts +105 -0
- package/dist/components/pr-checks.d.ts.map +1 -0
- package/dist/components/pr-checks.js +119 -0
- package/dist/components/pr-pipeline.d.ts +34 -0
- package/dist/components/pr-pipeline.d.ts.map +1 -1
- package/dist/components/pr-pipeline.js +14 -1
- package/dist/components/product-pipeline.d.ts +16 -1
- package/dist/components/product-pipeline.d.ts.map +1 -1
- package/dist/components/product-pipeline.js +17 -2
- package/dist/components/product-plan.d.ts +257 -4
- package/dist/components/product-plan.d.ts.map +1 -1
- package/dist/components/product-plan.js +241 -11
- package/dist/config.d.ts +10 -6
- package/dist/config.d.ts.map +1 -1
- package/dist/config.js +11 -6
- package/dist/control/consumers.d.ts +6 -0
- package/dist/control/consumers.d.ts.map +1 -1
- package/dist/control/consumers.js +6 -0
- package/dist/dead-guards.d.ts.map +1 -1
- package/dist/dead-guards.js +9 -6
- package/dist/discovery/files.d.ts +1 -1
- package/dist/discovery/files.js +1 -1
- package/dist/drift-issue.d.ts +20 -3
- package/dist/drift-issue.d.ts.map +1 -1
- package/dist/drift-issue.js +16 -0
- package/dist/drift-record.d.ts +45 -5
- package/dist/drift-record.d.ts.map +1 -1
- package/dist/drift-record.js +27 -6
- package/dist/floor-table.d.ts +6 -6
- package/dist/floor-table.d.ts.map +1 -1
- package/dist/floor-table.data.d.ts.map +1 -1
- package/dist/floor-table.data.js +58 -21
- package/dist/floor-table.js +10 -7
- package/dist/forge-check/contract.d.ts +8 -0
- package/dist/forge-check/contract.d.ts.map +1 -1
- package/dist/forge-check/contract.js +4 -1
- package/dist/forge-check/index.d.ts +2 -0
- package/dist/forge-check/index.d.ts.map +1 -1
- package/dist/forge-check/index.js +2 -0
- package/dist/forge-flags.d.ts +10 -0
- package/dist/forge-flags.d.ts.map +1 -1
- package/dist/forge-flags.js +31 -0
- package/dist/forge-remote.d.ts +47 -0
- package/dist/forge-remote.d.ts.map +1 -0
- package/dist/forge-remote.js +69 -0
- package/dist/generated-check.d.ts +74 -0
- package/dist/generated-check.d.ts.map +1 -0
- package/dist/generated-check.js +216 -0
- package/dist/lexicon.d.ts +16 -0
- package/dist/lexicon.d.ts.map +1 -1
- package/dist/lifecycle/publish-npm.d.ts +15 -0
- package/dist/lifecycle/publish-npm.d.ts.map +1 -1
- package/dist/lifecycle/publish-npm.js +49 -3
- package/dist/lifecycle/release-images.d.ts +22 -1
- package/dist/lifecycle/release-images.d.ts.map +1 -1
- package/dist/lifecycle/release-images.js +27 -3
- package/dist/lifecycle/release-ledger.d.ts +4 -3
- package/dist/lifecycle/release-ledger.d.ts.map +1 -1
- package/dist/lifecycle/release-ledger.js +3 -2
- package/dist/local-chant.d.ts +57 -3
- package/dist/local-chant.d.ts.map +1 -1
- package/dist/local-chant.js +122 -13
- package/dist/op/op-waves-evidence-jobs.d.ts +92 -0
- package/dist/op/op-waves-evidence-jobs.d.ts.map +1 -0
- package/dist/op/op-waves-evidence-jobs.js +112 -0
- package/dist/op/op-waves-evidence.d.ts +12 -1
- package/dist/op/op-waves-evidence.d.ts.map +1 -1
- package/dist/op/op-waves-evidence.js +23 -2
- package/dist/op/op-waves-run.d.ts +12 -1
- package/dist/op/op-waves-run.d.ts.map +1 -1
- package/dist/op/op-waves-run.js +54 -3
- package/dist/op/op-waves.d.ts +8 -0
- package/dist/op/op-waves.d.ts.map +1 -1
- package/dist/op/op-waves.js +10 -0
- package/dist/op/schedule-overdue.d.ts +39 -2
- package/dist/op/schedule-overdue.d.ts.map +1 -1
- package/dist/op/schedule-overdue.js +89 -7
- package/dist/pr-forge-reads.d.ts +21 -1
- package/dist/pr-forge-reads.d.ts.map +1 -1
- package/dist/pr-forge-reads.js +19 -1
- package/dist/pr-forge.d.ts +7 -1
- package/dist/pr-forge.d.ts.map +1 -1
- package/dist/pr-forge.js +7 -2
- package/dist/pr-plan-note.d.ts +24 -0
- package/dist/pr-plan-note.d.ts.map +1 -1
- package/dist/pr-plan-note.js +11 -1
- package/dist/pr-plan-record.d.ts +47 -0
- package/dist/pr-plan-record.d.ts.map +1 -0
- package/dist/pr-plan-record.js +89 -0
- package/dist/pr-post.d.ts +40 -0
- package/dist/pr-post.d.ts.map +1 -1
- package/dist/pr-post.js +79 -6
- package/dist/pr-requires.d.ts +8 -0
- package/dist/pr-requires.d.ts.map +1 -1
- package/dist/pr-requires.js +3 -1
- package/dist/ref-gate-init.d.ts +76 -0
- package/dist/ref-gate-init.d.ts.map +1 -0
- package/dist/ref-gate-init.js +144 -0
- package/dist/ref-gate-rules.d.ts +19 -0
- package/dist/ref-gate-rules.d.ts.map +1 -0
- package/dist/ref-gate-rules.js +17 -0
- package/dist/release-floors.d.ts +64 -16
- package/dist/release-floors.d.ts.map +1 -1
- package/dist/release-floors.js +65 -17
- package/dist/state-migration.d.ts +24 -1
- package/dist/state-migration.d.ts.map +1 -1
- package/dist/state-migration.js +39 -3
- package/dist/state-unlock.d.ts +32 -1
- package/dist/state-unlock.d.ts.map +1 -1
- package/dist/state-unlock.js +31 -0
- package/dist/wave-runtime.mjs +292 -285
- package/dist/workspace/ci-green-cli.d.ts.map +1 -1
- package/dist/workspace/ci-green-cli.js +13 -7
- package/dist/workspace/drift-cli.d.ts +1 -1
- package/dist/workspace/drift-cli.d.ts.map +1 -1
- package/dist/workspace/drift-cli.js +5 -12
- package/dist/workspace/forge-work.d.ts +3 -2
- package/dist/workspace/forge-work.d.ts.map +1 -1
- package/dist/workspace/forge-work.js +7 -17
- package/dist/workspace/lexicon-outputs.js +2 -2
- package/dist/workspace/release-workflow.d.ts +26 -3
- package/dist/workspace/release-workflow.d.ts.map +1 -1
- package/dist/workspace/release-workflow.js +48 -6
- package/dist/workspace/trust/check-evidence-report.d.ts +18 -0
- package/dist/workspace/trust/check-evidence-report.d.ts.map +1 -1
- package/dist/workspace/trust/check-evidence-report.js +13 -0
- package/dist/workspace/trust/check-evidence.d.ts +13 -1
- package/dist/workspace/trust/check-evidence.d.ts.map +1 -1
- package/dist/workspace/trust/check-evidence.js +8 -3
- package/dist/workspace/trust/evidence.d.ts +5 -0
- package/dist/workspace/trust/evidence.d.ts.map +1 -1
- package/dist/workspace/trust/evidence.js +5 -0
- package/dist/workspace/trust/open-evidence.d.ts +67 -0
- package/dist/workspace/trust/open-evidence.d.ts.map +1 -0
- package/dist/workspace/trust/open-evidence.js +92 -0
- package/dist/workspace/trust/ref-gate-cli.d.ts.map +1 -1
- package/dist/workspace/trust/ref-gate-cli.js +65 -3
- package/dist/workspace/trust/ref-gate.d.ts +61 -2
- package/dist/workspace/trust/ref-gate.d.ts.map +1 -1
- package/dist/workspace/trust/ref-gate.js +72 -7
- package/package.json +1 -1
- package/src/action-pins.ts +2 -0
- package/src/actor.test.ts +12 -0
- package/src/actor.ts +19 -0
- package/src/bundle-check.test.ts +22 -0
- package/src/bundle-check.ts +33 -5
- package/src/chant-install.test.ts +109 -1
- package/src/chant-install.ts +243 -2
- package/src/ci-commit.test.ts +51 -5
- package/src/ci-commit.ts +1 -2
- package/src/ci-control.ts +1 -0
- package/src/ci-evidence-claims.ts +102 -0
- package/src/ci-evidence-from-job.test.ts +147 -0
- package/src/ci-evidence-from-job.ts +195 -0
- package/src/ci-evidence-jobs.ts +41 -4
- package/src/ci-handover.ts +16 -3
- package/src/ci-identity.test.ts +3 -3
- package/src/ci-identity.ts +51 -11
- package/src/ci-image.test.ts +60 -10
- package/src/ci-image.ts +78 -19
- package/src/ci-jobs.ts +7 -2
- package/src/ci-login.test.ts +131 -3
- package/src/ci-login.token-drop.test.ts +204 -0
- package/src/ci-login.ts +137 -39
- package/src/ci-product-words.ts +30 -0
- package/src/ci-product.ts +26 -1
- package/src/cli/commands/__fixtures__/source-dir-root/migrations/0001-init/backfill.ts +3 -0
- package/src/cli/handlers/approve-confirm.test.ts +35 -0
- package/src/cli/handlers/approve-confirm.ts +44 -0
- package/src/cli/handlers/build-source-dir.test.ts +4 -0
- package/src/cli/handlers/build.ts +20 -2
- package/src/cli/handlers/ci-check.ts +19 -1
- package/src/cli/handlers/ci-evidence-open.test.ts +164 -0
- package/src/cli/handlers/ci-evidence.ts +210 -16
- package/src/cli/handlers/ci-forge-check.ts +22 -9
- package/src/cli/handlers/generated-check.ts +39 -0
- package/src/cli/handlers/lifecycle.test.ts +20 -0
- package/src/cli/handlers/lifecycle.ts +4 -0
- package/src/cli/handlers/local-chant.ts +39 -1
- package/src/cli/handlers/pr.ts +43 -5
- package/src/cli/handlers/run-wave.ts +7 -0
- package/src/cli/main.ts +38 -4
- package/src/cli/parse-args.ts +46 -0
- package/src/cli/registry.ts +24 -0
- package/src/components/check-hooks.ts +22 -0
- package/src/components/check-report-summary.test.ts +78 -0
- package/src/components/pr-checks.ts +159 -0
- package/src/components/pr-pipeline.ts +41 -1
- package/src/components/product-pipeline.ts +25 -3
- package/src/components/product-plan.test.ts +102 -1
- package/src/components/product-plan.ts +416 -15
- package/src/config.ts +13 -8
- package/src/control/consumers.ts +7 -0
- package/src/dead-guards.test.ts +27 -5
- package/src/dead-guards.ts +9 -6
- package/src/discovery/files.ts +1 -1
- package/src/drift-issue.test.ts +29 -1
- package/src/drift-issue.ts +28 -3
- package/src/drift-record.test.ts +25 -0
- package/src/drift-record.ts +55 -6
- package/src/floor-table.data.ts +58 -21
- package/src/floor-table.ts +12 -9
- package/src/forge-check/contract.ts +11 -1
- package/src/forge-check/forge-check.test.ts +8 -0
- package/src/forge-check/index.ts +2 -0
- package/src/forge-flags.test.ts +25 -1
- package/src/forge-flags.ts +34 -0
- package/src/forge-remote.test.ts +37 -0
- package/src/forge-remote.ts +79 -0
- package/src/generated-check.e2e.test.ts +98 -0
- package/src/generated-check.test.ts +104 -0
- package/src/generated-check.ts +269 -0
- package/src/lexicon.ts +17 -0
- package/src/lifecycle/publish-npm.ts +56 -3
- package/src/lifecycle/release-catalog.test.ts +2 -2
- package/src/lifecycle/release-images-dockerfile.test.ts +20 -0
- package/src/lifecycle/release-images.test.ts +44 -0
- package/src/lifecycle/release-images.ts +39 -3
- package/src/lifecycle/release-ledger.ts +4 -3
- package/src/local-chant.e2e.test.ts +81 -6
- package/src/local-chant.test.ts +22 -3
- package/src/local-chant.ts +130 -13
- package/src/op/op-waves-evidence-jobs.ts +134 -0
- package/src/op/op-waves-evidence.test.ts +36 -3
- package/src/op/op-waves-evidence.ts +23 -3
- package/src/op/op-waves-run.ts +57 -2
- package/src/op/op-waves.ts +11 -0
- package/src/op/schedule-overdue.test.ts +83 -1
- package/src/op/schedule-overdue.ts +107 -9
- package/src/pr-forge-reads-compare.test.ts +2 -1
- package/src/pr-forge-reads.ts +37 -1
- package/src/pr-forge.ts +14 -3
- package/src/pr-plan-note.ts +32 -3
- package/src/pr-plan-record.test.ts +75 -0
- package/src/pr-plan-record.ts +101 -0
- package/src/pr-post-plan-note.test.ts +60 -0
- package/src/pr-post.test.ts +30 -0
- package/src/pr-post.ts +110 -6
- package/src/pr-requires.test.ts +20 -0
- package/src/pr-requires.ts +10 -1
- package/src/ref-gate-init.ts +189 -0
- package/src/ref-gate-rules.ts +26 -0
- package/src/release-floors.ts +86 -17
- package/src/state-migration-record.test.ts +90 -0
- package/src/state-migration.test.ts +1 -1
- package/src/state-migration.ts +52 -3
- package/src/state-unlock.test.ts +33 -1
- package/src/state-unlock.ts +49 -1
- package/src/workspace/ci-green-cli.ts +12 -6
- package/src/workspace/drift-cli.ts +6 -18
- package/src/workspace/forge-work.ts +7 -14
- package/src/workspace/lexicon-outputs.ts +2 -2
- package/src/workspace/release-workflow.test.ts +70 -0
- package/src/workspace/release-workflow.ts +56 -8
- package/src/workspace/trust/check-evidence-report.ts +24 -0
- package/src/workspace/trust/check-evidence.ts +17 -5
- package/src/workspace/trust/evidence.ts +5 -0
- package/src/workspace/trust/open-evidence.ts +129 -0
- package/src/workspace/trust/ref-gate-cli.ts +59 -3
- package/src/workspace/trust/ref-gate-pieces.test.ts +175 -0
- package/src/workspace/trust/ref-gate.e2e.test.ts +17 -0
- package/src/workspace/trust/ref-gate.ts +87 -6
package/src/state-unlock.ts
CHANGED
|
@@ -26,7 +26,8 @@
|
|
|
26
26
|
import { CHANT_EXIT } from "./exit-codes";
|
|
27
27
|
import { gatedOp, type GatedRequestLedger } from "./lifecycle/gated-op";
|
|
28
28
|
import type { GatedRequestRules } from "./lifecycle/gated-request";
|
|
29
|
-
import type {
|
|
29
|
+
import type { ForgeOverrides } from "./forge-flags";
|
|
30
|
+
import type { ForgeFetch, ForgeKind, ForgeTarget, ForgeTargetOptions } from "./pr-forge";
|
|
30
31
|
|
|
31
32
|
/** The first chant with the engine-neutral lock release and {@link forgeLiveRuns} (#4762). */
|
|
32
33
|
export const STATE_UNLOCK_FLOOR = "0.124.77";
|
|
@@ -108,6 +109,53 @@ export async function forgeLiveRuns(t: LiveRunsTarget): Promise<LiveRun[]> {
|
|
|
108
109
|
return [...out.values()];
|
|
109
110
|
}
|
|
110
111
|
|
|
112
|
+
/**
|
|
113
|
+
* The live runs of a {@link ForgeTarget} (#4911), from `forgeTargetFromEnv`,
|
|
114
|
+
* `forgeTargetWith` or `forgeTargetFromFlags`: {@link forgeLiveRuns} with
|
|
115
|
+
* the target's forge, REST base, repository, token and GitLab token header.
|
|
116
|
+
*/
|
|
117
|
+
export function forgeTargetLiveRuns(target: Pick<ForgeTarget, "kind" | "apiBase" | "repo" | "token" | "tokenHeader">, fetch?: ForgeFetch): Promise<LiveRun[]> {
|
|
118
|
+
return forgeLiveRuns({ kind: target.kind, apiBase: target.apiBase, repo: target.repo, token: target.token, ...(target.tokenHeader ? { tokenHeader: target.tokenHeader } : {}), ...(fetch ? { fetch } : {}) });
|
|
119
|
+
}
|
|
120
|
+
|
|
121
|
+
/** What {@link forgeLiveRunsOf} reads the forge from besides the environment. */
|
|
122
|
+
export interface ForgeLiveRunsOptions {
|
|
123
|
+
/**
|
|
124
|
+
* A checkout whose origin remote names the forge (#4920) when the
|
|
125
|
+
* environment names no CI forge and `forge` no repository: its kind, web
|
|
126
|
+
* origin and repository, each under what `forge` gives.
|
|
127
|
+
*/
|
|
128
|
+
cwd?: string;
|
|
129
|
+
/** The remote in `cwd`. Default `origin`. */
|
|
130
|
+
remote?: string;
|
|
131
|
+
fetch?: ForgeFetch;
|
|
132
|
+
/** Reads a remote's URL. Default `git remote get-url`. For tests. */
|
|
133
|
+
remoteUrl?: (cwd: string, remote: string) => string | undefined;
|
|
134
|
+
}
|
|
135
|
+
|
|
136
|
+
/**
|
|
137
|
+
* The `liveRuns` reader of the forge `forge` names over `env` (#4911),
|
|
138
|
+
* read each time it is called: `forgeTargetWith`'s target (a product's
|
|
139
|
+
* `--forge`, `--repo` and `--url` over the job's environment), and its runs.
|
|
140
|
+
* On a laptop, with no CI variables and no repository given, the origin
|
|
141
|
+
* remote of `opts.cwd` names the forge and the repository (#4920), so a
|
|
142
|
+
* release run there needs only a token. A forge that cannot be named, or a
|
|
143
|
+
* missing token, throws, and the release it guards is refused.
|
|
144
|
+
*/
|
|
145
|
+
export function forgeLiveRunsOf(env: Record<string, string | undefined>, forge: ForgeTargetOptions & ForgeOverrides = {}, opts: ForgeLiveRunsOptions = {}): () => Promise<LiveRun[]> {
|
|
146
|
+
return async () => {
|
|
147
|
+
const [{ forgeTargetWith }, { detectForge }] = await Promise.all([import("./forge-flags"), import("./pr-forge")]);
|
|
148
|
+
let given = forge;
|
|
149
|
+
if (opts.cwd && !detectForge(env) && !forge.repo?.trim()) {
|
|
150
|
+
const { forgeOfCheckout } = await import("./forge-remote");
|
|
151
|
+
const at = forgeOfCheckout(opts.cwd, { ...(opts.remote ? { remote: opts.remote } : {}), ...(forge.kind ? { kind: forge.kind } : {}), ...(opts.remoteUrl ? { remoteUrl: opts.remoteUrl } : {}) });
|
|
152
|
+
const set = Object.fromEntries(Object.entries(forge).filter(([, v]) => v !== undefined && v !== "")) as typeof forge;
|
|
153
|
+
if (at) given = { kind: at.kind, repo: at.repo, url: at.url, ...set };
|
|
154
|
+
}
|
|
155
|
+
return forgeTargetLiveRuns(forgeTargetWith(env, given), opts.fetch);
|
|
156
|
+
};
|
|
157
|
+
}
|
|
158
|
+
|
|
111
159
|
/** How far a run's start may be after the lock's and still count as a run that could hold it: the clocks of the job and the forge differ. */
|
|
112
160
|
export const CLOCK_SKEW_MS = 2 * 60 * 1000;
|
|
113
161
|
|
|
@@ -233,7 +233,12 @@ export async function runCiWorkflow(ctx: CommandContext): Promise<number> {
|
|
|
233
233
|
const repoRoot = gitTop(root) ?? root;
|
|
234
234
|
const member = resolveMemberContext(cwd, found);
|
|
235
235
|
const target = ctx.args.output ? resolve(realpathSync(cwd), ctx.args.output) : join(repoRoot, CI_GREEN_WORKFLOW_FILE);
|
|
236
|
-
|
|
236
|
+
// #4909: under `chant dev generated-check` the file goes to the render
|
|
237
|
+
// tree; it is read and named as the committed file it stands for.
|
|
238
|
+
const { committedPathOf, isRenderPath, renderPathOf } = await import("../generated-check");
|
|
239
|
+
const rendering = isRenderPath(target);
|
|
240
|
+
const asCommitted = committedPathOf(target);
|
|
241
|
+
const fromRepo = relative(repoRoot, asCommitted).split(sep).join("/");
|
|
237
242
|
|
|
238
243
|
// The merge queue's verdict (#4644) is ours too, and holds no phase.
|
|
239
244
|
const sources = readWorkflowSources(repoRoot, fromRepo).filter((s) => s.path !== MERGE_QUEUE_WORKFLOW_FILE);
|
|
@@ -252,7 +257,7 @@ export async function runCiWorkflow(ctx: CommandContext): Promise<number> {
|
|
|
252
257
|
|
|
253
258
|
const base = member ? member.memberRoot : root;
|
|
254
259
|
const parts = ["chant", "ci", "workflow", ...extra.flatMap((w) => ["--workflow", w])];
|
|
255
|
-
if (ctx.args.output) parts.push("--output", relative(base,
|
|
260
|
+
if (ctx.args.output && !(rendering && asCommitted === join(repoRoot, CI_GREEN_WORKFLOW_FILE))) parts.push("--output", relative(base, asCommitted).split(sep).join("/"));
|
|
256
261
|
if (ctx.args.ciChant) parts.push("--chant", ctx.args.ciChant);
|
|
257
262
|
if (ctx.args.ciInstall) parts.push("--install", ctx.args.ciInstall);
|
|
258
263
|
if (push && "secret" in push) parts.push("--token-secret", push.secret);
|
|
@@ -269,19 +274,20 @@ export async function runCiWorkflow(ctx: CommandContext): Promise<number> {
|
|
|
269
274
|
const npmLock = ctx.args.ciInstall && existsSync(join(root, "package-lock.json")) ? (workspaceRoot === "." ? "package-lock.json" : `${workspaceRoot}/package-lock.json`) : undefined;
|
|
270
275
|
const yaml = renderCiGreenWorkflow({ green, workflows, chantVersion: readerVersion(), workspaceRoot, chant: ctx.args.ciChant, install: ctx.args.ciInstall, npmLock, push, ...(runnerKeySecret ? { runnerKeySecret } : {}), ...(compose ? { compose } : {}) });
|
|
271
276
|
const written = writeWorkflowFile(target, ciGreenHeader(command, member ? "member" : "root") + yaml);
|
|
272
|
-
if (member) recordGeneratedFiles(member.memberRoot, [{ path: fromRepo, command }]);
|
|
277
|
+
if (member && !rendering) recordGeneratedFiles(member.memberRoot, [{ path: fromRepo, command }]);
|
|
273
278
|
console.log(`Wrote ${written}: ticks when ${workflows.join(", ")} complete${workflows.length === 1 ? "s" : ""} on ${greenBranches(green).join(", ")}${compose ? " or a chant/compose/ branch" : ""}, and every 15 minutes.`);
|
|
274
279
|
// #4644: the merge queue's verdict, beside the tick and from the same command.
|
|
275
280
|
if (green.mergeQueue && !member) {
|
|
276
281
|
const queue = renderMergeQueueWorkflow({ green, chantVersion: readerVersion(), workspaceRoot, chant: ctx.args.ciChant, install: ctx.args.ciInstall, npmLock });
|
|
277
|
-
const at = writeWorkflowFile(join(repoRoot, MERGE_QUEUE_WORKFLOW_FILE), ciGreenHeader(command, "root") + queue);
|
|
282
|
+
const at = writeWorkflowFile(rendering ? renderPathOf(join(repoRoot, MERGE_QUEUE_WORKFLOW_FILE)) : join(repoRoot, MERGE_QUEUE_WORKFLOW_FILE), ciGreenHeader(command, "root") + queue);
|
|
278
283
|
const retries = green.mergeQueue.retries;
|
|
279
284
|
const again = retries > 0 ? `, re-running a failed job's workflow run up to ${retries} time${retries === 1 ? "" : "s"} first` : "";
|
|
280
285
|
console.log(`Wrote ${at}: on each merge group, ${MERGE_QUEUE_VERDICT_JOB} passes when every required phase passed on the group's commit${again}. Require ${MERGE_QUEUE_VERDICT_JOB} in the branch's ruleset.`);
|
|
281
286
|
}
|
|
282
287
|
for (const e of edits) {
|
|
283
|
-
|
|
284
|
-
|
|
288
|
+
// A check renders every edited workflow, changed or not, so each has its twin in the render tree.
|
|
289
|
+
if (!e.changed && !rendering) continue;
|
|
290
|
+
const path = writeWorkflowFile(rendering ? renderPathOf(join(repoRoot, e.path)) : join(repoRoot, e.path), e.text);
|
|
285
291
|
console.log(
|
|
286
292
|
e.build === "newest"
|
|
287
293
|
? `Wrote ${path}'s triggers and concurrency: ${e.phases.join(", ")} build${e.phases.length === 1 ? "s" : ""} the newest commit on ${greenBranches(green).join(", ")} when a run ends, and a ci/build/<sha> tag by hand.`
|
|
@@ -8,7 +8,7 @@
|
|
|
8
8
|
*
|
|
9
9
|
* | kind | default read | how |
|
|
10
10
|
* |---|---|---|
|
|
11
|
-
* | `chant` | `live-read` | the member's `chant lifecycle diff <env> --live --json`, through `liveDiffDriftRecords`
|
|
11
|
+
* | `chant` | `live-read` | the member's `chant lifecycle diff <env> --live --json`, each lexicon's section through `lexiconDriftRecords` (`liveDiffDriftRecords`, with `mergeDeepDrift` when a lexicon has a deep reader, and the section's `absent`, #4896). `--components` adds `chant components status <env> --live --json` through `componentStatusDriftRecords`. Needs `--env` |
|
|
12
12
|
* | `terraform` | `state` | `chant lifecycle drift` in the member's reader project: the terraform lexicon's `readDrift`, `terraform show -json` over state, or `--read plan` for a saved plan's `show -json` |
|
|
13
13
|
* | `choudoufu` | `ownership` | the same, through `choudoufu live-plan -json` (and `live-ls`), or `--read plan` for live-plan with a plan beside it; `--resource <addr>` passes `choudoufu live-plan -resource=<addr>`'s stream through |
|
|
14
14
|
* | `pulumi` | `refresh` | `chant lifecycle drift` in the member's reader project: the pulumi lexicon's `readDrift`, `pulumi refresh --preview-only --json --target <urn>` per resource in the checked-in export, or `plunge drift --resource <urn> --stream` for a member on plunge; `--resource <urn>` reads that URN alone (#4455) |
|
|
@@ -50,7 +50,6 @@ import {
|
|
|
50
50
|
componentStatusDriftRecords,
|
|
51
51
|
countDriftStatuses,
|
|
52
52
|
decodeDriftLines,
|
|
53
|
-
deepDiffDriftRecords,
|
|
54
53
|
DRIFT_READS,
|
|
55
54
|
DRIFT_SCHEMA_ID,
|
|
56
55
|
DRIFT_VERSION,
|
|
@@ -61,15 +60,13 @@ import {
|
|
|
61
60
|
driftStart,
|
|
62
61
|
encodeDriftLines,
|
|
63
62
|
foldDriftLines,
|
|
64
|
-
|
|
65
|
-
mergeDeepDrift,
|
|
63
|
+
lexiconDriftRecords,
|
|
66
64
|
type DriftDocument,
|
|
67
65
|
type DriftLine,
|
|
68
66
|
type DriftRead,
|
|
69
67
|
type DriftRecord,
|
|
68
|
+
type LiveDiffLexiconSection,
|
|
70
69
|
} from "../drift-record";
|
|
71
|
-
import type { DeepDiffResult } from "../lifecycle/deep-diff";
|
|
72
|
-
import type { LiveDiffResult } from "../lifecycle/live-diff";
|
|
73
70
|
import type { ComponentStatusRow } from "../lifecycle/status";
|
|
74
71
|
import { readDeclaration, readerVersion, WORKSPACE_ERROR_CODES, WorkspaceReadError } from "./declaration";
|
|
75
72
|
import { prepareKindReaders } from "./kind-readers";
|
|
@@ -214,13 +211,8 @@ function chantRecords(member: string, diffOut: string, componentsOut: string | u
|
|
|
214
211
|
const lexicons: LexiconDiff[] = [...Object.values(doc.lexicons ?? {}), ...Object.values(doc.stacks ?? {}).flatMap((s) => Object.values(s))];
|
|
215
212
|
const base = { member, observedAt, ...(version ? { version } : {}) };
|
|
216
213
|
const out: DriftRecord[] = [];
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
const types: Record<string, string> = {};
|
|
220
|
-
for (const [name, meta] of Object.entries(lex.observed ?? {})) if (typeof meta?.type === "string") types[name] = meta.type;
|
|
221
|
-
const thin = liveDiffDriftRecords({ ...base, diff: lex.resources, types });
|
|
222
|
-
out.push(...(lex.deep ? mergeDeepDrift(thin, deepDiffDriftRecords({ ...base, diff: lex.deep })) : thin));
|
|
223
|
-
}
|
|
214
|
+
// The section's own `absent` (#4896): the sql lexicon's confirmed-absent objects are missing, not pending.
|
|
215
|
+
for (const section of lexicons) out.push(...lexiconDriftRecords({ ...base, section }));
|
|
224
216
|
if (componentsOut !== undefined) {
|
|
225
217
|
let rows: ComponentStatusRow[];
|
|
226
218
|
try {
|
|
@@ -233,11 +225,7 @@ function chantRecords(member: string, diffOut: string, componentsOut: string | u
|
|
|
233
225
|
return out;
|
|
234
226
|
}
|
|
235
227
|
|
|
236
|
-
|
|
237
|
-
resources?: LiveDiffResult;
|
|
238
|
-
observed?: Record<string, { type?: unknown }>;
|
|
239
|
-
deep?: DeepDiffResult;
|
|
240
|
-
}
|
|
228
|
+
type LexiconDiff = LiveDiffLexiconSection;
|
|
241
229
|
|
|
242
230
|
/** The command line the member runs. */
|
|
243
231
|
function memberArgv(kind: string, query: DriftQuery, read: DriftRead): string[] {
|
|
@@ -23,8 +23,7 @@
|
|
|
23
23
|
*/
|
|
24
24
|
|
|
25
25
|
import { execFileSync } from "node:child_process";
|
|
26
|
-
import {
|
|
27
|
-
import { remoteHost } from "../op/activities/gh-host";
|
|
26
|
+
import { forgeKindOfHost, forgeOfRemote } from "../forge-remote";
|
|
28
27
|
import { detectForge, FORGE_TOKEN_ORDER, ForgeApiError, forgeClient, forgeTargetFromEnv, type ForgeFetch, type ForgeKind, type ForgeTarget, type PrForge } from "../pr-forge";
|
|
29
28
|
|
|
30
29
|
/** What the forge says one pull request closes. */
|
|
@@ -85,14 +84,8 @@ function ghAuthToken(host: string): string | undefined {
|
|
|
85
84
|
}
|
|
86
85
|
}
|
|
87
86
|
|
|
88
|
-
/** The forge kind a remote host is
|
|
89
|
-
export
|
|
90
|
-
const h = host.toLowerCase().replace(/:\d+$/, "");
|
|
91
|
-
if (h === "github.com" || /(^|[.-])github([.-]|$)/.test(h)) return "github";
|
|
92
|
-
if (h === "gitlab.com" || /(^|[.-])gitlab([.-]|$)/.test(h)) return "gitlab";
|
|
93
|
-
if (h === "codeberg.org" || /(^|[.-])(forgejo|gitea)([.-]|$)/.test(h)) return "forgejo";
|
|
94
|
-
return null;
|
|
95
|
-
}
|
|
87
|
+
/** The forge kind a remote host is, as `@intentius/chant/forge-remote` reads it (#4920). */
|
|
88
|
+
export { forgeKindOfHost };
|
|
96
89
|
|
|
97
90
|
/** The REST base of a forge at `host`, as the clients take it. */
|
|
98
91
|
export function forgeApiBase(kind: ForgeKind, host: string): string {
|
|
@@ -113,10 +106,10 @@ function locate(top: string, opts: ForgeWorkOptions): { target: ForgeTarget } |
|
|
|
113
106
|
}
|
|
114
107
|
const url = opts.remoteUrl !== undefined ? opts.remoteUrl : gitRemote(top);
|
|
115
108
|
if (!url) return { source: null, reason: "there is no origin remote to name the forge" };
|
|
116
|
-
|
|
117
|
-
const
|
|
118
|
-
|
|
119
|
-
|
|
109
|
+
// #4920: the origin remote's forge, as `@intentius/chant/forge-remote` reads it.
|
|
110
|
+
const at = forgeOfRemote(url);
|
|
111
|
+
if (!at) return { source: null, reason: `origin (${url}) is not on a forge chant reads issues from: GitHub, GitLab or Forgejo` };
|
|
112
|
+
const { kind, host, repo } = at;
|
|
120
113
|
const source = { kind, host, repo };
|
|
121
114
|
const names = ["CHANT_FORGE_TOKEN", ...FORGE_TOKEN_ORDER[kind]];
|
|
122
115
|
const tokenSource = names.find((n) => env[n]?.trim());
|
|
@@ -95,8 +95,8 @@ function staticInclude(read: StaticFieldsRead): string[] {
|
|
|
95
95
|
/**
|
|
96
96
|
* Only the files under the member's `sourceDir`, when its config sets one, as
|
|
97
97
|
* a build reads them (#3941). Without one, every source file of the member
|
|
98
|
-
* but its top-level `scripts/`, which a root build leaves
|
|
99
|
-
* `ROOT_SOURCE_EXCLUDES`) unless `include` brings
|
|
98
|
+
* but its top-level `scripts/` and `migrations/`, which a root build leaves
|
|
99
|
+
* out (#4794, #4921, `ROOT_SOURCE_EXCLUDES`) unless `include` brings one back.
|
|
100
100
|
*/
|
|
101
101
|
function withinSourceDir(files: string[], member: string, sourceDir: string | undefined, include: string[] = []): string[] {
|
|
102
102
|
if (!sourceDir) {
|
|
@@ -213,6 +213,17 @@ describe("the release workflow's permissions, env and setup (#4751)", () => {
|
|
|
213
213
|
expect(() => renderReleaseWorkflow({ forge: "gitlab", groups: new Set(), pipeline: { ...pipeline, permissions: undefined } })).toThrow(/give it as \{ run \}/);
|
|
214
214
|
});
|
|
215
215
|
|
|
216
|
+
test("a named setup step renders with its name on GitHub, and as its line on GitLab (#4932)", () => {
|
|
217
|
+
const named = { trigger: "dispatch" as const, setup: [{ name: "QEMU for arm64", uses: "docker/setup-qemu-action@29109295f81e9208d7d86ff1c6c12d2833863392", with: { platforms: "arm64" } }, { name: "npm 11", run: "npm install -g npm@11.19.0" }] };
|
|
218
|
+
const doc = parseYAML(renderReleaseWorkflow({ forge: "github", groups: new Set(), images: true, pipeline: named })) as GhDoc;
|
|
219
|
+
const i = doc.jobs.cut!.steps.findIndex((s) => s.run === "npm ci");
|
|
220
|
+
expect(doc.jobs.cut!.steps[i + 1]).toEqual({ name: "QEMU for arm64", uses: "docker/setup-qemu-action@29109295f81e9208d7d86ff1c6c12d2833863392", with: { platforms: "arm64" } });
|
|
221
|
+
expect(doc.jobs.cut!.steps[i + 2]).toEqual({ name: "npm 11", run: "npm install -g npm@11.19.0" });
|
|
222
|
+
const gl = parseYAML(renderReleaseWorkflow({ forge: "gitlab", groups: new Set(), pipeline: { trigger: "dispatch", setup: [{ name: "npm 11", run: "npm install -g npm@11.19.0" }] } })) as Record<string, { script: string[] }>;
|
|
223
|
+
expect(gl["chant-release-cut"]!.script).toContain("npm install -g npm@11.19.0");
|
|
224
|
+
expect(() => renderReleaseWorkflow({ forge: "github", groups: new Set(), pipeline: { setup: [{ name: "", run: "x" }] } })).toThrow(/name is blank/);
|
|
225
|
+
});
|
|
226
|
+
|
|
216
227
|
test("a scope already granted and a bad variable name are refused", () => {
|
|
217
228
|
expect(() => renderReleaseWorkflow({ forge: "github", groups: new Set(), pipeline: { permissions: { contents: "read" } } })).toThrow(/already granted/);
|
|
218
229
|
expect(() => renderReleaseWorkflow({ forge: "github", groups: new Set(), pipeline: { env: { "BAD-NAME": "x" } } })).toThrow(/not a variable name/);
|
|
@@ -465,3 +476,62 @@ describe("GHCR credentials and npm trusted publishing from the targets (#4786)",
|
|
|
465
476
|
expect(runs(tagged.jobs.publish!)).toContain(NPM_TRUSTED_PUBLISHING_SETUP);
|
|
466
477
|
});
|
|
467
478
|
});
|
|
479
|
+
|
|
480
|
+
describe("QEMU for the platforms release.images builds (#4876)", () => {
|
|
481
|
+
type Step = { uses?: string; run?: string; with?: Record<string, unknown> };
|
|
482
|
+
const TWO = ["linux/amd64", "linux/arm64"];
|
|
483
|
+
const render = (forge: (typeof FORGES)[number], imagePlatforms: string[], pipeline: ReleaseWorkflowInput["pipeline"] = {}, trigger: "dispatch" | "tag" = "dispatch") =>
|
|
484
|
+
renderReleaseWorkflow({ forge, groups: new Set(), images: true, imageArchives: ["dist/images/app.tar"], imagePlatforms, pipeline: { ...(trigger === "dispatch" ? { trigger } : {}), ...pipeline } });
|
|
485
|
+
const ghSteps = (yaml: string, job: string): Step[] => (parseYAML(yaml) as { jobs: Record<string, { steps: Step[] }> }).jobs[job]!.steps;
|
|
486
|
+
|
|
487
|
+
test("a two-platform release.images: the cut and the publish set up QEMU for arm64 after the install, before the config's setup, on GitHub and Forgejo", () => {
|
|
488
|
+
for (const forge of ["github", "forgejo"] as const) {
|
|
489
|
+
const yaml = render(forge, TWO, { setup: [{ run: "echo own" }] });
|
|
490
|
+
for (const job of ["cut", "publish"]) {
|
|
491
|
+
const steps = ghSteps(yaml, job);
|
|
492
|
+
const at = steps.findIndex((s) => s.uses?.startsWith("docker/setup-qemu-action@"));
|
|
493
|
+
expect(steps[at], `${forge} ${job}`).toEqual({ uses: `docker/setup-qemu-action@${ACTION_PINS.dockerSetupQemu4.sha}`, with: { platforms: "arm64" } });
|
|
494
|
+
expect(steps[at - 1]!.run, `${forge} ${job}`).toBe("npm ci");
|
|
495
|
+
expect(steps[at + 1]!.run, `${forge} ${job}`).toBe("echo own");
|
|
496
|
+
}
|
|
497
|
+
expect(yaml).toContain(`docker/setup-qemu-action@${ACTION_PINS.dockerSetupQemu4.sha} # v4.4.0`);
|
|
498
|
+
// The tag-triggered publish job builds the images too.
|
|
499
|
+
expect(ghSteps(render(forge, TWO, {}, "tag"), "publish").some((s) => s.uses?.startsWith("docker/setup-qemu-action@")), forge).toBe(true);
|
|
500
|
+
}
|
|
501
|
+
});
|
|
502
|
+
|
|
503
|
+
test("on GitLab, a binfmt run line in the cut and the publish", () => {
|
|
504
|
+
const doc = parseYAML(render("gitlab", TWO)) as Record<string, { script: string[] }>;
|
|
505
|
+
for (const job of ["chant-release-cut", "chant-release-publish"]) {
|
|
506
|
+
const script = doc[job]!.script;
|
|
507
|
+
expect(script[script.indexOf("npm ci") + 1], job).toBe("docker run --privileged --rm tonistiigi/binfmt --install arm64");
|
|
508
|
+
}
|
|
509
|
+
});
|
|
510
|
+
|
|
511
|
+
test("a one-platform release.images, or none, renders no QEMU on any forge", () => {
|
|
512
|
+
for (const forge of FORGES) {
|
|
513
|
+
for (const platforms of [["linux/amd64"], []]) {
|
|
514
|
+
const yaml = render(forge, platforms);
|
|
515
|
+
expect(yaml, forge).not.toContain("setup-qemu-action");
|
|
516
|
+
expect(yaml, forge).not.toContain("binfmt");
|
|
517
|
+
}
|
|
518
|
+
}
|
|
519
|
+
// A config with no release.images builds nothing, whatever the platforms.
|
|
520
|
+
expect(renderReleaseWorkflow({ forge: "github", groups: new Set(), imagePlatforms: TWO, pipeline: { trigger: "dispatch" } })).not.toContain("setup-qemu-action");
|
|
521
|
+
});
|
|
522
|
+
|
|
523
|
+
test("a config that names the step itself renders as today, and drops it to the same file", () => {
|
|
524
|
+
const qemu = { uses: `docker/setup-qemu-action@${ACTION_PINS.dockerSetupQemu4.sha} # v4.4.0`, with: { platforms: "arm64" } };
|
|
525
|
+
const own = { run: 'echo "npm"' };
|
|
526
|
+
const byHand = render("github", TWO, { setup: [qemu, own] });
|
|
527
|
+
expect(byHand).toBe(render("github", [], { setup: [qemu, own] }));
|
|
528
|
+
expect(render("github", TWO, { setup: [own] })).toBe(byHand);
|
|
529
|
+
const binfmt = { run: "docker run --privileged --rm tonistiigi/binfmt --install arm64" };
|
|
530
|
+
expect(render("gitlab", TWO, { setup: [binfmt] })).toBe(render("gitlab", [], { setup: [binfmt] }));
|
|
531
|
+
});
|
|
532
|
+
|
|
533
|
+
test("other architectures go in as QEMU names them", () => {
|
|
534
|
+
const steps = ghSteps(render("github", ["linux/amd64", "linux/arm/v7", "linux/riscv64", "linux/arm64"]), "cut");
|
|
535
|
+
expect(steps.find((s) => s.uses?.startsWith("docker/setup-qemu-action@"))!.with).toEqual({ platforms: "arm,arm64,riscv64" });
|
|
536
|
+
});
|
|
537
|
+
});
|
|
@@ -28,7 +28,7 @@
|
|
|
28
28
|
* renders the tag-triggered file it always did.
|
|
29
29
|
*/
|
|
30
30
|
import { ACTION_PINS, tagComments, usesRef } from "../action-pins";
|
|
31
|
-
import { resolveReleaseImages } from "../lifecycle/release-images";
|
|
31
|
+
import { releaseImagePlatforms, resolveReleaseImages } from "../lifecycle/release-images";
|
|
32
32
|
import { GENERATED_MARKER } from "../discovery/files";
|
|
33
33
|
import type { SecurityGroup } from "./security";
|
|
34
34
|
import type { OpSetupStep } from "../lexicon";
|
|
@@ -74,9 +74,9 @@ export interface ReleasePipelineConfig {
|
|
|
74
74
|
env?: Record<string, string>;
|
|
75
75
|
/**
|
|
76
76
|
* Steps the cut and publish jobs run after the install (#4751): `{ run }`,
|
|
77
|
-
* or `{ uses, with }` on GitHub and Forgejo, such as
|
|
78
|
-
*
|
|
79
|
-
*
|
|
77
|
+
* or `{ uses, with }` on GitHub and Forgejo, such as a newer npm. GitLab
|
|
78
|
+
* takes `run` steps as script lines and refuses `uses` by name. QEMU for
|
|
79
|
+
* the platforms `release.images` builds is set up without one (#4876).
|
|
80
80
|
*/
|
|
81
81
|
setup?: OpSetupStep[];
|
|
82
82
|
/** Where the workflow is written, from the repository root, such as `.github/workflows/publish.yml` for an npm trusted publisher that names that file. Default {@link RELEASE_WORKFLOW_FILES}. */
|
|
@@ -107,6 +107,12 @@ export interface ReleaseWorkflowInput {
|
|
|
107
107
|
* two jobs cannot change what is published.
|
|
108
108
|
*/
|
|
109
109
|
imageArchives?: string[];
|
|
110
|
+
/**
|
|
111
|
+
* The platforms `release.images` builds (#4876). Those the runner can't run
|
|
112
|
+
* ({@link RELEASE_RUNNER_PLATFORM}) get QEMU's binfmt handlers in the cut
|
|
113
|
+
* and publish jobs, before `release.workflow.setup`.
|
|
114
|
+
*/
|
|
115
|
+
imagePlatforms?: string[];
|
|
110
116
|
/** `release.lane` (#4692): the gate's green lane. */
|
|
111
117
|
lane?: string;
|
|
112
118
|
/**
|
|
@@ -174,6 +180,35 @@ export function targetExtras(forge: ReleaseWorkflowForge, targets: ReadonlyArray
|
|
|
174
180
|
return { ...(permissions ? { permissions } : {}), ...(Object.keys(env).length > 0 ? { env } : {}), ...(setup.length > 0 ? { setup } : {}) };
|
|
175
181
|
}
|
|
176
182
|
|
|
183
|
+
/** The platform the jobs `chant release workflow` writes run on: GitHub's and Forgejo's `ubuntu-latest`, and a GitLab runner's default (#4876). */
|
|
184
|
+
export const RELEASE_RUNNER_PLATFORM = "linux/amd64";
|
|
185
|
+
|
|
186
|
+
/** The binfmt image a GitLab job installs QEMU's handlers with (#4876). */
|
|
187
|
+
export const RELEASE_BINFMT_IMAGE = "tonistiigi/binfmt";
|
|
188
|
+
|
|
189
|
+
/** The architectures among `platforms` the runner can't run, as QEMU names them (`linux/arm/v7` is `arm`), each once. */
|
|
190
|
+
export function qemuArchitectures(platforms: readonly string[]): string[] {
|
|
191
|
+
return [...new Set(platforms.filter((p) => p.split("/").slice(0, 2).join("/") !== RELEASE_RUNNER_PLATFORM).map((p) => p.split("/")[1] ?? p))].sort();
|
|
192
|
+
}
|
|
193
|
+
|
|
194
|
+
/**
|
|
195
|
+
* QEMU's binfmt setup for the platforms `release.images` builds that the
|
|
196
|
+
* runner can't, such as `linux/arm64` on an amd64 runner (#4876), so no
|
|
197
|
+
* product names it in `release.workflow.setup`. GitHub and Forgejo get
|
|
198
|
+
* `docker/setup-qemu-action` at its pin; GitLab a `docker run --privileged`
|
|
199
|
+
* of {@link RELEASE_BINFMT_IMAGE}, which `chant release workflow` notes needs
|
|
200
|
+
* an executor that runs privileged containers. A config whose `setup` names
|
|
201
|
+
* the action or the binfmt image already gets nothing more, so its file
|
|
202
|
+
* renders as it did.
|
|
203
|
+
*/
|
|
204
|
+
export function qemuSetup(forge: ReleaseWorkflowForge, platforms: readonly string[], p: ReleasePipelineConfig): OpSetupStep[] {
|
|
205
|
+
const archs = qemuArchitectures(platforms);
|
|
206
|
+
if (archs.length === 0) return [];
|
|
207
|
+
const named = (p.setup ?? []).some((s) => ("uses" in s ? /^docker\/setup-qemu-action@/.test(s.uses) : s.run.includes(RELEASE_BINFMT_IMAGE)));
|
|
208
|
+
if (named) return [];
|
|
209
|
+
return forge === "gitlab" ? [{ run: `docker run --privileged --rm ${RELEASE_BINFMT_IMAGE} --install ${archs.join(",")}` }] : [{ uses: usesRef(ACTION_PINS.dockerSetupQemu4), with: { platforms: archs.join(",") } }];
|
|
210
|
+
}
|
|
211
|
+
|
|
177
212
|
/** The flags `chant release publish` gets under the groups. */
|
|
178
213
|
export function publishFlags(groups: ReadonlySet<SecurityGroup>): string[] {
|
|
179
214
|
return [...(groups.has("supply-chain") ? ["--require-provenance"] : []), "--yes"];
|
|
@@ -214,12 +249,14 @@ export function renderReleaseWorkflow(input: ReleaseWorkflowInput): string {
|
|
|
214
249
|
const version = input.version === true;
|
|
215
250
|
// #4786: the targets' own needs first, then the config's, so a config that set them by hand renders the same file without them.
|
|
216
251
|
const derived = targetExtras(input.forge, input.publish ?? [], p);
|
|
252
|
+
// #4876: QEMU before the config's setup, where the products named it.
|
|
253
|
+
const qemu = images ? qemuSetup(input.forge, input.imagePlatforms ?? [], p) : [];
|
|
217
254
|
const extra = jobExtras(
|
|
218
255
|
{
|
|
219
256
|
...p,
|
|
220
257
|
...(derived.permissions ? { permissions: { ...p.permissions, ...derived.permissions } } : {}),
|
|
221
258
|
...(derived.env ? { env: { ...p.env, ...derived.env } } : {}),
|
|
222
|
-
...(derived.setup ? { setup: [...(p.setup ?? []), ...derived.setup] } : {}),
|
|
259
|
+
...(derived.setup || qemu.length > 0 ? { setup: [...qemu, ...(p.setup ?? []), ...(derived.setup ?? [])] } : {}),
|
|
223
260
|
},
|
|
224
261
|
input.forge,
|
|
225
262
|
);
|
|
@@ -347,11 +384,14 @@ function jobExtras(p: ReleasePipelineConfig, forge: ReleaseWorkflowForge): JobEx
|
|
|
347
384
|
if (!/^[a-z][a-z-]*$/.test(k) || (v !== "read" && v !== "write")) throw new Error(`${where}.permissions: ${k}: ${String(v)} is not a scope and read or write`);
|
|
348
385
|
}
|
|
349
386
|
for (const s of setup) if (!("uses" in s) && s.run.trim() === "") throw new Error(`${where}.setup: a run step is empty`);
|
|
387
|
+
for (const s of setup) if (s.name !== undefined && (s.name.trim() === "" || /[\r\n]/.test(s.name))) throw new Error(`${where}.setup: a step's name is blank or more than one line`);
|
|
350
388
|
}
|
|
351
389
|
const q = (v: string | number | boolean): string => JSON.stringify(v);
|
|
352
390
|
const map = (indent: string, entries: Array<[string, string | number | boolean]>): string[] => entries.map(([k, v]) => `${indent}${k}: ${q(v)}`);
|
|
391
|
+
// #4932: a named step opens with its name.
|
|
353
392
|
const githubSteps = setup.flatMap((s) => [
|
|
354
|
-
|
|
393
|
+
...(s.name !== undefined ? [` - name: ${q(s.name)}`] : []),
|
|
394
|
+
` ${s.name !== undefined ? " " : "-"} ${"uses" in s ? `uses: ${s.uses}` : `run: ${q(s.run)}`}`,
|
|
355
395
|
...("uses" in s && s.with && Object.keys(s.with).length > 0 ? [" with:", ...map(" ", Object.entries(s.with))] : []),
|
|
356
396
|
...(s.env && Object.keys(s.env).length > 0 ? [" env:", ...map(" ", Object.entries(s.env))] : []),
|
|
357
397
|
]);
|
|
@@ -664,7 +704,7 @@ export async function runReleaseWorkflow(ctx: import("../cli/registry").CommandC
|
|
|
664
704
|
groups,
|
|
665
705
|
workspaceRoot,
|
|
666
706
|
...(release?.workflow ? { pipeline: release.workflow } : {}),
|
|
667
|
-
...((release?.images?.length ?? 0) > 0 ? { images: true, imageArchives: resolveReleaseImages(release!.images!).map((i) => i.archive) } : {}),
|
|
707
|
+
...((release?.images?.length ?? 0) > 0 ? { images: true, imageArchives: resolveReleaseImages(release!.images!).map((i) => i.archive), imagePlatforms: releaseImagePlatforms(release!.images!) } : {}),
|
|
668
708
|
...(release?.lane ? { lane: release.lane } : {}),
|
|
669
709
|
...(release?.version ? { version: true } : {}),
|
|
670
710
|
...(release?.publish ? { publish: release.publish } : {}),
|
|
@@ -673,11 +713,15 @@ export async function runReleaseWorkflow(ctx: import("../cli/registry").CommandC
|
|
|
673
713
|
...(args.ciChant ? { chant: args.ciChant } : {}),
|
|
674
714
|
});
|
|
675
715
|
const target = args.output ? resolve(process.cwd(), args.output) : join(repoRoot, release?.workflow?.file ?? RELEASE_WORKFLOW_FILES[forge]);
|
|
716
|
+
// #4909: under `chant dev generated-check` the header names the committed file the render stands for.
|
|
717
|
+
const { committedPathOf, isRenderPath } = await import("../generated-check");
|
|
718
|
+
const asCommitted = committedPathOf(target);
|
|
719
|
+
const defaultTarget = join(repoRoot, release?.workflow?.file ?? RELEASE_WORKFLOW_FILES[forge]);
|
|
676
720
|
const parts = ["chant", "release", "workflow", "--forge", forge];
|
|
677
721
|
if (args.ciInstall) parts.push("--install", args.ciInstall);
|
|
678
722
|
if (args.buildCommand) parts.push("--build", args.buildCommand);
|
|
679
723
|
if (args.ciChant) parts.push("--chant", args.ciChant);
|
|
680
|
-
if (args.output) parts.push("--output", relative(root,
|
|
724
|
+
if (args.output && !(isRenderPath(target) && asCommitted === defaultTarget)) parts.push("--output", relative(root, asCommitted).split(sep).join("/"));
|
|
681
725
|
mkdirSync(dirname(target), { recursive: true });
|
|
682
726
|
writeFileSync(target, releaseWorkflowHeader(parts.map(shellArg).join(" ")) + text);
|
|
683
727
|
const shown = relative(process.cwd(), target).split(sep).join("/") || target;
|
|
@@ -685,6 +729,10 @@ export async function runReleaseWorkflow(ctx: import("../cli/registry").CommandC
|
|
|
685
729
|
const what = release?.workflow?.trigger === "dispatch" ? "cuts and publishes a release started by hand with its label, from a green commit" : "publishes the release a release/** tag names";
|
|
686
730
|
console.log(formatSuccess(`Wrote ${shown}: ${what}${extras.length > 0 ? `, and ${extras.join(" and ")}` : ""}.`));
|
|
687
731
|
if (forge === "gitlab") console.log(`Include it from .gitlab-ci.yml: include: [{ local: ${release?.workflow?.file ?? RELEASE_WORKFLOW_FILES.gitlab} }]`);
|
|
732
|
+
// #4876: a GitLab executor that refuses privileged containers can't install the handlers from the job.
|
|
733
|
+
const archs = (release?.images?.length ?? 0) > 0 ? qemuArchitectures(releaseImagePlatforms(release!.images!)) : [];
|
|
734
|
+
if (forge === "gitlab" && archs.length > 0 && text.includes(`${RELEASE_BINFMT_IMAGE} --install`))
|
|
735
|
+
console.log(`The cut and publish jobs install QEMU's binfmt handlers for ${archs.join(", ")} with docker run --privileged ${RELEASE_BINFMT_IMAGE}: the runner's executor must run privileged containers, or have the handlers installed on its host.`);
|
|
688
736
|
if (forge === "gitlab" && release?.workflow?.trigger === "dispatch") console.log("The cut and publish jobs push with CHANT_RELEASE_TOKEN: a project access token with write_repository, as a masked CI/CD variable.");
|
|
689
737
|
return 0;
|
|
690
738
|
}
|
|
@@ -97,6 +97,30 @@ export function planReportChecks(dir: string, result: string | undefined): { sig
|
|
|
97
97
|
return { sign, skipped };
|
|
98
98
|
}
|
|
99
99
|
|
|
100
|
+
/**
|
|
101
|
+
* What a GitLab signing job in the target branch's pipeline keeps for one
|
|
102
|
+
* merge request (#4914), `<out>/<iid>/evidence.json`: the note, with the
|
|
103
|
+
* merge request and the head it was signed for, so the note job uses it
|
|
104
|
+
* only for that head.
|
|
105
|
+
*/
|
|
106
|
+
export interface OpenEvidenceFile extends CheckEvidenceNote {
|
|
107
|
+
pr: number;
|
|
108
|
+
head: string;
|
|
109
|
+
}
|
|
110
|
+
|
|
111
|
+
/**
|
|
112
|
+
* The `evidence.json` the signing job kept for merge request `pr` at
|
|
113
|
+
* `head` under `dir` (#4914), as text for the note job's report directory,
|
|
114
|
+
* or undefined when it kept none for that head. The file comes from a job
|
|
115
|
+
* of the same target-branch pipeline, which ran none of the change's code;
|
|
116
|
+
* it is read as data all the same.
|
|
117
|
+
*/
|
|
118
|
+
export function openEvidenceFor(dir: string, pr: number, head: string): string | undefined {
|
|
119
|
+
const doc = readJson(join(dir, String(pr), CHECK_EVIDENCE_FILE)) as Partial<OpenEvidenceFile> | undefined;
|
|
120
|
+
if (!doc || doc.pr !== pr || doc.head !== head || !Array.isArray(doc.signed) || !Array.isArray(doc.skipped)) return undefined;
|
|
121
|
+
return JSON.stringify({ signed: doc.signed, skipped: doc.skipped }, null, 2) + "\n";
|
|
122
|
+
}
|
|
123
|
+
|
|
100
124
|
/**
|
|
101
125
|
* The line the plan note ends with when the signing step wrote
|
|
102
126
|
* {@link CHECK_EVIDENCE_FILE} in `dir`, or undefined when it did not.
|
|
@@ -159,8 +159,19 @@ export function commitAndTree(repo: string, rev: string): { commit: string; tree
|
|
|
159
159
|
return { commit, tree: git(repo, ["rev-parse", `${commit}^{tree}`]) };
|
|
160
160
|
}
|
|
161
161
|
|
|
162
|
-
/**
|
|
163
|
-
export
|
|
162
|
+
/** Where a check's pass was read from (#4926): the forge's run and job ids, and the step whose conclusion said so. */
|
|
163
|
+
export interface CheckSource {
|
|
164
|
+
run: number;
|
|
165
|
+
job: number;
|
|
166
|
+
step?: string;
|
|
167
|
+
}
|
|
168
|
+
|
|
169
|
+
/**
|
|
170
|
+
* The check's statement over `commit`, with the digest of what it said when
|
|
171
|
+
* given, and (#4926) the run, job and step a signer outside the check's job
|
|
172
|
+
* read its pass from, so a verifier can look them up.
|
|
173
|
+
*/
|
|
174
|
+
export function checkStatement(input: { commit: string; tree: string; check: string; runner: string; claim?: Buffer | string; source?: CheckSource }): EvidenceStatement {
|
|
164
175
|
if (!input.check.trim()) throw new Error("a check's evidence needs the check's name");
|
|
165
176
|
return {
|
|
166
177
|
_type: STATEMENT_TYPE,
|
|
@@ -172,6 +183,7 @@ export function checkStatement(input: { commit: string; tree: string; check: str
|
|
|
172
183
|
tree: input.tree,
|
|
173
184
|
check: input.check,
|
|
174
185
|
...(input.claim !== undefined ? { claim: { sha256: createHash("sha256").update(input.claim).digest("hex") } } : {}),
|
|
186
|
+
...(input.source ? { source: { run: input.source.run, job: input.source.job, ...(input.source.step ? { step: input.source.step } : {}) } } : {}),
|
|
175
187
|
},
|
|
176
188
|
};
|
|
177
189
|
}
|
|
@@ -186,11 +198,11 @@ export interface SignedCheck {
|
|
|
186
198
|
}
|
|
187
199
|
|
|
188
200
|
/** Sign each of `checks` over `at` with `signer`. Writes nothing. */
|
|
189
|
-
export async function signChecks(repo: string, at: string, checks: readonly { check: string; claim?: Buffer | string }[], signer: EvidenceSigner): Promise<SignedCheck[]> {
|
|
201
|
+
export async function signChecks(repo: string, at: string, checks: readonly { check: string; claim?: Buffer | string; source?: CheckSource }[], signer: EvidenceSigner): Promise<SignedCheck[]> {
|
|
190
202
|
const { commit, tree } = commitAndTree(repo, at);
|
|
191
203
|
const out: SignedCheck[] = [];
|
|
192
|
-
for (const { check, claim } of checks) {
|
|
193
|
-
const statement = checkStatement({ commit, tree, check, runner: signer.principal, ...(claim !== undefined ? { claim } : {}) });
|
|
204
|
+
for (const { check, claim, source } of checks) {
|
|
205
|
+
const statement = checkStatement({ commit, tree, check, runner: signer.principal, ...(claim !== undefined ? { claim } : {}), ...(source ? { source } : {}) });
|
|
194
206
|
out.push({ check, commit, tree, runner: signer.principal, envelope: await signer.sign(IN_TOTO_PAYLOAD_TYPE, Buffer.from(canonicalJson(statement), "utf8")) });
|
|
195
207
|
}
|
|
196
208
|
return out;
|
|
@@ -81,6 +81,11 @@ export const evidenceStatementSchema = z
|
|
|
81
81
|
check: z.string().min(1),
|
|
82
82
|
claim: z.object({ sha256: sha256Hex }).strict().optional(),
|
|
83
83
|
environment: z.object({ sha256: sha256Hex }).strict().optional(),
|
|
84
|
+
// #4926: the forge's record the signer relied on: the run, the job, and the step whose conclusion it read.
|
|
85
|
+
source: z
|
|
86
|
+
.object({ run: z.number().int().nonnegative(), job: z.number().int().nonnegative(), step: z.string().min(1).optional() })
|
|
87
|
+
.strict()
|
|
88
|
+
.optional(),
|
|
84
89
|
})
|
|
85
90
|
.strict(),
|
|
86
91
|
})
|