@intentius/chant 0.124.96 → 0.124.98
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/audit/core.d.ts +29 -0
- package/dist/audit/core.d.ts.map +1 -1
- package/dist/audit/core.js +48 -11
- package/dist/audit/identity.d.ts +27 -0
- package/dist/audit/identity.d.ts.map +1 -0
- package/dist/audit/identity.js +36 -0
- package/dist/audit/report-html.d.ts +3 -1
- package/dist/audit/report-html.d.ts.map +1 -1
- package/dist/audit/report-html.js +1 -1
- package/dist/audit/report-model.d.ts +16 -0
- package/dist/audit/report-model.d.ts.map +1 -1
- package/dist/audit/report-model.js +5 -1
- package/dist/change-set-graph.d.ts +3 -1
- package/dist/change-set-graph.d.ts.map +1 -1
- package/dist/change-set-graph.js +7 -1
- package/dist/change-set.d.ts +5 -2
- package/dist/change-set.d.ts.map +1 -1
- package/dist/change-set.js +6 -3
- package/dist/ci-agent.d.ts +17 -0
- package/dist/ci-agent.d.ts.map +1 -1
- package/dist/ci-agent.js +32 -0
- package/dist/ci-comment-allow.d.ts +88 -0
- package/dist/ci-comment-allow.d.ts.map +1 -0
- package/dist/ci-comment-allow.js +178 -0
- package/dist/ci-comment-commands.d.ts +12 -0
- package/dist/ci-comment-commands.d.ts.map +1 -1
- package/dist/ci-comment-commands.js +22 -0
- package/dist/ci-control.d.ts +6 -1
- package/dist/ci-control.d.ts.map +1 -1
- package/dist/ci-control.js +6 -1
- package/dist/ci-product.d.ts +3 -0
- package/dist/ci-product.d.ts.map +1 -1
- package/dist/ci-product.js +3 -0
- package/dist/cli/commands/audit.d.ts +3 -1
- package/dist/cli/commands/audit.d.ts.map +1 -1
- package/dist/cli/commands/audit.js +23 -6
- package/dist/cli/commands/import.d.ts +8 -1
- package/dist/cli/commands/import.d.ts.map +1 -1
- package/dist/cli/commands/import.js +31 -6
- package/dist/cli/handlers/agent.d.ts.map +1 -1
- package/dist/cli/handlers/agent.js +12 -2
- package/dist/cli/handlers/pr-comment.d.ts +6 -0
- package/dist/cli/handlers/pr-comment.d.ts.map +1 -1
- package/dist/cli/handlers/pr-comment.js +12 -0
- package/dist/cli/handlers/promote.d.ts.map +1 -1
- package/dist/cli/handlers/promote.js +53 -6
- package/dist/cli/main.d.ts.map +1 -1
- package/dist/cli/main.js +29 -6
- package/dist/cli/parse-args.d.ts.map +1 -1
- package/dist/cli/parse-args.js +23 -0
- package/dist/cli/registry.d.ts +8 -0
- package/dist/cli/registry.d.ts.map +1 -1
- package/dist/cloud-lister/mask.d.ts +30 -1
- package/dist/cloud-lister/mask.d.ts.map +1 -1
- package/dist/cloud-lister/mask.js +66 -3
- package/dist/components/driver.d.ts +8 -1
- package/dist/components/driver.d.ts.map +1 -1
- package/dist/components/driver.js +1 -0
- package/dist/components/product-pipeline.d.ts +23 -1
- package/dist/components/product-pipeline.d.ts.map +1 -1
- package/dist/components/product-pipeline.js +40 -7
- package/dist/components/product-plan.d.ts +20 -0
- package/dist/components/product-plan.d.ts.map +1 -1
- package/dist/components/product-plan.js +11 -1
- package/dist/control/applied.d.ts +8 -1
- package/dist/control/applied.d.ts.map +1 -1
- package/dist/control/applied.js +18 -2
- package/dist/control/dispatch.d.ts +52 -0
- package/dist/control/dispatch.d.ts.map +1 -1
- package/dist/control/dispatch.js +140 -4
- package/dist/control/train.d.ts +198 -0
- package/dist/control/train.d.ts.map +1 -0
- package/dist/control/train.js +294 -0
- package/dist/deep-observation.js +2 -2
- package/dist/floor-table.data.d.ts.map +1 -1
- package/dist/floor-table.data.js +7 -1
- package/dist/graph-detail.d.ts +9 -0
- package/dist/graph-detail.d.ts.map +1 -1
- package/dist/graph-detail.js +38 -13
- package/dist/graph-refs.d.ts +233 -3
- package/dist/graph-refs.d.ts.map +1 -1
- package/dist/graph-refs.js +106 -15
- package/dist/lint/post-synth.d.ts +22 -0
- package/dist/lint/post-synth.d.ts.map +1 -1
- package/dist/lint/rules/declarable-naming-convention.d.ts +12 -0
- package/dist/lint/rules/declarable-naming-convention.d.ts.map +1 -1
- package/dist/lint/rules/declarable-naming-convention.js +38 -8
- package/dist/lint/rules/imported-source.d.ts +20 -0
- package/dist/lint/rules/imported-source.d.ts.map +1 -0
- package/dist/lint/rules/imported-source.js +27 -0
- package/dist/lint/rules/no-unused-declarable.d.ts.map +1 -1
- package/dist/lint/rules/no-unused-declarable.js +3 -0
- package/dist/op/gate.d.ts +2 -0
- package/dist/op/gate.d.ts.map +1 -1
- package/dist/op/gate.js +8 -1
- package/dist/pr-forge-reads.d.ts +17 -0
- package/dist/pr-forge-reads.d.ts.map +1 -1
- package/dist/pr-forge-reads.js +55 -0
- package/dist/reconcile.d.ts +9 -0
- package/dist/reconcile.d.ts.map +1 -1
- package/dist/release-floors.d.ts +9 -1
- package/dist/release-floors.d.ts.map +1 -1
- package/dist/release-floors.js +10 -2
- package/dist/repo-path.d.ts +29 -0
- package/dist/repo-path.d.ts.map +1 -0
- package/dist/repo-path.js +81 -0
- package/dist/sensitive-key.d.ts +23 -0
- package/dist/sensitive-key.d.ts.map +1 -1
- package/dist/sensitive-key.js +37 -0
- package/dist/terraform/hcl2json.d.ts +7 -0
- package/dist/terraform/hcl2json.d.ts.map +1 -1
- package/dist/terraform/hcl2json.js +7 -0
- package/dist/wave-runtime.mjs +352 -345
- package/dist/workspace/catalog-edges.d.ts +147 -0
- package/dist/workspace/catalog-edges.d.ts.map +1 -0
- package/dist/workspace/catalog-edges.js +461 -0
- package/dist/workspace/compose-graph.d.ts +73 -3
- package/dist/workspace/compose-graph.d.ts.map +1 -1
- package/dist/workspace/declaration.d.ts +2 -0
- package/dist/workspace/declaration.d.ts.map +1 -1
- package/dist/workspace/declaration.js +1 -0
- package/dist/workspace/declaration.schema.json +6 -0
- package/dist/workspace/discover.d.ts +134 -0
- package/dist/workspace/discover.d.ts.map +1 -0
- package/dist/workspace/discover.js +372 -0
- package/dist/workspace/graph-cli.d.ts +20 -0
- package/dist/workspace/graph-cli.d.ts.map +1 -1
- package/dist/workspace/graph-cli.js +178 -20
- package/dist/workspace/graph.schema.json +195 -2
- package/dist/workspace/release-train.d.ts +214 -3
- package/dist/workspace/release-train.d.ts.map +1 -1
- package/dist/workspace/release-train.js +552 -16
- package/dist/workspace/repo-ref.d.ts +14 -0
- package/dist/workspace/repo-ref.d.ts.map +1 -1
- package/dist/workspace/repo-ref.js +26 -1
- package/dist/workspace/workspace-gates.d.ts +24 -0
- package/dist/workspace/workspace-gates.d.ts.map +1 -1
- package/dist/workspace/workspace-gates.js +29 -5
- package/dist/workspace/workspace-ledger.d.ts +31 -5
- package/dist/workspace/workspace-ledger.d.ts.map +1 -1
- package/dist/workspace/workspace-ledger.js +2 -1
- package/dist/workspace/workspace-run.d.ts +14 -0
- package/dist/workspace/workspace-run.d.ts.map +1 -1
- package/dist/workspace/workspace-run.js +2 -2
- package/dist/yaml.d.ts.map +1 -1
- package/dist/yaml.js +33 -8
- package/package.json +1 -1
- package/src/audit/core.test.ts +64 -1
- package/src/audit/core.ts +75 -10
- package/src/audit/identity.test.ts +31 -0
- package/src/audit/identity.ts +43 -0
- package/src/audit/report-html.ts +4 -2
- package/src/audit/report-model.ts +21 -1
- package/src/change-set-graph.test.ts +33 -1
- package/src/change-set-graph.ts +7 -1
- package/src/change-set.ts +6 -3
- package/src/ci-agent.test.ts +32 -0
- package/src/ci-agent.ts +42 -0
- package/src/ci-comment-allow.test.ts +380 -0
- package/src/ci-comment-allow.ts +184 -0
- package/src/ci-comment-commands.ts +25 -0
- package/src/ci-control.ts +42 -0
- package/src/ci-product.ts +3 -0
- package/src/cli/commands/audit-parser-notice.test.ts +74 -0
- package/src/cli/commands/audit.test.ts +12 -0
- package/src/cli/commands/audit.ts +25 -7
- package/src/cli/commands/import-layout.test.ts +2 -1
- package/src/cli/commands/import.ts +29 -6
- package/src/cli/handlers/agent.ts +13 -2
- package/src/cli/handlers/pr-before-merge.test.ts +18 -0
- package/src/cli/handlers/pr-comment.ts +12 -0
- package/src/cli/handlers/promote.test.ts +68 -0
- package/src/cli/handlers/promote.ts +52 -6
- package/src/cli/main.test.ts +5 -0
- package/src/cli/main.ts +29 -6
- package/src/cli/parse-args.ts +18 -0
- package/src/cli/registry.ts +8 -0
- package/src/cloud-lister/kubernetes.k3d.e2e.test.ts +104 -0
- package/src/cloud-lister/mask-references.test.ts +132 -0
- package/src/cloud-lister/mask.ts +68 -3
- package/src/components/driver.ts +9 -1
- package/src/components/product-pipeline.ts +57 -7
- package/src/components/product-plan.ts +27 -2
- package/src/control/applied.ts +33 -3
- package/src/control/dispatch.ts +156 -5
- package/src/control/train.test.ts +215 -0
- package/src/control/train.ts +413 -0
- package/src/deep-observation.ts +2 -2
- package/src/floor-table.data.ts +7 -1
- package/src/graph-detail.ts +37 -12
- package/src/graph-refs.test.ts +45 -1
- package/src/graph-refs.ts +321 -14
- package/src/lint/post-synth.ts +20 -0
- package/src/lint/rules/declarable-naming-convention.test.ts +35 -1
- package/src/lint/rules/declarable-naming-convention.ts +35 -8
- package/src/lint/rules/imported-source.test.ts +22 -0
- package/src/lint/rules/imported-source.ts +31 -0
- package/src/lint/rules/no-unused-declarable.test.ts +16 -0
- package/src/lint/rules/no-unused-declarable.ts +7 -0
- package/src/op/gate.ts +10 -2
- package/src/pr-forge-reads.ts +62 -0
- package/src/reconcile.ts +9 -0
- package/src/release-floors.ts +14 -2
- package/src/repo-path.test.ts +72 -0
- package/src/repo-path.ts +103 -0
- package/src/sensitive-key.ts +38 -0
- package/src/terraform/hcl2json.ts +8 -0
- package/src/workspace/application-set.e2e.test.ts +405 -0
- package/src/workspace/catalog-edges.ts +507 -0
- package/src/workspace/ci-green-workflow.test.ts +2 -2
- package/src/workspace/cluster-join.e2e.test.ts +150 -0
- package/src/workspace/compose-graph.ts +74 -5
- package/src/workspace/declaration.schema.json +6 -0
- package/src/workspace/declaration.ts +3 -0
- package/src/workspace/discover.e2e.test.ts +122 -0
- package/src/workspace/discover.test.ts +225 -0
- package/src/workspace/discover.ts +406 -0
- package/src/workspace/drift-reader.test.ts +3 -3
- package/src/workspace/external-secret-catalog.e2e.test.ts +98 -0
- package/src/workspace/external-secret-catalog.test.ts +142 -0
- package/src/workspace/graph-cli.ts +207 -21
- package/src/workspace/graph-contract.test.ts +92 -0
- package/src/workspace/graph.schema.json +195 -2
- package/src/workspace/helm-references.e2e.test.ts +135 -0
- package/src/workspace/identity-annotation-catalog.e2e.test.ts +91 -0
- package/src/workspace/identity-annotation-catalog.test.ts +139 -0
- package/src/workspace/release-train-repos.test.ts +304 -0
- package/src/workspace/release-train.test.ts +296 -0
- package/src/workspace/release-train.ts +631 -16
- package/src/workspace/repo-ref.ts +26 -1
- package/src/workspace/runs-on.test.ts +45 -0
- package/src/workspace/workspace-gates.ts +48 -5
- package/src/workspace/workspace-ledger.ts +28 -5
- package/src/workspace/workspace-run.test.ts +1 -1
- package/src/workspace/workspace-run.ts +2 -2
- package/src/yaml.test.ts +96 -8
- package/src/yaml.ts +36 -8
|
@@ -42,4 +42,18 @@ export type RepoFetch = {
|
|
|
42
42
|
* Never throws; a failure says why.
|
|
43
43
|
*/
|
|
44
44
|
export declare function fetchRepoAt(ref: RepoRef, workspaceRoot: string, env?: NodeJS.ProcessEnv): RepoFetch;
|
|
45
|
+
/**
|
|
46
|
+
* Bring the repository's `chant/lifecycle` into the cache clone (#5119), so
|
|
47
|
+
* `chant release list` in a revision's worktree there reads that
|
|
48
|
+
* repository's releases. The ledger moves on its own, apart from the pinned
|
|
49
|
+
* revision, so it is fetched again on every call, forced, and only that
|
|
50
|
+
* branch. Run after {@link fetchRepoAt}, which makes the clone. Never
|
|
51
|
+
* throws; a failure says why.
|
|
52
|
+
*/
|
|
53
|
+
export declare function fetchRepoLifecycle(ref: RepoRef, workspaceRoot: string, env?: NodeJS.ProcessEnv): {
|
|
54
|
+
ok: true;
|
|
55
|
+
} | {
|
|
56
|
+
ok: false;
|
|
57
|
+
message: string;
|
|
58
|
+
};
|
|
45
59
|
//# sourceMappingURL=repo-ref.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"repo-ref.d.ts","sourceRoot":"","sources":["../../src/workspace/repo-ref.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;GAgBG;AASH,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,eAAe,CAAC;AAE7C,yGAAyG;AACzG,wBAAgB,SAAS,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,CAW7C;AAED;;;;GAIG;AACH,wBAAgB,YAAY,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,GAAG,IAAI,CAOvD;AAED,wGAAwG;AACxG,wBAAgB,YAAY,CAAC,GAAG,GAAE,MAAM,CAAC,UAAwB,GAAG,MAAM,CAGzE;AAED,qHAAqH;AACrH,wBAAgB,QAAQ,CAAC,GAAG,EAAE,MAAM,EAAE,aAAa,EAAE,MAAM,GAAG,MAAM,CAInE;AAED,MAAM,MAAM,SAAS,GAAG;IAAE,EAAE,EAAE,IAAI,CAAC;IAAC,GAAG,EAAE,MAAM,CAAC;IAAC,QAAQ,EAAE,MAAM,CAAA;CAAE,GAAG;IAAE,EAAE,EAAE,KAAK,CAAC;IAAC,OAAO,EAAE,MAAM,CAAA;CAAE,CAAC;
|
|
1
|
+
{"version":3,"file":"repo-ref.d.ts","sourceRoot":"","sources":["../../src/workspace/repo-ref.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;GAgBG;AASH,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,eAAe,CAAC;AAE7C,yGAAyG;AACzG,wBAAgB,SAAS,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,CAW7C;AAED;;;;GAIG;AACH,wBAAgB,YAAY,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,GAAG,IAAI,CAOvD;AAED,wGAAwG;AACxG,wBAAgB,YAAY,CAAC,GAAG,GAAE,MAAM,CAAC,UAAwB,GAAG,MAAM,CAGzE;AAED,qHAAqH;AACrH,wBAAgB,QAAQ,CAAC,GAAG,EAAE,MAAM,EAAE,aAAa,EAAE,MAAM,GAAG,MAAM,CAInE;AAED,MAAM,MAAM,SAAS,GAAG;IAAE,EAAE,EAAE,IAAI,CAAC;IAAC,GAAG,EAAE,MAAM,CAAC;IAAC,QAAQ,EAAE,MAAM,CAAA;CAAE,GAAG;IAAE,EAAE,EAAE,KAAK,CAAC;IAAC,OAAO,EAAE,MAAM,CAAA;CAAE,CAAC;AAmBrG;;;;GAIG;AACH,wBAAgB,WAAW,CAAC,GAAG,EAAE,OAAO,EAAE,aAAa,EAAE,MAAM,EAAE,GAAG,GAAE,MAAM,CAAC,UAAwB,GAAG,SAAS,CAyBhH;AAKD;;;;;;;GAOG;AACH,wBAAgB,kBAAkB,CAAC,GAAG,EAAE,OAAO,EAAE,aAAa,EAAE,MAAM,EAAE,GAAG,GAAE,MAAM,CAAC,UAAwB,GAAG;IAAE,EAAE,EAAE,IAAI,CAAA;CAAE,GAAG;IAAE,EAAE,EAAE,KAAK,CAAC;IAAC,OAAO,EAAE,MAAM,CAAA;CAAE,CAO3J"}
|
|
@@ -66,6 +66,10 @@ export function fetchUrl(url, workspaceRoot) {
|
|
|
66
66
|
return resolve(workspaceRoot, url);
|
|
67
67
|
}
|
|
68
68
|
const GIT_ENV = { ...process.env, GIT_TERMINAL_PROMPT: "0" };
|
|
69
|
+
/** The cache clone of one URL, as git is handed it. */
|
|
70
|
+
function cloneDirOf(url, env) {
|
|
71
|
+
return join(repoCacheDir(env), createHash("sha256").update(url).digest("hex").slice(0, 24));
|
|
72
|
+
}
|
|
69
73
|
function git(args, cwd) {
|
|
70
74
|
try {
|
|
71
75
|
const out = execFileSync("git", args, { cwd, encoding: "utf-8", env: GIT_ENV, stdio: ["ignore", "pipe", "pipe"], timeout: 120000 });
|
|
@@ -85,7 +89,7 @@ export function fetchRepoAt(ref, workspaceRoot, env = process.env) {
|
|
|
85
89
|
if (urlCredential(ref.url))
|
|
86
90
|
return { ok: false, message: `the repo url carries a credential, which chant refuses to use (WSP016)` };
|
|
87
91
|
const url = fetchUrl(ref.url, workspaceRoot);
|
|
88
|
-
const clone =
|
|
92
|
+
const clone = cloneDirOf(url, env);
|
|
89
93
|
const worktree = join(clone, "at", ref.rev);
|
|
90
94
|
const dir = ref.workspace === "." ? worktree : join(worktree, ...ref.workspace.split("/"));
|
|
91
95
|
if (existsSync(join(worktree, ".git")))
|
|
@@ -112,3 +116,24 @@ export function fetchRepoAt(ref, workspaceRoot, env = process.env) {
|
|
|
112
116
|
return { ok: false, message: `could not check out ${ref.rev} in the cache: ${add.out}` };
|
|
113
117
|
return { ok: true, dir, worktree };
|
|
114
118
|
}
|
|
119
|
+
/** The ledger branch a repository's releases are read from. */
|
|
120
|
+
const LIFECYCLE_BRANCH = "refs/heads/chant/lifecycle";
|
|
121
|
+
/**
|
|
122
|
+
* Bring the repository's `chant/lifecycle` into the cache clone (#5119), so
|
|
123
|
+
* `chant release list` in a revision's worktree there reads that
|
|
124
|
+
* repository's releases. The ledger moves on its own, apart from the pinned
|
|
125
|
+
* revision, so it is fetched again on every call, forced, and only that
|
|
126
|
+
* branch. Run after {@link fetchRepoAt}, which makes the clone. Never
|
|
127
|
+
* throws; a failure says why.
|
|
128
|
+
*/
|
|
129
|
+
export function fetchRepoLifecycle(ref, workspaceRoot, env = process.env) {
|
|
130
|
+
if (urlCredential(ref.url))
|
|
131
|
+
return { ok: false, message: `the repo url carries a credential, which chant refuses to use (WSP016)` };
|
|
132
|
+
const clone = cloneDirOf(fetchUrl(ref.url, workspaceRoot), env);
|
|
133
|
+
if (!existsSync(join(clone, ".git")))
|
|
134
|
+
return { ok: false, message: `${redactUrl(ref.url)} has no cache clone yet` };
|
|
135
|
+
const got = git(["-C", clone, "fetch", "-q", "--no-tags", "origin", `+${LIFECYCLE_BRANCH}:${LIFECYCLE_BRANCH}`]);
|
|
136
|
+
if (!got.ok)
|
|
137
|
+
return { ok: false, message: `could not fetch chant/lifecycle from ${redactUrl(ref.url)}: ${got.out}` };
|
|
138
|
+
return { ok: true };
|
|
139
|
+
}
|
|
@@ -19,6 +19,12 @@
|
|
|
19
19
|
* `acceptWorkspaceGates: true`. A declaration read only from the working
|
|
20
20
|
* tree never opts a member in.
|
|
21
21
|
*
|
|
22
|
+
* A release train's promote (`chant workspace train promote --gate`, #4037)
|
|
23
|
+
* gathers each member's release gates before any member deploys: a cover
|
|
24
|
+
* then also names the member's `releaseDigest`, and its `planDigest` is the
|
|
25
|
+
* member's change set for the environment. The member's promote, started
|
|
26
|
+
* under the gate, asks the same rule from the release gate.
|
|
27
|
+
*
|
|
22
28
|
* A member run started under the gate (`CHANT_WORKSPACE_GATE`) asks this
|
|
23
29
|
* module through `GateCheckInput.workspace` after its own approvals have
|
|
24
30
|
* not passed the gate. Nothing is written to the member's gate ledger: the
|
|
@@ -33,6 +39,18 @@ export interface WorkspaceGateCover {
|
|
|
33
39
|
planDigest: string;
|
|
34
40
|
/** The member gate's environment, when it is bound to one. */
|
|
35
41
|
environment?: string;
|
|
42
|
+
/**
|
|
43
|
+
* The release a member's release gate binds (#4037): set on the covers a
|
|
44
|
+
* release train's promote gathers, whose `planDigest` is that member's
|
|
45
|
+
* change set for the environment. A cover with it stands in only for a
|
|
46
|
+
* gate bound to the same release.
|
|
47
|
+
*/
|
|
48
|
+
releaseDigest?: string;
|
|
49
|
+
}
|
|
50
|
+
/** The release train a workspace gate's fact was gathered for (#4037). */
|
|
51
|
+
export interface WorkspaceGateTrain {
|
|
52
|
+
id: string;
|
|
53
|
+
digest: string;
|
|
36
54
|
}
|
|
37
55
|
export interface WorkspaceGatePending {
|
|
38
56
|
version: 1;
|
|
@@ -43,6 +61,8 @@ export interface WorkspaceGatePending {
|
|
|
43
61
|
timestamp: string;
|
|
44
62
|
digest: string;
|
|
45
63
|
covers: WorkspaceGateCover[];
|
|
64
|
+
/** The train `chant workspace train promote --gate` gathered the covers for, or absent. */
|
|
65
|
+
train?: WorkspaceGateTrain;
|
|
46
66
|
}
|
|
47
67
|
export interface WorkspaceGateApproval {
|
|
48
68
|
version: 1;
|
|
@@ -53,6 +73,8 @@ export interface WorkspaceGateApproval {
|
|
|
53
73
|
approvedBy: string;
|
|
54
74
|
timestamp: string;
|
|
55
75
|
note?: string;
|
|
76
|
+
/** Copied from the pending fact it approves. */
|
|
77
|
+
train?: WorkspaceGateTrain;
|
|
56
78
|
}
|
|
57
79
|
export type WorkspaceGateLine = WorkspaceGatePending | WorkspaceGateApproval;
|
|
58
80
|
/** Covers in one order, so the same set always has the same digest. */
|
|
@@ -65,6 +87,8 @@ export interface MemberGateQuery {
|
|
|
65
87
|
gate: string;
|
|
66
88
|
planDigest: string;
|
|
67
89
|
environment?: string;
|
|
90
|
+
/** Set on a release gate (#4037). */
|
|
91
|
+
releaseDigest?: string;
|
|
68
92
|
}
|
|
69
93
|
/**
|
|
70
94
|
* The rule of ws-039, pure: the newest approval that stands in for the
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"workspace-gates.d.ts","sourceRoot":"","sources":["../../src/workspace/workspace-gates.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"workspace-gates.d.ts","sourceRoot":"","sources":["../../src/workspace/workspace-gates.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA+BG;AAIH,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,YAAY,CAAC;AAGrD,+CAA+C;AAC/C,MAAM,WAAW,kBAAkB;IACjC,MAAM,EAAE,MAAM,CAAC;IACf,EAAE,EAAE,MAAM,CAAC;IACX,IAAI,EAAE,MAAM,CAAC;IACb,UAAU,EAAE,MAAM,CAAC;IACnB,8DAA8D;IAC9D,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB;;;;;OAKG;IACH,aAAa,CAAC,EAAE,MAAM,CAAC;CACxB;AAED,0EAA0E;AAC1E,MAAM,WAAW,kBAAkB;IACjC,EAAE,EAAE,MAAM,CAAC;IACX,MAAM,EAAE,MAAM,CAAC;CAChB;AAED,MAAM,WAAW,oBAAoB;IACnC,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true`. A declaration read only from the working
|
|
20
20
|
* tree never opts a member in.
|
|
21
21
|
*
|
|
22
|
+
* A release train's promote (`chant workspace train promote --gate`, #4037)
|
|
23
|
+
* gathers each member's release gates before any member deploys: a cover
|
|
24
|
+
* then also names the member's `releaseDigest`, and its `planDigest` is the
|
|
25
|
+
* member's change set for the environment. The member's promote, started
|
|
26
|
+
* under the gate, asks the same rule from the release gate.
|
|
27
|
+
*
|
|
22
28
|
* A member run started under the gate (`CHANT_WORKSPACE_GATE`) asks this
|
|
23
29
|
* module through `GateCheckInput.workspace` after its own approvals have
|
|
24
30
|
* not passed the gate. Nothing is written to the member's gate ledger: the
|
|
@@ -29,9 +35,16 @@ import { resolveMemberLedger } from "../lifecycle/member-ledger.js";
|
|
|
29
35
|
import { appendWorkspaceLine, canonicalDigest, readWorkspaceLines, WORKSPACE_GATES_DIR } from "./workspace-ledger.js";
|
|
30
36
|
/** Covers in one order, so the same set always has the same digest. */
|
|
31
37
|
export function sortCovers(covers) {
|
|
32
|
-
const key = (c) => `${c.member}\u0000${c.op}\u0000${c.gate}\u0000${c.environment ?? ""}\u0000${c.planDigest}`;
|
|
38
|
+
const key = (c) => `${c.member}\u0000${c.op}\u0000${c.gate}\u0000${c.environment ?? ""}\u0000${c.planDigest}\u0000${c.releaseDigest ?? ""}`;
|
|
33
39
|
return [...covers]
|
|
34
|
-
.map((c) => ({
|
|
40
|
+
.map((c) => ({
|
|
41
|
+
member: c.member,
|
|
42
|
+
op: c.op,
|
|
43
|
+
gate: c.gate,
|
|
44
|
+
planDigest: c.planDigest,
|
|
45
|
+
...(c.environment !== undefined ? { environment: c.environment } : {}),
|
|
46
|
+
...(c.releaseDigest !== undefined ? { releaseDigest: c.releaseDigest } : {}),
|
|
47
|
+
}))
|
|
35
48
|
.sort((a, b) => (key(a) < key(b) ? -1 : key(a) > key(b) ? 1 : 0));
|
|
36
49
|
}
|
|
37
50
|
/** The digest a workspace gate's pending fact and approval carry: the member plans it covers. */
|
|
@@ -50,7 +63,8 @@ export function workspaceGateStandsIn(q, ctx) {
|
|
|
50
63
|
workspaceGateDigest(a.covers) === a.digest &&
|
|
51
64
|
a.covers.some((c) => c.member === ctx.member && c.op === q.op && c.gate === q.gate &&
|
|
52
65
|
samePlanDigest(c.planDigest, q.planDigest) &&
|
|
53
|
-
(c.environment ?? null) === (q.environment ?? null)
|
|
66
|
+
(c.environment ?? null) === (q.environment ?? null) &&
|
|
67
|
+
(c.releaseDigest ?? null) === (q.releaseDigest ?? null)));
|
|
54
68
|
return covering.sort((a, b) => (a.timestamp < b.timestamp ? -1 : a.timestamp > b.timestamp ? 1 : 0)).at(-1) ?? null;
|
|
55
69
|
}
|
|
56
70
|
const fileFor = (gate) => `${gate}.jsonl`;
|
|
@@ -81,7 +95,16 @@ export async function readWorkspaceGate(cwd, gate) {
|
|
|
81
95
|
}
|
|
82
96
|
export async function appendWorkspaceGatePending(cwd, input) {
|
|
83
97
|
const covers = sortCovers(input.covers);
|
|
84
|
-
const record = {
|
|
98
|
+
const record = {
|
|
99
|
+
version: 1,
|
|
100
|
+
kind: "pending",
|
|
101
|
+
gate: input.gate,
|
|
102
|
+
run: input.run,
|
|
103
|
+
timestamp: input.timestamp,
|
|
104
|
+
digest: workspaceGateDigest(covers),
|
|
105
|
+
covers,
|
|
106
|
+
...(input.train ? { train: input.train } : {}),
|
|
107
|
+
};
|
|
85
108
|
await appendWorkspaceLine(cwd, WORKSPACE_GATES_DIR, fileFor(input.gate), record, `Workspace gate pending: ${input.gate}`);
|
|
86
109
|
return record;
|
|
87
110
|
}
|
|
@@ -96,7 +119,7 @@ export async function approveWorkspaceGate(cwd, input) {
|
|
|
96
119
|
const fact = candidates.at(-1);
|
|
97
120
|
if (!fact) {
|
|
98
121
|
throw new Error(input.digest === undefined
|
|
99
|
-
? `workspace gate "${input.gate}" has no pending fact to approve; a chant workspace run --gate ${input.gate} whose members stop at their gates records one`
|
|
122
|
+
? `workspace gate "${input.gate}" has no pending fact to approve; a chant workspace run --gate ${input.gate} whose members stop at their gates records one, as does a chant workspace train promote --gate ${input.gate}`
|
|
100
123
|
: `workspace gate "${input.gate}" has no pending fact with digest ${input.digest}`);
|
|
101
124
|
}
|
|
102
125
|
const record = {
|
|
@@ -108,6 +131,7 @@ export async function approveWorkspaceGate(cwd, input) {
|
|
|
108
131
|
approvedBy: input.approvedBy,
|
|
109
132
|
timestamp: input.timestamp,
|
|
110
133
|
...(input.note ? { note: input.note } : {}),
|
|
134
|
+
...(fact.train ? { train: fact.train } : {}),
|
|
111
135
|
};
|
|
112
136
|
await appendWorkspaceLine(cwd, WORKSPACE_GATES_DIR, fileFor(input.gate), record, `Workspace gate approval: ${input.gate}`);
|
|
113
137
|
return record;
|
|
@@ -13,7 +13,8 @@
|
|
|
13
13
|
* Each names the member plans it covers and their digest
|
|
14
14
|
* (`./workspace-gates.ts`).
|
|
15
15
|
* - `<env>/trains.jsonl`: release trains, each pinning one release of every
|
|
16
|
-
* `chant` member (`./release-train.ts`).
|
|
16
|
+
* `chant` member, with a digest over those releases (`./release-train.ts`).
|
|
17
|
+
* A train's promote is a run in `<env>/runs.jsonl` that names the train.
|
|
17
18
|
*
|
|
18
19
|
* A malformed line is skipped and counted, never thrown on.
|
|
19
20
|
*/
|
|
@@ -33,8 +34,12 @@ export declare function readWorkspaceLines<T>(cwd: string, dir: string, file: st
|
|
|
33
34
|
}>;
|
|
34
35
|
/** `sha256:<hex>` over a value's canonical JSON (keys sorted). */
|
|
35
36
|
export declare function canonicalDigest(value: unknown): string;
|
|
36
|
-
/**
|
|
37
|
-
|
|
37
|
+
/**
|
|
38
|
+
* How one `<member>/<op>` step of a workspace run ended. `dispatched` is a
|
|
39
|
+
* step of a train's promote across repositories (#5119) whose member
|
|
40
|
+
* repository was dispatched and has not answered yet.
|
|
41
|
+
*/
|
|
42
|
+
export type WorkspaceStepStatus = "ok" | "fail" | "gated" | "not-run" | "dispatched";
|
|
38
43
|
export interface WorkspaceRunStep {
|
|
39
44
|
/** `<member>/<op>`. */
|
|
40
45
|
target: string;
|
|
@@ -52,14 +57,26 @@ export interface WorkspaceRunStep {
|
|
|
52
57
|
planDigest: string | null;
|
|
53
58
|
environment: string | null;
|
|
54
59
|
};
|
|
60
|
+
/** For a step run in another repository (#5119): that repository's URL. */
|
|
61
|
+
repo?: string;
|
|
62
|
+
/** For a step run in another repository: what its applied dispatch said, once it answered. */
|
|
63
|
+
outcome?: string;
|
|
64
|
+
/** For a step run in another repository: a step that did not pass, in a sentence. */
|
|
65
|
+
reason?: string;
|
|
55
66
|
}
|
|
56
67
|
export interface WorkspaceRunRecord {
|
|
57
68
|
version: 1;
|
|
58
69
|
id: string;
|
|
59
70
|
started: string;
|
|
60
71
|
ended: string;
|
|
61
|
-
/**
|
|
62
|
-
|
|
72
|
+
/**
|
|
73
|
+
* `gated` when a step stopped at a gate; `fail` when a step failed. A run
|
|
74
|
+
* stops at the first step that does not pass. `dispatched` is a train's
|
|
75
|
+
* promote across repositories (#5119) waiting on a member repository's
|
|
76
|
+
* answer: it is appended again, under the same id, as each member answers,
|
|
77
|
+
* and the newest line of an id is the run.
|
|
78
|
+
*/
|
|
79
|
+
status: "ok" | "fail" | "gated" | "dispatched";
|
|
63
80
|
/** `--env`, or null. */
|
|
64
81
|
env: string | null;
|
|
65
82
|
/** The workspace gate the run was started under (`--gate`), or null. */
|
|
@@ -67,6 +84,15 @@ export interface WorkspaceRunRecord {
|
|
|
67
84
|
/** `--dependents-of`, the member whose dependents the run ran, or null. */
|
|
68
85
|
dependentsOf: string | null;
|
|
69
86
|
steps: WorkspaceRunStep[];
|
|
87
|
+
/**
|
|
88
|
+
* The release train the run promoted (#4037), by id and digest: a run of
|
|
89
|
+
* `chant workspace train promote`, whose steps are each member's
|
|
90
|
+
* `components promote` of its release in the train. Absent on every other run.
|
|
91
|
+
*/
|
|
92
|
+
train?: {
|
|
93
|
+
id: string;
|
|
94
|
+
digest: string;
|
|
95
|
+
};
|
|
70
96
|
}
|
|
71
97
|
export declare function appendWorkspaceRun(cwd: string, record: WorkspaceRunRecord): Promise<string>;
|
|
72
98
|
export declare function readWorkspaceRuns(cwd: string, env?: string): Promise<{
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"workspace-ledger.d.ts","sourceRoot":"","sources":["../../src/workspace/workspace-ledger.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"workspace-ledger.d.ts","sourceRoot":"","sources":["../../src/workspace/workspace-ledger.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;GAmBG;AAOH,sEAAsE;AACtE,eAAO,MAAM,qBAAqB,eAAe,CAAC;AAClD,mDAAmD;AACnD,eAAO,MAAM,uBAAuB,yBAA6C,CAAC;AAClF,8FAA8F;AAC9F,eAAO,MAAM,qBAAqB,UAAU,CAAC;AAC7C,eAAO,MAAM,mBAAmB,WAAW,CAAC;AAQ5C,4FAA4F;AAC5F,wBAAsB,mBAAmB,CAAC,GAAG,EAAE,MAAM,EAAE,GAAG,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,EAAE,KAAK,EAAE,OAAO,EAAE,OAAO,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC,CAelI;AAED,2EAA2E;AAC3E,wBAAsB,kBAAkB,CAAC,CAAC,EAAE,GAAG,EAAE,MAAM,EAAE,GAAG,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,EAAE,MAAM,EAAE,CAAC,CAAC,EAAE,OAAO,KAAK,CAAC,IAAI,CAAC,GAAG,OAAO,CAAC;IAAE,OAAO,EAAE,CAAC,EAAE,CAAC;IAAC,SAAS,EAAE,MAAM,CAAA;CAAE,CAAC,CAgBhK;AAED,kEAAkE;AAClE,wBAAgB,eAAe,CAAC,KAAK,EAAE,OAAO,GAAG,MAAM,CAEtD;AAID;;;;GAIG;AACH,MAAM,MAAM,mBAAmB,GAAG,IAAI,GAAG,MAAM,GAAG,OAAO,GAAG,SAAS,GAAG,YAAY,CAAC;AAErF,MAAM,WAAW,gBAAgB;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,GAAG,OAAO,CAAC,MAAM,CAAC,CAEjG;AAED,wBAAsB,iBAAiB,CAAC,GAAG,EAAE,MAAM,EAAE,GAAG,GAAE,MAA8B,GAAG,OAAO,CAAC;IAAE,OAAO,EAAE,kBAAkB,EAAE,CAAC;IAAC,SAAS,EAAE,MAAM,CAAA;CAAE,CAAC,CAEvJ"}
|
|
@@ -13,7 +13,8 @@
|
|
|
13
13
|
* Each names the member plans it covers and their digest
|
|
14
14
|
* (`./workspace-gates.ts`).
|
|
15
15
|
* - `<env>/trains.jsonl`: release trains, each pinning one release of every
|
|
16
|
-
* `chant` member (`./release-train.ts`).
|
|
16
|
+
* `chant` member, with a digest over those releases (`./release-train.ts`).
|
|
17
|
+
* A train's promote is a run in `<env>/runs.jsonl` that names the train.
|
|
17
18
|
*
|
|
18
19
|
* A malformed line is skipped and counted, never thrown on.
|
|
19
20
|
*/
|
|
@@ -106,6 +106,20 @@ export type WorkspaceRunOutcome = {
|
|
|
106
106
|
pending: WorkspaceGatePending | null;
|
|
107
107
|
ledgerError: string | null;
|
|
108
108
|
};
|
|
109
|
+
export declare function defaultReadGraph(cwd: string): Promise<{
|
|
110
|
+
graph: WorkspaceGraph;
|
|
111
|
+
failed: boolean;
|
|
112
|
+
} | {
|
|
113
|
+
error: string;
|
|
114
|
+
}>;
|
|
115
|
+
/**
|
|
116
|
+
* Run one member's `chant run`, under the member's own toolchain (the one
|
|
117
|
+
* `chant workspace graph` reads it with), from inside its directory.
|
|
118
|
+
*/
|
|
119
|
+
export declare function defaultRunMember(cwd: string, member: {
|
|
120
|
+
name: string;
|
|
121
|
+
dir: string;
|
|
122
|
+
}, argv: string[], env: Record<string, string>): Promise<MemberOpResult>;
|
|
109
123
|
/** Plan and, unless `dryRun`, run a workspace run. Throws a {@link WorkspaceReadError} when the declaration can't be read. */
|
|
110
124
|
export declare function workspaceRun(query: WorkspaceRunQuery): Promise<WorkspaceRunOutcome>;
|
|
111
125
|
export declare function runWorkspaceRun(ctx: CommandContext):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B,CAAC,CAkGzF;AAQD,wBAAsB,eAAe,CAAC,GAAG,EAAE,cAAc,GAAG,OAAO,CAAC,MAAM,CAAC,CAuE1E"}
|
|
@@ -151,7 +151,7 @@ export function orderTargets(targets, links) {
|
|
|
151
151
|
}
|
|
152
152
|
return placed.flatMap((m) => targets.filter((t) => t.member === m));
|
|
153
153
|
}
|
|
154
|
-
async function defaultReadGraph(cwd) {
|
|
154
|
+
export async function defaultReadGraph(cwd) {
|
|
155
155
|
const { workspaceGraph } = await import("./graph-cli.js");
|
|
156
156
|
const { doc, failed } = await workspaceGraph({ cwd, onStderr: (t) => process.stderr.write(t) });
|
|
157
157
|
if ("error" in doc)
|
|
@@ -162,7 +162,7 @@ async function defaultReadGraph(cwd) {
|
|
|
162
162
|
* Run one member's `chant run`, under the member's own toolchain (the one
|
|
163
163
|
* `chant workspace graph` reads it with), from inside its directory.
|
|
164
164
|
*/
|
|
165
|
-
async function defaultRunMember(cwd, member, argv, env) {
|
|
165
|
+
export async function defaultRunMember(cwd, member, argv, env) {
|
|
166
166
|
const located = locateWorkspace(cwd);
|
|
167
167
|
const declaration = readDeclaration(located.tree, "", { rootChant: true });
|
|
168
168
|
const { registry: kinds } = loadKindRegistry(declaration.pins, located.rootOnDisk);
|
package/dist/yaml.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"yaml.d.ts","sourceRoot":"","sources":["../src/yaml.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;
|
|
1
|
+
{"version":3,"file":"yaml.d.ts","sourceRoot":"","sources":["../src/yaml.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AA6CH,wBAAgB,QAAQ,CAAC,KAAK,EAAE,OAAO,EAAE,MAAM,EAAE,MAAM,GAAG,MAAM,CA8I/D;AAED;;;;;GAKG;AACH,wBAAgB,aAAa,CAAC,GAAG,EAAE,MAAM,EAAE,KAAK,EAAE,OAAO,EAAE,MAAM,SAAI,GAAG,MAAM,CAG7E;AAMD;;;GAGG;AACH,qBAAa,cAAe,SAAQ,KAAK;IACvC,gEAAgE;IAChE,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IAEtB,YAAY,IAAI,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,EAIxC;CACF;AAmID;;;;;;;GAOG;AACH,wBAAgB,SAAS,CAAC,OAAO,EAAE,MAAM,GAAG,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAQlE;AAED;;;;GAIG;AACH,wBAAgB,iBAAiB,CAAC,OAAO,EAAE,MAAM,GAAG,OAAO,CAO1D;AAED;;;;;;GAMG;AACH,wBAAgB,kBAAkB,CAAC,OAAO,EAAE,MAAM,GAAG,MAAM,EAAE,CAc5D;AAED;;GAEG;AACH,wBAAgB,WAAW,CAAC,KAAK,EAAE,MAAM,GAAG,OAAO,CAwBlD"}
|
package/dist/yaml.js
CHANGED
|
@@ -30,6 +30,10 @@ import { FLOAT_TYPE, INT_TYPE, load, MAP_TYPE, NULL_TYPE, SEQ_TYPE, STR_TYPE, YA
|
|
|
30
30
|
function definedEntries(obj) {
|
|
31
31
|
return Object.entries(obj).filter(([, val]) => val !== undefined);
|
|
32
32
|
}
|
|
33
|
+
/** A double-quoted scalar. JSON escapes are YAML escapes; the characters JSON leaves raw are escaped too. */
|
|
34
|
+
function doubleQuote(value) {
|
|
35
|
+
return JSON.stringify(value).replace(/[\x7f\x85\u2028\u2029\ufeff]/g, (c) => `\\u${c.charCodeAt(0).toString(16).padStart(4, "0")}`);
|
|
36
|
+
}
|
|
33
37
|
export function emitYAML(value, indent) {
|
|
34
38
|
const prefix = " ".repeat(indent);
|
|
35
39
|
// `undefined` only reaches here as a top-level value or an array element —
|
|
@@ -47,20 +51,33 @@ export function emitYAML(value, indent) {
|
|
|
47
51
|
return String(value);
|
|
48
52
|
}
|
|
49
53
|
if (typeof value === "string") {
|
|
50
|
-
// Multiline strings use YAML literal block scalar
|
|
54
|
+
// Multiline strings use a YAML literal block scalar. The chomping
|
|
55
|
+
// indicator carries the string's own ending (#5073): `|-` when it has no
|
|
56
|
+
// final newline, `|` for exactly one, `|+` for more.
|
|
51
57
|
if (value.includes("\n")) {
|
|
52
|
-
const
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
58
|
+
const body = value.replace(/\n+$/, "");
|
|
59
|
+
const finalNewlines = value.length - body.length;
|
|
60
|
+
// Text a literal block cannot carry faithfully (a string of only
|
|
61
|
+
// newlines, carriage returns, control characters, the Unicode line
|
|
62
|
+
// separators) is written double-quoted instead.
|
|
63
|
+
if (body.trim() === "" || /[\r\x00-\x08\x0b\x0c\x0e-\x1f\x7f\x85\u2028\u2029\ufeff]/.test(value)) {
|
|
64
|
+
return doubleQuote(value);
|
|
65
|
+
}
|
|
66
|
+
const chomp = finalNewlines === 0 ? "-" : finalNewlines === 1 ? "" : "+";
|
|
67
|
+
// A first line that starts with a space needs an explicit indentation
|
|
68
|
+
// indicator, relative to the parent node, which is always two columns.
|
|
69
|
+
const firstText = body.split("\n").find((l) => l !== "");
|
|
70
|
+
const indicator = firstText !== undefined && firstText.startsWith(" ") ? "2" : "";
|
|
71
|
+
const lines = body.split("\n");
|
|
72
|
+
for (let i = 1; i < finalNewlines; i++)
|
|
73
|
+
lines.push("");
|
|
74
|
+
return `|${indicator}${chomp}\n` + lines.map((l) => `${prefix}${l}`).join("\n");
|
|
56
75
|
}
|
|
57
76
|
// Quote strings that could be misinterpreted
|
|
58
77
|
if (value === "" ||
|
|
59
78
|
value === "true" ||
|
|
60
79
|
value === "false" ||
|
|
61
80
|
value === "null" ||
|
|
62
|
-
value === "yes" ||
|
|
63
|
-
value === "no" ||
|
|
64
81
|
value.includes(": ") ||
|
|
65
82
|
value.includes("#") ||
|
|
66
83
|
value.startsWith("*") ||
|
|
@@ -77,7 +94,15 @@ export function emitYAML(value, indent) {
|
|
|
77
94
|
// whitespace, a signed or dotted number, and the other spellings of
|
|
78
95
|
// booleans, null and the float constants (#3006).
|
|
79
96
|
/^[-?:](?:\s|$)|^[,\]}|>%@`]|:$|^\s|\s$|^[-+.]\d/.test(value) ||
|
|
80
|
-
/^(?:true|false|null|~|
|
|
97
|
+
/^(?:true|false|null|~|[-+]?\.(?:inf|nan))$/i.test(value) ||
|
|
98
|
+
// YAML 1.1 reads these as other types: its booleans `y`, `n`, `yes`,
|
|
99
|
+
// `no`, `on` and `off` in any case, the value indicator `=` (which a 1.1
|
|
100
|
+
// parser refuses outright), and the merge key `<<` (#5074). Octal-looking
|
|
101
|
+
// and sexagesimal numbers (`0755`, `1:30`) start with a digit and are
|
|
102
|
+
// quoted above.
|
|
103
|
+
/^(?:y|n|yes|no|on|off)$/i.test(value) ||
|
|
104
|
+
value === "=" ||
|
|
105
|
+
value === "<<") {
|
|
81
106
|
// Use single quotes, escaping internal single quotes
|
|
82
107
|
return `'${value.replace(/'/g, "''")}'`;
|
|
83
108
|
}
|
package/package.json
CHANGED
package/src/audit/core.test.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { beforeAll, describe, test, expect } from "vitest";
|
|
2
|
-
import { auditFiles, CROSS_FILE, type AuditInput } from "./core";
|
|
2
|
+
import { auditFiles, CROSS_FILE, describeSkip, parserPackageOf, type AuditInput, type AuditSkip } from "./core";
|
|
3
3
|
import type { PostSynthCheck } from "../lint/post-synth";
|
|
4
4
|
|
|
5
5
|
const ARGO_APP = `apiVersion: argoproj.io/v1alpha1
|
|
@@ -135,6 +135,22 @@ describe("auditFiles", () => {
|
|
|
135
135
|
expect(findings.map((f) => f.file).sort()).toEqual(["a.yml", "b.yml"]);
|
|
136
136
|
});
|
|
137
137
|
|
|
138
|
+
test("hands a check the audited root, and none for a remote tree (#5109)", async () => {
|
|
139
|
+
const seen: Array<{ root?: string } | undefined> = [];
|
|
140
|
+
const probe: PostSynthCheck = {
|
|
141
|
+
id: "PROBE001",
|
|
142
|
+
description: "probe",
|
|
143
|
+
check: (ctx) => {
|
|
144
|
+
seen.push(ctx.audit);
|
|
145
|
+
return [];
|
|
146
|
+
},
|
|
147
|
+
};
|
|
148
|
+
const input: AuditInput[] = [{ path: "a.yml", content: "x", lexicon: "github" }];
|
|
149
|
+
await auditFiles(input, { checksProvider: async () => [probe], root: "/tmp/some-tree" });
|
|
150
|
+
await auditFiles(input, { checksProvider: async () => [probe] });
|
|
151
|
+
expect(seen).toEqual([{ root: "/tmp/some-tree" }, { root: "/tmp/some-tree" }, {}, {}]);
|
|
152
|
+
});
|
|
153
|
+
|
|
138
154
|
test("skips an auditOptIn check unless enabledRules names it (#3190)", async () => {
|
|
139
155
|
const optIn: PostSynthCheck = {
|
|
140
156
|
id: "OPT001",
|
|
@@ -293,3 +309,50 @@ describe("auditFiles", () => {
|
|
|
293
309
|
expect(findings).toEqual([]);
|
|
294
310
|
});
|
|
295
311
|
});
|
|
312
|
+
|
|
313
|
+
describe("a parser that is not installed (#5083)", () => {
|
|
314
|
+
const input = (path: string): AuditInput => ({ path, lexicon: "terraform", content: "resource \"x\" \"y\" {}" });
|
|
315
|
+
const check: PostSynthCheck = { id: "T001", description: "d", check: () => [] };
|
|
316
|
+
const missing = (): never => {
|
|
317
|
+
throw Object.assign(new Error("Cannot find package"), { parserPackage: "@cdktn/hcl2json" });
|
|
318
|
+
};
|
|
319
|
+
|
|
320
|
+
test("records the inputs it could not read, once per package", async () => {
|
|
321
|
+
const skips: AuditSkip[] = [];
|
|
322
|
+
const findings = await auditFiles([input("envs/prod"), input("envs/dev")], {
|
|
323
|
+
checksProvider: async () => [check],
|
|
324
|
+
entitiesProvider: async () => missing,
|
|
325
|
+
skips,
|
|
326
|
+
});
|
|
327
|
+
expect(findings).toEqual([]);
|
|
328
|
+
expect(skips).toEqual([
|
|
329
|
+
{ lexicon: "terraform", reason: "parser-not-installed", package: "@cdktn/hcl2json", install: "npm install -D @cdktn/hcl2json", paths: ["envs/dev", "envs/prod"] },
|
|
330
|
+
]);
|
|
331
|
+
expect(describeSkip(skips[0]!)).toContain("npm install -D @cdktn/hcl2json");
|
|
332
|
+
expect(describeSkip(skips[0]!)).toContain("envs/dev, envs/prod");
|
|
333
|
+
});
|
|
334
|
+
|
|
335
|
+
test("an unparseable file is not a skip", async () => {
|
|
336
|
+
const skips: AuditSkip[] = [];
|
|
337
|
+
await auditFiles([input("a")], {
|
|
338
|
+
checksProvider: async () => [check],
|
|
339
|
+
entitiesProvider: async () => () => {
|
|
340
|
+
throw new Error("syntax error");
|
|
341
|
+
},
|
|
342
|
+
skips,
|
|
343
|
+
});
|
|
344
|
+
expect(skips).toEqual([]);
|
|
345
|
+
});
|
|
346
|
+
|
|
347
|
+
test("an installed parser records nothing", async () => {
|
|
348
|
+
const skips: AuditSkip[] = [];
|
|
349
|
+
await auditFiles([input("a")], { checksProvider: async () => [check], entitiesProvider: async () => () => new Map(), skips });
|
|
350
|
+
expect(skips).toEqual([]);
|
|
351
|
+
});
|
|
352
|
+
|
|
353
|
+
test("parserPackageOf reads only a string property", () => {
|
|
354
|
+
expect(parserPackageOf({ parserPackage: "p" })).toBe("p");
|
|
355
|
+
expect(parserPackageOf({ parserPackage: 3 })).toBeUndefined();
|
|
356
|
+
expect(parserPackageOf(null)).toBeUndefined();
|
|
357
|
+
});
|
|
358
|
+
});
|