@intentius/chant-lexicon-docker 0.124.97 → 0.124.99
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/codegen/docs-cli.d.ts +0 -1
- package/dist/codegen/docs.d.ts +0 -1
- package/dist/codegen/generate-cli.d.ts +0 -1
- package/dist/codegen/generate-compose.d.ts +0 -1
- package/dist/codegen/generate-dockerfile.d.ts +0 -1
- package/dist/codegen/generate.d.ts +0 -1
- package/dist/codegen/naming.d.ts +0 -1
- package/dist/codegen/package.d.ts +0 -1
- package/dist/codegen/patches.d.ts +0 -1
- package/dist/codegen/versions.d.ts +0 -1
- package/dist/compose-key.d.ts +0 -1
- package/dist/composites/catalog.d.ts +0 -1
- package/dist/composites/docker-otel-collector.d.ts +0 -1
- package/dist/composites/docker-web-service.d.ts +0 -1
- package/dist/composites/index.d.ts +0 -1
- package/dist/coverage.d.ts +0 -1
- package/dist/default-labels.d.ts +0 -1
- package/dist/detect.d.ts +0 -1
- package/dist/dockerfile-order.d.ts +0 -1
- package/dist/export-resources.d.ts +0 -1
- package/dist/generated/index.d.ts +0 -1
- package/dist/generated/runtime.d.ts +0 -1
- package/dist/import/adapter.d.ts +0 -1
- package/dist/import/adapter.js +4 -2
- package/dist/import/embedded.d.ts +0 -1
- package/dist/import/engine.d.ts +0 -1
- package/dist/import/generator.d.ts +9 -2
- package/dist/import/generator.js +23 -1
- package/dist/import/live-export.d.ts +0 -1
- package/dist/import/parser.d.ts +0 -1
- package/dist/import/testdata/tar.d.ts +0 -1
- package/dist/index.d.ts +0 -1
- package/dist/integrity.json +2 -2
- package/dist/interpolation.d.ts +0 -1
- package/dist/lint/audit-catalog.d.ts +0 -1
- package/dist/lint/audit-lineage.d.ts +0 -1
- package/dist/lint/post-synth/add-url-checksum.d.ts +0 -1
- package/dist/lint/post-synth/apt-no-recommends.d.ts +0 -1
- package/dist/lint/post-synth/apt-update-alone.d.ts +0 -1
- package/dist/lint/post-synth/cache-busting-copy.d.ts +0 -1
- package/dist/lint/post-synth/copy-from-stage.d.ts +0 -1
- package/dist/lint/post-synth/docker-helpers.d.ts +0 -1
- package/dist/lint/post-synth/index.d.ts +0 -1
- package/dist/lint/post-synth/no-latest-image.d.ts +0 -1
- package/dist/lint/post-synth/no-root-user.d.ts +0 -1
- package/dist/lint/post-synth/prefer-copy.d.ts +0 -1
- package/dist/lint/post-synth/relative-workdir.d.ts +0 -1
- package/dist/lint/post-synth/repeated-cmd.d.ts +0 -1
- package/dist/lint/post-synth/root-after-user.d.ts +0 -1
- package/dist/lint/post-synth/ssh-port-exposed.d.ts +0 -1
- package/dist/lint/post-synth/unused-global-arg.d.ts +0 -1
- package/dist/lint/post-synth/unused-volume.d.ts +0 -1
- package/dist/lint/rules/data/deprecated-images.d.ts +0 -1
- package/dist/lint/rules/data/known-base-images.d.ts +0 -1
- package/dist/lint/rules/index.d.ts +0 -1
- package/dist/lint/rules/no-latest-tag.d.ts +0 -1
- package/dist/lint/rules/per-kind-order.d.ts +0 -1
- package/dist/list-artifacts.d.ts +0 -1
- package/dist/lsp/completions.d.ts +0 -1
- package/dist/lsp/hover.d.ts +0 -1
- package/dist/manifest.json +1 -1
- package/dist/package-cli.d.ts +0 -1
- package/dist/plugin.d.ts +0 -1
- package/dist/serializer.d.ts +0 -1
- package/dist/spec/fetch-compose.d.ts +0 -1
- package/dist/spec/fetch-engine.d.ts +0 -1
- package/dist/spec/parse-compose.d.ts +0 -1
- package/dist/spec/parse-engine.d.ts +0 -1
- package/dist/validate-cli.d.ts +0 -1
- package/dist/validate.d.ts +0 -1
- package/dist/variables.d.ts +0 -1
- package/package.json +4 -5
- package/dist/codegen/docs-cli.d.ts.map +0 -1
- package/dist/codegen/docs.d.ts.map +0 -1
- package/dist/codegen/generate-cli.d.ts.map +0 -1
- package/dist/codegen/generate-compose.d.ts.map +0 -1
- package/dist/codegen/generate-dockerfile.d.ts.map +0 -1
- package/dist/codegen/generate.d.ts.map +0 -1
- package/dist/codegen/naming.d.ts.map +0 -1
- package/dist/codegen/package.d.ts.map +0 -1
- package/dist/codegen/patches.d.ts.map +0 -1
- package/dist/codegen/versions.d.ts.map +0 -1
- package/dist/compose-key.d.ts.map +0 -1
- package/dist/composites/catalog.d.ts.map +0 -1
- package/dist/composites/docker-otel-collector.d.ts.map +0 -1
- package/dist/composites/docker-web-service.d.ts.map +0 -1
- package/dist/composites/index.d.ts.map +0 -1
- package/dist/coverage.d.ts.map +0 -1
- package/dist/default-labels.d.ts.map +0 -1
- package/dist/detect.d.ts.map +0 -1
- package/dist/dockerfile-order.d.ts.map +0 -1
- package/dist/export-resources.d.ts.map +0 -1
- package/dist/generated/index.d.ts.map +0 -1
- package/dist/generated/runtime.d.ts.map +0 -1
- package/dist/import/adapter.d.ts.map +0 -1
- package/dist/import/embedded.d.ts.map +0 -1
- package/dist/import/engine.d.ts.map +0 -1
- package/dist/import/generator.d.ts.map +0 -1
- package/dist/import/live-export.d.ts.map +0 -1
- package/dist/import/parser.d.ts.map +0 -1
- package/dist/import/testdata/tar.d.ts.map +0 -1
- package/dist/index.d.ts.map +0 -1
- package/dist/interpolation.d.ts.map +0 -1
- package/dist/lint/audit-catalog.d.ts.map +0 -1
- package/dist/lint/audit-lineage.d.ts.map +0 -1
- package/dist/lint/post-synth/add-url-checksum.d.ts.map +0 -1
- package/dist/lint/post-synth/apt-no-recommends.d.ts.map +0 -1
- package/dist/lint/post-synth/apt-update-alone.d.ts.map +0 -1
- package/dist/lint/post-synth/cache-busting-copy.d.ts.map +0 -1
- package/dist/lint/post-synth/copy-from-stage.d.ts.map +0 -1
- package/dist/lint/post-synth/docker-helpers.d.ts.map +0 -1
- package/dist/lint/post-synth/index.d.ts.map +0 -1
- package/dist/lint/post-synth/no-latest-image.d.ts.map +0 -1
- package/dist/lint/post-synth/no-root-user.d.ts.map +0 -1
- package/dist/lint/post-synth/prefer-copy.d.ts.map +0 -1
- package/dist/lint/post-synth/relative-workdir.d.ts.map +0 -1
- package/dist/lint/post-synth/repeated-cmd.d.ts.map +0 -1
- package/dist/lint/post-synth/root-after-user.d.ts.map +0 -1
- package/dist/lint/post-synth/ssh-port-exposed.d.ts.map +0 -1
- package/dist/lint/post-synth/unused-global-arg.d.ts.map +0 -1
- package/dist/lint/post-synth/unused-volume.d.ts.map +0 -1
- package/dist/lint/rules/data/deprecated-images.d.ts.map +0 -1
- package/dist/lint/rules/data/known-base-images.d.ts.map +0 -1
- package/dist/lint/rules/index.d.ts.map +0 -1
- package/dist/lint/rules/no-latest-tag.d.ts.map +0 -1
- package/dist/lint/rules/per-kind-order.d.ts.map +0 -1
- package/dist/list-artifacts.d.ts.map +0 -1
- package/dist/lsp/completions.d.ts.map +0 -1
- package/dist/lsp/hover.d.ts.map +0 -1
- package/dist/package-cli.d.ts.map +0 -1
- package/dist/plugin.d.ts.map +0 -1
- package/dist/serializer.d.ts.map +0 -1
- package/dist/spec/fetch-compose.d.ts.map +0 -1
- package/dist/spec/fetch-engine.d.ts.map +0 -1
- package/dist/spec/parse-compose.d.ts.map +0 -1
- package/dist/spec/parse-engine.d.ts.map +0 -1
- package/dist/validate-cli.d.ts.map +0 -1
- package/dist/validate.d.ts.map +0 -1
- package/dist/variables.d.ts.map +0 -1
- package/src/codegen/__snapshots__/okf.test.ts.snap +0 -555
- package/src/codegen/docs-cli.ts +0 -10
- package/src/codegen/docs.ts +0 -171
- package/src/codegen/generate-cli.ts +0 -36
- package/src/codegen/generate-compose.ts +0 -21
- package/src/codegen/generate-dockerfile.ts +0 -21
- package/src/codegen/generate.test.ts +0 -115
- package/src/codegen/generate.ts +0 -258
- package/src/codegen/naming.test.ts +0 -81
- package/src/codegen/naming.ts +0 -54
- package/src/codegen/okf.test.ts +0 -36
- package/src/codegen/package.ts +0 -59
- package/src/codegen/patches.ts +0 -42
- package/src/codegen/versions.ts +0 -46
- package/src/compose-key.ts +0 -31
- package/src/composites/catalog.test.ts +0 -39
- package/src/composites/catalog.ts +0 -118
- package/src/composites/docker-otel-collector.ts +0 -83
- package/src/composites/docker-web-service.test.ts +0 -34
- package/src/composites/docker-web-service.ts +0 -75
- package/src/composites/index.ts +0 -9
- package/src/coverage.test.ts +0 -33
- package/src/coverage.ts +0 -54
- package/src/default-labels.test.ts +0 -85
- package/src/default-labels.ts +0 -72
- package/src/detect.ts +0 -7
- package/src/dockerfile-order.ts +0 -20
- package/src/docs-examples.test.ts +0 -141
- package/src/export-resources.ts +0 -90
- package/src/generated/index.d.ts +0 -407
- package/src/generated/index.ts +0 -410
- package/src/generated/runtime.ts +0 -4
- package/src/import/adapter.ts +0 -99
- package/src/import/embedded-live.test.ts +0 -248
- package/src/import/embedded.ts +0 -83
- package/src/import/engine.ts +0 -107
- package/src/import/generator.test.ts +0 -134
- package/src/import/generator.ts +0 -202
- package/src/import/live-export.test.ts +0 -271
- package/src/import/live-export.ts +0 -359
- package/src/import/parser.test.ts +0 -137
- package/src/import/parser.ts +0 -269
- package/src/import/roundtrip.test.ts +0 -257
- package/src/import/testdata/configs-secrets.yaml +0 -15
- package/src/import/testdata/full.yaml +0 -43
- package/src/import/testdata/names-and-fields.yaml +0 -44
- package/src/import/testdata/simple.yaml +0 -9
- package/src/import/testdata/tar.ts +0 -24
- package/src/import/testdata/webapp.yaml +0 -41
- package/src/index.ts +0 -32
- package/src/interpolation.test.ts +0 -41
- package/src/interpolation.ts +0 -76
- package/src/lint/audit-catalog.ts +0 -28
- package/src/lint/audit-lineage.ts +0 -48
- package/src/lint/post-synth/add-url-checksum.ts +0 -38
- package/src/lint/post-synth/apt-no-recommends.ts +0 -43
- package/src/lint/post-synth/apt-update-alone.ts +0 -39
- package/src/lint/post-synth/cache-busting-copy.ts +0 -65
- package/src/lint/post-synth/copy-from-stage.ts +0 -54
- package/src/lint/post-synth/docker-helpers.ts +0 -194
- package/src/lint/post-synth/index.ts +0 -33
- package/src/lint/post-synth/no-latest-image.ts +0 -36
- package/src/lint/post-synth/no-root-user.ts +0 -38
- package/src/lint/post-synth/post-synth.test.ts +0 -330
- package/src/lint/post-synth/prefer-copy.ts +0 -53
- package/src/lint/post-synth/relative-workdir.ts +0 -38
- package/src/lint/post-synth/repeated-cmd.ts +0 -35
- package/src/lint/post-synth/root-after-user.ts +0 -44
- package/src/lint/post-synth/ssh-port-exposed.ts +0 -68
- package/src/lint/post-synth/unused-global-arg.ts +0 -38
- package/src/lint/post-synth/unused-volume.ts +0 -49
- package/src/lint/rules/data/deprecated-images.ts +0 -28
- package/src/lint/rules/data/known-base-images.ts +0 -20
- package/src/lint/rules/index.ts +0 -6
- package/src/lint/rules/no-latest-tag.ts +0 -63
- package/src/lint/rules/per-kind-order.ts +0 -130
- package/src/lint/rules/rules.test.ts +0 -170
- package/src/list-artifacts.test.ts +0 -141
- package/src/list-artifacts.ts +0 -164
- package/src/lsp/completions.test.ts +0 -40
- package/src/lsp/completions.ts +0 -21
- package/src/lsp/hover.test.ts +0 -35
- package/src/lsp/hover.ts +0 -39
- package/src/package-cli.ts +0 -25
- package/src/plugin.test.ts +0 -121
- package/src/plugin.ts +0 -268
- package/src/serializer.test.ts +0 -545
- package/src/serializer.ts +0 -444
- package/src/skills/chant-docker-patterns.md +0 -222
- package/src/skills/chant-docker.md +0 -156
- package/src/spec/fetch-compose.ts +0 -35
- package/src/spec/fetch-engine.ts +0 -25
- package/src/spec/parse-compose.ts +0 -195
- package/src/spec/parse-engine.ts +0 -59
- package/src/typecheck.e2e.test.ts +0 -125
- package/src/typed-props.test.ts +0 -60
- package/src/validate-cli.ts +0 -19
- package/src/validate.test.ts +0 -16
- package/src/validate.ts +0 -44
- package/src/variables.test.ts +0 -32
- package/src/variables.ts +0 -47
- /package/{src → dist}/generated/lexicon-docker.json +0 -0
|
@@ -1,75 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* DockerWebService composite: one HTTP service as a Compose service, built
|
|
3
|
-
* from a Dockerfile or run from an image, listening on one port, with a
|
|
4
|
-
* health check on an HTTP path.
|
|
5
|
-
*
|
|
6
|
-
* It is the shape a single web app takes when Compose runs it, and the kind a
|
|
7
|
-
* component names in its contract's `composites` when it deploys one
|
|
8
|
-
* (#2662), so `chant workspace graph --composites` can offer that component
|
|
9
|
-
* for the instance.
|
|
10
|
-
*/
|
|
11
|
-
|
|
12
|
-
import { Composite, mergeDefaults } from "@intentius/chant";
|
|
13
|
-
import { Service } from "../generated/index";
|
|
14
|
-
|
|
15
|
-
export interface DockerWebServiceProps {
|
|
16
|
-
/** Build the image from a Dockerfile: the context, and the Dockerfile's path in it (default: "Dockerfile"). */
|
|
17
|
-
build?: { context: string; dockerfile?: string };
|
|
18
|
-
/** The image to run, or the tag to give the built one. One of `build` and `image` is required. */
|
|
19
|
-
image?: string;
|
|
20
|
-
/** The port the app listens on in the container. It is also passed to the app as `PORT`. */
|
|
21
|
-
port: number;
|
|
22
|
-
/** The port published on the host (default: `port`). */
|
|
23
|
-
hostPort?: number;
|
|
24
|
-
/** More environment variables. A `PORT` here overrides the one from `port`. */
|
|
25
|
-
environment?: Record<string, string>;
|
|
26
|
-
/** An HTTP path the health check fetches with `wget` inside the container (default: no health check). */
|
|
27
|
-
healthPath?: string;
|
|
28
|
-
/** Restart policy (default: "unless-stopped"). */
|
|
29
|
-
restart?: string;
|
|
30
|
-
/** Per-member defaults for fine-grained overrides. */
|
|
31
|
-
defaults?: {
|
|
32
|
-
service?: Partial<Record<string, unknown>>;
|
|
33
|
-
};
|
|
34
|
-
}
|
|
35
|
-
|
|
36
|
-
/**
|
|
37
|
-
* One HTTP service as a Compose service, with a published port and an HTTP
|
|
38
|
-
* health check. Returns the service, keyed by the export name plus `Service`.
|
|
39
|
-
*
|
|
40
|
-
* @example
|
|
41
|
-
* ```ts
|
|
42
|
-
* import { DockerWebService } from "@intentius/chant-lexicon-docker";
|
|
43
|
-
*
|
|
44
|
-
* export const app = DockerWebService({
|
|
45
|
-
* build: { context: "../app" },
|
|
46
|
-
* image: "app:local",
|
|
47
|
-
* port: 8080,
|
|
48
|
-
* healthPath: "/healthz",
|
|
49
|
-
* });
|
|
50
|
-
* ```
|
|
51
|
-
*/
|
|
52
|
-
export const DockerWebService = Composite((props: DockerWebServiceProps) => {
|
|
53
|
-
const { build, image, port, hostPort = port, environment, healthPath, restart = "unless-stopped", defaults: defs } = props;
|
|
54
|
-
if (!build && !image) throw new Error("DockerWebService: give `build`, `image`, or both");
|
|
55
|
-
|
|
56
|
-
const service = new Service(mergeDefaults({
|
|
57
|
-
...(build ? { build: { context: build.context, dockerfile: build.dockerfile ?? "Dockerfile" } } : {}),
|
|
58
|
-
...(image ? { image } : {}),
|
|
59
|
-
ports: [`${hostPort}:${port}`],
|
|
60
|
-
environment: { PORT: String(port), ...environment },
|
|
61
|
-
restart,
|
|
62
|
-
...(healthPath
|
|
63
|
-
? {
|
|
64
|
-
healthcheck: {
|
|
65
|
-
test: ["CMD", "wget", "-qO-", `http://127.0.0.1:${port}${healthPath}`],
|
|
66
|
-
interval: "30s",
|
|
67
|
-
timeout: "5s",
|
|
68
|
-
retries: 3,
|
|
69
|
-
},
|
|
70
|
-
}
|
|
71
|
-
: {}),
|
|
72
|
-
}, defs?.service));
|
|
73
|
-
|
|
74
|
-
return { service };
|
|
75
|
-
}, "DockerWebService");
|
package/src/composites/index.ts
DELETED
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Docker lexicon composites: factory functions that return pre-configured
|
|
3
|
-
* multi-resource bundles.
|
|
4
|
-
*/
|
|
5
|
-
|
|
6
|
-
export { DockerOtelCollector } from "./docker-otel-collector";
|
|
7
|
-
export type { DockerOtelCollectorProps } from "./docker-otel-collector";
|
|
8
|
-
export { DockerWebService } from "./docker-web-service";
|
|
9
|
-
export type { DockerWebServiceProps } from "./docker-web-service";
|
package/src/coverage.test.ts
DELETED
|
@@ -1,33 +0,0 @@
|
|
|
1
|
-
import { describe, test, expect } from "vitest";
|
|
2
|
-
import { analyzeDockerCoverage, computeCoverage } from "./coverage";
|
|
3
|
-
|
|
4
|
-
describe("analyzeDockerCoverage", () => {
|
|
5
|
-
test("is an async function", () => {
|
|
6
|
-
expect(typeof analyzeDockerCoverage).toBe("function");
|
|
7
|
-
});
|
|
8
|
-
|
|
9
|
-
test("throws when generated dir does not exist", async () => {
|
|
10
|
-
await expect(
|
|
11
|
-
analyzeDockerCoverage({ basePath: "/tmp/nonexistent-docker-lexicon-test" }),
|
|
12
|
-
).rejects.toThrow();
|
|
13
|
-
});
|
|
14
|
-
});
|
|
15
|
-
|
|
16
|
-
describe("computeCoverage", () => {
|
|
17
|
-
test("is a function", () => {
|
|
18
|
-
expect(typeof computeCoverage).toBe("function");
|
|
19
|
-
});
|
|
20
|
-
|
|
21
|
-
test("handles a minimal lexicon JSON", () => {
|
|
22
|
-
const minimal = JSON.stringify({
|
|
23
|
-
Service: {
|
|
24
|
-
resourceType: "Docker::Compose::Service",
|
|
25
|
-
kind: "resource",
|
|
26
|
-
description: "A service",
|
|
27
|
-
properties: {},
|
|
28
|
-
},
|
|
29
|
-
});
|
|
30
|
-
const report = computeCoverage(minimal);
|
|
31
|
-
expect(report).toBeDefined();
|
|
32
|
-
});
|
|
33
|
-
});
|
package/src/coverage.ts
DELETED
|
@@ -1,54 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Coverage analysis for Docker lexicon.
|
|
3
|
-
*/
|
|
4
|
-
|
|
5
|
-
import { existsSync, readFileSync } from "fs";
|
|
6
|
-
import { join, dirname } from "path";
|
|
7
|
-
import { fileURLToPath } from "url";
|
|
8
|
-
import {
|
|
9
|
-
computeCoverage,
|
|
10
|
-
overallPct,
|
|
11
|
-
formatSummary,
|
|
12
|
-
formatVerbose,
|
|
13
|
-
checkThresholds,
|
|
14
|
-
type CoverageReport,
|
|
15
|
-
type CoverageThresholds,
|
|
16
|
-
} from "@intentius/chant/codegen/coverage";
|
|
17
|
-
|
|
18
|
-
export type { CoverageReport, CoverageThresholds };
|
|
19
|
-
export { computeCoverage, overallPct, formatSummary, formatVerbose, checkThresholds };
|
|
20
|
-
|
|
21
|
-
/**
|
|
22
|
-
* Run coverage analysis for the Docker lexicon.
|
|
23
|
-
*/
|
|
24
|
-
export async function analyzeDockerCoverage(opts?: {
|
|
25
|
-
basePath?: string;
|
|
26
|
-
verbose?: boolean;
|
|
27
|
-
minOverall?: number;
|
|
28
|
-
}): Promise<CoverageReport> {
|
|
29
|
-
const basePath = opts?.basePath ?? dirname(dirname(fileURLToPath(import.meta.url)));
|
|
30
|
-
const lexiconPath = join(basePath, "src", "generated", "lexicon-docker.json");
|
|
31
|
-
|
|
32
|
-
if (!existsSync(lexiconPath)) {
|
|
33
|
-
throw new Error(`Generated lexicon not found at ${lexiconPath}. Run "chant dev generate" first.`);
|
|
34
|
-
}
|
|
35
|
-
|
|
36
|
-
const content = readFileSync(lexiconPath, "utf-8");
|
|
37
|
-
const report = computeCoverage(content);
|
|
38
|
-
|
|
39
|
-
if (opts?.verbose) {
|
|
40
|
-
console.error(formatVerbose(report));
|
|
41
|
-
} else {
|
|
42
|
-
console.error(formatSummary(report));
|
|
43
|
-
}
|
|
44
|
-
|
|
45
|
-
if (typeof opts?.minOverall === "number") {
|
|
46
|
-
const result = checkThresholds(report, { minOverallPct: opts.minOverall });
|
|
47
|
-
if (!result.ok) {
|
|
48
|
-
for (const v of result.violations) console.error(` FAIL: ${v}`);
|
|
49
|
-
throw new Error("Coverage below threshold");
|
|
50
|
-
}
|
|
51
|
-
}
|
|
52
|
-
|
|
53
|
-
return report;
|
|
54
|
-
}
|
|
@@ -1,85 +0,0 @@
|
|
|
1
|
-
import { describe, test, expect } from "vitest";
|
|
2
|
-
import {
|
|
3
|
-
DEFAULT_LABELS_MARKER,
|
|
4
|
-
DEFAULT_ANNOTATIONS_MARKER,
|
|
5
|
-
defaultLabels,
|
|
6
|
-
defaultAnnotations,
|
|
7
|
-
isDefaultLabels,
|
|
8
|
-
isDefaultAnnotations,
|
|
9
|
-
} from "./default-labels";
|
|
10
|
-
|
|
11
|
-
describe("DEFAULT_LABELS_MARKER", () => {
|
|
12
|
-
test("is a well-known symbol", () => {
|
|
13
|
-
expect(typeof DEFAULT_LABELS_MARKER).toBe("symbol");
|
|
14
|
-
expect(DEFAULT_LABELS_MARKER.toString()).toContain("docker.defaultLabels");
|
|
15
|
-
});
|
|
16
|
-
});
|
|
17
|
-
|
|
18
|
-
describe("DEFAULT_ANNOTATIONS_MARKER", () => {
|
|
19
|
-
test("is a well-known symbol", () => {
|
|
20
|
-
expect(typeof DEFAULT_ANNOTATIONS_MARKER).toBe("symbol");
|
|
21
|
-
expect(DEFAULT_ANNOTATIONS_MARKER.toString()).toContain("docker.defaultAnnotations");
|
|
22
|
-
});
|
|
23
|
-
});
|
|
24
|
-
|
|
25
|
-
describe("defaultLabels", () => {
|
|
26
|
-
test("creates a DefaultLabels entity", () => {
|
|
27
|
-
const labels = { "app.team": "platform", "app.managed-by": "chant" };
|
|
28
|
-
const entity = defaultLabels(labels);
|
|
29
|
-
|
|
30
|
-
expect(entity.lexicon).toBe("docker");
|
|
31
|
-
expect(entity.entityType).toBe("Docker::DefaultLabels");
|
|
32
|
-
expect(entity.props.labels).toEqual(labels);
|
|
33
|
-
});
|
|
34
|
-
|
|
35
|
-
test("has DEFAULT_LABELS_MARKER", () => {
|
|
36
|
-
const entity = defaultLabels({ "x": "y" });
|
|
37
|
-
expect(DEFAULT_LABELS_MARKER in entity).toBe(true);
|
|
38
|
-
});
|
|
39
|
-
});
|
|
40
|
-
|
|
41
|
-
describe("defaultAnnotations", () => {
|
|
42
|
-
test("creates a DefaultAnnotations entity", () => {
|
|
43
|
-
const annotations = { "app.version": "1.0.0" };
|
|
44
|
-
const entity = defaultAnnotations(annotations);
|
|
45
|
-
|
|
46
|
-
expect(entity.lexicon).toBe("docker");
|
|
47
|
-
expect(entity.entityType).toBe("Docker::DefaultAnnotations");
|
|
48
|
-
expect(entity.props.annotations).toEqual(annotations);
|
|
49
|
-
});
|
|
50
|
-
|
|
51
|
-
test("has DEFAULT_ANNOTATIONS_MARKER", () => {
|
|
52
|
-
const entity = defaultAnnotations({ "x": "y" });
|
|
53
|
-
expect(DEFAULT_ANNOTATIONS_MARKER in entity).toBe(true);
|
|
54
|
-
});
|
|
55
|
-
});
|
|
56
|
-
|
|
57
|
-
describe("isDefaultLabels", () => {
|
|
58
|
-
test("returns true for defaultLabels entity", () => {
|
|
59
|
-
const entity = defaultLabels({ "x": "y" });
|
|
60
|
-
expect(isDefaultLabels(entity)).toBe(true);
|
|
61
|
-
});
|
|
62
|
-
|
|
63
|
-
test("returns false for plain objects", () => {
|
|
64
|
-
expect(isDefaultLabels({})).toBe(false);
|
|
65
|
-
expect(isDefaultLabels(null)).toBe(false);
|
|
66
|
-
expect(isDefaultLabels("string")).toBe(false);
|
|
67
|
-
});
|
|
68
|
-
});
|
|
69
|
-
|
|
70
|
-
describe("isDefaultAnnotations", () => {
|
|
71
|
-
test("returns true for defaultAnnotations entity", () => {
|
|
72
|
-
const entity = defaultAnnotations({ "x": "y" });
|
|
73
|
-
expect(isDefaultAnnotations(entity)).toBe(true);
|
|
74
|
-
});
|
|
75
|
-
|
|
76
|
-
test("returns false for defaultLabels", () => {
|
|
77
|
-
const entity = defaultLabels({ "x": "y" });
|
|
78
|
-
expect(isDefaultAnnotations(entity)).toBe(false);
|
|
79
|
-
});
|
|
80
|
-
|
|
81
|
-
test("returns false for plain objects", () => {
|
|
82
|
-
expect(isDefaultAnnotations({})).toBe(false);
|
|
83
|
-
expect(isDefaultAnnotations(null)).toBe(false);
|
|
84
|
-
});
|
|
85
|
-
});
|
package/src/default-labels.ts
DELETED
|
@@ -1,72 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Default labels for Docker Compose services.
|
|
3
|
-
*
|
|
4
|
-
* Follows the K8s lexicon pattern for defaultLabels/defaultAnnotations.
|
|
5
|
-
* The serializer merges these into every Compose service's labels map.
|
|
6
|
-
*/
|
|
7
|
-
|
|
8
|
-
import { DECLARABLE_MARKER, type Declarable } from "@intentius/chant/declarable";
|
|
9
|
-
|
|
10
|
-
export const DEFAULT_LABELS_MARKER = Symbol.for("docker.defaultLabels");
|
|
11
|
-
export const DEFAULT_ANNOTATIONS_MARKER = Symbol.for("docker.defaultAnnotations");
|
|
12
|
-
|
|
13
|
-
export interface DefaultLabels extends Declarable {
|
|
14
|
-
readonly [DEFAULT_LABELS_MARKER]: true;
|
|
15
|
-
readonly props: { labels: Record<string, string> };
|
|
16
|
-
}
|
|
17
|
-
|
|
18
|
-
export interface DefaultAnnotations extends Declarable {
|
|
19
|
-
readonly [DEFAULT_ANNOTATIONS_MARKER]: true;
|
|
20
|
-
readonly props: { annotations: Record<string, string> };
|
|
21
|
-
}
|
|
22
|
-
|
|
23
|
-
export function isDefaultLabels(value: unknown): value is DefaultLabels {
|
|
24
|
-
return (
|
|
25
|
-
typeof value === "object" &&
|
|
26
|
-
value !== null &&
|
|
27
|
-
DEFAULT_LABELS_MARKER in value
|
|
28
|
-
);
|
|
29
|
-
}
|
|
30
|
-
|
|
31
|
-
export function isDefaultAnnotations(value: unknown): value is DefaultAnnotations {
|
|
32
|
-
return (
|
|
33
|
-
typeof value === "object" &&
|
|
34
|
-
value !== null &&
|
|
35
|
-
DEFAULT_ANNOTATIONS_MARKER in value
|
|
36
|
-
);
|
|
37
|
-
}
|
|
38
|
-
|
|
39
|
-
/**
|
|
40
|
-
* Create a DefaultLabels entity that the serializer will merge into all services.
|
|
41
|
-
*
|
|
42
|
-
* @example
|
|
43
|
-
* export const labels = defaultLabels({
|
|
44
|
-
* "com.example.team": "platform",
|
|
45
|
-
* "com.example.managed-by": "chant",
|
|
46
|
-
* });
|
|
47
|
-
*/
|
|
48
|
-
export function defaultLabels(labels: Record<string, string>): DefaultLabels {
|
|
49
|
-
return {
|
|
50
|
-
[DECLARABLE_MARKER]: true,
|
|
51
|
-
[DEFAULT_LABELS_MARKER]: true,
|
|
52
|
-
lexicon: "docker",
|
|
53
|
-
entityType: "Docker::DefaultLabels",
|
|
54
|
-
kind: "resource",
|
|
55
|
-
props: { labels },
|
|
56
|
-
};
|
|
57
|
-
}
|
|
58
|
-
|
|
59
|
-
/**
|
|
60
|
-
* Create a DefaultAnnotations entity.
|
|
61
|
-
* (Not used by Compose directly, but useful for Dockerfile LABEL instructions.)
|
|
62
|
-
*/
|
|
63
|
-
export function defaultAnnotations(annotations: Record<string, string>): DefaultAnnotations {
|
|
64
|
-
return {
|
|
65
|
-
[DECLARABLE_MARKER]: true,
|
|
66
|
-
[DEFAULT_ANNOTATIONS_MARKER]: true,
|
|
67
|
-
lexicon: "docker",
|
|
68
|
-
entityType: "Docker::DefaultAnnotations",
|
|
69
|
-
kind: "resource",
|
|
70
|
-
props: { annotations },
|
|
71
|
-
};
|
|
72
|
-
}
|
package/src/detect.ts
DELETED
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
/** Edge-safe template detection for docker (Compose) — see #426. */
|
|
2
|
-
export function detectTemplate(data: unknown): boolean {
|
|
3
|
-
if (typeof data !== "object" || data === null) return false;
|
|
4
|
-
const obj = data as Record<string, unknown>;
|
|
5
|
-
// Docker Compose files have a services: key
|
|
6
|
-
return "services" in obj;
|
|
7
|
-
}
|
package/src/dockerfile-order.ts
DELETED
|
@@ -1,20 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* The order a Dockerfile stage's per-kind fields (`run`, `copy`, `user`, ...)
|
|
3
|
-
* are written in when the stage has no `steps`. It never changes, so a
|
|
4
|
-
* Dockerfile declared with per-kind fields builds the same output it always
|
|
5
|
-
* has; `steps` is how a stage controls its own order.
|
|
6
|
-
*/
|
|
7
|
-
export const PER_KIND_ORDER = [
|
|
8
|
-
"arg", "env", "workdir", "user", "run", "copy", "add",
|
|
9
|
-
"expose", "volume", "label", "entrypoint", "cmd", "healthcheck",
|
|
10
|
-
] as const;
|
|
11
|
-
|
|
12
|
-
export type PerKindField = (typeof PER_KIND_ORDER)[number];
|
|
13
|
-
|
|
14
|
-
/** The step keys whose array value is written in JSON exec form. */
|
|
15
|
-
export const EXEC_FORM_STEPS: ReadonlySet<string> = new Set(["run", "cmd", "entrypoint", "shell"]);
|
|
16
|
-
|
|
17
|
-
/** Every instruction a step can name. FROM is the stage's own field. */
|
|
18
|
-
export const STEP_INSTRUCTIONS: ReadonlySet<string> = new Set([
|
|
19
|
-
...PER_KIND_ORDER, "shell", "stopsignal", "onbuild",
|
|
20
|
-
]);
|
|
@@ -1,141 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* The Dockerfile examples in the docs and skills build, and build what the
|
|
3
|
-
* page says they do.
|
|
4
|
-
*
|
|
5
|
-
* - A ```typescript block with no title that declares a Dockerfile is run
|
|
6
|
-
* and serialized. When the next code block is an untitled ```dockerfile
|
|
7
|
-
* block, the built file must equal it.
|
|
8
|
-
* - A titled ```typescript block (`title="src/web.ts"`) must equal that file
|
|
9
|
-
* in examples/dockerfile-sharing, and a titled ```dockerfile block
|
|
10
|
-
* (`title="Dockerfile.web"`) must equal that file from building the
|
|
11
|
-
* example.
|
|
12
|
-
* - In importing.mdx, importing the ```dockerfile block titled "Dockerfile"
|
|
13
|
-
* must give the ```typescript block that follows it.
|
|
14
|
-
*/
|
|
15
|
-
|
|
16
|
-
import { describe, test, expect } from "vitest";
|
|
17
|
-
import { readFileSync } from "fs";
|
|
18
|
-
import { join } from "path";
|
|
19
|
-
import * as ts from "typescript";
|
|
20
|
-
import { build } from "@intentius/chant/build";
|
|
21
|
-
import * as chant from "@intentius/chant";
|
|
22
|
-
import type { Declarable } from "@intentius/chant/declarable";
|
|
23
|
-
import * as lexicon from "./index";
|
|
24
|
-
import { dockerSerializer } from "./serializer";
|
|
25
|
-
import { DockerTemplateGenerator, DockerTemplateParser } from "./import/adapter";
|
|
26
|
-
|
|
27
|
-
const root = join(import.meta.dirname, "..");
|
|
28
|
-
const sharingExample = join(root, "examples", "dockerfile-sharing");
|
|
29
|
-
|
|
30
|
-
interface Block {
|
|
31
|
-
lang: string;
|
|
32
|
-
title?: string;
|
|
33
|
-
code: string;
|
|
34
|
-
/** The prose between the previous code block and this one. */
|
|
35
|
-
before: string;
|
|
36
|
-
}
|
|
37
|
-
|
|
38
|
-
function blocks(file: string): Block[] {
|
|
39
|
-
const text = readFileSync(join(root, file), "utf8");
|
|
40
|
-
const out: Block[] = [];
|
|
41
|
-
let last = 0;
|
|
42
|
-
for (const m of text.matchAll(/^```(\w+)([^\n]*)\n([\s\S]*?)^```$/gm)) {
|
|
43
|
-
const title = m[2]!.match(/title="([^"]+)"/)?.[1];
|
|
44
|
-
out.push({ lang: m[1]!, ...(title ? { title } : {}), code: m[3]!, before: text.slice(last, m.index) });
|
|
45
|
-
last = m.index! + m[0].length;
|
|
46
|
-
}
|
|
47
|
-
return out;
|
|
48
|
-
}
|
|
49
|
-
|
|
50
|
-
/**
|
|
51
|
-
* Run one TypeScript block as a module and serialize the Dockerfiles it
|
|
52
|
-
* exports. A block whose first line is a path comment (`// src/web.ts`) is
|
|
53
|
-
* one module of a multi-file example: `modules` holds the exports of the
|
|
54
|
-
* page's earlier modules, by path, for its relative imports.
|
|
55
|
-
*/
|
|
56
|
-
function buildBlock(code: string, pageModules: Map<string, Record<string, unknown>> = new Map()): Record<string, string> {
|
|
57
|
-
const js = ts.transpileModule(code, { compilerOptions: { module: ts.ModuleKind.CommonJS, target: ts.ScriptTarget.ES2022 } }).outputText;
|
|
58
|
-
const modules: Record<string, unknown> = { "@intentius/chant-lexicon-docker": lexicon, "@intentius/chant": chant };
|
|
59
|
-
const path = code.match(/^\/\/ (src\/\S+)\.ts\s*$/m)?.[1];
|
|
60
|
-
const req = (name: string): unknown => {
|
|
61
|
-
if (name.startsWith("./") && path) {
|
|
62
|
-
const target = join(path, "..", name).replace(/\\/g, "/");
|
|
63
|
-
const found = pageModules.get(target);
|
|
64
|
-
if (found) return found;
|
|
65
|
-
}
|
|
66
|
-
if (!(name in modules)) throw new Error(`docs example imports ${name}, which this test does not provide`);
|
|
67
|
-
return modules[name];
|
|
68
|
-
};
|
|
69
|
-
const mod = { exports: {} as Record<string, unknown> };
|
|
70
|
-
// Snippets that leave out the import line still see the lexicon's exports.
|
|
71
|
-
const globals = Object.keys(lexicon).filter((k) => /^[A-Za-z_$][\w$]*$/.test(k));
|
|
72
|
-
new Function("require", "module", "exports", ...globals, js)(req, mod, mod.exports, ...globals.map((k) => (lexicon as Record<string, unknown>)[k]));
|
|
73
|
-
if (path) pageModules.set(path, mod.exports);
|
|
74
|
-
const entities = new Map<string, Declarable>();
|
|
75
|
-
for (const [name, value] of Object.entries(mod.exports)) {
|
|
76
|
-
if (value && typeof value === "object" && "entityType" in value) entities.set(name, value as Declarable);
|
|
77
|
-
}
|
|
78
|
-
const result = dockerSerializer.serialize(entities);
|
|
79
|
-
return typeof result === "string" ? {} : (result.files ?? {});
|
|
80
|
-
}
|
|
81
|
-
|
|
82
|
-
const PAGES = [
|
|
83
|
-
"docs/pages/dockerfiles.mdx",
|
|
84
|
-
"docs/pages/examples.mdx",
|
|
85
|
-
"docs/pages/lint-rules.mdx",
|
|
86
|
-
"src/skills/chant-docker.md",
|
|
87
|
-
"src/skills/chant-docker-patterns.md",
|
|
88
|
-
];
|
|
89
|
-
|
|
90
|
-
describe("docs Dockerfile examples", () => {
|
|
91
|
-
for (const page of PAGES) {
|
|
92
|
-
test(`${page}: every Dockerfile example builds what the page shows`, () => {
|
|
93
|
-
const list = blocks(page);
|
|
94
|
-
const pageModules = new Map<string, Record<string, unknown>>();
|
|
95
|
-
let checked = 0;
|
|
96
|
-
list.forEach((b, i) => {
|
|
97
|
-
if (b.lang !== "typescript" || b.title) return;
|
|
98
|
-
const isModule = /^\/\/ src\/\S+\.ts\s*$/m.test(b.code);
|
|
99
|
-
if (!b.code.includes("new Dockerfile(") && !isModule) return;
|
|
100
|
-
const files = buildBlock(b.code, pageModules);
|
|
101
|
-
if (!b.code.includes("new Dockerfile(")) return;
|
|
102
|
-
expect(Object.keys(files).length, `${page} block ${i + 1} declares a Dockerfile`).toBeGreaterThan(0);
|
|
103
|
-
checked++;
|
|
104
|
-
// The output shown right after it, under a "`Dockerfile.name`:" line.
|
|
105
|
-
const next = list[i + 1];
|
|
106
|
-
if (next && next.lang === "dockerfile" && !next.title && /^\s*`Dockerfile\.\w+`:\s*$/.test(next.before)) {
|
|
107
|
-
expect(Object.values(files).join("---\n"), `${page} block ${i + 1}`).toBe(next.code);
|
|
108
|
-
}
|
|
109
|
-
});
|
|
110
|
-
expect(checked, `${page} has Dockerfile examples`).toBeGreaterThan(0);
|
|
111
|
-
});
|
|
112
|
-
}
|
|
113
|
-
|
|
114
|
-
test("dockerfiles.mdx sharing section matches the dockerfile-sharing example and its build", async () => {
|
|
115
|
-
const titled = blocks("docs/pages/dockerfiles.mdx").filter((b) => b.title);
|
|
116
|
-
const sources = titled.filter((b) => b.lang === "typescript");
|
|
117
|
-
const outputs = titled.filter((b) => b.lang === "dockerfile");
|
|
118
|
-
expect(sources.map((b) => b.title)).toEqual(["src/shared/node.ts", "src/web.ts", "src/worker.ts", "src/shared/node-image.ts", "src/api.ts"]);
|
|
119
|
-
for (const b of sources) {
|
|
120
|
-
expect(b.code, b.title).toBe(readFileSync(join(sharingExample, b.title!), "utf8"));
|
|
121
|
-
}
|
|
122
|
-
|
|
123
|
-
const result = await build(join(sharingExample, "src"), [dockerSerializer]);
|
|
124
|
-
expect(result.errors).toEqual([]);
|
|
125
|
-
const files = (result.outputs.get("docker") as unknown as { files: Record<string, string> }).files;
|
|
126
|
-
expect(outputs.map((b) => b.title).sort()).toEqual(Object.keys(files).sort());
|
|
127
|
-
for (const b of outputs) {
|
|
128
|
-
expect(b.code, b.title).toBe(files[b.title!]);
|
|
129
|
-
}
|
|
130
|
-
});
|
|
131
|
-
|
|
132
|
-
test("importing.mdx shows what importing its Dockerfile produces", () => {
|
|
133
|
-
const list = blocks("docs/pages/importing.mdx");
|
|
134
|
-
const at = list.findIndex((b) => b.lang === "dockerfile" && b.title === "Dockerfile");
|
|
135
|
-
expect(at).toBeGreaterThan(-1);
|
|
136
|
-
const [file] = new DockerTemplateGenerator().generate(new DockerTemplateParser().parse(list[at]!.code));
|
|
137
|
-
expect(list[at + 1]!.code).toBe(file!.content.endsWith("\n") ? file!.content : `${file!.content}\n`);
|
|
138
|
-
// And building the import gives the Dockerfile back.
|
|
139
|
-
expect(Object.values(buildBlock(list[at + 1]!.code))[0]).toBe(list[at]!.code.replace(/^#.*\n/gm, ""));
|
|
140
|
-
});
|
|
141
|
-
});
|
package/src/export-resources.ts
DELETED
|
@@ -1,90 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Live export for the docker lexicon (#4388): implements
|
|
3
|
-
* `LexiconPlugin.exportResources()` so `chant import --from <env>` regenerates
|
|
4
|
-
* a compose project's services, and the configs they read, as chant
|
|
5
|
-
* TypeScript.
|
|
6
|
-
*
|
|
7
|
-
* Which project: `COMPOSE_PROJECT_NAME` when set, else the environment name.
|
|
8
|
-
* The containers are found by compose's `com.docker.compose.project` label.
|
|
9
|
-
* All Engine I/O lives here; mapping is pure in `./import/live-export`.
|
|
10
|
-
*/
|
|
11
|
-
|
|
12
|
-
import type { ExportedTemplate, ResourceSelector } from "@intentius/chant/lexicon";
|
|
13
|
-
import { defaultDockerEngine, singleFileText, type DockerEngine } from "./import/engine";
|
|
14
|
-
import {
|
|
15
|
-
buildExportFromProject,
|
|
16
|
-
configCandidates,
|
|
17
|
-
isChantOwned,
|
|
18
|
-
PROJECT_LABEL,
|
|
19
|
-
serviceContainers,
|
|
20
|
-
type ContainerInspect,
|
|
21
|
-
type ImageInspect,
|
|
22
|
-
type LiveService,
|
|
23
|
-
} from "./import/live-export";
|
|
24
|
-
|
|
25
|
-
function json<T>(body: Buffer): T | undefined {
|
|
26
|
-
try {
|
|
27
|
-
return JSON.parse(body.toString("utf8")) as T;
|
|
28
|
-
} catch {
|
|
29
|
-
return undefined;
|
|
30
|
-
}
|
|
31
|
-
}
|
|
32
|
-
|
|
33
|
-
/** The compose project an environment exports. */
|
|
34
|
-
export function projectFor(environment: string): string {
|
|
35
|
-
return process.env.COMPOSE_PROJECT_NAME || environment;
|
|
36
|
-
}
|
|
37
|
-
|
|
38
|
-
export async function exportResources(
|
|
39
|
-
options: {
|
|
40
|
-
environment: string;
|
|
41
|
-
selector?: ResourceSelector;
|
|
42
|
-
owned?: boolean;
|
|
43
|
-
verbatim?: boolean;
|
|
44
|
-
},
|
|
45
|
-
engine: DockerEngine = defaultDockerEngine(),
|
|
46
|
-
signal?: AbortSignal,
|
|
47
|
-
): Promise<ExportedTemplate> {
|
|
48
|
-
const project = projectFor(options.environment);
|
|
49
|
-
const filters = encodeURIComponent(JSON.stringify({ label: [`${PROJECT_LABEL}=${project}`] }));
|
|
50
|
-
const list = await engine(`/containers/json?all=1&filters=${filters}`, signal);
|
|
51
|
-
if (list.status !== 200) {
|
|
52
|
-
throw new Error(`docker live export: listing the containers of compose project ${project} failed (${list.status}): ${list.body.toString("utf8").trim()}`);
|
|
53
|
-
}
|
|
54
|
-
const containers = serviceContainers(project, json<Array<{ Id?: string; Labels?: Record<string, string> }>>(list.body) ?? []);
|
|
55
|
-
|
|
56
|
-
const services: LiveService[] = [];
|
|
57
|
-
const images = new Map<string, ImageInspect | undefined>();
|
|
58
|
-
for (const [name, id] of containers) {
|
|
59
|
-
const res = await engine(`/containers/${encodeURIComponent(id)}/json`, signal);
|
|
60
|
-
const container = res.status === 200 ? json<ContainerInspect>(res.body) : undefined;
|
|
61
|
-
if (!container) continue;
|
|
62
|
-
|
|
63
|
-
const ref = container.Config?.Image;
|
|
64
|
-
if (ref && !images.has(ref)) {
|
|
65
|
-
const img = await engine(`/images/${encodeURIComponent(ref)}/json`, signal);
|
|
66
|
-
images.set(ref, img.status === 200 ? json<ImageInspect>(img.body) : undefined);
|
|
67
|
-
}
|
|
68
|
-
|
|
69
|
-
// Config files are read only for the services that are exported.
|
|
70
|
-
const files: Record<string, string> = {};
|
|
71
|
-
if (!options.owned || isChantOwned(container)) {
|
|
72
|
-
for (const path of configCandidates(container)) {
|
|
73
|
-
const res = await engine(`/containers/${encodeURIComponent(id)}/archive?path=${encodeURIComponent(path)}`, signal);
|
|
74
|
-
if (res.status !== 200) continue;
|
|
75
|
-
const text = singleFileText(res.body);
|
|
76
|
-
if (text !== undefined) files[path] = text;
|
|
77
|
-
}
|
|
78
|
-
}
|
|
79
|
-
|
|
80
|
-
services.push({ name, container, image: ref ? images.get(ref) : undefined, files });
|
|
81
|
-
}
|
|
82
|
-
|
|
83
|
-
if (options.owned) {
|
|
84
|
-
console.warn(
|
|
85
|
-
"[docker] the docker serializer stamps no ownership marker; under --owned only services labelled app.kubernetes.io/managed-by=chant (defaultLabels) are exported",
|
|
86
|
-
);
|
|
87
|
-
}
|
|
88
|
-
|
|
89
|
-
return buildExportFromProject(project, services, options);
|
|
90
|
-
}
|