@intentius/chant 0.124.90 → 0.124.92
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 +5 -3
- package/dist/actor.d.ts.map +1 -1
- package/dist/actor.js +7 -5
- package/dist/audit/core.d.ts.map +1 -1
- package/dist/audit/core.js +11 -1
- package/dist/ci-comment-commands.d.ts +11 -1
- package/dist/ci-comment-commands.d.ts.map +1 -1
- package/dist/ci-comment-commands.js +10 -3
- package/dist/ci-product.d.ts +27 -1
- package/dist/ci-product.d.ts.map +1 -1
- package/dist/ci-product.js +36 -10
- package/dist/cli/handlers/pr-comment.d.ts.map +1 -1
- package/dist/cli/handlers/pr-comment.js +17 -4
- package/dist/cli/handlers/pr.d.ts +2 -2
- package/dist/cli/handlers/pr.d.ts.map +1 -1
- package/dist/cli/handlers/pr.js +32 -10
- package/dist/cli/parse-args.d.ts.map +1 -1
- package/dist/cli/parse-args.js +13 -0
- package/dist/cli/registry.d.ts +4 -0
- package/dist/cli/registry.d.ts.map +1 -1
- package/dist/components/pr-checks.d.ts +11 -0
- package/dist/components/pr-checks.d.ts.map +1 -1
- package/dist/components/pr-checks.js +15 -5
- package/dist/components/pr-pipeline.d.ts +13 -4
- package/dist/components/pr-pipeline.d.ts.map +1 -1
- package/dist/components/pr-pipeline.js +23 -9
- package/dist/components/product-pipeline.d.ts +41 -7
- package/dist/components/product-pipeline.d.ts.map +1 -1
- package/dist/components/product-pipeline.js +63 -23
- package/dist/components/product-plan.d.ts +86 -1
- package/dist/components/product-plan.d.ts.map +1 -1
- package/dist/components/product-plan.js +141 -16
- package/dist/floor-table.data.d.ts.map +1 -1
- package/dist/floor-table.data.js +18 -9
- package/dist/lexicon-module.d.ts +2 -0
- package/dist/lexicon-module.d.ts.map +1 -1
- package/dist/lexicon-module.js +6 -2
- package/dist/lexicon.d.ts +42 -1
- package/dist/lexicon.d.ts.map +1 -1
- package/dist/op/before-merge-decide.d.ts +2 -0
- package/dist/op/before-merge-decide.d.ts.map +1 -1
- package/dist/op/op-waves-evidence-jobs.d.ts +3 -2
- package/dist/op/op-waves-evidence-jobs.d.ts.map +1 -1
- package/dist/op/op-waves-evidence-jobs.js +4 -3
- package/dist/op/op-waves-follow-on.d.ts +2 -0
- package/dist/op/op-waves-follow-on.d.ts.map +1 -1
- package/dist/op/op-waves-follow-on.js +8 -2
- package/dist/op/op-waves-names.d.ts +122 -0
- package/dist/op/op-waves-names.d.ts.map +1 -0
- package/dist/op/op-waves-names.js +151 -0
- package/dist/planned-files.d.ts +16 -8
- package/dist/planned-files.d.ts.map +1 -1
- package/dist/planned-files.js +12 -8
- package/dist/pr-forge-job.d.ts +8 -0
- package/dist/pr-forge-job.d.ts.map +1 -1
- package/dist/pr-forge-job.js +13 -0
- package/dist/pr-plan-record.d.ts +3 -1
- package/dist/pr-plan-record.d.ts.map +1 -1
- package/dist/pr-plan-record.js +1 -1
- package/dist/pr-post.d.ts +15 -3
- package/dist/pr-post.d.ts.map +1 -1
- package/dist/pr-post.js +10 -6
- package/dist/release-floors.d.ts +7 -1
- package/dist/release-floors.d.ts.map +1 -1
- package/dist/release-floors.js +8 -2
- package/dist/wave-runtime.mjs +276 -276
- package/package.json +1 -1
- package/src/actor.test.ts +14 -1
- package/src/actor.ts +8 -6
- package/src/audit/core.ts +13 -1
- package/src/audit/first-load.test.ts +101 -0
- package/src/ci-comment-commands.test.ts +19 -5
- package/src/ci-comment-commands.ts +18 -3
- package/src/ci-product.ts +42 -10
- package/src/cli/handlers/pr-comment.ts +14 -4
- package/src/cli/handlers/pr.ts +27 -10
- package/src/cli/parse-args.ts +9 -0
- package/src/cli/registry.ts +4 -0
- package/src/components/pr-checks.ts +16 -5
- package/src/components/pr-pipeline.ts +24 -11
- package/src/components/product-job-names.test.ts +176 -0
- package/src/components/product-pipeline.ts +101 -31
- package/src/components/product-plan-names.test.ts +135 -0
- package/src/components/product-plan.ts +218 -18
- package/src/floor-table.data.ts +18 -9
- package/src/lexicon-module.ts +6 -2
- package/src/lexicon.ts +42 -1
- package/src/op/before-merge-decide.ts +2 -0
- package/src/op/op-waves-evidence-jobs.ts +4 -3
- package/src/op/op-waves-follow-on.ts +10 -2
- package/src/op/op-waves-names.test.ts +131 -0
- package/src/op/op-waves-names.ts +241 -0
- package/src/planned-files.test.ts +33 -0
- package/src/planned-files.ts +26 -10
- package/src/pr-forge-job.ts +13 -0
- package/src/pr-plan-record.ts +4 -2
- package/src/pr-post-head.test.ts +116 -0
- package/src/pr-post.ts +26 -9
- package/src/release-floors.ts +11 -2
|
@@ -0,0 +1,135 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* #5003: the product plan keeps a product's names. A plan's own status
|
|
3
|
+
* context reaches every job that reads the plan status (the note job's
|
|
4
|
+
* `pr-post --context`, the stale job, the apply before merge), and `pr-post`
|
|
5
|
+
* posts and marks under it; on GitLab `pr-post --open --plan-job` finds a
|
|
6
|
+
* plan job of the product's name. The forge renders are in each lexicon's
|
|
7
|
+
* `product-plan-pipeline.names.test.ts`.
|
|
8
|
+
*/
|
|
9
|
+
import { mkdtempSync, readFileSync, rmSync, writeFileSync } from "node:fs";
|
|
10
|
+
import { tmpdir } from "node:os";
|
|
11
|
+
import { join } from "node:path";
|
|
12
|
+
import { afterAll, describe, expect, test } from "vitest";
|
|
13
|
+
import type { OpWavesSpec } from "../op/op-waves";
|
|
14
|
+
import { parseArgs } from "../cli/parse-args";
|
|
15
|
+
import { markStaleNotes, postOpenPlanReports, postPlanReport, prNoteTipMarker } from "../pr-post";
|
|
16
|
+
import { prNoteMarker } from "../pr-loop";
|
|
17
|
+
import { planNoteHandoff, PR_PLAN_NOTE_FILE, type PrPlanNote } from "../pr-plan-note";
|
|
18
|
+
import { withProductWords } from "../ci-product-words";
|
|
19
|
+
import type { ForgeStatus, OpenPullRequest, PrForge } from "../pr-forge";
|
|
20
|
+
import { TERRAGUCCI, TERRAGUCCI_NOTE } from "../__fixtures__/product-words";
|
|
21
|
+
import { productPipelineJobs } from "./product-pipeline";
|
|
22
|
+
import { productPlanJobs, productPlanWorkflowFile } from "./product-plan";
|
|
23
|
+
|
|
24
|
+
const NOTE = JSON.parse(readFileSync(join(import.meta.dirname, "..", "__fixtures__", "pr-loop", "terragucci-plan.note.json"), "utf-8")) as PrPlanNote;
|
|
25
|
+
const HEAD = NOTE.head;
|
|
26
|
+
const dirs: string[] = [];
|
|
27
|
+
afterAll(() => {
|
|
28
|
+
for (const d of dirs) rmSync(d, { recursive: true, force: true });
|
|
29
|
+
});
|
|
30
|
+
|
|
31
|
+
function fakeForge(open: OpenPullRequest[] = []): { forge: PrForge; statuses: Array<{ sha: string; status: ForgeStatus }>; notes: Map<string, string> } {
|
|
32
|
+
const statuses: Array<{ sha: string; status: ForgeStatus }> = [];
|
|
33
|
+
const notes = new Map<string, string>();
|
|
34
|
+
const forge = {
|
|
35
|
+
kind: "github",
|
|
36
|
+
host: "github.com",
|
|
37
|
+
async setStatus(sha: string, status: ForgeStatus) {
|
|
38
|
+
statuses.push({ sha, status });
|
|
39
|
+
},
|
|
40
|
+
async upsertNote(pr: number, marker: string, body: string) {
|
|
41
|
+
notes.set(`${pr} ${marker}`, body);
|
|
42
|
+
return "1";
|
|
43
|
+
},
|
|
44
|
+
async findComment(pr: number, marker: string) {
|
|
45
|
+
const body = notes.get(`${pr} ${marker}`);
|
|
46
|
+
return body === undefined ? undefined : { id: 1, body };
|
|
47
|
+
},
|
|
48
|
+
async openPullRequests(base: string) {
|
|
49
|
+
return open.filter((p) => p.base === base);
|
|
50
|
+
},
|
|
51
|
+
} as unknown as PrForge;
|
|
52
|
+
return { forge, statuses, notes };
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
const at = { pr: 7, env: "default", state: "success" as const, description: "2 roots planned" };
|
|
56
|
+
|
|
57
|
+
describe("pr-post under a product plan's own status context (#5003)", () => {
|
|
58
|
+
test("the note job posts the status under the context it is given", async () => {
|
|
59
|
+
const { forge, statuses } = fakeForge();
|
|
60
|
+
const dir = mkdtempSync(join(tmpdir(), "chant-pr-post-names-"));
|
|
61
|
+
dirs.push(dir);
|
|
62
|
+
writeFileSync(join(dir, PR_PLAN_NOTE_FILE), JSON.stringify(planNoteHandoff(NOTE, at)));
|
|
63
|
+
await withProductWords(TERRAGUCCI, () => postPlanReport({ forge, dir, pr: 7, head: HEAD, env: "default", result: "success", noteWords: TERRAGUCCI_NOTE, context: "tg/plan-roots" }));
|
|
64
|
+
expect(statuses.map((s) => s.status.context)).toEqual(["tg/plan-roots"]);
|
|
65
|
+
});
|
|
66
|
+
|
|
67
|
+
test("pr-post --open asks for the plan job it is named and posts under the context", async () => {
|
|
68
|
+
const { forge: base, statuses } = fakeForge();
|
|
69
|
+
const asked: string[] = [];
|
|
70
|
+
const forge = {
|
|
71
|
+
...base,
|
|
72
|
+
kind: "gitlab",
|
|
73
|
+
async mergeRequestJobs(_branch: string, job: string) {
|
|
74
|
+
asked.push(job);
|
|
75
|
+
return [{ pr: 7, head: HEAD, id: 11, status: "success", url: "https://gitlab.example/job/11" }];
|
|
76
|
+
},
|
|
77
|
+
async jobArtifact(_id: number, path: string) {
|
|
78
|
+
return path === "terragucci-report/pr-plan-note.json" ? JSON.stringify(planNoteHandoff(NOTE, at)) : undefined;
|
|
79
|
+
},
|
|
80
|
+
async statusUrl() {
|
|
81
|
+
return undefined;
|
|
82
|
+
},
|
|
83
|
+
setStatus: base.setStatus,
|
|
84
|
+
upsertNote: base.upsertNote,
|
|
85
|
+
findComment: base.findComment,
|
|
86
|
+
} as unknown as PrForge;
|
|
87
|
+
const done = await withProductWords(TERRAGUCCI, () => postOpenPlanReports({ forge, branch: "main", job: "tf-plan", artifactDir: "terragucci-report", env: "default", context: "tg/plan-roots" }));
|
|
88
|
+
expect(asked).toEqual(["tf-plan"]);
|
|
89
|
+
expect(done.posts[0]!.posted).toMatchObject({ noted: true });
|
|
90
|
+
expect(statuses.map((s) => s.status.context)).toEqual(["tg/plan-roots"]);
|
|
91
|
+
});
|
|
92
|
+
|
|
93
|
+
test("the stale job sets the named status back to pending", async () => {
|
|
94
|
+
const head = "d".repeat(40);
|
|
95
|
+
const { forge, statuses, notes } = fakeForge([{ number: 7, head: "feature", headSha: head, base: "main", fork: false }]);
|
|
96
|
+
notes.set(`7 ${prNoteMarker("default")}`, [prNoteMarker("default"), "body", prNoteTipMarker("a".repeat(40)), ""].join("\n"));
|
|
97
|
+
await withProductWords(TERRAGUCCI, () => markStaleNotes({ forge, branch: "main", tip: "b".repeat(40), env: "default", context: "tg/plan-roots" }));
|
|
98
|
+
expect(statuses).toEqual([{ sha: head, status: expect.objectContaining({ context: "tg/plan-roots", state: "pending" }) }]);
|
|
99
|
+
});
|
|
100
|
+
|
|
101
|
+
test("the command line takes --context (once a --member with --stale) and --plan-job", () => {
|
|
102
|
+
expect(parseArgs(["components", "pr-post", "--stale", "--member", "dev", "--context", "tg/dev/plan", "--member", "prod", "--context", "tg/prod/plan"]).statusContexts).toEqual(["tg/dev/plan", "tg/prod/plan"]);
|
|
103
|
+
expect(parseArgs(["components", "pr-post", "--open", "--plan-job", "tf-plan"]).planJob).toBe("tf-plan");
|
|
104
|
+
expect(() => parseArgs(["components", "pr-post", "--context", "tg plan"])).toThrow(/--context needs the plan status's context/);
|
|
105
|
+
expect(() => parseArgs(["components", "pr-post", "--plan-job", "--open"])).toThrow(/--plan-job needs the plan job's name/);
|
|
106
|
+
});
|
|
107
|
+
});
|
|
108
|
+
|
|
109
|
+
const words = { product: "terragucci", noun: ["root", "roots"] as [string, string], commands: { plan: "plan" as const, apply: "apply" as const }, approval: "per-wave" as const, op: "tf-apply", bin: "npx --no-install terragucci" };
|
|
110
|
+
const waves: OpWavesSpec = { name: "tf-apply", op: "tf-apply", step: { kind: "terraform-apply", root: "{target}" }, waves: [{ name: "dev", runs: [{ target: "envs/dev" }] }] } as OpWavesSpec;
|
|
111
|
+
|
|
112
|
+
describe("the product plan's status context in the pipeline (#5003)", () => {
|
|
113
|
+
const productPlan = { command: "terragucci plan {target} --out {output}", targets: [{ name: "dev" }, { name: "prod" }], statusContext: "tg/{target}/plan" };
|
|
114
|
+
|
|
115
|
+
test.each(["github", "forgejo", "gitlab"] as const)("on %s, the stale job sets each target's own status back", (forge) => {
|
|
116
|
+
const jobs = productPipelineJobs(forge, "default", { words, waves, productPlan, staleNotes: true });
|
|
117
|
+
expect(jobs.waves!.pipeline.staleNotes!.command).toBe(`npx --no-install terragucci components pr-post --stale --tip "$TIP_SHA" --env default --forge ${forge} --member dev --member prod --context tg/dev/plan --context tg/prod/plan`);
|
|
118
|
+
});
|
|
119
|
+
|
|
120
|
+
test("the apply before merge asks for the product's plan statuses", () => {
|
|
121
|
+
const jobs = productPipelineJobs("github", "default", { words, waves, productPlan, commentJob: true, wavesBeforeMerge: {} });
|
|
122
|
+
expect(jobs.comment!.jobs.wavesBeforeMerge!.plan).toEqual(["tg/dev/plan", "tg/prod/plan"]);
|
|
123
|
+
const gitlab = productPipelineJobs("gitlab", "default", { words, waves, productPlan: { ...productPlan, replan: true }, noteCommands: true, wavesBeforeMerge: {} });
|
|
124
|
+
expect(JSON.stringify(gitlab.noteCommands!.env)).toContain('\\"plan\\":[\\"tg/dev/plan\\",\\"tg/prod/plan\\"]');
|
|
125
|
+
});
|
|
126
|
+
|
|
127
|
+
test("without the options the jobs carry no names of their own", () => {
|
|
128
|
+
const [p] = productPlanJobs("github", "default", { plan: { command: "terragucci plan --out {output}" } }, { ...words, aliases: [] } as never);
|
|
129
|
+
expect(p!.context).toBeUndefined();
|
|
130
|
+
expect(p!.reportDir).toBeUndefined();
|
|
131
|
+
expect(productPlanWorkflowFile("gitlab", "default", { workflow: "terragucci" })).toBe(".gitlab/terragucci.gitlab-ci.yml");
|
|
132
|
+
expect(productPlanWorkflowFile("gitlab", "default", { workflowFile: ".gitlab/terragucci.yml" })).toBe(".gitlab/terragucci.yml");
|
|
133
|
+
expect(() => productPlanWorkflowFile("gitlab", "default", { workflowFile: "../ci.yml" })).toThrow(/inside it/);
|
|
134
|
+
});
|
|
135
|
+
});
|
|
@@ -51,6 +51,7 @@ import { PLAN_RUN_OP, PLAN_RUN_RECORD_FILE } from "../pr-plan-record";
|
|
|
51
51
|
import { idTokenVar, tradedClouds, type CloudTradeSpec } from "../ci-identity";
|
|
52
52
|
import { prNoteMarker } from "../pr-loop";
|
|
53
53
|
import { PRODUCT_MARKER_NAME } from "../pr-plan-note";
|
|
54
|
+
import { gitlabJobArtifacts, type PrCheckArtifacts } from "./pr-checks";
|
|
54
55
|
|
|
55
56
|
/** The variable the plan-note job reads the product's note words from (#4799), as JSON. Set from the pipeline, never from the report. */
|
|
56
57
|
export const PR_PLAN_NOTE_WORDS_ENV = "CHANT_PLAN_NOTE_WORDS";
|
|
@@ -371,6 +372,60 @@ export interface ProductPlanOptions {
|
|
|
371
372
|
* answer `/<product> lock` and `/<product> unlock` there too.
|
|
372
373
|
*/
|
|
373
374
|
reach?: { command: string; gate?: string };
|
|
375
|
+
/**
|
|
376
|
+
* The file the product writes the workflow to (#5003), from the
|
|
377
|
+
* repository root: on GitHub a file directly under `.github/workflows/`,
|
|
378
|
+
* on Forgejo under `.forgejo/workflows/`, on GitLab a `.yml` file, such
|
|
379
|
+
* as one the project's `.gitlab-ci.yml` includes. The generators return it as
|
|
380
|
+
* `path`. Default `<forge's workflow directory>/<workflow>.yml`, and on
|
|
381
|
+
* GitLab `.gitlab/<workflow>.gitlab-ci.yml`, with `workflow` the
|
|
382
|
+
* workflow's name.
|
|
383
|
+
*/
|
|
384
|
+
workflowFile?: string;
|
|
385
|
+
/**
|
|
386
|
+
* The plan jobs' names (#5003), so a product's required checks keep
|
|
387
|
+
* matching: `plan`, the plan job; `note`, its note job; `replan` and
|
|
388
|
+
* `replanNote`, the comment re-plan's. With `targets` each name holds
|
|
389
|
+
* `{target}`, filled with the target's name. Left out, a name is chant's:
|
|
390
|
+
* `plan`, `plan-note`, `replan`, `replan-note`, with targets
|
|
391
|
+
* `plan-{target}`, `plan-note-{target}`, `replan-{target}` and
|
|
392
|
+
* `replan-note-{target}` on GitHub and Forgejo and `{target}-plan`,
|
|
393
|
+
* `{target}-plan-note`, `{target}-replan` and `{target}-replan-note` on
|
|
394
|
+
* GitLab. A name is letters, digits, `_` and `-`, starting with a letter
|
|
395
|
+
* or `_` (on GitLab a digit too, and no top-level keyword such as
|
|
396
|
+
* `stages`), and no two jobs share one.
|
|
397
|
+
*/
|
|
398
|
+
jobNames?: { plan?: string; note?: string; replan?: string; replanNote?: string };
|
|
399
|
+
/**
|
|
400
|
+
* The plan status's context (#5003), which the note job posts
|
|
401
|
+
* (`pr-post --context`), the pending step says is pending, the stale job
|
|
402
|
+
* sets back to pending, and the apply before merge asks has passed. With
|
|
403
|
+
* `targets` it holds `{target}`. Default the words' `<product>/<plan
|
|
404
|
+
* stage>`, with targets `<product>/<plan stage>/<target>`. Letters,
|
|
405
|
+
* digits and `_./:-`.
|
|
406
|
+
*/
|
|
407
|
+
statusContext?: string;
|
|
408
|
+
/**
|
|
409
|
+
* The directory the plan verb writes into and the jobs hand on, keep as
|
|
410
|
+
* the artifact's path and post from (#5003): `{output}` in `command`
|
|
411
|
+
* and `report`, and `pr-post --output`. A path from the checkout's root
|
|
412
|
+
* that stays inside it, such as terragucci's `terragucci-report`.
|
|
413
|
+
* Default {@link PR_LOOP_REPORT_DIR}.
|
|
414
|
+
*/
|
|
415
|
+
reportDir?: string;
|
|
416
|
+
/**
|
|
417
|
+
* GitLab only (#5004): what each plan job keeps beside the report
|
|
418
|
+
* directory, as the check job's `artifacts` (#4988, {@link PrCheckArtifacts}):
|
|
419
|
+
* `paths` after it in `artifacts:paths`, and `reports` as
|
|
420
|
+
* `artifacts:reports`, such as terragucci's `{ terraform:
|
|
421
|
+
* "{output}/gitlab-terraform.json" }` for the merge request's widget.
|
|
422
|
+
* `{target}` and `{output}` are filled as in `command`. Kept when the plan
|
|
423
|
+
* fails too, as the report is. The re-plan jobs keep only the report
|
|
424
|
+
* directory: they run in a pipeline of the target branch, whose reports
|
|
425
|
+
* GitLab would read as the target branch's own. GitHub and Forgejo refuse
|
|
426
|
+
* it, since the plan verb is the job's last step there.
|
|
427
|
+
*/
|
|
428
|
+
artifacts?: PrCheckArtifacts;
|
|
374
429
|
}
|
|
375
430
|
|
|
376
431
|
/** The lock job a product plan with {@link ProductPlanOptions.reach} writes (#4979): its command and the values the command reads. */
|
|
@@ -457,6 +512,13 @@ export interface ProductPlanJob {
|
|
|
457
512
|
login?: OpWaveRunStep[];
|
|
458
513
|
/** The OIDC tokens the plan job requests (#4931), `{ <variable>: <audience> }`: the login's and the product's own. */
|
|
459
514
|
idTokens?: Record<string, string>;
|
|
515
|
+
/**
|
|
516
|
+
* With the product's own `idTokens` (#5021): the plan verb asks the forge
|
|
517
|
+
* for them by audience, so on GitHub and Forgejo the plan step keeps the
|
|
518
|
+
* variables a token is requested with. Without it, every step after the
|
|
519
|
+
* checkout but the login's starts without them.
|
|
520
|
+
*/
|
|
521
|
+
ownIdTokens?: true;
|
|
460
522
|
/** The pending status posted before the checkout (#4899), on GitHub and Forgejo. */
|
|
461
523
|
pending?: { context: string; description: string };
|
|
462
524
|
/** The control repo read after the checkout (#4899). */
|
|
@@ -475,6 +537,46 @@ export interface ProductPlanJob {
|
|
|
475
537
|
previous?: { marker: string; name: string };
|
|
476
538
|
/** With `record` (#4899): the plan step writes the run record, `env` its op, environment and labels as {@link PLAN_RUN_RECORD_ENV}; the note job's command records it. */
|
|
477
539
|
record?: { env: Record<string, string> };
|
|
540
|
+
/** With `statusContext` (#5003): the plan status's context, filled for the target. Absent: the words' {@link productStatusContext}. */
|
|
541
|
+
context?: string;
|
|
542
|
+
/** With `reportDir` (#5003): the directory the plan verb writes into and the jobs hand on. Absent: {@link PR_LOOP_REPORT_DIR}. */
|
|
543
|
+
reportDir?: string;
|
|
544
|
+
/** With `artifacts` (#5004), GitLab: the plan job's own paths and reports beside the report directory, `{target}` and `{output}` filled. */
|
|
545
|
+
artifacts?: PrCheckArtifacts;
|
|
546
|
+
}
|
|
547
|
+
|
|
548
|
+
/** The plan status's context of one plan job (#5003): its own, else the words'. */
|
|
549
|
+
export function productPlanContext(p: Pick<ProductPlanJob, "context" | "target">, words: CiProductWords): string {
|
|
550
|
+
return p.context ?? productStatusContext(words, "plan", p.target);
|
|
551
|
+
}
|
|
552
|
+
|
|
553
|
+
/** The directory one plan job hands on (#5003): its own, else {@link PR_LOOP_REPORT_DIR}. */
|
|
554
|
+
export function productPlanReportDir(p: Pick<ProductPlanJob, "reportDir">): string {
|
|
555
|
+
return p.reportDir ?? PR_LOOP_REPORT_DIR;
|
|
556
|
+
}
|
|
557
|
+
|
|
558
|
+
/** The workflow's default name (#4799): `chant-pr-<env>`. */
|
|
559
|
+
function defaultWorkflowName(env: string): string {
|
|
560
|
+
return `chant-pr-${env}`;
|
|
561
|
+
}
|
|
562
|
+
|
|
563
|
+
/**
|
|
564
|
+
* The file a product plan's workflow is written to (#5003),
|
|
565
|
+
* {@link ProductPlanOptions.workflowFile}: the product's, checked for the
|
|
566
|
+
* forge, else the workflow's name in the forge's workflow directory
|
|
567
|
+
* (`.gitlab/<name>.gitlab-ci.yml` on GitLab).
|
|
568
|
+
*/
|
|
569
|
+
export function productPlanWorkflowFile(forge: ForgeKind, env: string, plan: Pick<ProductPlanOptions, "workflow" | "workflowFile">): string {
|
|
570
|
+
const name = plan.workflow ?? defaultWorkflowName(env);
|
|
571
|
+
const dir = forge === "github" ? ".github/workflows" : forge === "forgejo" ? ".forgejo/workflows" : ".gitlab";
|
|
572
|
+
const file = plan.workflowFile;
|
|
573
|
+
if (file === undefined) return forge === "gitlab" ? `${dir}/${name}.gitlab-ci.yml` : `${dir}/${name}.yml`;
|
|
574
|
+
if (!/\.ya?ml$/.test(file)) throw new Error(`the product plan's workflowFile ${JSON.stringify(file)} is not a .yml or .yaml file`);
|
|
575
|
+
if (file.startsWith("/") || file.split("/").some((part) => part === "" || part === "." || part === "..") || !/^[A-Za-z0-9_.\/-]+$/.test(file)) {
|
|
576
|
+
throw new Error(`the product plan's workflowFile ${JSON.stringify(file)} is not a path from the repository root of letters, digits and _.-, inside it`);
|
|
577
|
+
}
|
|
578
|
+
if (forge !== "gitlab" && (!file.startsWith(`${dir}/`) || file.slice(dir.length + 1).includes("/"))) throw new Error(`the product plan's workflowFile ${JSON.stringify(file)} is not directly under ${dir}/, where ${forge === "github" ? "GitHub" : "Forgejo"} reads workflows`);
|
|
579
|
+
return file;
|
|
478
580
|
}
|
|
479
581
|
|
|
480
582
|
const TARGET_NAME = /^[A-Za-z0-9][A-Za-z0-9_-]*$/;
|
|
@@ -526,6 +628,17 @@ export function productPlanJobs(forge: ForgeKind, env: string, loop: PrLoopPipel
|
|
|
526
628
|
seen.add(t.name);
|
|
527
629
|
}
|
|
528
630
|
const github = forge !== "gitlab";
|
|
631
|
+
// #5003: the product's own names, checked before any job is written.
|
|
632
|
+
if (plan.workflowFile !== undefined) productPlanWorkflowFile(forge, env, plan);
|
|
633
|
+
const reportDir = plan.reportDir;
|
|
634
|
+
if (reportDir !== undefined && !isReportDir(reportDir)) throw new Error(`the product plan's reportDir ${JSON.stringify(reportDir)} is not a directory from the checkout's root that stays inside it: letters, digits and _.-, parts joined by /, with no . or .. part and no / at either end`);
|
|
635
|
+
const outputDir = reportDir ?? PR_LOOP_REPORT_DIR;
|
|
636
|
+
const statusContext = plan.statusContext;
|
|
637
|
+
if (statusContext !== undefined) {
|
|
638
|
+
if (!/^[A-Za-z0-9][A-Za-z0-9_.\/:{}-]*$/.test(statusContext) || /[{}]/.test(statusContext.replaceAll("{target}", ""))) throw new Error(`the product plan's statusContext ${JSON.stringify(statusContext)} is not a status context of letters, digits and _./:-${targets ? ", with {target}" : ""}`);
|
|
639
|
+
if (Boolean(targets) !== statusContext.includes("{target}")) throw new Error(targets ? `the product plan's statusContext ${JSON.stringify(statusContext)} is every target's, so it holds {target}` : `the product plan's statusContext ${JSON.stringify(statusContext)} holds {target}, and the plan has no targets`);
|
|
640
|
+
}
|
|
641
|
+
const namesOf = productPlanJobNames(forge, plan, targets?.map((t) => t.name));
|
|
529
642
|
const shared = prLoopPassedEnv(forge, loop);
|
|
530
643
|
const jobEnv = plan.env ? prLoopPassedEnv(forge, { variables: plan.env }) : {};
|
|
531
644
|
for (const key of Object.keys(jobEnv)) {
|
|
@@ -571,19 +684,24 @@ export function productPlanJobs(forge: ForgeKind, env: string, loop: PrLoopPipel
|
|
|
571
684
|
...(plan.noteWords ? { [PR_PLAN_NOTE_WORDS_ENV]: JSON.stringify(plan.noteWords) } : {}),
|
|
572
685
|
...(plan.watches?.length ? { [PLAN_WATCHES_ENV]: JSON.stringify(plan.watches) } : {}),
|
|
573
686
|
};
|
|
574
|
-
const fill = (line: string, name: string | undefined): string => line.replaceAll("{target}", name ?? env).replaceAll("{output}",
|
|
687
|
+
const fill = (line: string, name: string | undefined): string => line.replaceAll("{target}", name ?? env).replaceAll("{output}", outputDir);
|
|
575
688
|
const control = plan.controlRead ? controlNoteCheckout(forge, plan.controlRead, words) : undefined;
|
|
576
689
|
const one = (target?: ProductPlanTarget): ProductPlanJob => {
|
|
577
690
|
const name = target?.name;
|
|
578
|
-
const
|
|
579
|
-
const
|
|
691
|
+
const names = namesOf(name);
|
|
692
|
+
const jobName = names.plan;
|
|
693
|
+
const noteJobName = names.note;
|
|
694
|
+
// #5003: the product's status context, and on GitLab its plan job's name for `pr-post --open` to find.
|
|
695
|
+
const context = statusContext?.replaceAll("{target}", name ?? "");
|
|
696
|
+
const named = [...(context !== undefined ? ["--context", context] : []), ...(!github && jobName !== gitlabPlanJobName(name) ? ["--plan-job", jobName] : [])];
|
|
697
|
+
const withNames = <T extends { command: string }>(p: T): T => (named.length > 0 ? { ...p, command: `${p.command} ${named.join(" ")}` } : p);
|
|
580
698
|
const own = target ? prLoopPassedEnv(forge, { ...(target.variables ? { variables: target.variables } : {}), ...(target.secrets ? { secrets: target.secrets } : {}) }) : {};
|
|
581
699
|
for (const key of Object.keys(own)) {
|
|
582
700
|
if (key in shared) throw new Error(`target ${name}'s ${key} is the pipeline's too; give it on the target or on the pipeline`);
|
|
583
701
|
if (key in jobEnv) throw new Error(`target ${name}'s ${key} is the product plan's env too; give it once`);
|
|
584
702
|
}
|
|
585
703
|
// #4987: with staleNotes each target's note carries the target branch's commit, so the waves' push can mark it stale.
|
|
586
|
-
const post0 = prLoopPostJob(forge, env, name, words, loop.staleNotes ? { staleNotes: true } : {});
|
|
704
|
+
const post0 = withNames(prLoopPostJob(forge, env, name, words, { ...(loop.staleNotes ? { staleNotes: true } : {}), ...(reportDir !== undefined ? { output: reportDir } : {}) }));
|
|
587
705
|
// #4899: the note job records the plan job's run, named by that job.
|
|
588
706
|
const post1 = plan.record ? { ...post0, command: `${post0.command} --record-run ${jobName}` } : post0;
|
|
589
707
|
// #4914: on GitLab the signing job of the same pipeline keeps each merge request's evidence, which the note's checks line reads.
|
|
@@ -608,11 +726,30 @@ export function productPlanJobs(forge: ForgeKind, env: string, loop: PrLoopPipel
|
|
|
608
726
|
}
|
|
609
727
|
const idTokens = { ...(login?.idTokens ?? {}), ...tradeTokens, ...(ownTokens ?? {}) };
|
|
610
728
|
const artifact = plan.artifact ? (name ? `${plan.artifact}-${name}` : plan.artifact) : name ? `chant-pr-plan-${name}` : "chant-pr-plan";
|
|
729
|
+
// #5004: on GitLab the plan job's own paths and reports beside the report directory, such as terragucci's terraform report.
|
|
730
|
+
const given = plan.artifacts;
|
|
731
|
+
const artifacts = given
|
|
732
|
+
? gitlabJobArtifacts(
|
|
733
|
+
forge,
|
|
734
|
+
{
|
|
735
|
+
...(given.paths ? { paths: given.paths.map((p) => fill(p, name)) } : {}),
|
|
736
|
+
...(given.reports ? { reports: Object.fromEntries(Object.entries(given.reports).map(([type, p]) => [type, Array.isArray(p) ? p.map((q) => fill(q, name)) : fill(p, name)])) } : {}),
|
|
737
|
+
},
|
|
738
|
+
{ job: "the product plan", last: "the plan verb is the plan job's last step" },
|
|
739
|
+
)
|
|
740
|
+
: undefined;
|
|
611
741
|
// #4963: on GitHub and Forgejo the first re-plan job replies to the comments no other job takes.
|
|
612
742
|
const replies = github && Boolean(replanOpts.reply) && (targets === undefined || target === targets[0]);
|
|
613
743
|
const replan0 = replanComments
|
|
614
744
|
? {
|
|
615
|
-
...replanJobOf(forge, env, words, name, artifact, noteWords, {
|
|
745
|
+
...replanJobOf(forge, env, words, name, artifact, noteWords, {
|
|
746
|
+
notAffected: replanOpts.notAffected === true,
|
|
747
|
+
...(loop.staleNotes ? { staleNotes: true } : {}),
|
|
748
|
+
jobName: names.replan,
|
|
749
|
+
noteJobName: names.replanNote,
|
|
750
|
+
...(reportDir !== undefined ? { output: reportDir } : {}),
|
|
751
|
+
...(context !== undefined ? { context } : {}),
|
|
752
|
+
}),
|
|
616
753
|
...replanComments,
|
|
617
754
|
...(github && dispatchArg !== undefined ? { dispatch: { argument: dispatchArg } } : {}),
|
|
618
755
|
...(replies ? { reply: { prefix: `/${words.product}`, others } } : {}),
|
|
@@ -635,11 +772,12 @@ export function productPlanJobs(forge: ForgeKind, env: string, loop: PrLoopPipel
|
|
|
635
772
|
...(planRunner !== undefined ? { runner: planRunner } : {}),
|
|
636
773
|
...(noteRunner !== undefined ? { noteRunner } : {}),
|
|
637
774
|
// #4978: a target's plan job plans that target alone, so its checks are `plan:<target>` and `policy:<target>`.
|
|
638
|
-
...(evidence ? { evidence: planEvidenceOf(forge, evidence, words, jobName, { ...(plan.forks === "skip" ? { noForks: true } : {}), ...(name ? { member: { name, reportPath:
|
|
775
|
+
...(evidence ? { evidence: planEvidenceOf(forge, evidence, words, jobName, { ...(plan.forks === "skip" ? { noForks: true } : {}), ...(name ? { member: { name, reportPath: outputDir } } : {}), ...(reportDir !== undefined ? { dir: reportDir } : {}) }) } : {}),
|
|
639
776
|
...(Object.keys(jobEnv).length > 0 ? { jobEnv } : {}),
|
|
640
777
|
...(login && login.steps.length > 0 ? { login: login.steps } : {}),
|
|
641
778
|
...(Object.keys(idTokens).length > 0 ? { idTokens } : {}),
|
|
642
|
-
...(
|
|
779
|
+
...(Object.keys(ownTokens ?? {}).length > 0 ? { ownIdTokens: true as const } : {}),
|
|
780
|
+
...(plan.pending && github ? { pending: { context: context ?? productStatusContext(words, "plan", name), description: "planning" } } : {}),
|
|
643
781
|
...(control ? { control } : {}),
|
|
644
782
|
...(plan.setup?.length ? { setup: plan.setup } : {}),
|
|
645
783
|
...(plan.report ? { report: fill(plan.report, name) } : {}),
|
|
@@ -648,11 +786,62 @@ export function productPlanJobs(forge: ForgeKind, env: string, loop: PrLoopPipel
|
|
|
648
786
|
...(record ? { record } : {}),
|
|
649
787
|
...(tradeSpec ? { trade: tradeSpec } : {}),
|
|
650
788
|
...(plan.previousMarker && productMarker ? { previous: { marker: prNoteMarker(env, name), name: productMarker } } : {}),
|
|
789
|
+
...(context !== undefined ? { context } : {}),
|
|
790
|
+
...(reportDir !== undefined ? { reportDir } : {}),
|
|
791
|
+
...(artifacts ? { artifacts } : {}),
|
|
651
792
|
};
|
|
652
793
|
};
|
|
653
794
|
return targets ? targets.map(one) : [one()];
|
|
654
795
|
}
|
|
655
796
|
|
|
797
|
+
/** Whether `dir` is a report directory a product plan takes (#5003): a relative path that stays in the checkout. */
|
|
798
|
+
function isReportDir(dir: string): boolean {
|
|
799
|
+
return /^[A-Za-z0-9_.\/-]+$/.test(dir) && !dir.startsWith("-") && dir.split("/").every((part) => part !== "" && part !== "." && part !== "..");
|
|
800
|
+
}
|
|
801
|
+
|
|
802
|
+
/** GitLab's top-level keywords, which no job may be named (#5003). */
|
|
803
|
+
const GITLAB_KEYWORDS = new Set(["default", "include", "stages", "variables", "workflow", "image", "services", "cache", "before_script", "after_script", "spec", "pages"]);
|
|
804
|
+
|
|
805
|
+
/**
|
|
806
|
+
* The plan jobs' names for each target (#5003), from
|
|
807
|
+
* {@link ProductPlanOptions.jobNames}, else chant's. Throws on a name that
|
|
808
|
+
* is not one, a `{target}` given without targets or left out with them, and
|
|
809
|
+
* two jobs of the plan that share a name.
|
|
810
|
+
*/
|
|
811
|
+
function productPlanJobNames(forge: ForgeKind, plan: Pick<ProductPlanOptions, "jobNames" | "replan">, targets: string[] | undefined): (target?: string) => { plan: string; note: string; replan: string; replanNote: string } {
|
|
812
|
+
const github = forge !== "gitlab";
|
|
813
|
+
const given = plan.jobNames ?? {};
|
|
814
|
+
const chant = { plan: "plan", note: PR_PLAN_NOTE_JOB, replan: REPLAN_JOB, replanNote: REPLAN_NOTE_JOB };
|
|
815
|
+
const keys = ["plan", "note", "replan", "replanNote"] as const;
|
|
816
|
+
for (const key of keys) {
|
|
817
|
+
const t = given[key];
|
|
818
|
+
if (t === undefined) continue;
|
|
819
|
+
if (Boolean(targets) !== t.includes("{target}")) throw new Error(targets ? `the product plan's jobNames.${key} ${JSON.stringify(t)} names every target's job, so it holds {target}` : `the product plan's jobNames.${key} ${JSON.stringify(t)} holds {target}, and the plan has no targets`);
|
|
820
|
+
}
|
|
821
|
+
const namesOf = (target?: string) => {
|
|
822
|
+
const out = {} as Record<(typeof keys)[number], string>;
|
|
823
|
+
for (const key of keys) {
|
|
824
|
+
const t = given[key];
|
|
825
|
+
// chant's: `plan-<target>` on GitHub and Forgejo, `<target>-plan` on GitLab.
|
|
826
|
+
out[key] = t !== undefined ? t.replaceAll("{target}", target ?? "") : target ? (github ? `${chant[key]}-${target}` : `${target}-${chant[key]}`) : chant[key];
|
|
827
|
+
}
|
|
828
|
+
return out;
|
|
829
|
+
};
|
|
830
|
+
const seen = new Map<string, string>();
|
|
831
|
+
for (const target of targets ?? [undefined]) {
|
|
832
|
+
const names = namesOf(target);
|
|
833
|
+
for (const key of plan.replan ? keys : (["plan", "note"] as const)) {
|
|
834
|
+
const n = names[key];
|
|
835
|
+
const ok = github ? /^[A-Za-z_][A-Za-z0-9_-]*$/.test(n) : /^[A-Za-z0-9_][A-Za-z0-9_-]*$/.test(n) && !GITLAB_KEYWORDS.has(n);
|
|
836
|
+
if (!ok) throw new Error(`the product plan's ${given[key] !== undefined ? `jobNames.${key}` : `${key} job`} ${JSON.stringify(n)} is not a job name of letters, digits, _ and -, starting with a letter or _${github ? "" : " or a digit, and no GitLab keyword"}`);
|
|
837
|
+
const other = seen.get(n);
|
|
838
|
+
if (other !== undefined) throw new Error(`the product plan names two jobs ${n}: ${other} and ${key}${target ? ` of ${target}` : ""}`);
|
|
839
|
+
seen.set(n, `${key}${target ? ` of ${target}` : ""}`);
|
|
840
|
+
}
|
|
841
|
+
}
|
|
842
|
+
return namesOf;
|
|
843
|
+
}
|
|
844
|
+
|
|
656
845
|
/** The comments the re-plan answers (#4899): the plan command, then the words' aliases for it. Refused when the words name no plan command. */
|
|
657
846
|
function replanCommentsOf(words: CiProductWords): { comments: string[]; gated: Array<{ comment: string; when: string }> } {
|
|
658
847
|
const command = commentLine(words, "plan");
|
|
@@ -662,16 +851,25 @@ function replanCommentsOf(words: CiProductWords): { comments: string[]; gated: A
|
|
|
662
851
|
}
|
|
663
852
|
|
|
664
853
|
/** The re-plan's jobs for one target (#4899), its comments filled in by the caller. */
|
|
665
|
-
function replanJobOf(
|
|
854
|
+
function replanJobOf(
|
|
855
|
+
forge: ForgeKind,
|
|
856
|
+
env: string,
|
|
857
|
+
words: CiProductWords,
|
|
858
|
+
name: string | undefined,
|
|
859
|
+
artifact: string,
|
|
860
|
+
noteWords0: Record<string, string>,
|
|
861
|
+
opts: { notAffected?: boolean; staleNotes?: boolean; jobName: string; noteJobName: string; output?: string; context?: string },
|
|
862
|
+
): Omit<ProductPlanReplanJob, "comments" | "gated"> {
|
|
666
863
|
const github = forge !== "gitlab";
|
|
667
|
-
const
|
|
668
|
-
const noteJobName = github ? (name ? `${REPLAN_NOTE_JOB}-${name}` : REPLAN_NOTE_JOB) : name ? `${name}-${REPLAN_NOTE_JOB}` : REPLAN_NOTE_JOB;
|
|
864
|
+
const { jobName, noteJobName } = opts;
|
|
669
865
|
// pr-post reads the pull request and the head from the re-plan job, never the comment. GitLab's is GitHub's line with its own --forge.
|
|
670
866
|
// #4987: with staleNotes the note's tip line is the target branch's commit the re-plan ran at, as the comment preview's is.
|
|
671
|
-
|
|
672
|
-
const
|
|
867
|
+
// #5003: the product's report directory and status context.
|
|
868
|
+
const post0 = { ...(opts.staleNotes ? { staleNotes: true } : {}), ...(opts.output !== undefined ? { output: opts.output } : {}) };
|
|
869
|
+
const command0 = github ? prLoopPostJob(forge, env, name, words, post0).command : prLoopPostJob("github", env, name, words, post0).command.replace(" --forge github ", " --forge gitlab ");
|
|
870
|
+
const command1 = opts.context !== undefined ? `${command0} --context ${opts.context}` : command0;
|
|
673
871
|
// #4963: the argument the re-plan was narrowed to, which pr-post answers "not affected" for when the change does not reach it.
|
|
674
|
-
const command = opts.notAffected ? `${
|
|
872
|
+
const command = opts.notAffected ? `${command1} --not-affected "$${PLAN_ARGUMENT_ENV}"` : command1;
|
|
675
873
|
const noteWords1 = opts.notAffected && github ? { ...noteWords0, [PLAN_ARGUMENT_ENV]: `\${{ needs.${jobName}.outputs.argument }}` } : noteWords0;
|
|
676
874
|
const noteWords = opts.staleNotes ? { ...noteWords1, TIP_SHA: github ? "${{ github.sha }}" : "$CI_COMMIT_SHA" } : noteWords1;
|
|
677
875
|
const post = github
|
|
@@ -877,7 +1075,7 @@ export const PENDING_JS = [
|
|
|
877
1075
|
* report line whatever the verb's exit, then the step exits with the verb's
|
|
878
1076
|
* status. Without a report line, the verb alone.
|
|
879
1077
|
*/
|
|
880
|
-
export function planVerbLines(p: Pick<ProductPlanJob, "command" | "report" | "record">): string[] {
|
|
1078
|
+
export function planVerbLines(p: Pick<ProductPlanJob, "command" | "report" | "record" | "reportDir">): string[] {
|
|
881
1079
|
if (!p.report && !p.record) return [p.command];
|
|
882
1080
|
return [
|
|
883
1081
|
...(p.record ? ['chant_plan_started="$(date -u +%Y-%m-%dT%H:%M:%SZ)"'] : []),
|
|
@@ -885,7 +1083,7 @@ export function planVerbLines(p: Pick<ProductPlanJob, "command" | "report" | "re
|
|
|
885
1083
|
`${p.command} || chant_plan_exit=$?`,
|
|
886
1084
|
...(p.report ? [`${p.report} || echo "chant: the report line exited $?" >&2`] : []),
|
|
887
1085
|
// #4899: the run record goes into the hand-off, for the note job to keep on chant/lifecycle.
|
|
888
|
-
...(p.record ? [`CHANT_PLAN_EXIT="$chant_plan_exit" CHANT_PLAN_STARTED="$chant_plan_started" node -e '${PLAN_RECORD_JS}' ${
|
|
1086
|
+
...(p.record ? [`CHANT_PLAN_EXIT="$chant_plan_exit" CHANT_PLAN_STARTED="$chant_plan_started" node -e '${PLAN_RECORD_JS}' ${productPlanReportDir(p)} || echo "chant: the plan's run record was not written" >&2`] : []),
|
|
889
1087
|
'[ "$chant_plan_exit" -eq 0 ] || exit "$chant_plan_exit"',
|
|
890
1088
|
];
|
|
891
1089
|
}
|
|
@@ -917,25 +1115,27 @@ export const PLAN_RECORD_JS = [
|
|
|
917
1115
|
* #4978: a product plan target's plan job is signed the same way, under the
|
|
918
1116
|
* target's name.
|
|
919
1117
|
*/
|
|
920
|
-
export function planEvidenceOf(forge: ForgeKind, evidence: PipelineEvidence, words: CiProductWords, planJob: string, opts: { noForks?: boolean; member?: { name: string; reportPath: string } } = {}): NonNullable<ProductPlanJob["evidence"]> {
|
|
1118
|
+
export function planEvidenceOf(forge: ForgeKind, evidence: PipelineEvidence, words: CiProductWords, planJob: string, opts: { noForks?: boolean; member?: { name: string; reportPath: string }; dir?: string } = {}): NonNullable<ProductPlanJob["evidence"]> {
|
|
921
1119
|
assertPipelineEvidence(evidence);
|
|
922
1120
|
const key = evidenceKeyEnv(forge, evidence);
|
|
923
1121
|
const bin = words.bin;
|
|
924
1122
|
const member = opts.member ? { member: opts.member.name } : {};
|
|
1123
|
+
// #5003: the product plan's report directory, which the plan job handed on.
|
|
1124
|
+
const reportDir = opts.dir ?? PR_LOOP_REPORT_DIR;
|
|
925
1125
|
if (forge === "gitlab") {
|
|
926
1126
|
// #4914: the job runs in the target branch's plan notes pipeline, before the note job, and signs every open
|
|
927
1127
|
// merge request's settled plan job from its artifact; no job of a merge request pipeline holds the key.
|
|
928
1128
|
const dir = gitlabOpenEvidenceDir(planJob);
|
|
929
1129
|
return {
|
|
930
1130
|
jobName: `${planJob}-evidence`,
|
|
931
|
-
lines: openEvidenceLines({ job: planJob, dir: opts.member?.reportPath ??
|
|
1131
|
+
lines: openEvidenceLines({ job: planJob, dir: opts.member?.reportPath ?? reportDir, out: dir, ...(bin ? { bin } : {}), ...(opts.noForks ? { noForks: true } : {}), ...member }),
|
|
932
1132
|
env: key,
|
|
933
1133
|
dir,
|
|
934
1134
|
...(evidenceKeyless(evidence) ? { idTokens: evidenceIdTokens(evidence) } : {}),
|
|
935
1135
|
};
|
|
936
1136
|
}
|
|
937
1137
|
return {
|
|
938
|
-
lines: planEvidenceLines({ dir:
|
|
1138
|
+
lines: planEvidenceLines({ dir: reportDir, at: '"$HEAD_SHA"', base: '"$BASE_SHA"', result: '"$PLAN_RESULT"', ...(bin ? { bin } : {}), ...member }),
|
|
939
1139
|
env: { HEAD_SHA: "${{ github.sha }}", BASE_SHA: "${{ github.event.pull_request.base.sha }}", PLAN_RESULT: `\${{ needs.${planJob}.result }}`, ...key },
|
|
940
1140
|
...(evidenceKeyless(evidence) ? { idToken: true as const } : {}),
|
|
941
1141
|
};
|