@intentius/chant 0.124.29 → 0.124.31
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cli/handlers/build.d.ts.map +1 -1
- package/dist/cli/handlers/build.js +4 -1
- package/dist/cli/handlers/fan-out.d.ts.map +1 -1
- package/dist/cli/handlers/fan-out.js +27 -5
- package/dist/cli/handlers/pr.d.ts.map +1 -1
- package/dist/cli/main.d.ts.map +1 -1
- package/dist/cli/main.js +64 -0
- package/dist/cli/parse-args.d.ts.map +1 -1
- package/dist/cli/parse-args.js +99 -0
- package/dist/cli/registry.d.ts +35 -1
- package/dist/cli/registry.d.ts.map +1 -1
- package/dist/components/pr-pipeline.d.ts +24 -0
- package/dist/components/pr-pipeline.d.ts.map +1 -1
- package/dist/components/pr-pipeline.js +16 -0
- package/dist/components/pr-run.d.ts +20 -2
- package/dist/components/pr-run.d.ts.map +1 -1
- package/dist/components/pr-run.js +26 -13
- package/dist/components/wave-plan.d.ts +11 -0
- package/dist/components/wave-plan.d.ts.map +1 -1
- package/dist/components/wave-plan.js +26 -0
- package/dist/lifecycle/release-ledger.d.ts +8 -3
- package/dist/lifecycle/release-ledger.d.ts.map +1 -1
- package/dist/lifecycle/release-ledger.js +2 -0
- package/dist/lifecycle/run-ledger.d.ts +1 -1
- package/dist/lifecycle/run-ledger.d.ts.map +1 -1
- package/dist/lifecycle/run-ledger.js +9 -0
- package/dist/op/activities/activity-contracts.d.ts +1 -0
- package/dist/op/activities/activity-contracts.d.ts.map +1 -1
- package/dist/op/activities/activity-contracts.js +1 -0
- package/dist/op/activities/shell.d.ts +6 -0
- package/dist/op/activities/shell.d.ts.map +1 -1
- package/dist/op/activities/shell.js +1 -1
- package/dist/op/local-executor.d.ts +35 -1
- package/dist/op/local-executor.d.ts.map +1 -1
- package/dist/op/local-executor.js +31 -6
- package/dist/op/redact.d.ts +34 -0
- package/dist/op/redact.d.ts.map +1 -0
- package/dist/op/redact.js +94 -0
- package/dist/op/runtime.d.ts +27 -0
- package/dist/op/runtime.d.ts.map +1 -1
- package/dist/op/runtime.js +20 -0
- package/dist/op/step-console.d.ts +2 -0
- package/dist/op/step-console.d.ts.map +1 -1
- package/dist/op/step-console.js +5 -2
- package/dist/pr-forge.d.ts +40 -0
- package/dist/pr-forge.d.ts.map +1 -1
- package/dist/pr-forge.js +56 -6
- package/dist/pr-loop.d.ts +10 -0
- package/dist/pr-loop.d.ts.map +1 -1
- package/dist/pr-loop.js +7 -0
- package/dist/pr-report-url.d.ts +8 -0
- package/dist/pr-report-url.d.ts.map +1 -1
- package/dist/pr-report-url.js +47 -1
- package/dist/run-event-stream.d.ts +2 -2
- package/dist/run-event-stream.d.ts.map +1 -1
- package/dist/run-event-stream.js +2 -2
- package/dist/run-event.d.ts +15 -0
- package/dist/run-event.d.ts.map +1 -1
- package/dist/run-event.js +2 -0
- package/dist/wave-runtime.mjs +171 -171
- package/dist/workspace/ci-green-forge.d.ts +2 -0
- package/dist/workspace/ci-green-forge.d.ts.map +1 -1
- package/dist/workspace/ci-green.d.ts +2 -0
- package/dist/workspace/ci-green.d.ts.map +1 -1
- package/dist/workspace/ci-green.js +4 -2
- package/dist/workspace/ci-run-index.d.ts +96 -0
- package/dist/workspace/ci-run-index.d.ts.map +1 -0
- package/dist/workspace/ci-run-index.js +162 -0
- package/dist/workspace/ci-run-index.schema.json +50 -0
- package/dist/workspace/ci-run.d.ts +299 -0
- package/dist/workspace/ci-run.d.ts.map +1 -0
- package/dist/workspace/ci-run.js +691 -0
- package/dist/workspace/ci-runner-key.d.ts +120 -0
- package/dist/workspace/ci-runner-key.d.ts.map +1 -0
- package/dist/workspace/ci-runner-key.js +217 -0
- package/dist/workspace/ci-secrets.d.ts +65 -0
- package/dist/workspace/ci-secrets.d.ts.map +1 -0
- package/dist/workspace/ci-secrets.js +211 -0
- package/dist/workspace/ci-serve.d.ts +227 -0
- package/dist/workspace/ci-serve.d.ts.map +1 -0
- package/dist/workspace/ci-serve.js +468 -0
- package/dist/workspace/pr-report.schema.json +5 -0
- package/dist/workspace/reason-codes.d.ts +6 -2
- package/dist/workspace/reason-codes.d.ts.map +1 -1
- package/dist/workspace/reason-codes.js +7 -2
- package/dist/workspace/run-event.schema.json +14 -3
- package/dist/workspace/status-stewards.d.ts +2 -0
- package/dist/workspace/status-stewards.d.ts.map +1 -1
- package/dist/workspace/status-stewards.js +1 -0
- package/dist/workspace/status.schema.json +12 -1
- package/dist/workspace/trust/trust-write.d.ts +109 -0
- package/dist/workspace/trust/trust-write.d.ts.map +1 -0
- package/dist/workspace/trust/trust-write.js +320 -0
- package/dist/workspace/trust-write.schema.json +265 -0
- package/package.json +1 -1
- package/src/cli/handlers/build.test.ts +15 -0
- package/src/cli/handlers/build.ts +4 -1
- package/src/cli/handlers/fan-out.test.ts +82 -0
- package/src/cli/handlers/fan-out.ts +34 -5
- package/src/cli/handlers/pr.ts +5 -0
- package/src/cli/main.test.ts +1 -0
- package/src/cli/main.ts +64 -0
- package/src/cli/parse-args.ts +71 -0
- package/src/cli/registry.ts +35 -1
- package/src/components/pr-pipeline.ts +32 -0
- package/src/components/pr-run.test.ts +127 -0
- package/src/components/pr-run.ts +32 -12
- package/src/components/wave-plan.ts +30 -0
- package/src/lifecycle/release-ledger.ts +9 -3
- package/src/lifecycle/run-ledger.ts +7 -1
- package/src/op/activities/activity-contracts.ts +1 -0
- package/src/op/activities/shell.ts +7 -1
- package/src/op/local-executor.ts +58 -7
- package/src/op/redact.ts +93 -0
- package/src/op/runtime.ts +42 -0
- package/src/op/step-console.ts +7 -2
- package/src/pr-forge.test.ts +54 -0
- package/src/pr-forge.ts +92 -6
- package/src/pr-loop.test.ts +13 -1
- package/src/pr-loop.ts +16 -0
- package/src/pr-report-url.ts +53 -1
- package/src/run-event-stream.ts +4 -3
- package/src/run-event.ts +17 -0
- package/src/workspace/ci-green-forge.ts +2 -0
- package/src/workspace/ci-green.ts +6 -2
- package/src/workspace/ci-run-index.schema.json +50 -0
- package/src/workspace/ci-run-index.test.ts +353 -0
- package/src/workspace/ci-run-index.ts +192 -0
- package/src/workspace/ci-run.test.ts +716 -0
- package/src/workspace/ci-run.ts +833 -0
- package/src/workspace/ci-runner-key.test.ts +166 -0
- package/src/workspace/ci-runner-key.ts +250 -0
- package/src/workspace/ci-secrets.test.ts +106 -0
- package/src/workspace/ci-secrets.ts +213 -0
- package/src/workspace/ci-serve.test.ts +367 -0
- package/src/workspace/ci-serve.ts +574 -0
- package/src/workspace/pr-report.schema.json +5 -0
- package/src/workspace/reason-codes.test.ts +2 -0
- package/src/workspace/reason-codes.ts +7 -2
- package/src/workspace/run-event.schema.json +14 -3
- package/src/workspace/status-stewards.ts +3 -0
- package/src/workspace/status.schema.json +12 -1
- package/src/workspace/trust/trust-write.test.ts +179 -0
- package/src/workspace/trust/trust-write.ts +377 -0
- package/src/workspace/trust-write.schema.json +265 -0
|
@@ -0,0 +1,299 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* `chant ci run plan|apply` (#4094, epic #4101): run one pull-request job as
|
|
3
|
+
* a pipeline Op, the first slice of the chant runner.
|
|
4
|
+
*
|
|
5
|
+
* The job is the typed value `prLoopJobs` (../components/pr-pipeline.ts)
|
|
6
|
+
* returns, the one the github, gitlab and forgejo generators wrap in a
|
|
7
|
+
* workflow, so the runner and a generated workflow run the same command with
|
|
8
|
+
* the same values. Nothing reads generated YAML.
|
|
9
|
+
*
|
|
10
|
+
* The job runs as an Op on the local executor (../op/local-executor.ts):
|
|
11
|
+
*
|
|
12
|
+
* - a `setup` phase with the setup lines the default image needs,
|
|
13
|
+
* - a `build` phase with the lines given to run before the command
|
|
14
|
+
* (`--before-script`, which a generated workflow runs in the same place),
|
|
15
|
+
* then the job's build and lint lines with `--pr-build` (#4088),
|
|
16
|
+
* - and a phase named for the job, `plan` or `apply`, with the job's own
|
|
17
|
+
* setup lines and its command in one shell.
|
|
18
|
+
*
|
|
19
|
+
* Each line is one shell step with a clean environment: a short list of the
|
|
20
|
+
* runner's variables (PATH, HOME and the like), the forge's connection and
|
|
21
|
+
* token variables the commands read, any `--pass-env` names, and the job's
|
|
22
|
+
* own variables. The forge values a generated job reads from `${{ ... }}`
|
|
23
|
+
* expressions or GitLab's predefined variables come from flags here:
|
|
24
|
+
* `BASE_SHA` from `--base`, `PR_NUMBER` from `--pr`, and the commit from
|
|
25
|
+
* `--commit`. The values a forge job gets from repository secrets come from
|
|
26
|
+
* the host's secrets file (`--secrets`, ./ci-secrets.ts, #4096), and every
|
|
27
|
+
* secret value is redacted from the run's events, record, copied report and
|
|
28
|
+
* output by the executor's `redact` option.
|
|
29
|
+
*
|
|
30
|
+
* The steps run in a fresh checkout of the commit: a detached `git worktree`
|
|
31
|
+
* in a temporary directory outside the repository, removed when the run
|
|
32
|
+
* ends. A worktree shares the repository's refs, so what the job records on
|
|
33
|
+
* `chant/lifecycle` (pr-apply's pending gate facts) and the remote it pushes
|
|
34
|
+
* to are the repository's own, as in a forge job's checkout. The report the
|
|
35
|
+
* job writes under `.chant/pr` is copied out of the worktree before it goes,
|
|
36
|
+
* where a forge would keep it as an artifact.
|
|
37
|
+
*
|
|
38
|
+
* The run is recorded as Op `pr-plan` or `pr-apply` in the run ledger
|
|
39
|
+
* (`<env>/runs__<op>.jsonl` on `chant/lifecycle`), and signed when a runner
|
|
40
|
+
* key is given, so `chant ci tick --source runs` (#4044) judges the commit
|
|
41
|
+
* from it. Its events are `kind: "pipeline"` and `runtime: "ci"`, and the
|
|
42
|
+
* record and the events carry `runOrigin: { forge: "chant" }`.
|
|
43
|
+
*
|
|
44
|
+
* With a forge client (#4097) the job also sets a commit status at its
|
|
45
|
+
* commit: `pending` when it starts, `success` or `failure` when it settles.
|
|
46
|
+
* A status the forge refuses is a warning and never fails the job.
|
|
47
|
+
*/
|
|
48
|
+
import { type PrLoopJob, type PrLoopPipelineOptions } from "../components/pr-pipeline.js";
|
|
49
|
+
import { type CommitStatus, type ForgeKind } from "../pr-forge.js";
|
|
50
|
+
import type { CommandContext } from "../cli/registry.js";
|
|
51
|
+
import type { RunOrigin } from "../lifecycle/release-ledger.js";
|
|
52
|
+
import { type OpRunResult, type StepRecord } from "../op/local-executor.js";
|
|
53
|
+
import type { OpRunFailureReason, OpRunRecord } from "../op/runtime.js";
|
|
54
|
+
import type { OpConfig } from "../op/types.js";
|
|
55
|
+
import { type Redact } from "../op/redact.js";
|
|
56
|
+
import { type CiSecrets } from "./ci-secrets.js";
|
|
57
|
+
/** The two jobs a pull-request pipeline has. */
|
|
58
|
+
export type CiJobName = PrLoopJob["jobName"];
|
|
59
|
+
export declare const CI_JOB_NAMES: readonly CiJobName[];
|
|
60
|
+
/** The Op each job is recorded as, which `ci.green` phases match. */
|
|
61
|
+
export declare const CI_JOB_OPS: Record<CiJobName, string>;
|
|
62
|
+
/** Where a job the chant runner ran says it ran (#4094). */
|
|
63
|
+
export declare const CHANT_RUNNER_ORIGIN: RunOrigin;
|
|
64
|
+
/** The runner's variables every job gets, when the runner has them. */
|
|
65
|
+
export declare const CI_RUN_BASE_ENV: readonly ["PATH", "HOME", "USER", "LOGNAME", "SHELL", "LANG", "LC_ALL", "LC_CTYPE", "TMPDIR", "TZ"];
|
|
66
|
+
/**
|
|
67
|
+
* The forge's connection and token variables the pull-request commands read
|
|
68
|
+
* (`forgeFromEnv` in ../pr-forge.ts), which a forge job gets from the forge
|
|
69
|
+
* and a job here gets from the runner's environment.
|
|
70
|
+
*/
|
|
71
|
+
export declare const CI_RUN_FORGE_ENV: readonly ["CHANT_FORGE_TOKEN", "GITHUB_TOKEN", "GH_TOKEN", "GITHUB_REPOSITORY", "GITHUB_SERVER_URL", "GITHUB_API_URL", "GITLAB_TOKEN", "CI_API_V4_URL", "CI_PROJECT_ID", "CI_SERVER_HOST", "CI_SERVER_URL"];
|
|
72
|
+
/** The forge values a job reads, given on the command line in place of a forge's expressions. */
|
|
73
|
+
export interface CiRunValues {
|
|
74
|
+
/** `--base`: the commit the change is measured from, `BASE_SHA`. */
|
|
75
|
+
base?: string;
|
|
76
|
+
/** `--pr`: the pull request, `PR_NUMBER`. The plan needs it. */
|
|
77
|
+
pr?: number;
|
|
78
|
+
/** The full commit the job runs at. */
|
|
79
|
+
commit: string;
|
|
80
|
+
}
|
|
81
|
+
export declare class CiRunError extends Error {
|
|
82
|
+
constructor(message: string);
|
|
83
|
+
}
|
|
84
|
+
/**
|
|
85
|
+
* The job's environment: the runner's base variables, the forge variables
|
|
86
|
+
* and `passEnv` names it has, the job's secrets from the host's secrets file
|
|
87
|
+
* (#4096), `CHANT_ENV` as a generated workflow sets it, the commit as the
|
|
88
|
+
* forge spells it, and the job's own variables. A job variable the forge
|
|
89
|
+
* fills from an expression comes from a flag, or from a secret or the
|
|
90
|
+
* runner's environment for a token such as `GITHUB_TOKEN`; a literal one,
|
|
91
|
+
* such as `CHANT_RUN_EVENTS_DIR`, is kept as it is. A secret replaces the
|
|
92
|
+
* runner's variable of the same name, and none replaces a variable the
|
|
93
|
+
* runner sets for the job. `CHANT_RUNNER_KEY` is never in it.
|
|
94
|
+
*/
|
|
95
|
+
export declare function ciJobEnv(job: PrLoopJob, input: {
|
|
96
|
+
forge: ForgeKind;
|
|
97
|
+
env: string;
|
|
98
|
+
values: CiRunValues;
|
|
99
|
+
hostEnv: Record<string, string | undefined>;
|
|
100
|
+
passEnv?: readonly string[];
|
|
101
|
+
/** The secrets this job gets, from {@link ciSecretsFor}. */
|
|
102
|
+
secrets?: Record<string, string>;
|
|
103
|
+
}): Record<string, string>;
|
|
104
|
+
/** What {@link ciJobOp} builds the Op from. */
|
|
105
|
+
export interface CiJobOpInput {
|
|
106
|
+
job: PrLoopJob;
|
|
107
|
+
env: string;
|
|
108
|
+
/** The directory the steps run in, inside the fresh checkout. */
|
|
109
|
+
cwd: string;
|
|
110
|
+
/** The job's environment, from {@link ciJobEnv}. */
|
|
111
|
+
jobEnv: Record<string, string>;
|
|
112
|
+
/** Setup lines, from `prLoopSetup`. */
|
|
113
|
+
setup: readonly string[];
|
|
114
|
+
/** Lines to run before the command, in order: `--before-script`, then the job's build and lint lines (#4088). */
|
|
115
|
+
build: readonly string[];
|
|
116
|
+
/** What runs chant, in place of `chant` at the start of the command. */
|
|
117
|
+
chant?: string;
|
|
118
|
+
}
|
|
119
|
+
/** `line` with a `chant` at its start replaced by the command the caller names, when it names one. */
|
|
120
|
+
export declare function withChant(line: string, chant?: string): string;
|
|
121
|
+
/** The job's own setup lines and its command, as one shell script, with `chant` at its start replaced by the command the caller names. */
|
|
122
|
+
export declare function ciJobCommand(job: PrLoopJob, chant?: string): string;
|
|
123
|
+
/**
|
|
124
|
+
* The job as an Op: `setup`, `build` and the job's own phase, each line one
|
|
125
|
+
* shell step in `cwd` with the job's environment and nothing else. A phase
|
|
126
|
+
* with no lines is left out.
|
|
127
|
+
*/
|
|
128
|
+
export declare function ciJobOp(input: CiJobOpInput): OpConfig;
|
|
129
|
+
/**
|
|
130
|
+
* Why a failed job failed (#4094), from its step records and, when the
|
|
131
|
+
* command wrote one, its pull-request report (`pr-plan.json` or
|
|
132
|
+
* `pr-apply.json` under `reportDir`):
|
|
133
|
+
*
|
|
134
|
+
* - a failed setup or build line: `setup-failed` or `build-failed`, the line
|
|
135
|
+
* and its exit code as the reason, and the phase;
|
|
136
|
+
* - a failed command with a report: the report's `refusal`, else its
|
|
137
|
+
* `status`, with its `message` as the reason, else the members that failed;
|
|
138
|
+
* - a failed command with no report: `command-failed` and the step's error.
|
|
139
|
+
*
|
|
140
|
+
* Undefined when no step failed, such as a run that stopped on an error of
|
|
141
|
+
* its own before any step ran.
|
|
142
|
+
*/
|
|
143
|
+
export declare function ciJobFailure(input: {
|
|
144
|
+
job: CiJobName;
|
|
145
|
+
op: OpConfig;
|
|
146
|
+
records: readonly StepRecord[];
|
|
147
|
+
reportDir: string;
|
|
148
|
+
}): OpRunFailureReason | undefined;
|
|
149
|
+
/** What posts a job's commit status (#4097): the `setCommitStatus` of a GitHub or Forgejo client. */
|
|
150
|
+
export interface CiStatusClient {
|
|
151
|
+
setCommitStatus(sha: string, status: CommitStatus): Promise<void>;
|
|
152
|
+
}
|
|
153
|
+
/** Where a job's status goes (#4097). */
|
|
154
|
+
export interface CiStatusConfig {
|
|
155
|
+
client: CiStatusClient;
|
|
156
|
+
/** `--status-url`: the link the status carries, `{key}` standing for `<pr>/<commit>[/<member>]`. Otherwise an https `--report-url` is used. */
|
|
157
|
+
urlTemplate?: string;
|
|
158
|
+
}
|
|
159
|
+
/**
|
|
160
|
+
* A job's status context: `chant/pr-plan` for the plan, and for the apply
|
|
161
|
+
* `chant/<gate>`, which is `chant/pr-apply` unless `--gate` renamed the gate.
|
|
162
|
+
* pr-plan's own status is `chant/plan` (../pr-loop.ts), a different context.
|
|
163
|
+
*/
|
|
164
|
+
export declare function ciStatusContext(job: CiJobName, gate?: string): string;
|
|
165
|
+
/**
|
|
166
|
+
* The link a job's status carries: the `--status-url` template with `{key}`
|
|
167
|
+
* filled, else the https `--report-url` followed by the key and a slash, else
|
|
168
|
+
* none (an `s3://` or `file://` URL is not one a browser opens).
|
|
169
|
+
*/
|
|
170
|
+
export declare function ciStatusUrl(input: {
|
|
171
|
+
urlTemplate?: string;
|
|
172
|
+
reportUrl?: string;
|
|
173
|
+
pr?: number;
|
|
174
|
+
commit: string;
|
|
175
|
+
member?: string;
|
|
176
|
+
}): string | undefined;
|
|
177
|
+
/** What the settled status says: a short summary, or on failure the record's code and reason. */
|
|
178
|
+
export declare function ciStatusSettled(op: string, result: Pick<CiRunResult, "status" | "record" | "failure">, seconds: number): Pick<CommitStatus, "state" | "description">;
|
|
179
|
+
/**
|
|
180
|
+
* The status client for `chant ci run` and `chant ci serve` (#4097), or none:
|
|
181
|
+
* off with `--no-status`, on GitLab (its client has no commit status call
|
|
182
|
+
* here), and without a forge token. A token with the rest of the forge's
|
|
183
|
+
* variables missing gives a warning instead.
|
|
184
|
+
*/
|
|
185
|
+
export declare function ciStatusFromEnv(input: {
|
|
186
|
+
forge: ForgeKind;
|
|
187
|
+
hostEnv: Record<string, string | undefined>;
|
|
188
|
+
noStatus?: boolean;
|
|
189
|
+
statusUrl?: string;
|
|
190
|
+
}): {
|
|
191
|
+
status?: CiStatusConfig;
|
|
192
|
+
warning?: string;
|
|
193
|
+
};
|
|
194
|
+
/** What `chant ci run` runs. */
|
|
195
|
+
export interface CiRunRequest {
|
|
196
|
+
/** Where the command was run: the project, or a workspace member's directory. */
|
|
197
|
+
cwd: string;
|
|
198
|
+
job: CiJobName;
|
|
199
|
+
/** `--env`: the environment the pipeline is for. */
|
|
200
|
+
env: string;
|
|
201
|
+
forge: ForgeKind;
|
|
202
|
+
/** `--base`, `--pr` and `--commit` (default `HEAD`). */
|
|
203
|
+
base?: string;
|
|
204
|
+
pr?: number;
|
|
205
|
+
commit?: string;
|
|
206
|
+
/** The generator's options: `--gate`, `--branch`, `--events-json`, `--report-url`, `--pr-build` and `--pr-build-command`. */
|
|
207
|
+
loop?: PrLoopPipelineOptions;
|
|
208
|
+
/** `--image`: the image a generated pipeline names. Only the default gets setup lines. */
|
|
209
|
+
image?: string;
|
|
210
|
+
/** `--before-script` lines, run in the build phase before the job's build lines. */
|
|
211
|
+
beforeScript?: readonly string[];
|
|
212
|
+
/** `--chant`: what runs chant in the job. Default `chant`. */
|
|
213
|
+
chant?: string;
|
|
214
|
+
/** `--pass-env`: more of the runner's variables the job gets. */
|
|
215
|
+
passEnv?: readonly string[];
|
|
216
|
+
/** The runner's environment. Default `process.env`. */
|
|
217
|
+
hostEnv?: Record<string, string | undefined>;
|
|
218
|
+
/**
|
|
219
|
+
* The host's secrets file, read (#4096, `--secrets`): the job gets the
|
|
220
|
+
* secrets its allowlist names, and every value in it is redacted from the
|
|
221
|
+
* run's events, record, copied report and output.
|
|
222
|
+
*/
|
|
223
|
+
secrets?: CiSecrets;
|
|
224
|
+
/** `--output`: where the job's report is copied, from `cwd`. Default `.chant/pr`. */
|
|
225
|
+
output?: string;
|
|
226
|
+
/** `--run-index-limit`: how many runs the index at `loop.reportUrl` keeps (#4098). Default 200. */
|
|
227
|
+
runIndexLimit?: number;
|
|
228
|
+
/** A runner key, PEM, that signs the run's record. */
|
|
229
|
+
runnerKey?: string;
|
|
230
|
+
/**
|
|
231
|
+
* The key came from `CHANT_RUNNER_KEY`, not `--key`: one `.chant/trust.json`
|
|
232
|
+
* does not list leaves the run unsigned with a warning, as `chant run` does,
|
|
233
|
+
* where `--key` refuses the run.
|
|
234
|
+
*/
|
|
235
|
+
runnerKeyFromEnv?: boolean;
|
|
236
|
+
/** The run id. Default `chant-<epoch ms>`. */
|
|
237
|
+
runId?: string;
|
|
238
|
+
/** Where the run's events go as they happen (`--events-json`). They are kept on this host either way. */
|
|
239
|
+
runEvents?: (line: string) => void;
|
|
240
|
+
/** Where each line a step prints goes. */
|
|
241
|
+
stepOutput?: (line: string) => void;
|
|
242
|
+
/** Push `chant/lifecycle` once the record is written. Default true. */
|
|
243
|
+
push?: boolean;
|
|
244
|
+
/**
|
|
245
|
+
* The apply's resume record on this host (#4095), in place of the forge's
|
|
246
|
+
* CI cache: copied into the checkout at `PR_APPLY_RECORD` before the job,
|
|
247
|
+
* when it exists, and the job's record copied back to it after, passed or
|
|
248
|
+
* failed. `chant ci serve` names one per `prApplyRecordKey`.
|
|
249
|
+
*/
|
|
250
|
+
resumeRecord?: string;
|
|
251
|
+
/** Set a commit status at the job's commit (#4097). Absent: none is set. `chant ci run` builds it from the environment. */
|
|
252
|
+
status?: CiStatusConfig;
|
|
253
|
+
signal?: AbortSignal;
|
|
254
|
+
}
|
|
255
|
+
export interface CiRunResult {
|
|
256
|
+
op: string;
|
|
257
|
+
/** The executor's outcome: `ok` or `fail` for a job. */
|
|
258
|
+
status: OpRunResult["status"];
|
|
259
|
+
record: OpRunRecord;
|
|
260
|
+
/** The step that failed and why, for a failed run. */
|
|
261
|
+
failure?: {
|
|
262
|
+
phase: string;
|
|
263
|
+
error: string;
|
|
264
|
+
};
|
|
265
|
+
/** Where the job's report was copied, or null when it wrote none. */
|
|
266
|
+
report: string | null;
|
|
267
|
+
/** The runner the record was signed as, or null. */
|
|
268
|
+
signer: string | null;
|
|
269
|
+
pushed: boolean;
|
|
270
|
+
pushWarning?: string;
|
|
271
|
+
/** What went wrong beside the job, such as a record the key could not sign. */
|
|
272
|
+
warnings: string[];
|
|
273
|
+
/** The checkout the job ran in, removed by now. */
|
|
274
|
+
checkout: string;
|
|
275
|
+
}
|
|
276
|
+
/** The member a job runs for, and its directory from the repository root, as the generator decides it. */
|
|
277
|
+
export declare function ciJobPlace(cwd: string, top: string): {
|
|
278
|
+
member?: string;
|
|
279
|
+
dir: string;
|
|
280
|
+
};
|
|
281
|
+
/**
|
|
282
|
+
* Run one pull-request job as a pipeline Op in a fresh checkout of the
|
|
283
|
+
* commit, record it, and copy its report out. Throws {@link CiRunError}
|
|
284
|
+
* before anything runs when the request can't be run.
|
|
285
|
+
*/
|
|
286
|
+
export declare function ciRun(req: CiRunRequest): Promise<CiRunResult>;
|
|
287
|
+
/**
|
|
288
|
+
* Redact every text file under `dir` in place (#4096): the job's report, its
|
|
289
|
+
* change set and its component events, as `ci run` copied them out. A
|
|
290
|
+
* JSON file stays JSON. A file with a NUL byte is taken as binary and left.
|
|
291
|
+
*/
|
|
292
|
+
export declare function redactTree(dir: string, redact: Redact): void;
|
|
293
|
+
/** The text `chant ci run` prints when the run settles. */
|
|
294
|
+
export declare function formatCiRun(r: CiRunResult): string;
|
|
295
|
+
/** The secrets file `--secrets` names, else the one `CHANT_CI_SECRETS` names, read; undefined when neither names one (#4096). */
|
|
296
|
+
export declare function ciSecretsOf(flag: string | undefined, env?: Record<string, string | undefined>): CiSecrets | undefined;
|
|
297
|
+
/** `chant ci run plan|apply` (#4094). */
|
|
298
|
+
export declare function runCiRun(ctx: CommandContext): Promise<number>;
|
|
299
|
+
//# sourceMappingURL=ci-run.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ci-run.d.ts","sourceRoot":"","sources":["../../src/workspace/ci-run.ts"],"names":[],"mappings":"AAAA;;;;;;;;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