@intentius/chant 0.124.84 → 0.124.86
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/bundle-check.d.ts +102 -0
- package/dist/bundle-check.d.ts.map +1 -0
- package/dist/bundle-check.js +310 -0
- package/dist/chant-install.d.ts +100 -0
- package/dist/chant-install.d.ts.map +1 -0
- package/dist/chant-install.js +158 -0
- package/dist/ci-commit.d.ts +19 -6
- package/dist/ci-commit.d.ts.map +1 -1
- package/dist/ci-commit.js +23 -4
- package/dist/ci-evidence-jobs.d.ts +54 -0
- package/dist/ci-evidence-jobs.d.ts.map +1 -0
- package/dist/ci-evidence-jobs.js +55 -0
- package/dist/ci-image.d.ts +274 -0
- package/dist/ci-image.d.ts.map +1 -0
- package/dist/ci-image.js +635 -0
- package/dist/ci-login.d.ts +150 -0
- package/dist/ci-login.d.ts.map +1 -0
- package/dist/ci-login.js +240 -0
- package/dist/ci-product.d.ts +16 -0
- package/dist/ci-product.d.ts.map +1 -1
- package/dist/ci-product.js +17 -0
- package/dist/cli/commands/import-index.js +2 -2
- package/dist/cli/handlers/build.d.ts +8 -0
- package/dist/cli/handlers/build.d.ts.map +1 -1
- package/dist/cli/handlers/build.js +22 -4
- package/dist/cli/handlers/ci-check.d.ts.map +1 -1
- package/dist/cli/handlers/ci-check.js +57 -2
- package/dist/cli/handlers/ci-evidence.d.ts +3 -0
- package/dist/cli/handlers/ci-evidence.d.ts.map +1 -0
- package/dist/cli/handlers/ci-evidence.js +171 -0
- package/dist/cli/handlers/components.js +3 -3
- package/dist/cli/handlers/dead-guards.d.ts +3 -0
- package/dist/cli/handlers/dead-guards.d.ts.map +1 -0
- package/dist/cli/handlers/dead-guards.js +35 -0
- package/dist/cli/handlers/graph.js +4 -4
- package/dist/cli/handlers/lifecycle.d.ts +2 -1
- package/dist/cli/handlers/lifecycle.d.ts.map +1 -1
- package/dist/cli/handlers/lifecycle.js +5 -4
- package/dist/cli/handlers/local-chant.d.ts +16 -0
- package/dist/cli/handlers/local-chant.d.ts.map +1 -0
- package/dist/cli/handlers/local-chant.js +109 -0
- package/dist/cli/handlers/operator.js +2 -2
- package/dist/cli/handlers/search.js +5 -5
- package/dist/cli/main.d.ts.map +1 -1
- package/dist/cli/main.js +38 -0
- package/dist/cli/parse-args.d.ts.map +1 -1
- package/dist/cli/parse-args.js +28 -0
- package/dist/cli/registry.d.ts +16 -0
- package/dist/cli/registry.d.ts.map +1 -1
- package/dist/components/check-hooks.d.ts +49 -0
- package/dist/components/check-hooks.d.ts.map +1 -1
- package/dist/components/check-hooks.js +64 -4
- package/dist/components/check-steps.d.ts +17 -0
- package/dist/components/check-steps.d.ts.map +1 -1
- package/dist/components/check-steps.js +37 -5
- package/dist/components/product-pipeline.d.ts +23 -0
- package/dist/components/product-pipeline.d.ts.map +1 -1
- package/dist/components/product-pipeline.js +6 -2
- package/dist/components/product-plan.d.ts +137 -0
- package/dist/components/product-plan.d.ts.map +1 -0
- package/dist/components/product-plan.js +143 -0
- package/dist/components/release-compile.d.ts.map +1 -1
- package/dist/components/release-compile.js +2 -2
- package/dist/config.d.ts +39 -1
- package/dist/config.d.ts.map +1 -1
- package/dist/config.js +35 -3
- package/dist/dead-guards.d.ts +82 -0
- package/dist/dead-guards.d.ts.map +1 -0
- package/dist/dead-guards.js +436 -0
- package/dist/discovery/files.d.ts +3 -1
- package/dist/discovery/files.d.ts.map +1 -1
- package/dist/discovery/files.js +5 -3
- package/dist/drift-issue.d.ts +152 -0
- package/dist/drift-issue.d.ts.map +1 -0
- package/dist/drift-issue.js +167 -0
- package/dist/floor-table.d.ts +30 -0
- package/dist/floor-table.d.ts.map +1 -0
- package/dist/floor-table.data.d.ts +3 -0
- package/dist/floor-table.data.d.ts.map +1 -0
- package/dist/floor-table.data.js +178 -0
- package/dist/floor-table.js +56 -0
- package/dist/forge-flags.d.ts +90 -0
- package/dist/forge-flags.d.ts.map +1 -0
- package/dist/forge-flags.js +184 -0
- package/dist/lexicon.d.ts +69 -0
- package/dist/lexicon.d.ts.map +1 -1
- package/dist/lifecycle/gated-op.d.ts +7 -1
- package/dist/lifecycle/gated-op.d.ts.map +1 -1
- package/dist/lifecycle/gated-op.js +7 -4
- package/dist/local-chant.d.ts +98 -0
- package/dist/local-chant.d.ts.map +1 -0
- package/dist/local-chant.js +307 -0
- package/dist/op/activities/predict-behaviour.js +2 -2
- package/dist/op/op-waves-evidence-spec.d.ts +13 -0
- package/dist/op/op-waves-evidence-spec.d.ts.map +1 -0
- package/dist/op/op-waves-evidence-spec.js +21 -0
- package/dist/op/op-waves-evidence.d.ts +38 -0
- package/dist/op/op-waves-evidence.d.ts.map +1 -0
- package/dist/op/op-waves-evidence.js +57 -0
- package/dist/op/op-waves-run.d.ts +4 -0
- package/dist/op/op-waves-run.d.ts.map +1 -1
- package/dist/op/op-waves-run.js +24 -1
- package/dist/op/op-waves.d.ts +17 -1
- package/dist/op/op-waves.d.ts.map +1 -1
- package/dist/op/op-waves.js +23 -0
- package/dist/op/schedule-overdue.d.ts +41 -9
- package/dist/op/schedule-overdue.d.ts.map +1 -1
- package/dist/op/schedule-overdue.js +154 -25
- package/dist/plan-summary.d.ts +25 -0
- package/dist/plan-summary.d.ts.map +1 -1
- package/dist/plan-summary.js +31 -0
- package/dist/pr-plan-note.d.ts +35 -0
- package/dist/pr-plan-note.d.ts.map +1 -1
- package/dist/pr-plan-note.js +10 -0
- package/dist/pr-post.d.ts +23 -0
- package/dist/pr-post.d.ts.map +1 -1
- package/dist/pr-post.js +125 -3
- package/dist/release-floors.d.ts +31 -1
- package/dist/release-floors.d.ts.map +1 -1
- package/dist/release-floors.js +31 -1
- package/dist/state-migration.d.ts +24 -0
- package/dist/state-migration.d.ts.map +1 -1
- package/dist/state-migration.js +100 -5
- package/dist/wave-runtime.mjs +305 -298
- package/dist/workspace/lexicon-outputs.d.ts.map +1 -1
- package/dist/workspace/lexicon-outputs.js +21 -7
- package/dist/workspace/reason-codes.d.ts +3 -0
- package/dist/workspace/reason-codes.d.ts.map +1 -1
- package/dist/workspace/reason-codes.js +4 -0
- package/dist/workspace/ref-gate.schema.json +85 -0
- package/dist/workspace/search-contract.d.ts +1 -1
- package/dist/workspace/search-contract.d.ts.map +1 -1
- package/dist/workspace/trust/check-evidence-report.d.ts +51 -0
- package/dist/workspace/trust/check-evidence-report.d.ts.map +1 -0
- package/dist/workspace/trust/check-evidence-report.js +102 -0
- package/dist/workspace/trust/check-evidence.d.ts +126 -0
- package/dist/workspace/trust/check-evidence.d.ts.map +1 -0
- package/dist/workspace/trust/check-evidence.js +237 -0
- package/dist/workspace/trust/local-evidence.d.ts +120 -0
- package/dist/workspace/trust/local-evidence.d.ts.map +1 -0
- package/dist/workspace/trust/local-evidence.js +259 -0
- package/dist/workspace/trust/policy.d.ts +84 -0
- package/dist/workspace/trust/policy.d.ts.map +1 -1
- package/dist/workspace/trust/policy.js +94 -1
- package/dist/workspace/trust/ref-gate-cli.d.ts +33 -0
- package/dist/workspace/trust/ref-gate-cli.d.ts.map +1 -0
- package/dist/workspace/trust/ref-gate-cli.js +234 -0
- package/dist/workspace/trust/ref-gate-fixture.d.ts +38 -0
- package/dist/workspace/trust/ref-gate-fixture.d.ts.map +1 -0
- package/dist/workspace/trust/ref-gate-fixture.js +97 -0
- package/dist/workspace/trust/ref-gate.d.ts +187 -0
- package/dist/workspace/trust/ref-gate.d.ts.map +1 -0
- package/dist/workspace/trust/ref-gate.js +430 -0
- package/dist/workspace/trust/trust-files.d.ts.map +1 -1
- package/dist/workspace/trust/trust-files.js +18 -1
- package/package.json +1 -1
- package/src/bundle-check.test.ts +140 -0
- package/src/bundle-check.ts +352 -0
- package/src/chant-install.test.ts +112 -0
- package/src/chant-install.ts +179 -0
- package/src/ci-commit.test.ts +45 -0
- package/src/ci-commit.ts +38 -4
- package/src/ci-evidence-jobs.ts +67 -0
- package/src/ci-image.test.ts +506 -0
- package/src/ci-image.ts +822 -0
- package/src/ci-login.test.ts +235 -0
- package/src/ci-login.ts +307 -0
- package/src/ci-product.ts +18 -0
- package/src/cli/commands/__fixtures__/source-dir-include/chant.config.json +1 -0
- package/src/cli/commands/__fixtures__/source-dir-include/infra.ts +1 -0
- package/src/cli/commands/__fixtures__/source-dir-include/scripts/run-on-load.ts +3 -0
- package/src/cli/commands/__fixtures__/source-dir-root/chant.config.json +1 -0
- package/src/cli/commands/__fixtures__/source-dir-root/infra.test.ts +1 -0
- package/src/cli/commands/__fixtures__/source-dir-root/infra.ts +1 -0
- package/src/cli/commands/__fixtures__/source-dir-root/scripts/run-on-load.ts +3 -0
- package/src/cli/commands/__fixtures__/source-dir-scoped/app.ts +3 -0
- package/src/cli/commands/__fixtures__/source-dir-scoped/chant.config.json +1 -0
- package/src/cli/commands/__fixtures__/source-dir-scoped/infra/net.ts +1 -0
- package/src/cli/commands/__fixtures__/source-dir-scoped/scripts/run-on-load.ts +3 -0
- package/src/cli/commands/import-index.ts +2 -2
- package/src/cli/handlers/build-source-dir.test.ts +64 -0
- package/src/cli/handlers/build.ts +21 -4
- package/src/cli/handlers/ci-check.ts +56 -3
- package/src/cli/handlers/ci-evidence.ts +162 -0
- package/src/cli/handlers/components.ts +3 -3
- package/src/cli/handlers/dead-guards.ts +37 -0
- package/src/cli/handlers/graph.ts +4 -4
- package/src/cli/handlers/lifecycle.ts +5 -4
- package/src/cli/handlers/local-chant.ts +106 -0
- package/src/cli/handlers/operator.ts +2 -2
- package/src/cli/handlers/search.ts +5 -5
- package/src/cli/main.test.ts +7 -0
- package/src/cli/main.ts +38 -0
- package/src/cli/parse-args.ts +21 -0
- package/src/cli/registry.ts +16 -0
- package/src/components/check-evidence-stage.test.ts +80 -0
- package/src/components/check-hooks.ts +84 -4
- package/src/components/check-local-evidence-stage.test.ts +141 -0
- package/src/components/check-steps.ts +56 -6
- package/src/components/product-pipeline.ts +28 -3
- package/src/components/product-plan.test.ts +87 -0
- package/src/components/product-plan.ts +226 -0
- package/src/components/release-compile.ts +2 -2
- package/src/config.ts +44 -3
- package/src/dead-guards.test.ts +206 -0
- package/src/dead-guards.ts +446 -0
- package/src/discovery/files.ts +5 -3
- package/src/drift-issue-bundle.test.ts +31 -0
- package/src/drift-issue.test.ts +206 -0
- package/src/drift-issue.ts +274 -0
- package/src/fit-note.test.ts +44 -0
- package/src/floor-table.data.ts +180 -0
- package/src/floor-table.ts +77 -0
- package/src/forge-flags.test.ts +110 -0
- package/src/forge-flags.ts +208 -0
- package/src/gate-decision-bundle.test.ts +1 -0
- package/src/lexicon.ts +68 -0
- package/src/lifecycle/gated-op.ts +10 -5
- package/src/local-chant.e2e.test.ts +94 -0
- package/src/local-chant.test.ts +162 -0
- package/src/local-chant.ts +341 -0
- package/src/op/activities/predict-behaviour.ts +2 -2
- package/src/op/op-waves-evidence-spec.ts +24 -0
- package/src/op/op-waves-evidence.test.ts +130 -0
- package/src/op/op-waves-evidence.ts +57 -0
- package/src/op/op-waves-run.ts +25 -1
- package/src/op/op-waves.ts +31 -1
- package/src/op/schedule-overdue.test.ts +85 -0
- package/src/op/schedule-overdue.ts +162 -26
- package/src/plan-summary.ts +40 -0
- package/src/pr-plan-note.ts +34 -0
- package/src/pr-post-plan-note.test.ts +146 -0
- package/src/pr-post.ts +127 -3
- package/src/release-floors.ts +44 -1
- package/src/stage-hooks-bundle.test.ts +1 -0
- package/src/state-migration.test.ts +52 -1
- package/src/state-migration.ts +107 -5
- package/src/workspace/lexicon-outputs.ts +23 -6
- package/src/workspace/reason-codes.test.ts +3 -0
- package/src/workspace/reason-codes.ts +4 -0
- package/src/workspace/ref-gate.schema.json +85 -0
- package/src/workspace/trust/check-evidence-report.ts +106 -0
- package/src/workspace/trust/check-evidence.test.ts +133 -0
- package/src/workspace/trust/check-evidence.ts +257 -0
- package/src/workspace/trust/local-evidence.test.ts +127 -0
- package/src/workspace/trust/local-evidence.ts +266 -0
- package/src/workspace/trust/policy.ts +134 -1
- package/src/workspace/trust/ref-gate-cli.ts +244 -0
- package/src/workspace/trust/ref-gate-fixture.ts +125 -0
- package/src/workspace/trust/ref-gate.e2e.test.ts +76 -0
- package/src/workspace/trust/ref-gate.test.ts +247 -0
- package/src/workspace/trust/ref-gate.ts +538 -0
- package/src/workspace/trust/trust-files.test.ts +16 -0
- package/src/workspace/trust/trust-files.ts +41 -1
|
@@ -0,0 +1,274 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* CI images and engine installs for a CI product (#4784).
|
|
3
|
+
*
|
|
4
|
+
* terragucci, plywood and SQL Yodeler each built their CI image the same way:
|
|
5
|
+
* `node:22-bookworm-slim` by digest, git and CA certificates,
|
|
6
|
+
* `safe.directory '*'`, the product's bundle and the OCI labels, with each
|
|
7
|
+
* engine fetched in a separate stage and checked there. Each also installed
|
|
8
|
+
* engines in a job, and terragucci at run time from Node. This module is the
|
|
9
|
+
* one copy:
|
|
10
|
+
*
|
|
11
|
+
* - {@link ciToolRelease} names every engine release a product installs
|
|
12
|
+
* (tofu, terraform, terragrunt, choudoufu, infracost, cosign, atmos,
|
|
13
|
+
* terramate, pulumi, plunge, the AWS CLI, just, act) for Linux on amd64
|
|
14
|
+
* and arm64.
|
|
15
|
+
* - {@link CI_TOOL_SHA256} records the sha256 chant knows for a release. A
|
|
16
|
+
* product records others in its own config and passes them as `sha256`.
|
|
17
|
+
* - {@link ciToolFetchScript} is the shell that downloads one release and
|
|
18
|
+
* checks it, for an image's fetch stage; {@link ciToolInstallLine} is the
|
|
19
|
+
* job line that runs it unless the binary is there; {@link installCiTool}
|
|
20
|
+
* does the same from Node, for a product that installs a pinned release
|
|
21
|
+
* at run time.
|
|
22
|
+
* - {@link productImageStages} is a product's image as stages a Dockerfile
|
|
23
|
+
* takes (the docker lexicon's `new Dockerfile({ stages })`), and
|
|
24
|
+
* {@link productImageDockerfile} is the same as text. The product passes
|
|
25
|
+
* its name, its bundle, its words and its engines.
|
|
26
|
+
* - {@link derivedImageDockerfile} is an image a user builds FROM the
|
|
27
|
+
* product's, such as a provider mirror or preinstalled plugins.
|
|
28
|
+
*
|
|
29
|
+
* Every check follows one rule, in the shell and in Node. A release whose
|
|
30
|
+
* project publishes a checksums file is checked against that file's line
|
|
31
|
+
* for the archive, and against the recorded sha256 when there is one, so a
|
|
32
|
+
* tampered checksums file fails as a tampered archive does. A release with
|
|
33
|
+
* no checksums file (the AWS CLI, just, act) needs a recorded sha256. An
|
|
34
|
+
* image always needs a recorded sha256 for both architectures, and a caller
|
|
35
|
+
* passes `requirePin` to ask the same of a job line or a run-time install.
|
|
36
|
+
*
|
|
37
|
+
* Like `./policy-engine.ts` this module imports only node built-ins and
|
|
38
|
+
* chant's release floors, so a product can bundle it or import it from a
|
|
39
|
+
* plain Node script.
|
|
40
|
+
*/
|
|
41
|
+
import { CI_IMAGE_FLOOR } from "./release-floors.js";
|
|
42
|
+
export { CI_IMAGE_FLOOR };
|
|
43
|
+
export type CiTool = "tofu" | "terraform" | "terragrunt" | "choudoufu" | "infracost" | "cosign" | "atmos" | "terramate" | "pulumi" | "plunge" | "aws-cli" | "just" | "act";
|
|
44
|
+
/** The architectures chant fetches, as Docker's `TARGETARCH` names them. */
|
|
45
|
+
export type CiToolArch = "amd64" | "arm64";
|
|
46
|
+
export declare const CI_TOOL_ARCHES: readonly CiToolArch[];
|
|
47
|
+
/**
|
|
48
|
+
* How a release file holds its binary: the file is the binary, a `.tar.gz`
|
|
49
|
+
* or `.zip` holds it as `member`, a `.tar.gz` holds a tree with one top
|
|
50
|
+
* directory that is unpacked whole (Pulumi's language hosts sit beside the
|
|
51
|
+
* binary), or the AWS CLI's zip with its own installer.
|
|
52
|
+
*/
|
|
53
|
+
export type CiToolLayout = "binary" | "tar.gz" | "zip" | "tree" | "aws-cli";
|
|
54
|
+
export declare const CI_TOOLS: readonly CiTool[];
|
|
55
|
+
/**
|
|
56
|
+
* The sha256 of each release file chant records, as
|
|
57
|
+
* `<tool>-<version>-linux-<arch>`, copied from the release's checksums file
|
|
58
|
+
* (the AWS CLI's from the archives, as plywood and terragucci recorded them).
|
|
59
|
+
* A checksums file that lists another sum for one of these fails the
|
|
60
|
+
* install. Add a release's two lines when a product moves to it, or record
|
|
61
|
+
* them in the product's config and pass `sha256`.
|
|
62
|
+
*/
|
|
63
|
+
export declare const CI_TOOL_SHA256: Readonly<Record<string, string>>;
|
|
64
|
+
/** One release file of one tool for one architecture. */
|
|
65
|
+
export interface CiToolRelease {
|
|
66
|
+
tool: CiTool;
|
|
67
|
+
version: string;
|
|
68
|
+
arch: CiToolArch;
|
|
69
|
+
/** The command's name on PATH. */
|
|
70
|
+
bin: string;
|
|
71
|
+
/** The release file's name. */
|
|
72
|
+
asset: string;
|
|
73
|
+
url: string;
|
|
74
|
+
/** The release's checksums file, when it publishes one. */
|
|
75
|
+
checksumsUrl?: string;
|
|
76
|
+
/** Its name, for messages. */
|
|
77
|
+
checksums?: string;
|
|
78
|
+
layout: CiToolLayout;
|
|
79
|
+
/** The binary inside a `tar.gz` or `zip`. */
|
|
80
|
+
member: string;
|
|
81
|
+
/** The binary under the install directory. */
|
|
82
|
+
path: string;
|
|
83
|
+
}
|
|
84
|
+
/** The release file of `tool` at `version` for `arch`. A version is a plain semver, so it is safe on a shell line. */
|
|
85
|
+
export declare function ciToolRelease(tool: CiTool, version: string, arch: CiToolArch): CiToolRelease;
|
|
86
|
+
/** The recorded sha256 of `tool` at `version` by architecture: the caller's, else {@link CI_TOOL_SHA256}'s. */
|
|
87
|
+
export declare function ciToolSha256(tool: CiTool, version: string, given?: Partial<Record<CiToolArch, string>>): Partial<Record<CiToolArch, string>>;
|
|
88
|
+
/** Where a tool lives once installed: `<root>/<tool>-<version>`. */
|
|
89
|
+
export declare function ciToolDir(tool: CiTool, version: string, root: string): string;
|
|
90
|
+
/** The binary's path once installed under `root`. */
|
|
91
|
+
export declare function ciToolBin(tool: CiTool, version: string, root: string): string;
|
|
92
|
+
/** A shell expression giving the job's architecture as amd64 or arm64. */
|
|
93
|
+
export declare const CI_TOOL_JOB_ARCH = "\"$(uname -m | sed 's/x86_64/amd64/;s/aarch64/arm64/')\"";
|
|
94
|
+
/** A Docker build's target architecture (`ARG TARGETARCH`), amd64 or arm64. */
|
|
95
|
+
export declare const CI_TOOL_DOCKER_ARCH = "\"$TARGETARCH\"";
|
|
96
|
+
export interface CiToolCheckOptions {
|
|
97
|
+
/** Recorded sums by architecture, in place of {@link CI_TOOL_SHA256}'s for this release. */
|
|
98
|
+
sha256?: Partial<Record<CiToolArch, string>>;
|
|
99
|
+
/** Refuse a release with no recorded sha256 for an architecture, rather than trust its checksums file alone. Default false. */
|
|
100
|
+
requirePin?: boolean;
|
|
101
|
+
}
|
|
102
|
+
export interface CiToolFetchOptions extends CiToolCheckOptions {
|
|
103
|
+
/** The directory the tool installs into, an absolute path: {@link ciToolDir} under the image's tool root. */
|
|
104
|
+
dir: string;
|
|
105
|
+
/** A shell expression giving amd64 or arm64. Default {@link CI_TOOL_JOB_ARCH}; an image build passes {@link CI_TOOL_DOCKER_ARCH}. */
|
|
106
|
+
arch?: string;
|
|
107
|
+
/** A shell word for the checksums file's URL, such as `"$CHECKSUMS_URL"`. Default the release's own. */
|
|
108
|
+
checksumsUrl?: string;
|
|
109
|
+
}
|
|
110
|
+
/**
|
|
111
|
+
* Shell that downloads one release into `dir` and checks it (#4784). Run it
|
|
112
|
+
* under `set -e`. `arch` and `checksumsUrl` go onto the line as they are, so
|
|
113
|
+
* they are the caller's shell, never a value from outside. Throws when the
|
|
114
|
+
* release needs a recorded sha256 it lacks.
|
|
115
|
+
*/
|
|
116
|
+
export declare function ciToolFetchScript(tool: CiTool, version: string, options: CiToolFetchOptions): string;
|
|
117
|
+
export interface CiToolInstallOptions extends CiToolCheckOptions {
|
|
118
|
+
/** Where the versioned directories live. Default {@link CI_TOOL_ROOT}. */
|
|
119
|
+
root?: string;
|
|
120
|
+
/** Link the binary into /usr/local/bin (default true). `false` leaves PATH alone, for a pin a step runs by its path. */
|
|
121
|
+
link?: boolean;
|
|
122
|
+
/** Skip the install when any `<bin>` is on PATH, whatever its version. Default false: only the versioned directory counts. */
|
|
123
|
+
onPath?: boolean;
|
|
124
|
+
}
|
|
125
|
+
/** Where a job line installs each release by default. */
|
|
126
|
+
export declare const CI_TOOL_ROOT = "/opt/chant";
|
|
127
|
+
/**
|
|
128
|
+
* The job line that installs `tool` at `version` under
|
|
129
|
+
* `<root>/<tool>-<version>/`, checked as {@link ciToolFetchScript} checks
|
|
130
|
+
* it. It skips the download when that directory holds the binary, as in an
|
|
131
|
+
* image that carries the release, and links the binary into /usr/local/bin
|
|
132
|
+
* unless `link` is false.
|
|
133
|
+
*/
|
|
134
|
+
export declare function ciToolInstallLine(tool: CiTool, version: string, options?: CiToolInstallOptions): string;
|
|
135
|
+
/** The expected digest for `file` in a checksums file's text, or undefined when it lists none. A name may carry `*` or `./` before it. */
|
|
136
|
+
export declare function checksumFor(sums: string, file: string): string | undefined;
|
|
137
|
+
/** One file out of a zip archive, by name. Stored and deflated entries only, which is what releases use. */
|
|
138
|
+
export declare function unzipEntry(zip: Uint8Array, name: string): Uint8Array | undefined;
|
|
139
|
+
export interface InstallCiToolOptions extends CiToolCheckOptions {
|
|
140
|
+
/** Fetches a release file. Default: Node's fetch. Tests pass their own. */
|
|
141
|
+
download?: (url: string) => Promise<Uint8Array>;
|
|
142
|
+
/** Where the versioned directories live. Default `CHANT_TOOL_CACHE`, else `chant-tools` in the temp directory. */
|
|
143
|
+
root?: string;
|
|
144
|
+
/** The architecture to fetch for. Default this process's. */
|
|
145
|
+
arch?: CiToolArch;
|
|
146
|
+
/** The platform this runs on. Default this process's; the releases are Linux builds, so any other is refused. */
|
|
147
|
+
platform?: string;
|
|
148
|
+
}
|
|
149
|
+
/** This process's architecture as chant fetches it. Throws on one chant has no builds for. */
|
|
150
|
+
export declare function ciToolArch(arch?: string): CiToolArch;
|
|
151
|
+
/**
|
|
152
|
+
* Install `tool` at `version` under `<root>/<tool>-<version>/` and return
|
|
153
|
+
* the directory and the binary, checked by the same rule as the shell
|
|
154
|
+
* (#4784). A binary already there is returned without a download. A
|
|
155
|
+
* download that does not match is never written.
|
|
156
|
+
*/
|
|
157
|
+
export declare function installCiTool(tool: CiTool, version: string, options?: InstallCiToolOptions): Promise<{
|
|
158
|
+
dir: string;
|
|
159
|
+
bin: string;
|
|
160
|
+
}>;
|
|
161
|
+
/**
|
|
162
|
+
* Base images by index digest, so a rebuild cannot change underneath a tag:
|
|
163
|
+
* the ones all three products pinned. `node` carries Node 22.23.3.
|
|
164
|
+
*/
|
|
165
|
+
export declare const CI_BASE_IMAGES: {
|
|
166
|
+
readonly node: "node:22-bookworm-slim@sha256:c3de60bf2f9dd0ac6370e6117950ff62d6e339527e7472301c9c78a017978392";
|
|
167
|
+
readonly debian: "debian:bookworm-slim@sha256:3783cc01769c7b2b1b83a5c5ad96c815348e28ed7da68e2e3687004faa906251";
|
|
168
|
+
};
|
|
169
|
+
/** The build argument a release passes its label in (chant's release.version). */
|
|
170
|
+
export declare const CI_IMAGE_LABEL_ARG = "CHANT_RELEASE_LABEL";
|
|
171
|
+
/** One Dockerfile instruction, as the docker lexicon's stage `steps` take it: `{ run: "..." }`. */
|
|
172
|
+
export type CiImageStep = Readonly<Partial<Record<"arg" | "env" | "run" | "copy" | "label" | "cmd" | "user" | "workdir" | "expose" | "entrypoint", string>>>;
|
|
173
|
+
/** One stage, as the docker lexicon's `new Dockerfile({ stages })` takes it. */
|
|
174
|
+
export interface CiImageStage {
|
|
175
|
+
from: string;
|
|
176
|
+
as?: string;
|
|
177
|
+
steps: CiImageStep[];
|
|
178
|
+
}
|
|
179
|
+
/** One engine an image carries. */
|
|
180
|
+
export interface CiImageTool {
|
|
181
|
+
tool: CiTool;
|
|
182
|
+
version: string;
|
|
183
|
+
/** Recorded sums by architecture, from the product's config, for a release chant records none for. */
|
|
184
|
+
sha256?: Partial<Record<CiToolArch, string>>;
|
|
185
|
+
/** A build argument naming the checksums file, defaulting to the release's own, so a tampered one can be shown to fail the build. */
|
|
186
|
+
checksumsArg?: string;
|
|
187
|
+
/** Link the binary into /usr/local/bin. Default true. */
|
|
188
|
+
link?: boolean;
|
|
189
|
+
}
|
|
190
|
+
/** How the product's own code goes into the image. */
|
|
191
|
+
export type CiImageBundle =
|
|
192
|
+
/** A one-file bundle in the build context, copied in as `/usr/local/bin/<bin>`. */
|
|
193
|
+
{
|
|
194
|
+
file: string;
|
|
195
|
+
bin: string;
|
|
196
|
+
}
|
|
197
|
+
/** A tarball from `npm pack` in the build context, installed globally. `check` runs after, such as `plywood --version`. */
|
|
198
|
+
| {
|
|
199
|
+
tarball: string;
|
|
200
|
+
check?: string;
|
|
201
|
+
}
|
|
202
|
+
/**
|
|
203
|
+
* Packages npm installs into `prefix`, whose `node_modules` is linked at
|
|
204
|
+
* /node_modules so a checkout anywhere in the container resolves them, and
|
|
205
|
+
* whose `.bin` goes on PATH. `packages` is shell words, such as
|
|
206
|
+
* `"${PKG:-@scope/name@$VERSION}" $PINS`. npm lists a release before it
|
|
207
|
+
* serves its tarballs, so an E404 or ETARGET is tried again, three times,
|
|
208
|
+
* 45s apart. With `mountContext` the build context is at /ctx, so a packed
|
|
209
|
+
* tarball installs as /ctx/<file>.tgz. `require` names build arguments
|
|
210
|
+
* that must be set; `check` runs after.
|
|
211
|
+
*/
|
|
212
|
+
| {
|
|
213
|
+
npm: string;
|
|
214
|
+
prefix: string;
|
|
215
|
+
mountContext?: boolean;
|
|
216
|
+
require?: string[];
|
|
217
|
+
check?: string[];
|
|
218
|
+
};
|
|
219
|
+
export interface ProductImageSpec {
|
|
220
|
+
/** The image's title, such as `terragucci-tofu`. */
|
|
221
|
+
name: string;
|
|
222
|
+
/** The product, the job's `USER` and the default tool root `/opt/<product>`. */
|
|
223
|
+
product: string;
|
|
224
|
+
description: string;
|
|
225
|
+
/** The repository URL for `org.opencontainers.image.source`. */
|
|
226
|
+
source: string;
|
|
227
|
+
/** Default Apache-2.0. */
|
|
228
|
+
licenses?: string;
|
|
229
|
+
/** The engines, fetched and checked in a stage of their own, so curl never reaches the image. Each needs a recorded sha256 for both architectures. */
|
|
230
|
+
tools?: CiImageTool[];
|
|
231
|
+
/** Where the engines live. Default `/opt/<product>`. */
|
|
232
|
+
toolRoot?: string;
|
|
233
|
+
/** apt packages beside git and ca-certificates, such as openssh-client. */
|
|
234
|
+
packages?: string[];
|
|
235
|
+
/** Environment beside chant's (`USER`, `HOME=/tmp`, no Node compile cache, no npm debug logs). */
|
|
236
|
+
env?: string[];
|
|
237
|
+
/** npm packages installed into /usr/local, on the bundle's module path, at exact versions: `@cdktn/hcl2json@0.24.0`. */
|
|
238
|
+
npm?: string[];
|
|
239
|
+
/** The chant release whose one-file wave runtime is the image's `chant`, for a product whose bundle runs `chant` off PATH. */
|
|
240
|
+
chant?: string;
|
|
241
|
+
bundle: CiImageBundle;
|
|
242
|
+
/** The product's own steps, after the engines and before the bundle, such as plugin installs. */
|
|
243
|
+
steps?: CiImageStep[];
|
|
244
|
+
/** The build argument the version label reads. Default {@link CI_IMAGE_LABEL_ARG}. */
|
|
245
|
+
versionArg?: string;
|
|
246
|
+
/** More build arguments the final stage takes. */
|
|
247
|
+
args?: string[];
|
|
248
|
+
/** Default `["bash"]`. */
|
|
249
|
+
cmd?: string;
|
|
250
|
+
}
|
|
251
|
+
/**
|
|
252
|
+
* A product's CI image as stages (#4784): a fetch stage that downloads each
|
|
253
|
+
* engine and checks it against a recorded sha256, then the pinned Node base
|
|
254
|
+
* with git and CA certificates, `safe.directory '*'`, the engines, the
|
|
255
|
+
* product's steps, its bundle and the OCI labels. Pass the stages to the
|
|
256
|
+
* docker lexicon's `new Dockerfile({ stages })`, or write
|
|
257
|
+
* {@link productImageDockerfile}'s text.
|
|
258
|
+
*/
|
|
259
|
+
export declare function productImageStages(spec: ProductImageSpec): CiImageStage[];
|
|
260
|
+
/** Stages as Dockerfile text, as the docker lexicon writes them, with `header` as comment lines on top. */
|
|
261
|
+
export declare function dockerfileText(stages: readonly CiImageStage[], header?: readonly string[]): string;
|
|
262
|
+
/** A product's CI image as Dockerfile text, with `header` as comment lines on top. */
|
|
263
|
+
export declare function productImageDockerfile(spec: ProductImageSpec, header?: readonly string[]): string;
|
|
264
|
+
/** An image a user builds FROM the product's in their own CI. */
|
|
265
|
+
export interface DerivedImageSpec {
|
|
266
|
+
/** The product's image, by digest when it is known. */
|
|
267
|
+
from: string;
|
|
268
|
+
/** Comment lines on top: what it is, how to build it, where to name it. */
|
|
269
|
+
header?: readonly string[];
|
|
270
|
+
steps: CiImageStep[];
|
|
271
|
+
}
|
|
272
|
+
/** A derived image's Dockerfile (#4784): FROM the product's image, the user's steps, nothing pushed. */
|
|
273
|
+
export declare function derivedImageDockerfile(spec: DerivedImageSpec): string;
|
|
274
|
+
//# sourceMappingURL=ci-image.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ci-image.d.ts","sourceRoot":"","sources":["../src/ci-image.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAuCG;AASH,OAAO,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAC;AAElD,OAAO,EAAE,cAAc,EAAE,CAAC;AAK1B,MAAM,MAAM,MAAM,GACd,MAAM,GACN,WAAW,GACX,YAAY,GACZ,WAAW,GACX,WAAW,GACX,QAAQ,GACR,OAAO,GACP,WAAW,GACX,QAAQ,GACR,QAAQ,GACR,SAAS,GACT,MAAM,GACN,KAAK,CAAC;AAEV,4EAA4E;AAC5E,MAAM,MAAM,UAAU,GAAG,OAAO,GAAG,OAAO,CAAC;AAC3C,eAAO,MAAM,cAAc,EAAE,SAAS,UAAU,EAAuB,CAAC;AAExE;;;;;GAKG;AACH,MAAM,MAAM,YAAY,GAAG,QAAQ,GAAG,QAAQ,GAAG,KAAK,GAAG,MAAM,GAAG,SAAS,CAAC;AAiI5E,eAAO,MAAM,QAAQ,EAAE,SAAS,MAAM,EAAmC,CAAC;AAE1E;;;;;;;GAOG;AACH,eAAO,MAAM,cAAc,EAAE,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAa3D,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