@intentius/chant 0.124.88 → 0.124.89
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/actor.d.ts +36 -1
- package/dist/actor.d.ts.map +1 -1
- package/dist/actor.js +39 -1
- package/dist/chant-install.d.ts.map +1 -1
- package/dist/chant-install.js +1 -2
- package/dist/ci-base.d.ts +30 -0
- package/dist/ci-base.d.ts.map +1 -0
- package/dist/ci-base.js +33 -0
- package/dist/ci-comment-commands.d.ts +177 -0
- package/dist/ci-comment-commands.d.ts.map +1 -0
- package/dist/ci-comment-commands.js +325 -0
- package/dist/ci-comment-replies.d.ts +40 -0
- package/dist/ci-comment-replies.d.ts.map +1 -0
- package/dist/ci-comment-replies.js +59 -0
- package/dist/ci-evidence-from-job.d.ts +25 -0
- package/dist/ci-evidence-from-job.d.ts.map +1 -1
- package/dist/ci-evidence-from-job.js +43 -2
- package/dist/ci-evidence-jobs.d.ts +30 -1
- package/dist/ci-evidence-jobs.d.ts.map +1 -1
- package/dist/ci-evidence-jobs.js +46 -3
- package/dist/ci-image.d.ts +21 -4
- package/dist/ci-image.d.ts.map +1 -1
- package/dist/ci-image.js +62 -10
- package/dist/ci-note-commands.d.ts +63 -3
- package/dist/ci-note-commands.d.ts.map +1 -1
- package/dist/ci-note-commands.js +69 -35
- package/dist/ci-product-words.d.ts +42 -0
- package/dist/ci-product-words.d.ts.map +1 -1
- package/dist/ci-product-words.js +25 -0
- package/dist/ci-product.d.ts +31 -0
- package/dist/ci-product.d.ts.map +1 -1
- package/dist/ci-product.js +34 -4
- package/dist/cli/commands/build.d.ts.map +1 -1
- package/dist/cli/commands/build.js +29 -2
- package/dist/cli/handlers/approve.d.ts.map +1 -1
- package/dist/cli/handlers/approve.js +2 -1
- package/dist/cli/handlers/ci-check.d.ts +1 -1
- package/dist/cli/handlers/ci-check.d.ts.map +1 -1
- package/dist/cli/handlers/ci-check.js +17 -7
- package/dist/cli/handlers/ci-evidence.d.ts.map +1 -1
- package/dist/cli/handlers/ci-evidence.js +33 -7
- package/dist/cli/handlers/components.d.ts.map +1 -1
- package/dist/cli/handlers/components.js +3 -1
- package/dist/cli/handlers/generated-check.d.ts +8 -0
- package/dist/cli/handlers/generated-check.d.ts.map +1 -1
- package/dist/cli/handlers/generated-check.js +31 -1
- package/dist/cli/handlers/lock.d.ts.map +1 -1
- package/dist/cli/handlers/lock.js +121 -4
- package/dist/cli/handlers/pr-comment.d.ts +21 -0
- package/dist/cli/handlers/pr-comment.d.ts.map +1 -0
- package/dist/cli/handlers/pr-comment.js +112 -0
- package/dist/cli/handlers/pr-env.d.ts.map +1 -1
- package/dist/cli/handlers/pr-env.js +6 -3
- package/dist/cli/handlers/pr.d.ts +23 -1
- package/dist/cli/handlers/pr.d.ts.map +1 -1
- package/dist/cli/handlers/pr.js +55 -9
- package/dist/cli/handlers/promote.d.ts.map +1 -1
- package/dist/cli/handlers/promote.js +2 -1
- package/dist/cli/handlers/release.d.ts.map +1 -1
- package/dist/cli/handlers/release.js +11 -2
- package/dist/cli/handlers/run-wave.d.ts.map +1 -1
- package/dist/cli/handlers/run-wave.js +28 -2
- package/dist/cli/handlers/run.d.ts.map +1 -1
- package/dist/cli/handlers/run.js +2 -1
- package/dist/cli/main.d.ts.map +1 -1
- package/dist/cli/main.js +24 -2
- package/dist/cli/parse-args.d.ts.map +1 -1
- package/dist/cli/parse-args.js +16 -0
- package/dist/cli/registry.d.ts +11 -0
- package/dist/cli/registry.d.ts.map +1 -1
- package/dist/components/auto-release.d.ts.map +1 -1
- package/dist/components/auto-release.js +2 -1
- package/dist/components/pr-checks.d.ts +70 -6
- package/dist/components/pr-checks.d.ts.map +1 -1
- package/dist/components/pr-checks.js +74 -13
- package/dist/components/pr-pipeline.d.ts +16 -12
- package/dist/components/pr-pipeline.d.ts.map +1 -1
- package/dist/components/pr-pipeline.js +3 -11
- package/dist/components/product-pipeline.d.ts +42 -1
- package/dist/components/product-pipeline.d.ts.map +1 -1
- package/dist/components/product-pipeline.js +64 -12
- package/dist/components/product-plan.d.ts +190 -5
- package/dist/components/product-plan.d.ts.map +1 -1
- package/dist/components/product-plan.js +220 -39
- package/dist/drift-record.d.ts +7 -0
- package/dist/drift-record.d.ts.map +1 -1
- package/dist/drift-record.js +19 -0
- package/dist/floor-table.data.d.ts.map +1 -1
- package/dist/floor-table.data.js +54 -31
- package/dist/forge-check/contract.d.ts +11 -1
- 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/gate-resume-run.d.ts +9 -1
- package/dist/gate-resume-run.d.ts.map +1 -1
- package/dist/gate-resume-run.js +26 -3
- package/dist/generated-check.d.ts +18 -4
- package/dist/generated-check.d.ts.map +1 -1
- package/dist/generated-check.js +37 -5
- package/dist/image-pins.d.ts +26 -0
- package/dist/image-pins.d.ts.map +1 -0
- package/dist/image-pins.js +19 -0
- package/dist/lexicon.d.ts +11 -0
- package/dist/lexicon.d.ts.map +1 -1
- package/dist/lifecycle/git.d.ts +11 -0
- package/dist/lifecycle/git.d.ts.map +1 -1
- package/dist/lifecycle/git.js +30 -3
- package/dist/lifecycle/publish-npm.d.ts +11 -0
- package/dist/lifecycle/publish-npm.d.ts.map +1 -1
- package/dist/lifecycle/publish-npm.js +27 -1
- package/dist/lifecycle/reach-locks.d.ts +131 -0
- package/dist/lifecycle/reach-locks.d.ts.map +1 -0
- package/dist/lifecycle/reach-locks.js +118 -0
- package/dist/lifecycle/release-cut.d.ts +3 -1
- package/dist/lifecycle/release-cut.d.ts.map +1 -1
- package/dist/lifecycle/release-cut.js +15 -0
- package/dist/lifecycle/release-images.d.ts.map +1 -1
- package/dist/lifecycle/release-images.js +1 -2
- package/dist/notify-product.d.ts +12 -3
- package/dist/notify-product.d.ts.map +1 -1
- package/dist/notify-product.js +10 -6
- package/dist/op/activities/source-release.d.ts.map +1 -1
- package/dist/op/activities/source-release.js +2 -1
- package/dist/op/activities/source-rollback.d.ts.map +1 -1
- package/dist/op/activities/source-rollback.js +2 -1
- package/dist/op/index.d.ts +2 -0
- package/dist/op/index.d.ts.map +1 -1
- package/dist/op/index.js +1 -0
- package/dist/op/op-waves-evidence-jobs.d.ts +6 -1
- package/dist/op/op-waves-evidence-jobs.d.ts.map +1 -1
- package/dist/op/op-waves-evidence-jobs.js +9 -3
- package/dist/op/op-waves-render-spec.d.ts +100 -0
- package/dist/op/op-waves-render-spec.d.ts.map +1 -0
- package/dist/op/op-waves-render-spec.js +162 -0
- package/dist/op/op-waves-run.d.ts +2 -0
- package/dist/op/op-waves-run.d.ts.map +1 -1
- package/dist/op/op-waves-run.js +2 -1
- package/dist/op/op-waves.d.ts +4 -0
- package/dist/op/op-waves.d.ts.map +1 -1
- package/dist/op/op-waves.js +4 -1
- package/dist/op/schedule-overdue.d.ts.map +1 -1
- package/dist/op/schedule-overdue.js +59 -3
- package/dist/op/wave-stop.d.ts +64 -0
- package/dist/op/wave-stop.d.ts.map +1 -0
- package/dist/op/wave-stop.js +127 -0
- package/dist/planned-files.d.ts +76 -0
- package/dist/planned-files.d.ts.map +1 -0
- package/dist/planned-files.js +108 -0
- package/dist/pr-forge-job.d.ts +22 -0
- package/dist/pr-forge-job.d.ts.map +1 -0
- package/dist/pr-forge-job.js +46 -0
- package/dist/pr-loop.d.ts +3 -6
- package/dist/pr-loop.d.ts.map +1 -1
- package/dist/pr-loop.js +4 -81
- package/dist/pr-plan-note.d.ts +97 -0
- package/dist/pr-plan-note.d.ts.map +1 -1
- package/dist/pr-plan-note.js +94 -1
- package/dist/pr-post.d.ts +28 -3
- package/dist/pr-post.d.ts.map +1 -1
- package/dist/pr-post.js +145 -13
- package/dist/pr-status.d.ts +16 -0
- package/dist/pr-status.d.ts.map +1 -0
- package/dist/pr-status.js +90 -0
- package/dist/ref-gate-init.d.ts +16 -2
- package/dist/ref-gate-init.d.ts.map +1 -1
- package/dist/ref-gate-init.js +24 -13
- package/dist/release-floors.d.ts +37 -1
- package/dist/release-floors.d.ts.map +1 -1
- package/dist/release-floors.js +61 -25
- package/dist/render-module.d.ts +15 -0
- package/dist/render-module.d.ts.map +1 -0
- package/dist/render-module.js +73 -0
- package/dist/state-migration.d.ts.map +1 -1
- package/dist/state-migration.js +1 -2
- package/dist/wave-runtime.mjs +304 -301
- package/dist/workspace/ci-green-cli.d.ts.map +1 -1
- package/dist/workspace/ci-green-cli.js +3 -2
- package/dist/workspace/release-train.d.ts.map +1 -1
- package/dist/workspace/release-train.js +2 -1
- package/dist/workspace/release-workflow.d.ts +4 -3
- package/dist/workspace/release-workflow.d.ts.map +1 -1
- package/dist/workspace/release-workflow.js +10 -7
- package/dist/workspace/trust/check-evidence-report.d.ts +7 -2
- package/dist/workspace/trust/check-evidence-report.d.ts.map +1 -1
- package/dist/workspace/trust/check-evidence-report.js +15 -8
- package/dist/workspace/trust/ref-gate-cli.d.ts +10 -1
- package/dist/workspace/trust/ref-gate-cli.d.ts.map +1 -1
- package/dist/workspace/trust/ref-gate-cli.js +30 -10
- package/dist/workspace/workspace-run.d.ts.map +1 -1
- package/dist/workspace/workspace-run.js +2 -1
- package/package.json +1 -1
- package/src/actor.test.ts +68 -2
- package/src/actor.ts +61 -1
- package/src/chant-install.test.ts +2 -3
- package/src/chant-install.ts +1 -2
- package/src/ci-base.test.ts +41 -0
- package/src/ci-base.ts +43 -0
- package/src/ci-comment-commands.test.ts +376 -0
- package/src/ci-comment-commands.ts +389 -0
- package/src/ci-comment-replies.ts +78 -0
- package/src/ci-commit.test.ts +2 -3
- package/src/ci-evidence-from-job.test.ts +18 -0
- package/src/ci-evidence-from-job.ts +58 -2
- package/src/ci-evidence-jobs.ts +50 -5
- package/src/ci-image.test.ts +130 -9
- package/src/ci-image.ts +85 -12
- package/src/ci-note-commands.ts +104 -41
- package/src/ci-product-words.ts +59 -0
- package/src/ci-product.ts +40 -4
- package/src/cli/commands/build.test.ts +41 -0
- package/src/cli/commands/build.ts +27 -2
- package/src/cli/handlers/approve.ts +2 -1
- package/src/cli/handlers/ci-check.ts +19 -7
- package/src/cli/handlers/ci-evidence.ts +29 -8
- package/src/cli/handlers/components.ts +3 -1
- package/src/cli/handlers/generated-check.ts +31 -1
- package/src/cli/handlers/lock-reach.test.ts +103 -0
- package/src/cli/handlers/lock.ts +100 -4
- package/src/cli/handlers/pr-comment.ts +104 -0
- package/src/cli/handlers/pr-env.ts +6 -3
- package/src/cli/handlers/pr-record.test.ts +1 -1
- package/src/cli/handlers/pr.ts +50 -10
- package/src/cli/handlers/promote.ts +2 -1
- package/src/cli/handlers/release.e2e.test.ts +35 -0
- package/src/cli/handlers/release.ts +14 -2
- package/src/cli/handlers/run-wave.ts +28 -2
- package/src/cli/handlers/run.ts +2 -1
- package/src/cli/main.ts +24 -2
- package/src/cli/parse-args.ts +12 -0
- package/src/cli/registry.ts +11 -0
- package/src/components/auto-release.ts +2 -1
- package/src/components/pr-checks.ts +112 -17
- package/src/components/pr-pipeline.ts +17 -15
- package/src/components/product-pipeline.ts +93 -11
- package/src/components/product-plan.test.ts +40 -2
- package/src/components/product-plan.ts +331 -45
- package/src/drift-record.test.ts +20 -0
- package/src/drift-record.ts +16 -0
- package/src/floor-table.data.ts +54 -31
- package/src/forge-check/contract.ts +12 -1
- package/src/forge-check/forge-check.test.ts +17 -0
- package/src/forge-check/index.ts +2 -0
- package/src/gate-resume-run.ts +27 -3
- package/src/generated-check.e2e.test.ts +21 -1
- package/src/generated-check.test.ts +66 -0
- package/src/generated-check.ts +51 -10
- package/src/image-pins.ts +31 -0
- package/src/lexicon.ts +11 -0
- package/src/lifecycle/git.test.ts +48 -0
- package/src/lifecycle/git.ts +27 -4
- package/src/lifecycle/publish-npm.ts +31 -1
- package/src/lifecycle/reach-locks.test.ts +87 -0
- package/src/lifecycle/reach-locks.ts +169 -0
- package/src/lifecycle/release-cut.ts +17 -1
- package/src/lifecycle/release-images.test.ts +56 -0
- package/src/lifecycle/release-images.ts +1 -2
- package/src/notify-product.ts +19 -8
- package/src/op/activities/source-release.ts +2 -1
- package/src/op/activities/source-rollback.ts +2 -1
- package/src/op/gate-resume.test.ts +27 -0
- package/src/op/index.ts +10 -0
- package/src/op/op-waves-evidence-jobs.ts +10 -4
- package/src/op/op-waves-notify-words.test.ts +18 -0
- package/src/op/op-waves-render-spec.test.ts +160 -0
- package/src/op/op-waves-render-spec.ts +171 -0
- package/src/op/op-waves-run.ts +2 -1
- package/src/op/op-waves.ts +5 -2
- package/src/op/schedule-overdue.test.ts +43 -0
- package/src/op/schedule-overdue.ts +57 -3
- package/src/op/wave-stop.test.ts +72 -0
- package/src/op/wave-stop.ts +137 -0
- package/src/planned-files.test.ts +80 -0
- package/src/planned-files.ts +134 -0
- package/src/pr-forge-job.test.ts +53 -0
- package/src/pr-forge-job.ts +46 -0
- package/src/pr-loop-narrowed.test.ts +2 -1
- package/src/pr-loop-words.test.ts +2 -1
- package/src/pr-loop.test.ts +1 -2
- package/src/pr-loop.ts +4 -80
- package/src/pr-plan-note.ts +155 -3
- package/src/pr-post-replan.test.ts +144 -0
- package/src/pr-post-subject.test.ts +230 -0
- package/src/pr-post.test.ts +2 -1
- package/src/pr-post.ts +150 -15
- package/src/pr-status.ts +91 -0
- package/src/ref-gate-init.ts +30 -11
- package/src/release-floors.ts +78 -25
- package/src/render-module.ts +73 -0
- package/src/state-migration-record.test.ts +2 -3
- package/src/state-migration.ts +1 -2
- package/src/workspace/ci-green-cli.ts +3 -2
- package/src/workspace/ci-green-workflow.test.ts +32 -1
- package/src/workspace/release-train.ts +2 -1
- package/src/workspace/release-workflow.test.ts +36 -5
- package/src/workspace/release-workflow.ts +10 -7
- package/src/workspace/trust/check-evidence-report.ts +15 -8
- package/src/workspace/trust/check-evidence.test.ts +5 -0
- package/src/workspace/trust/ref-gate-cli.ts +30 -8
- package/src/workspace/trust/ref-gate-pieces.test.ts +46 -1
- package/src/workspace/trust/ref-gate.test.ts +10 -0
- package/src/workspace/workspace-run.ts +2 -1
|
@@ -4,7 +4,8 @@
|
|
|
4
4
|
* package.json) into a directory under the OS temp directory, compare each
|
|
5
5
|
* with the committed file, and exit 1 naming every one that drifted. The
|
|
6
6
|
* directory is left in place and printed. Exit 2 when the product declares
|
|
7
|
-
* no `chantGenerated`.
|
|
7
|
+
* no `chantGenerated`. Also `chant dev render` (#4950), which writes a
|
|
8
|
+
* module's file-text export in place.
|
|
8
9
|
*/
|
|
9
10
|
import { checkGenerated, readGeneratedCheckConfig } from "../../generated-check.js";
|
|
10
11
|
import { formatError } from "../format.js";
|
|
@@ -39,3 +40,32 @@ export async function runDevGeneratedCheck(ctx) {
|
|
|
39
40
|
}
|
|
40
41
|
return result.ok ? 0 : 1;
|
|
41
42
|
}
|
|
43
|
+
const RENDER_USAGE = "chant dev render <module> <export> [--output <root>]";
|
|
44
|
+
/**
|
|
45
|
+
* `chant dev render <module> <export> [--output <root>]` (#4950): import the
|
|
46
|
+
* module, call its export (a `{ path: text }` object, or a function that
|
|
47
|
+
* returns one) and write each file at its path below the root, the working
|
|
48
|
+
* directory unless `--output` names one. Under `chant dev generated-check`
|
|
49
|
+
* a path inside the product goes to the render tree instead.
|
|
50
|
+
*/
|
|
51
|
+
export async function runDevRender(ctx) {
|
|
52
|
+
const [, modulePath, exportName] = ctx.args.positionals ?? [];
|
|
53
|
+
if (!modulePath || !exportName) {
|
|
54
|
+
console.error(formatError({ message: "name the module and its export that returns the files", hint: RENDER_USAGE }));
|
|
55
|
+
return 2;
|
|
56
|
+
}
|
|
57
|
+
const { resolve } = await import("node:path");
|
|
58
|
+
const { renderPathOf } = await import("../../generated-check.js");
|
|
59
|
+
const { renderModuleFiles, writeRenderedFiles } = await import("../../render-module.js");
|
|
60
|
+
try {
|
|
61
|
+
const files = await renderModuleFiles(modulePath, exportName);
|
|
62
|
+
const root = resolve(ctx.args.output ?? ".");
|
|
63
|
+
for (const path of writeRenderedFiles(root, files, renderPathOf))
|
|
64
|
+
console.error(` wrote ${path}`);
|
|
65
|
+
return 0;
|
|
66
|
+
}
|
|
67
|
+
catch (err) {
|
|
68
|
+
console.error(formatError({ message: `chant dev render: ${err instanceof Error ? err.message : String(err)}`, hint: RENDER_USAGE }));
|
|
69
|
+
return 1;
|
|
70
|
+
}
|
|
71
|
+
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"lock.d.ts","sourceRoot":"","sources":["../../../src/cli/handlers/lock.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"lock.d.ts","sourceRoot":"","sources":["../../../src/cli/handlers/lock.ts"],"names":[],"mappings":"AA8DA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,aAAa,CAAC;AAsBlD,iEAAiE;AACjE,eAAO,MAAM,mBAAmB,eAAe,CAAC;AA4DhD,iBAAiB;AACjB,wBAAsB,OAAO,CAAC,GAAG,EAAE,cAAc,GAAG,OAAO,CAAC,MAAM,CAAC,CAgJlE;AAqED,mBAAmB;AACnB,wBAAsB,SAAS,CAAC,GAAG,EAAE,cAAc,GAAG,OAAO,CAAC,MAAM,CAAC,CAoCpE"}
|
|
@@ -6,6 +6,8 @@
|
|
|
6
6
|
* chant lock <target>... --pr <n> [--stage plan|apply|lock] [--head <sha>] [--by <who>] [--gate <name>] [--forge <kind>] [--json]
|
|
7
7
|
* chant lock --from-report <pr-plan.json> --pr <n> [--stage plan] [--forge <kind>] [--json]
|
|
8
8
|
* chant lock --keep --pr <n> [--head <sha>] [--gate <name>] [--forge <kind>] [--json]
|
|
9
|
+
* chant lock --reach --pr <n> --head <sha> --base <sha> --forge <kind> [--stage plan|apply|lock] [--gate <name>] [--json]
|
|
10
|
+
* chant lock --reach --open --base <sha> --forge gitlab [--branch <name>] [--stage plan] [--gate <name>] [--json]
|
|
9
11
|
* chant lock --list [--gate <name>] [--json]
|
|
10
12
|
* chant lock --alive <run>
|
|
11
13
|
* chant unlock --pr <n> [<target>...] [--gate <name>] [--json]
|
|
@@ -20,6 +22,13 @@
|
|
|
20
22
|
* a member is on the resource lock grain (#4552) the report carries
|
|
21
23
|
* `lockTargets`, its row keys, and those are locked instead.
|
|
22
24
|
*
|
|
25
|
+
* `--reach` (#4979) locks what a change reaches by the pipeline's reach line
|
|
26
|
+
* in `CHANT_LOCK_REACH`, which prints target names one a line from the
|
|
27
|
+
* change's files read as data (../../lifecycle/reach-locks.ts). chant first
|
|
28
|
+
* fetches the pull request's head and checks it is `--head`. With `--open`
|
|
29
|
+
* (GitLab's plan notes pipeline) every open merge request into the branch is
|
|
30
|
+
* locked, and a holder that is no longer open releases its locks.
|
|
31
|
+
*
|
|
23
32
|
* `--list` prints the target locks, then the apply rows of the gate's rows
|
|
24
33
|
* file (#4552, #4594), each with the run that holds it and when it took it.
|
|
25
34
|
*
|
|
@@ -52,9 +61,13 @@ import { readFileSync } from "node:fs";
|
|
|
52
61
|
import { CHANT_EXIT } from "../../exit-codes.js";
|
|
53
62
|
import { resolve } from "node:path";
|
|
54
63
|
import { formatError, formatInfo, formatSuccess, formatWarning } from "../format.js";
|
|
55
|
-
import { FORGE_KINDS
|
|
64
|
+
import { FORGE_KINDS } from "../../pr-forge.js";
|
|
65
|
+
// #4964: a status for a pull_request run's merge preview goes on the pull request's head.
|
|
66
|
+
import { forgeFromJobEnv } from "../../pr-forge-job.js";
|
|
56
67
|
import { PR_APPLY_GATE } from "../../pr-loop.js";
|
|
68
|
+
import { actorFromEnv } from "../../actor.js";
|
|
57
69
|
import { describeHeldTargetLocks, readTargetLocks, releaseTargetLocks, takeTargetLocks, targetLockGateProblem, targetLockPathAt, TARGET_LOCK_STAGES, } from "../../lifecycle/target-lock.js";
|
|
70
|
+
import { LOCK_REACH_ENV, reachedTargets, reachOpen } from "../../lifecycle/reach-locks.js";
|
|
58
71
|
/** The exit for a target another open pull request holds: `CHANT_EXIT.held`, 5 (#4553). */
|
|
59
72
|
const HELD_EXIT_CODE = CHANT_EXIT.held;
|
|
60
73
|
/** The status `chant lock --head <sha> --forge <kind>` posts. */
|
|
@@ -79,7 +92,7 @@ function forgeOf(ctx) {
|
|
|
79
92
|
if (!FORGE_KINDS.includes(kind))
|
|
80
93
|
return { error: `--forge ${kind} is not one of ${FORGE_KINDS.join(", ")}` };
|
|
81
94
|
try {
|
|
82
|
-
return
|
|
95
|
+
return forgeFromJobEnv(kind);
|
|
83
96
|
}
|
|
84
97
|
catch (err) {
|
|
85
98
|
return { error: err instanceof Error ? err.message : String(err) };
|
|
@@ -179,6 +192,9 @@ export async function runLock(ctx) {
|
|
|
179
192
|
console.log(`${key}\trun ${holder.run}\t${holder.at}${holder.url ? `\t${holder.url}` : ""}${holder.beat ? `\tbeat ${holder.beat}` : ""}`);
|
|
180
193
|
return 0;
|
|
181
194
|
}
|
|
195
|
+
// #4979: GitLab's lock job, in the target branch's plan notes pipeline, locks what every open merge request reaches.
|
|
196
|
+
if (args.lockReach && args.open)
|
|
197
|
+
return runReachOpen(ctx, gate);
|
|
182
198
|
if (args.pr === undefined)
|
|
183
199
|
return fail("chant lock needs the pull or merge request that holds the locks: --pr <n>", "chant lock --list prints the locks held now.");
|
|
184
200
|
const stage = (args.lockStage ?? "lock");
|
|
@@ -186,7 +202,27 @@ export async function runLock(ctx) {
|
|
|
186
202
|
return fail(`--stage ${args.lockStage} is not one of ${TARGET_LOCK_STAGES.join(", ")}`);
|
|
187
203
|
let targets = targetsOf(ctx);
|
|
188
204
|
let head = args.head;
|
|
189
|
-
if (args.
|
|
205
|
+
if (args.lockReach) {
|
|
206
|
+
// #4979: the targets the change reaches, from the pipeline's reach line, after the head is fetched and checked.
|
|
207
|
+
if (targets.length > 0 || args.fromReport || args.keepLocks)
|
|
208
|
+
return fail("--reach locks what the reach line prints; drop the names, --from-report and --keep");
|
|
209
|
+
const line = process.env[LOCK_REACH_ENV] ?? "";
|
|
210
|
+
if (!line.trim())
|
|
211
|
+
return fail(`--reach runs the reach line in ${LOCK_REACH_ENV}, which is not set`, "The generated lock job sets it from the product plan's reach.");
|
|
212
|
+
if (args.forge === undefined || !FORGE_KINDS.includes(args.forge))
|
|
213
|
+
return fail("--reach fetches the pull request's head from the forge: give --forge github, gitlab or forgejo");
|
|
214
|
+
if (!head || args.base === undefined)
|
|
215
|
+
return fail("--reach measures the change from --base <sha> to --head <sha>");
|
|
216
|
+
const reached = reachedTargets({ forge: args.forge, pr: args.pr, head, base: args.base, line });
|
|
217
|
+
if ("error" in reached)
|
|
218
|
+
return fail(reached.error);
|
|
219
|
+
if ("moved" in reached) {
|
|
220
|
+
console.error(formatInfo(reached.moved));
|
|
221
|
+
return 0;
|
|
222
|
+
}
|
|
223
|
+
targets = reached.targets;
|
|
224
|
+
}
|
|
225
|
+
else if (args.keepLocks) {
|
|
190
226
|
if (targets.length > 0 || args.fromReport)
|
|
191
227
|
return fail("--keep keeps the locks the pull request holds; drop the names and --from-report");
|
|
192
228
|
let file;
|
|
@@ -217,7 +253,7 @@ export async function runLock(ctx) {
|
|
|
217
253
|
if (forge && "error" in forge)
|
|
218
254
|
return fail(forge.error);
|
|
219
255
|
const isOpen = forge?.pullRequestOpen?.bind(forge);
|
|
220
|
-
const by = args.by ??
|
|
256
|
+
const by = args.by ?? actorFromEnv();
|
|
221
257
|
const name = prName(forge);
|
|
222
258
|
let result;
|
|
223
259
|
try {
|
|
@@ -250,6 +286,87 @@ export async function runLock(ctx) {
|
|
|
250
286
|
console.error(formatInfo("chant/lifecycle was not pushed: this repository has no remote, or recording is off"));
|
|
251
287
|
return 0;
|
|
252
288
|
}
|
|
289
|
+
/**
|
|
290
|
+
* `chant lock --reach --open --base <sha> --forge gitlab [--branch <name>]`
|
|
291
|
+
* (#4979): GitLab's lock job, in a pipeline of the target branch. Every
|
|
292
|
+
* open merge request from the project that merges into the branch (default
|
|
293
|
+
* `CI_COMMIT_BRANCH`) takes the locks of what its change reaches, and a
|
|
294
|
+
* holder that is no longer open releases its locks. Exit 3 when another
|
|
295
|
+
* merge request holds what one reaches, 1 when a reach could not be read.
|
|
296
|
+
*/
|
|
297
|
+
async function runReachOpen(ctx, gate) {
|
|
298
|
+
const { args } = ctx;
|
|
299
|
+
const line = process.env[LOCK_REACH_ENV] ?? "";
|
|
300
|
+
if (!line.trim())
|
|
301
|
+
return fail(`--reach runs the reach line in ${LOCK_REACH_ENV}, which is not set`);
|
|
302
|
+
if (args.pr !== undefined || targetsOf(ctx).length > 0)
|
|
303
|
+
return fail("--open locks every open merge request; drop --pr and the names");
|
|
304
|
+
if (args.base === undefined)
|
|
305
|
+
return fail("--reach measures each change from --base <sha>, the target branch's commit");
|
|
306
|
+
const stage = (args.lockStage ?? "plan");
|
|
307
|
+
if (!TARGET_LOCK_STAGES.includes(stage))
|
|
308
|
+
return fail(`--stage ${args.lockStage} is not one of ${TARGET_LOCK_STAGES.join(", ")}`);
|
|
309
|
+
const forge = forgeOf(ctx);
|
|
310
|
+
if (!forge)
|
|
311
|
+
return fail("--open asks the forge for the open merge requests: give --forge gitlab");
|
|
312
|
+
if ("error" in forge)
|
|
313
|
+
return fail(forge.error);
|
|
314
|
+
const branch = args.branch ?? process.env.CI_COMMIT_BRANCH ?? "";
|
|
315
|
+
if (!branch)
|
|
316
|
+
return fail("--open locks the merge requests into one branch: give --branch <name>, or run it in a branch pipeline");
|
|
317
|
+
if (!forge.openPullRequests || !forge.pullRequestOpen)
|
|
318
|
+
return fail(`the ${forge.kind} client cannot list the open merge requests`);
|
|
319
|
+
const isOpen = forge.pullRequestOpen.bind(forge);
|
|
320
|
+
const name = prName(forge);
|
|
321
|
+
let open;
|
|
322
|
+
try {
|
|
323
|
+
open = await forge.openPullRequests(branch);
|
|
324
|
+
}
|
|
325
|
+
catch (err) {
|
|
326
|
+
return fail(`could not list the open merge requests into ${branch}: ${err instanceof Error ? err.message : String(err)}`);
|
|
327
|
+
}
|
|
328
|
+
const by = actorFromEnv();
|
|
329
|
+
const { outcomes, released } = await reachOpen({
|
|
330
|
+
forge: forge.kind,
|
|
331
|
+
base: args.base,
|
|
332
|
+
line,
|
|
333
|
+
branch,
|
|
334
|
+
open,
|
|
335
|
+
isOpen,
|
|
336
|
+
take: async (pr, head, targets) => {
|
|
337
|
+
const r = await takeTargetLocks(gate, targets, { pr, by, at: new Date().toISOString(), stage, head }, { isOpen, releaseStalePlan: stage === "plan" });
|
|
338
|
+
if (r.ok) {
|
|
339
|
+
await postStatus(forge, head, "success", r.taken.length > 0 ? `holds ${r.taken.join(", ")}` : "reaches no target");
|
|
340
|
+
return { ok: true, released: r.released };
|
|
341
|
+
}
|
|
342
|
+
await postStatus(forge, head, "failure", `locked by ${[...new Set(r.held.map((h) => h.pr))].map(name).join(", ")}: ${r.held.map((h) => h.target).join(", ")}`);
|
|
343
|
+
return { ok: false, held: `${describeHeldTargetLocks(r.held, name)}, so ${name(pr)} is not locked` };
|
|
344
|
+
},
|
|
345
|
+
holders: async () => [...new Set(Object.values((await readTargetLocks(gate)).locks).map((l) => l.pr))].sort((a, b) => a - b),
|
|
346
|
+
release: async (pr) => (await releaseTargetLocks(gate, pr)).released,
|
|
347
|
+
});
|
|
348
|
+
let code = 0;
|
|
349
|
+
for (const o of outcomes) {
|
|
350
|
+
if (o.kind === "locked")
|
|
351
|
+
console.error(formatSuccess(`${name(o.pr)} ${o.targets.length > 0 ? `holds ${o.targets.join(", ")}` : "reaches no target"} on ${gate}${o.released.length > 0 ? `; released ${o.released.join(", ")}, which it no longer reaches` : ""}`));
|
|
352
|
+
else if (o.kind === "skipped")
|
|
353
|
+
console.error(formatInfo(o.text));
|
|
354
|
+
else if (o.kind === "held") {
|
|
355
|
+
console.error(formatError({ message: o.text }));
|
|
356
|
+
if (code === 0)
|
|
357
|
+
code = HELD_EXIT_CODE;
|
|
358
|
+
}
|
|
359
|
+
else {
|
|
360
|
+
console.error(formatError({ message: `${name(o.pr)}: ${o.text}` }));
|
|
361
|
+
code = 1;
|
|
362
|
+
}
|
|
363
|
+
}
|
|
364
|
+
for (const r of released)
|
|
365
|
+
console.error(formatInfo(`${name(r.pr)} is not open, so its locks on ${r.targets.join(", ")} are released`));
|
|
366
|
+
if (args.json)
|
|
367
|
+
console.log(JSON.stringify({ gate, outcomes, released }, null, 2));
|
|
368
|
+
return code;
|
|
369
|
+
}
|
|
253
370
|
/** chant unlock */
|
|
254
371
|
export async function runUnlock(ctx) {
|
|
255
372
|
const { args } = ctx;
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* `chant components pr-comment --forge github|forgejo` (#4946): the comment
|
|
3
|
+
* job of GitHub's and Forgejo's product pipeline.
|
|
4
|
+
*
|
|
5
|
+
* It reads the `issue_comment` event from `GITHUB_EVENT_PATH`, and the jobs
|
|
6
|
+
* the pipeline has from `CHANT_COMMENT_JOBS` (JSON, written by the
|
|
7
|
+
* generator), and answers the comment when no other job of the pipeline
|
|
8
|
+
* does (`../../ci-comment-commands.ts`): a refusal, a command no job runs,
|
|
9
|
+
* or the re-run of a merged pull request's apply. The words are the
|
|
10
|
+
* product's, as its bin set them.
|
|
11
|
+
*
|
|
12
|
+
* It runs at the target branch's commit with the job's token
|
|
13
|
+
* (`GITHUB_TOKEN`), so none of the change's code runs here, and it loads no
|
|
14
|
+
* plugins.
|
|
15
|
+
*/
|
|
16
|
+
import { type CommentJobs } from "../../ci-comment-commands.js";
|
|
17
|
+
import type { CommandContext } from "../registry.js";
|
|
18
|
+
/** The jobs named in {@link COMMENT_JOBS_ENV}: each a boolean, `targets` a list of names, and anything else is refused. */
|
|
19
|
+
export declare function commentJobsFromEnv(raw: string | undefined): CommentJobs;
|
|
20
|
+
export declare function runComponentsPrComment(ctx: CommandContext): Promise<number>;
|
|
21
|
+
//# sourceMappingURL=pr-comment.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"pr-comment.d.ts","sourceRoot":"","sources":["../../../src/cli/handlers/pr-comment.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAIH,OAAO,EAAuD,KAAK,WAAW,EAAE,MAAM,2BAA2B,CAAC;AAIlH,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,aAAa,CAAC;AAOlD,2HAA2H;AAC3H,wBAAgB,kBAAkB,CAAC,GAAG,EAAE,MAAM,GAAG,SAAS,GAAG,WAAW,CAwBvE;AAED,wBAAsB,sBAAsB,CAAC,GAAG,EAAE,cAAc,GAAG,OAAO,CAAC,MAAM,CAAC,CA+CjF"}
|
|
@@ -0,0 +1,112 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* `chant components pr-comment --forge github|forgejo` (#4946): the comment
|
|
3
|
+
* job of GitHub's and Forgejo's product pipeline.
|
|
4
|
+
*
|
|
5
|
+
* It reads the `issue_comment` event from `GITHUB_EVENT_PATH`, and the jobs
|
|
6
|
+
* the pipeline has from `CHANT_COMMENT_JOBS` (JSON, written by the
|
|
7
|
+
* generator), and answers the comment when no other job of the pipeline
|
|
8
|
+
* does (`../../ci-comment-commands.ts`): a refusal, a command no job runs,
|
|
9
|
+
* or the re-run of a merged pull request's apply. The words are the
|
|
10
|
+
* product's, as its bin set them.
|
|
11
|
+
*
|
|
12
|
+
* It runs at the target branch's commit with the job's token
|
|
13
|
+
* (`GITHUB_TOKEN`), so none of the change's code runs here, and it loads no
|
|
14
|
+
* plugins.
|
|
15
|
+
*/
|
|
16
|
+
import { readFileSync } from "node:fs";
|
|
17
|
+
import { activeProductWords } from "../../ci-product-words.js";
|
|
18
|
+
import { answerProductComment, COMMENT_JOBS_ENV, commentRuns } from "../../ci-comment-commands.js";
|
|
19
|
+
import { forgeFromEnv, forgeTargetFromEnv } from "../../pr-forge.js";
|
|
20
|
+
import { forgeReadsFor } from "../../pr-forge-reads.js";
|
|
21
|
+
import { formatError, formatInfo } from "../format.js";
|
|
22
|
+
const fail = (message) => {
|
|
23
|
+
console.error(formatError({ message }));
|
|
24
|
+
return 1;
|
|
25
|
+
};
|
|
26
|
+
/** The jobs named in {@link COMMENT_JOBS_ENV}: each a boolean, `targets` a list of names, and anything else is refused. */
|
|
27
|
+
export function commentJobsFromEnv(raw) {
|
|
28
|
+
if (raw === undefined || raw.trim() === "")
|
|
29
|
+
return {};
|
|
30
|
+
const v = JSON.parse(raw);
|
|
31
|
+
if (typeof v !== "object" || v === null || Array.isArray(v))
|
|
32
|
+
throw new Error(`${COMMENT_JOBS_ENV} is a JSON object of the jobs the pipeline has`);
|
|
33
|
+
const known = new Set(["preview", "applyBeforeMerge", "applyOnMerge", "locks", "agent", "commits", "actions", "skipForks", "targets", "noPlanFlags", "waves"]);
|
|
34
|
+
const jobs = {};
|
|
35
|
+
for (const [k, x] of Object.entries(v)) {
|
|
36
|
+
if (!known.has(k))
|
|
37
|
+
throw new Error(`${COMMENT_JOBS_ENV} names ${JSON.stringify(k)}, which is not one of ${[...known].join(", ")}`);
|
|
38
|
+
// #4979: the waves' op and count, for a wave stop on a re-run.
|
|
39
|
+
if (k === "waves") {
|
|
40
|
+
const w = x;
|
|
41
|
+
if (!w || typeof w !== "object" || typeof w.op !== "string" || !/^[A-Za-z0-9][A-Za-z0-9_.-]{0,127}$/.test(w.op) || !Number.isInteger(w.count) || w.count < 1)
|
|
42
|
+
throw new Error(`${COMMENT_JOBS_ENV}.waves is { op, count }: the waves' op name and how many waves there are`);
|
|
43
|
+
jobs.waves = { op: w.op, count: w.count };
|
|
44
|
+
continue;
|
|
45
|
+
}
|
|
46
|
+
if (k === "targets") {
|
|
47
|
+
if (!Array.isArray(x) || x.some((t) => typeof t !== "string" || !/^[A-Za-z0-9][A-Za-z0-9_-]*$/.test(t)))
|
|
48
|
+
throw new Error(`${COMMENT_JOBS_ENV}.targets is a list of target names`);
|
|
49
|
+
if (x.length > 0)
|
|
50
|
+
jobs.targets = x;
|
|
51
|
+
continue;
|
|
52
|
+
}
|
|
53
|
+
if (typeof x !== "boolean")
|
|
54
|
+
throw new Error(`${COMMENT_JOBS_ENV}.${k} is true or false`);
|
|
55
|
+
if (x)
|
|
56
|
+
jobs[k] = true;
|
|
57
|
+
}
|
|
58
|
+
return jobs;
|
|
59
|
+
}
|
|
60
|
+
export async function runComponentsPrComment(ctx) {
|
|
61
|
+
const { args } = ctx;
|
|
62
|
+
const kind = args.forge;
|
|
63
|
+
if (kind !== "github" && kind !== "forgejo")
|
|
64
|
+
return fail("pr-comment answers a GitHub or Forgejo comment: --forge github|forgejo (GitLab's notes are polled by pr-notes)");
|
|
65
|
+
const env = process.env;
|
|
66
|
+
const eventPath = env.GITHUB_EVENT_PATH;
|
|
67
|
+
if (!eventPath)
|
|
68
|
+
return fail("pr-comment reads the comment from the event file, and GITHUB_EVENT_PATH is not set");
|
|
69
|
+
let event;
|
|
70
|
+
let jobs;
|
|
71
|
+
let poster;
|
|
72
|
+
let target;
|
|
73
|
+
try {
|
|
74
|
+
event = JSON.parse(readFileSync(eventPath, "utf8"));
|
|
75
|
+
jobs = commentJobsFromEnv(env[COMMENT_JOBS_ENV]);
|
|
76
|
+
poster = forgeFromEnv(kind, env);
|
|
77
|
+
target = forgeTargetFromEnv(env, { kind });
|
|
78
|
+
}
|
|
79
|
+
catch (err) {
|
|
80
|
+
return fail(err instanceof Error ? err.message : String(err));
|
|
81
|
+
}
|
|
82
|
+
const repository = event?.repository;
|
|
83
|
+
const base = args.branch ?? (typeof repository?.default_branch === "string" ? repository.default_branch : undefined);
|
|
84
|
+
if (!base)
|
|
85
|
+
return fail("pr-comment needs the default branch: --branch <name>, or repository.default_branch in the event");
|
|
86
|
+
const outcome = await answerProductComment({
|
|
87
|
+
forge: kind,
|
|
88
|
+
event,
|
|
89
|
+
repo: target.repo,
|
|
90
|
+
reads: forgeReadsFor(target),
|
|
91
|
+
poster,
|
|
92
|
+
runs: commentRuns({ apiBase: target.apiBase, repo: target.repo, token: target.token }),
|
|
93
|
+
words: activeProductWords(),
|
|
94
|
+
base,
|
|
95
|
+
jobs,
|
|
96
|
+
env,
|
|
97
|
+
// #4979: the wave stop goes on this checkout's chant/lifecycle, which the job pushes with its token.
|
|
98
|
+
...(jobs.waves
|
|
99
|
+
? {
|
|
100
|
+
stops: async (op, sha, stop) => {
|
|
101
|
+
const { setWaveStop } = await import("../../op/wave-stop.js");
|
|
102
|
+
await setWaveStop(op, sha, stop);
|
|
103
|
+
},
|
|
104
|
+
}
|
|
105
|
+
: {}),
|
|
106
|
+
});
|
|
107
|
+
const line = `pr-comment: ${outcome.reason}`;
|
|
108
|
+
if (outcome.fail)
|
|
109
|
+
return fail(line);
|
|
110
|
+
console.error(formatInfo(line));
|
|
111
|
+
return 0;
|
|
112
|
+
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"pr-env.d.ts","sourceRoot":"","sources":["../../../src/cli/handlers/pr-env.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAmCG;
|
|
1
|
+
{"version":3,"file":"pr-env.d.ts","sourceRoot":"","sources":["../../../src/cli/handlers/pr-env.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAmCG;AA8CH,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,aAAa,CAAC;AAWlD,8CAA8C;AAC9C,wBAAsB,kBAAkB,CAAC,GAAG,EAAE,cAAc,GAAG,OAAO,CAAC,MAAM,CAAC,CAO7E"}
|
|
@@ -44,9 +44,12 @@ import { commandTeardownAdapter, prEnvDown as prEnvDownRun, prEnvOp, prEnvSweep
|
|
|
44
44
|
import { forgePrEnvPublisher, lifecyclePrEnvPorts } from "../../components/pr-env-ports.js";
|
|
45
45
|
import { applyPrSet } from "../../components/pr-run.js";
|
|
46
46
|
import { prOp } from "../../pr-loop.js";
|
|
47
|
-
import { FORGE_KINDS,
|
|
47
|
+
import { FORGE_KINDS, forgePrincipalOf } from "../../pr-forge.js";
|
|
48
|
+
// #4964: a status for a pull_request run's merge preview goes on the pull request's head.
|
|
49
|
+
import { forgeFromJobEnv } from "../../pr-forge-job.js";
|
|
48
50
|
import { formatError, formatInfo, formatWarning } from "../format.js";
|
|
49
51
|
import { withComponentEndpoint } from "../component-endpoint.js";
|
|
52
|
+
import { actorFromEnv } from "../../actor.js";
|
|
50
53
|
const USAGE = "chant components pr-env up --base <ref> --pr <n> [--no-push] | post --pr <n> --head <sha> | down --pr <n> [--reason closed|expired] | sweep";
|
|
51
54
|
const fail = (message, hint) => {
|
|
52
55
|
console.error(formatError({ message, ...(hint ? { hint } : {}) }));
|
|
@@ -72,14 +75,14 @@ function forgeOf(ctx) {
|
|
|
72
75
|
if (!FORGE_KINDS.includes(kind))
|
|
73
76
|
return fail(`--forge ${kind} is not one of ${FORGE_KINDS.join(", ")}`);
|
|
74
77
|
try {
|
|
75
|
-
return
|
|
78
|
+
return forgeFromJobEnv(kind);
|
|
76
79
|
}
|
|
77
80
|
catch (err) {
|
|
78
81
|
return fail(err instanceof Error ? err.message : String(err));
|
|
79
82
|
}
|
|
80
83
|
}
|
|
81
84
|
function actor() {
|
|
82
|
-
return process.env
|
|
85
|
+
return actorFromEnv(process.env, "chant");
|
|
83
86
|
}
|
|
84
87
|
function memberOf(ctx) {
|
|
85
88
|
return ctx.args.members?.length === 1 ? ctx.args.members[0] : undefined;
|
|
@@ -172,6 +172,28 @@ export declare function leaseRoundRows(p: Pick<Prepared, "gate">): NonNullable<P
|
|
|
172
172
|
export declare function runComponentsPrPlan(ctx: CommandContext): Promise<number>;
|
|
173
173
|
/** chant components pr-apply --base <ref> [--pr <n>] [--env <env>] [--gate <name>] [--forge <kind>] [--require-review] [--before-merge [--requires <list>]] [--output <dir>] [--json] [--events-json] [--report-url <url>] */
|
|
174
174
|
export declare function runComponentsPrApply(ctx: CommandContext): Promise<number>;
|
|
175
|
+
/**
|
|
176
|
+
* The branch an apply before merge lands on (#4966): `--branch`, else the
|
|
177
|
+
* pull request's target as its job names it, else the branch the job runs
|
|
178
|
+
* on, which for the generated apply job is the target branch (an
|
|
179
|
+
* `issue_comment` run on GitHub and Forgejo, a target-branch pipeline on
|
|
180
|
+
* GitLab).
|
|
181
|
+
*/
|
|
182
|
+
export declare function beforeMergeBranch(explicit: string | undefined, env?: Record<string, string | undefined>): string | undefined;
|
|
183
|
+
/**
|
|
184
|
+
* The statuses an apply before merge waits for beside the forge's own
|
|
185
|
+
* (#4966): the ref gate's status for the target branch, as the policy at
|
|
186
|
+
* `base` sets it (`refGateRulesAt`), passed as `require` to the `checks`
|
|
187
|
+
* require, so `checks` does not pass before the `ref-gate` job posted it.
|
|
188
|
+
* No rule for the branch requires nothing; a policy that can't be read is
|
|
189
|
+
* a problem, and the apply stops.
|
|
190
|
+
*/
|
|
191
|
+
export declare function beforeMergeRefGate(cwd: string, base: string, branch: string | undefined, env?: Record<string, string | undefined>): Promise<{
|
|
192
|
+
require: string[];
|
|
193
|
+
note?: string;
|
|
194
|
+
} | {
|
|
195
|
+
problem: string;
|
|
196
|
+
}>;
|
|
175
197
|
/** chant components pr-record --base <ref> [--pr <n>] [--env <env>] [--gate <name>] [--forge <kind>] [--output <dir>] [--json] [--events-json] [--report-url <url>] */
|
|
176
198
|
export declare function runComponentsPrRecord(ctx: CommandContext): Promise<number>;
|
|
177
199
|
/** A waiting wave's or round's approve lines (#4574): one per component when the product's template names `{target}`, as the note names them (#4601). */
|
|
@@ -200,7 +222,7 @@ export declare function runComponentsPlanWave(ctx: CommandContext): Promise<numb
|
|
|
200
222
|
*/
|
|
201
223
|
export declare function runComponentsApplyWave(ctx: CommandContext): Promise<number>;
|
|
202
224
|
/**
|
|
203
|
-
* chant components pr-post --pr <n> --head <sha> --env <env> --forge <kind> [--member <name>] [--output <dir>] [--result <result>] (#4295)
|
|
225
|
+
* chant components pr-post --pr <n> --head <sha> --env <env> --forge <kind> [--member <name>] [--output <dir>] [--result <result>] [--not-affected <argument>] (#4295, #4963)
|
|
204
226
|
* chant components pr-post --open --env <env> --forge gitlab [--branch <branch>] [--member <name>] [--output <dir>] (#4328)
|
|
205
227
|
*
|
|
206
228
|
* Post the plan note and the `chant/plan` status from the report a plan job
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"pr.d.ts","sourceRoot":"","sources":["../../../src/cli/handlers/pr.ts"],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IAAE,OAAO,EAAE,MAAM,CAAA;CAAE,CAAC,CAQ1N;AA2CD,uKAAuK;AACvK,wBAAgB,qBAAqB,CAAC,GAAG,EAAE,cAAc,GAAG,OAAO,CAAC,MAAM,CAAC,CAG1E;AAgVD,yJAAyJ;AACzJ,wBAAgB,gBAAgB,CAAC,EAAE,EAAE,MAAM,EAAE,GAAG,EAAE,MAAM,EAAE,CAAC,EAAE;IAAE,IAAI,EAAE,MAAM,CAAC;IAAC,MAAM,EAAE,MAAM,CAAC;IAAC,UAAU,EAAE,SAAS,MAAM,EAAE,CAAA;CAAE,GAAG,MAAM,CAGpI;AA+oBD;;;;;;;;GAQG;AACH,wBAAsB,qBAAqB,CAAC,GAAG,EAAE,cAAc,GAAG,OAAO,CAAC,MAAM,CAAC,CAMhF;AAED;;;;;;;GAOG;AACH,wBAAsB,sBAAsB,CAAC,GAAG,EAAE,cAAc,GAAG,OAAO,CAAC,MAAM,CAAC,CAMjF;AA6LD;;;;;;;;;;GAUG;AACH,wBAAsB,mBAAmB,CAAC,GAAG,EAAE,cAAc,GAAG,OAAO,CAAC,MAAM,CAAC,CA0C9E"}
|
package/dist/cli/handlers/pr.js
CHANGED
|
@@ -82,8 +82,11 @@ import { evaluateGate, gateIsSealed, gitGateLedgerPort } from "../../op/gate.js"
|
|
|
82
82
|
import { emitGateStep, gateEventsOf, GATE_PHASE } from "../../run-event-stream.js";
|
|
83
83
|
import { openCliRunEvents, refusesEventsWithJson } from "../run-events.js";
|
|
84
84
|
import { openPrReportUpload, parseReportUrl, reportKey } from "../../pr-report-url.js";
|
|
85
|
-
import { describePlanChanged, PR_APPLY_GATE, prApproveCommand, prApproveCommands, prNoteMarker, prOp,
|
|
85
|
+
import { describePlanChanged, PR_APPLY_GATE, prApproveCommand, prApproveCommands, prNoteMarker, prOp, prStatusContext, renderPrNote, } from "../../pr-loop.js";
|
|
86
|
+
import { prStatusDescription, prStatusState } from "../../pr-status.js";
|
|
86
87
|
import { FORGE_KINDS, forgeFromEnv, forgePrincipalOf } from "../../pr-forge.js";
|
|
88
|
+
// #4964: a status for a pull_request run's merge preview goes on the pull request's head.
|
|
89
|
+
import { forgeFromJobEnv } from "../../pr-forge-job.js";
|
|
87
90
|
import { GITHUB_COMMENT_LIMIT, GITLAB_NOTE_LIMIT } from "../../plan-summary.js";
|
|
88
91
|
import { upsertPlanNote } from "../../pr-post.js";
|
|
89
92
|
import { activeProductWords, commandWord, parseProductComment, productContext } from "../../ci-product-words.js";
|
|
@@ -104,6 +107,7 @@ import { PREVIEW_COMMENT_ENV } from "../../components/pr-pipeline.js";
|
|
|
104
107
|
import { prLoopHooksAt, runPrHooks } from "../../components/pr-hooks.js";
|
|
105
108
|
import { decidePrPolicyOverride, policyReviewOf, prLoopPolicyAt, preparePrPolicyEngine, prPolicyReport, runPrPolicy, spendPrPolicyOverride } from "../../components/pr-policy.js";
|
|
106
109
|
import { lexiconNames } from "../../lexicon-module.js";
|
|
110
|
+
import { actorFromEnv } from "../../actor.js";
|
|
107
111
|
/** Where the reports land unless `--output` says. */
|
|
108
112
|
export const PR_REPORT_DIR = ".chant/pr";
|
|
109
113
|
const fail = (message, hint) => {
|
|
@@ -151,7 +155,7 @@ export async function prepare(ctx, stage) {
|
|
|
151
155
|
let forge;
|
|
152
156
|
if (args.forge && !(stage === "plan" && args.noStatus)) {
|
|
153
157
|
try {
|
|
154
|
-
forge =
|
|
158
|
+
forge = forgeFromJobEnv(args.forge);
|
|
155
159
|
}
|
|
156
160
|
catch (err) {
|
|
157
161
|
return fail(err instanceof Error ? err.message : String(err));
|
|
@@ -1345,7 +1349,7 @@ async function mergeAfterUpdate(ctx, p, pr) {
|
|
|
1345
1349
|
}
|
|
1346
1350
|
let forge;
|
|
1347
1351
|
try {
|
|
1348
|
-
forge =
|
|
1352
|
+
forge = forgeFromJobEnv(kind, env);
|
|
1349
1353
|
}
|
|
1350
1354
|
catch (err) {
|
|
1351
1355
|
console.error(formatWarning({ message: `the pull request was not merged: ${err instanceof Error ? err.message : String(err)}` }));
|
|
@@ -1431,7 +1435,7 @@ async function beforeMergeChecks(ctx) {
|
|
|
1431
1435
|
let head;
|
|
1432
1436
|
let base;
|
|
1433
1437
|
try {
|
|
1434
|
-
forge =
|
|
1438
|
+
forge = forgeFromJobEnv(args.forge);
|
|
1435
1439
|
head = await resolveCommit(cwd, args.head ?? "HEAD");
|
|
1436
1440
|
base = await resolveMergeBase(cwd, args.base, head);
|
|
1437
1441
|
}
|
|
@@ -1453,8 +1457,14 @@ async function beforeMergeChecks(ctx) {
|
|
|
1453
1457
|
// plywood#66: the forge also reports the pull-request pipeline's plan job, `chant-pr.<member>.<env> / plan (<event>)`, which a denial fails too.
|
|
1454
1458
|
const planJob = [`chant-pr.${member ?? "*"}.${ctx.args.env ?? "*"} / plan*`];
|
|
1455
1459
|
const ignore = [...new Set([productContext(activeProductWords(), gate), productContext(activeProductWords(), PR_APPLY_GATE), `chant/${gate}`, `chant/${PR_APPLY_GATE}`, prStatusContext("apply", member), prStatusContext("plan"), `${prStatusContext("plan")}/`, ...planJob])];
|
|
1460
|
+
// #4966: the `checks` require waits for the ref gate's status too, when the policy at base has a rule for the target branch.
|
|
1461
|
+
const refGate = await beforeMergeRefGate(cwd, args.base, args.branch);
|
|
1462
|
+
if ("problem" in refGate)
|
|
1463
|
+
return fail(refGate.problem);
|
|
1464
|
+
if (refGate.note)
|
|
1465
|
+
console.error(formatInfo(refGate.note));
|
|
1456
1466
|
// ws-106 gives the declaration no way to leave a check out, so with no --requires all four are asked (#4336, #4607).
|
|
1457
|
-
const requires = await checkPrRequires(forge, args.pr, head, { ignore, ...(only ? { only: only.checks } : {}) });
|
|
1467
|
+
const requires = await checkPrRequires(forge, args.pr, head, { ignore, ...(only ? { only: only.checks } : {}), ...(refGate.require.length > 0 ? { require: refGate.require } : {}) });
|
|
1458
1468
|
for (const r of requires)
|
|
1459
1469
|
console.error(formatInfo(`${r.name}: ${r.passed ? "passed" : r.pending ? "pending" : "unmet"}, ${r.reason}`));
|
|
1460
1470
|
const unmet = unmetRequires(requires);
|
|
@@ -1463,6 +1473,40 @@ async function beforeMergeChecks(ctx) {
|
|
|
1463
1473
|
}
|
|
1464
1474
|
return { requires };
|
|
1465
1475
|
}
|
|
1476
|
+
/**
|
|
1477
|
+
* The branch an apply before merge lands on (#4966): `--branch`, else the
|
|
1478
|
+
* pull request's target as its job names it, else the branch the job runs
|
|
1479
|
+
* on, which for the generated apply job is the target branch (an
|
|
1480
|
+
* `issue_comment` run on GitHub and Forgejo, a target-branch pipeline on
|
|
1481
|
+
* GitLab).
|
|
1482
|
+
*/
|
|
1483
|
+
export function beforeMergeBranch(explicit, env = process.env) {
|
|
1484
|
+
for (const v of [explicit, env.GITHUB_BASE_REF, env.CI_MERGE_REQUEST_TARGET_BRANCH_NAME, env.CI_COMMIT_BRANCH, env.GITHUB_REF_NAME]) {
|
|
1485
|
+
if (v && v.trim())
|
|
1486
|
+
return v.trim();
|
|
1487
|
+
}
|
|
1488
|
+
return undefined;
|
|
1489
|
+
}
|
|
1490
|
+
/**
|
|
1491
|
+
* The statuses an apply before merge waits for beside the forge's own
|
|
1492
|
+
* (#4966): the ref gate's status for the target branch, as the policy at
|
|
1493
|
+
* `base` sets it (`refGateRulesAt`), passed as `require` to the `checks`
|
|
1494
|
+
* require, so `checks` does not pass before the `ref-gate` job posted it.
|
|
1495
|
+
* No rule for the branch requires nothing; a policy that can't be read is
|
|
1496
|
+
* a problem, and the apply stops.
|
|
1497
|
+
*/
|
|
1498
|
+
export async function beforeMergeRefGate(cwd, base, branch, env = process.env) {
|
|
1499
|
+
const target = beforeMergeBranch(branch, env);
|
|
1500
|
+
if (!target)
|
|
1501
|
+
return { require: [], note: "the job names no target branch (--branch), so the ref gate's status is not waited for" };
|
|
1502
|
+
const { refGateRulesAt } = await import("../../ref-gate-rules.js");
|
|
1503
|
+
const rules = refGateRulesAt(cwd, { ref: `refs/heads/${target}`, base });
|
|
1504
|
+
if (rules.problems.length > 0)
|
|
1505
|
+
return { problem: `the trust policy at base can't be read, so the apply before merge can't tell which ref gate status to wait for: ${rules.problems.join("; ")}. Nothing was applied.` };
|
|
1506
|
+
if (!rules.matched || !rules.status)
|
|
1507
|
+
return { require: [] };
|
|
1508
|
+
return { require: [rules.status], note: `the checks require waits for ${rules.status}, the ref gate's status for refs/heads/${target}` };
|
|
1509
|
+
}
|
|
1466
1510
|
/** The refusal report of an apply before merge stopped before it planned (#4301): nothing selected, nothing planned. */
|
|
1467
1511
|
function earlyStop(ctx, forge, at) {
|
|
1468
1512
|
return async (beforeMerge, refusal, message, code) => {
|
|
@@ -1483,7 +1527,7 @@ function earlyStop(ctx, forge, at) {
|
|
|
1483
1527
|
async function takeApplyLocks(p, pr, targets = p.plan.order) {
|
|
1484
1528
|
const { takeTargetLocks, describeHeldTargetLocks } = await import("../../lifecycle/target-lock.js");
|
|
1485
1529
|
const isOpen = p.forge?.pullRequestOpen?.bind(p.forge);
|
|
1486
|
-
const by =
|
|
1530
|
+
const by = actorFromEnv();
|
|
1487
1531
|
let result;
|
|
1488
1532
|
try {
|
|
1489
1533
|
result = await takeTargetLocks(p.gate, targets, { pr, by, at: new Date().toISOString(), stage: "apply", head: p.head }, { ...(isOpen ? { isOpen } : {}) });
|
|
@@ -2689,7 +2733,7 @@ function writeWaveChangeSet(ctx, wave, doc, upload) {
|
|
|
2689
2733
|
upload?.file(name, body);
|
|
2690
2734
|
}
|
|
2691
2735
|
/**
|
|
2692
|
-
* chant components pr-post --pr <n> --head <sha> --env <env> --forge <kind> [--member <name>] [--output <dir>] [--result <result>] (#4295)
|
|
2736
|
+
* chant components pr-post --pr <n> --head <sha> --env <env> --forge <kind> [--member <name>] [--output <dir>] [--result <result>] [--not-affected <argument>] (#4295, #4963)
|
|
2693
2737
|
* chant components pr-post --open --env <env> --forge gitlab [--branch <branch>] [--member <name>] [--output <dir>] (#4328)
|
|
2694
2738
|
*
|
|
2695
2739
|
* Post the plan note and the `chant/plan` status from the report a plan job
|
|
@@ -2717,7 +2761,7 @@ export async function runComponentsPrPost(ctx) {
|
|
|
2717
2761
|
return fail(`pr-post takes one --member, not ${args.members.join(", ")}`);
|
|
2718
2762
|
let forge;
|
|
2719
2763
|
try {
|
|
2720
|
-
forge =
|
|
2764
|
+
forge = forgeFromJobEnv(args.forge);
|
|
2721
2765
|
}
|
|
2722
2766
|
catch (err) {
|
|
2723
2767
|
return fail(err instanceof Error ? err.message : String(err));
|
|
@@ -2743,6 +2787,8 @@ export async function runComponentsPrPost(ctx) {
|
|
|
2743
2787
|
...(args.forge !== "gitlab" && process.env.GITHUB_STEP_SUMMARY ? { summaryFile: process.env.GITHUB_STEP_SUMMARY } : {}),
|
|
2744
2788
|
// #4899: the product plan job's run record, kept on chant/lifecycle with the note.
|
|
2745
2789
|
...(args.recordRun ? { recordRun: await planRunRecorder(args.forge, args.recordRun) } : {}),
|
|
2790
|
+
// #4963: a re-plan narrowed to an argument the change does not reach gets a reply in place of the note.
|
|
2791
|
+
...(args.notAffected ? { notAffected: args.notAffected } : {}),
|
|
2746
2792
|
});
|
|
2747
2793
|
for (const message of posted.warnings)
|
|
2748
2794
|
console.error(formatWarning({ message }));
|
|
@@ -2838,7 +2884,7 @@ async function runComponentsPrPostStale(ctx) {
|
|
|
2838
2884
|
return fail("pr-post --stale marks the notes of the pull requests into a branch: run it in a job of a push, or pass --branch <branch>");
|
|
2839
2885
|
let forge;
|
|
2840
2886
|
try {
|
|
2841
|
-
forge =
|
|
2887
|
+
forge = forgeFromJobEnv(args.forge);
|
|
2842
2888
|
}
|
|
2843
2889
|
catch (err) {
|
|
2844
2890
|
return fail(err instanceof Error ? err.message : String(err));
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"promote.d.ts","sourceRoot":"","sources":["../../../src/cli/handlers/promote.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;GAqBG;AAkDH,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,aAAa,CAAC;
|
|
1
|
+
{"version":3,"file":"promote.d.ts","sourceRoot":"","sources":["../../../src/cli/handlers/promote.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;GAqBG;AAkDH,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,aAAa,CAAC;AA24BlD,wBAAsB,oBAAoB,CAAC,GAAG,EAAE,cAAc,GAAG,OAAO,CAAC,MAAM,CAAC,CAmF/E;AAED,wBAAsB,qBAAqB,CAAC,GAAG,EAAE,cAAc,GAAG,OAAO,CAAC,MAAM,CAAC,CAiDhF;AAsCD,wBAAsB,qBAAqB,CAAC,GAAG,EAAE,cAAc,GAAG,OAAO,CAAC,MAAM,CAAC,CA6BhF"}
|
|
@@ -45,6 +45,7 @@ import { formatError, formatWarning, formatSuccess, formatBold, formatInfo } fro
|
|
|
45
45
|
import { GATED_EXIT_CODE } from "./run.js";
|
|
46
46
|
import { withComponentEndpoint } from "../component-endpoint.js";
|
|
47
47
|
import { redeployLine, releaseRollbackLine, rollbackTarget, unsettledComponents } from "../../lifecycle/mixed-environment.js";
|
|
48
|
+
import { actorFromEnv } from "../../actor.js";
|
|
48
49
|
const PROMOTE_USAGE = "chant components promote --to <env> [--from <env>] [--allow-skip] [--release <label|digest>] [--component <name> [--digest <sha256:...>] | --digest <component>=<sha256:...> ...] [--wave-gate <gate>] [--resume <file>] [--dry-run] [--json]";
|
|
49
50
|
const ROLLBACK_USAGE = "chant components rollback <env> (--component <name> [--digest <sha256:...>] | --release <label|digest>) [--dry-run] [--json]";
|
|
50
51
|
const REDEPLOY_USAGE = "chant components redeploy <env> --component <name> [--digest <sha256:...>] [--dry-run] [--json]";
|
|
@@ -75,7 +76,7 @@ function planJson(plan, removed) {
|
|
|
75
76
|
};
|
|
76
77
|
}
|
|
77
78
|
function resolveActor(ctx) {
|
|
78
|
-
return ctx.args.actor ?? process.env
|
|
79
|
+
return ctx.args.actor ?? (actorFromEnv(process.env, "") || undefined);
|
|
79
80
|
}
|
|
80
81
|
/**
|
|
81
82
|
* Config, params and the declared components, or the exit code of a refusal
|