@kici-dev/orchestrator 0.20.0 → 0.20.1
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.js +725 -664
- package/dist/db/migrations/160_execution_jobs_workflow_name.d.ts +16 -0
- package/dist/db/types.d.ts +6 -0
- package/dist/pipeline/dispatch-matched-workflow.d.ts +6 -0
- package/dist/pipeline/invoke-gate.d.ts +1 -1
- package/dist/pipeline/route-or-dispatch-jobs.d.ts +3 -1
- package/dist/pipeline/test-pipeline.d.ts +2 -0
- package/dist/provenance/backfill-run.d.ts +2 -0
- package/dist/reporting/execution-tracker.d.ts +19 -2
- package/dist/reporting/run-aggregator.d.ts +8 -0
- package/dist/reporting/run-workflow-names.d.ts +30 -0
- package/dist/server.js +51590 -51393
- package/dist/standalone.js +8382 -8208
- package/dist/ws/job-status-forward-frame.d.ts +2 -0
- package/installer-image-digests.json +3 -3
- package/package.json +4 -4
- package/sbom.spdx.json +53 -53
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { type Kysely } from 'kysely';
|
|
2
|
+
/**
|
|
3
|
+
* `execution_jobs.workflow_name`: the workflow that defines the job. A fixture
|
|
4
|
+
* run with no `--workflow` runs every matched workflow under one run id, so
|
|
5
|
+
* `execution_runs.workflow_name` (the first matched workflow) does not say
|
|
6
|
+
* which workflow a job belongs to.
|
|
7
|
+
*
|
|
8
|
+
* Nullable, with no backfill: a row written before this column reads as
|
|
9
|
+
* unknown, and the readers fall back to the run's workflow for a run that can
|
|
10
|
+
* span only one.
|
|
11
|
+
*
|
|
12
|
+
* Idempotent.
|
|
13
|
+
*/
|
|
14
|
+
export declare function up(db: Kysely<unknown>): Promise<void>;
|
|
15
|
+
export declare function down(db: Kysely<unknown>): Promise<void>;
|
|
16
|
+
//# sourceMappingURL=160_execution_jobs_workflow_name.d.ts.map
|
package/dist/db/types.d.ts
CHANGED
|
@@ -651,6 +651,12 @@ export interface ExecutionJobTable {
|
|
|
651
651
|
job_id: string;
|
|
652
652
|
/** Job name (e.g. "test", "test[node-18]") */
|
|
653
653
|
job_name: string;
|
|
654
|
+
/**
|
|
655
|
+
* The workflow that defines the job. A run can span several workflows (a
|
|
656
|
+
* fixture run with no `--workflow`), so the run's own `workflow_name` does not
|
|
657
|
+
* name it. NULL on a row written before the column existed.
|
|
658
|
+
*/
|
|
659
|
+
workflow_name: ColumnType<string | null, string | null | undefined, string | null>;
|
|
654
660
|
/** Job status: an `ExecutionJobStatus` value (engine). */
|
|
655
661
|
status: Generated<string>;
|
|
656
662
|
/**
|
|
@@ -198,6 +198,12 @@ export interface WorkflowDispatchContext {
|
|
|
198
198
|
* explicitly rather than leave it `pending` forever.
|
|
199
199
|
*/
|
|
200
200
|
runRegisteredBeforeDispatch?: boolean;
|
|
201
|
+
/**
|
|
202
|
+
* Called each time this dispatch registers the run with the tracker. A
|
|
203
|
+
* fixture run dispatches several workflows under one run id, and holds the
|
|
204
|
+
* run open from the first registration until every workflow has registered.
|
|
205
|
+
*/
|
|
206
|
+
onRunRegistered?: () => void;
|
|
201
207
|
/**
|
|
202
208
|
* Set once `setupDispatchContext` posted the queued `kici/<workflow>` check
|
|
203
209
|
* and one `kici/<workflow>/job/<name>` per static job. They go up BEFORE the
|
|
@@ -20,7 +20,7 @@ import { ExecutionJobStatus } from '@kici-dev/engine';
|
|
|
20
20
|
import type { LockInvoke, LockJob } from '@kici-dev/engine';
|
|
21
21
|
import type { Kysely } from 'kysely';
|
|
22
22
|
import type { Database } from '../db/types.js';
|
|
23
|
-
import type
|
|
23
|
+
import { type ExecutionTracker } from '../reporting/execution-tracker.js';
|
|
24
24
|
/**
|
|
25
25
|
* The invoke parameters carried from a gate's lock job to its (possibly deferred)
|
|
26
26
|
* execution. Persisted on the pending job context so a gate released later — or
|
|
@@ -9,7 +9,7 @@ import type { LockJob, MaterializedJob } from '@kici-dev/engine';
|
|
|
9
9
|
import type { JobKind } from '../db/types.js';
|
|
10
10
|
import type { RunContext, RunCoordinator } from '../cluster/coordinator.js';
|
|
11
11
|
import type { Dispatcher } from '../agent/dispatcher.js';
|
|
12
|
-
import type
|
|
12
|
+
import { type ExecutionTracker } from '../reporting/execution-tracker.js';
|
|
13
13
|
export interface DispatchedJobEntry {
|
|
14
14
|
jobId: string;
|
|
15
15
|
jobName: string;
|
|
@@ -73,6 +73,8 @@ export declare function routeOrDispatchJobs(opts: RouteOrDispatchOptions): Promi
|
|
|
73
73
|
}>;
|
|
74
74
|
export interface RegisterDispatchedJobsOptions {
|
|
75
75
|
newRunId: string;
|
|
76
|
+
/** The workflow the jobs belong to, recorded on each job row. */
|
|
77
|
+
workflowName: string;
|
|
76
78
|
dispatchedJobs: DispatchedJobEntry[];
|
|
77
79
|
rejectedJobs: RejectedJobEntry[];
|
|
78
80
|
executionTracker: ExecutionTracker;
|
|
@@ -38,6 +38,8 @@ export interface TestTriggerInput {
|
|
|
38
38
|
routingKey: string;
|
|
39
39
|
/** Uploaded tarball reference. */
|
|
40
40
|
uploadId?: string;
|
|
41
|
+
/** The commit the uploaded overlay was built from, as its upload recorded it. */
|
|
42
|
+
uploadSha?: string;
|
|
41
43
|
/** Fixture secret context mappings `{ contextName: envName }`. */
|
|
42
44
|
secrets?: Record<string, string>;
|
|
43
45
|
/** Base64 X25519+AES-GCM blob of the developer's local secrets ({flat, contexts}). */
|
|
@@ -31,6 +31,8 @@ export interface BackfillJobRow {
|
|
|
31
31
|
run_id: string;
|
|
32
32
|
job_id: string;
|
|
33
33
|
job_name: string;
|
|
34
|
+
/** Optional: a loader that does not select it forwards no workflow. */
|
|
35
|
+
workflow_name?: string | null;
|
|
34
36
|
status: string;
|
|
35
37
|
started_at: Date | null;
|
|
36
38
|
completed_at: Date | null;
|
|
@@ -206,7 +206,9 @@ export interface ExecutionTrackerDeps {
|
|
|
206
206
|
*/
|
|
207
207
|
initFailure?: InitFailure,
|
|
208
208
|
/** Ordered bound deployment-context names for this job (multi-env jobs). */
|
|
209
|
-
contexts?: string[]
|
|
209
|
+
contexts?: string[],
|
|
210
|
+
/** The workflow that defines the job, when recorded. */
|
|
211
|
+
workflowName?: string) => void;
|
|
210
212
|
/**
|
|
211
213
|
* Optional callback to emit run.event messages to Platform.
|
|
212
214
|
* Fires at orchestrator lifecycle points (dispatch, agent assignment, job start/complete).
|
|
@@ -282,6 +284,13 @@ export interface ExecutionTrackerDeps {
|
|
|
282
284
|
export interface TrackedJobRow {
|
|
283
285
|
jobId: string;
|
|
284
286
|
jobName: string;
|
|
287
|
+
/**
|
|
288
|
+
* The workflow that defines the job. A fixture run with no `--workflow` runs
|
|
289
|
+
* every matched workflow under one run id, so the run's own workflow does not
|
|
290
|
+
* name it. `onExecutionStarted` stamps its own workflow on a job without one;
|
|
291
|
+
* `addJobsToRun` inherits it from the placeholder the job replaces.
|
|
292
|
+
*/
|
|
293
|
+
workflowName?: string;
|
|
285
294
|
matrixValues?: Record<string, unknown>;
|
|
286
295
|
runsOnLabels?: string[];
|
|
287
296
|
baseJobName?: string;
|
|
@@ -307,6 +316,8 @@ export interface TrackedJobRow {
|
|
|
307
316
|
/** For a gate job, its wall-clock timeout in ms (orchestrator-swept). */
|
|
308
317
|
timeoutMs?: number;
|
|
309
318
|
}
|
|
319
|
+
/** Stamp each job with `workflowName`, keeping a workflow a job already names. */
|
|
320
|
+
export declare function jobsOfWorkflow<T extends TrackedJobRow>(workflowName: string, jobs: T[]): T[];
|
|
310
321
|
export declare class ExecutionTracker {
|
|
311
322
|
private readonly db;
|
|
312
323
|
private readonly observerRegistry?;
|
|
@@ -538,6 +549,11 @@ export declare class ExecutionTracker {
|
|
|
538
549
|
/** Synthetic job ID to replace (e.g. needs-pending-deploy-{uuid}). */
|
|
539
550
|
replaceSyntheticId?: string): Promise<void>;
|
|
540
551
|
private addJobsToRunImpl;
|
|
552
|
+
/**
|
|
553
|
+
* The workflow of the placeholder a job replaces: from memory, or from its
|
|
554
|
+
* row when another peer registered it.
|
|
555
|
+
*/
|
|
556
|
+
private placeholderWorkflowName;
|
|
541
557
|
/** Mark a run as a test run for observer broadcasting (called by the test pipeline). */
|
|
542
558
|
markTestRun(runId: string): void;
|
|
543
559
|
isTestRun(runId: string): boolean;
|
|
@@ -1089,7 +1105,7 @@ export declare class ExecutionTracker {
|
|
|
1089
1105
|
* worker's first status update creates the `execution_jobs` row. An existing
|
|
1090
1106
|
* entry is never clobbered, so a later terminal status survives.
|
|
1091
1107
|
*/
|
|
1092
|
-
registerJobName(runId: string, jobId: string, jobName: string): void;
|
|
1108
|
+
registerJobName(runId: string, jobId: string, jobName: string, workflowName?: string): void;
|
|
1093
1109
|
/**
|
|
1094
1110
|
* The in-memory run owning a dispatched jobId, so `getExecutionContext`
|
|
1095
1111
|
* resolves for a job-scoped agent `event.emit`. In-memory only, like
|
|
@@ -1169,6 +1185,7 @@ export declare class ExecutionTracker {
|
|
|
1169
1185
|
jobs: Array<{
|
|
1170
1186
|
jobId: string;
|
|
1171
1187
|
jobName: string;
|
|
1188
|
+
workflowName?: string;
|
|
1172
1189
|
status: string;
|
|
1173
1190
|
startedAt?: number;
|
|
1174
1191
|
completedAt?: number;
|
|
@@ -39,6 +39,8 @@ export declare function mapRunDetailStep(step: RunDetailStepRow): {
|
|
|
39
39
|
export interface RunDetailJobRow {
|
|
40
40
|
job_id: string;
|
|
41
41
|
job_name: string;
|
|
42
|
+
/** Absent from an archived row written before the column existed. */
|
|
43
|
+
workflow_name?: string | null;
|
|
42
44
|
status: string;
|
|
43
45
|
matrix_values: unknown;
|
|
44
46
|
base_job_name: string | null;
|
|
@@ -67,6 +69,11 @@ export interface RunDetailJobLookups {
|
|
|
67
69
|
upstreamName: string;
|
|
68
70
|
runOn: ExecutionJobStatus[];
|
|
69
71
|
}>>;
|
|
72
|
+
/** The run's own workflow, naming a job row that records none; see {@link jobWorkflowName}. */
|
|
73
|
+
runWorkflow?: {
|
|
74
|
+
workflow_name: string;
|
|
75
|
+
is_test_run: boolean;
|
|
76
|
+
};
|
|
70
77
|
}
|
|
71
78
|
/**
|
|
72
79
|
* The routing reason as a reader should see it: only while the job is `pending`/`queued`.
|
|
@@ -82,6 +89,7 @@ export declare function visibleRoutingReason(status: string, routingReason: stri
|
|
|
82
89
|
export declare function buildRunDetailJobs(jobs: RunDetailJobRow[], lookups: RunDetailJobLookups): {
|
|
83
90
|
jobId: string;
|
|
84
91
|
jobName: string;
|
|
92
|
+
workflowName: string | null;
|
|
85
93
|
status: string;
|
|
86
94
|
matrixValues: Record<string, unknown> | null;
|
|
87
95
|
baseJobName: string | null;
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The workflows a run spans, read from its job rows.
|
|
3
|
+
*
|
|
4
|
+
* A fixture run with no `--workflow` runs every matched workflow under one run
|
|
5
|
+
* id. `execution_runs.workflow_name` holds the first of them; each job row
|
|
6
|
+
* records its own in `execution_jobs.workflow_name`.
|
|
7
|
+
*/
|
|
8
|
+
import type { Kysely } from 'kysely';
|
|
9
|
+
import type { Database } from '../db/types.js';
|
|
10
|
+
/** The run fields the readers below need. */
|
|
11
|
+
export interface RunWorkflowRef {
|
|
12
|
+
run_id: string;
|
|
13
|
+
workflow_name: string;
|
|
14
|
+
}
|
|
15
|
+
/**
|
|
16
|
+
* Every workflow each run spans, the run's own workflow first and the rest in
|
|
17
|
+
* the order their first job registered. A run whose job rows name no workflow
|
|
18
|
+
* (written before the column existed) lists its own workflow alone.
|
|
19
|
+
*/
|
|
20
|
+
export declare function loadRunWorkflowNames(db: Kysely<Database>, runs: readonly RunWorkflowRef[]): Promise<Map<string, string[]>>;
|
|
21
|
+
/**
|
|
22
|
+
* The workflow a job row belongs to. A row written before the column existed
|
|
23
|
+
* records none: a run that is not a fixture run spans one workflow, so the
|
|
24
|
+
* run's own names it; a fixture run may span several, so it stays unknown.
|
|
25
|
+
*/
|
|
26
|
+
export declare function jobWorkflowName(jobWorkflow: string | null, run: {
|
|
27
|
+
workflow_name: string;
|
|
28
|
+
is_test_run: boolean;
|
|
29
|
+
}): string | null;
|
|
30
|
+
//# sourceMappingURL=run-workflow-names.d.ts.map
|