boatyard 0.9.5.dev261__tar.gz → 0.9.6__tar.gz
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.
- {boatyard-0.9.5.dev261 → boatyard-0.9.6}/AGENTS.md +29 -17
- {boatyard-0.9.5.dev261 → boatyard-0.9.6}/PKG-INFO +1 -1
- {boatyard-0.9.5.dev261 → boatyard-0.9.6}/pyproject.toml +1 -1
- {boatyard-0.9.5.dev261 → boatyard-0.9.6}/src/boatyard/lock.py +50 -29
- {boatyard-0.9.5.dev261 → boatyard-0.9.6}/src/boatyard/markers.py +2 -2
- {boatyard-0.9.5.dev261 → boatyard-0.9.6}/src/boatyard/models/config_file.py +35 -12
- boatyard-0.9.6/src/boatyard/models/workload.py +424 -0
- {boatyard-0.9.5.dev261 → boatyard-0.9.6}/src/boatyard/score.py +130 -136
- {boatyard-0.9.5.dev261 → boatyard-0.9.6}/src/boatyard/score_compose.py +22 -12
- {boatyard-0.9.5.dev261 → boatyard-0.9.6}/src/boatyard/score_k8s.py +2 -2
- {boatyard-0.9.5.dev261 → boatyard-0.9.6}/src/boatyard/score_patch_templates/gpu-pod.tpl +2 -2
- {boatyard-0.9.5.dev261 → boatyard-0.9.6}/src/boatyard/verbs/down.py +1 -1
- {boatyard-0.9.5.dev261 → boatyard-0.9.6}/src/boatyard/yaml.py +8 -5
- {boatyard-0.9.5.dev261 → boatyard-0.9.6}/tests/test_build_docker.py +2 -2
- {boatyard-0.9.5.dev261 → boatyard-0.9.6}/tests/test_bump.py +4 -4
- {boatyard-0.9.5.dev261 → boatyard-0.9.6}/tests/test_compose.py +5 -5
- {boatyard-0.9.5.dev261 → boatyard-0.9.6}/tests/test_config.py +88 -77
- {boatyard-0.9.5.dev261 → boatyard-0.9.6}/tests/test_image_builds.py +6 -7
- {boatyard-0.9.5.dev261 → boatyard-0.9.6}/tests/test_lock.py +50 -17
- {boatyard-0.9.5.dev261 → boatyard-0.9.6}/tests/test_matrix.py +2 -2
- {boatyard-0.9.5.dev261 → boatyard-0.9.6}/tests/test_publish_compose.py +2 -2
- {boatyard-0.9.5.dev261 → boatyard-0.9.6}/tests/test_score_generate.py +475 -283
- {boatyard-0.9.5.dev261 → boatyard-0.9.6}/tests/test_tree_tags.py +2 -2
- {boatyard-0.9.5.dev261 → boatyard-0.9.6}/tests/test_values.py +5 -3
- boatyard-0.9.5.dev261/src/boatyard/models/workload.py +0 -517
- {boatyard-0.9.5.dev261 → boatyard-0.9.6}/.gitattributes +0 -0
- {boatyard-0.9.5.dev261 → boatyard-0.9.6}/.github/workflows/cleanup-pr-releases.yml +0 -0
- {boatyard-0.9.5.dev261 → boatyard-0.9.6}/.github/workflows/integrate.yml +0 -0
- {boatyard-0.9.5.dev261 → boatyard-0.9.6}/.github/workflows/merge-gate.yml +0 -0
- {boatyard-0.9.5.dev261 → boatyard-0.9.6}/.github/workflows/release.yml +0 -0
- {boatyard-0.9.5.dev261 → boatyard-0.9.6}/.gitignore +0 -0
- {boatyard-0.9.5.dev261 → boatyard-0.9.6}/.python-version +0 -0
- {boatyard-0.9.5.dev261 → boatyard-0.9.6}/CLAUDE.md +0 -0
- {boatyard-0.9.5.dev261 → boatyard-0.9.6}/LICENSE +0 -0
- {boatyard-0.9.5.dev261 → boatyard-0.9.6}/NOTICE +0 -0
- {boatyard-0.9.5.dev261 → boatyard-0.9.6}/README.md +0 -0
- {boatyard-0.9.5.dev261 → boatyard-0.9.6}/design/AGENTS.md +0 -0
- {boatyard-0.9.5.dev261 → boatyard-0.9.6}/design/CLAUDE.md +0 -0
- {boatyard-0.9.5.dev261 → boatyard-0.9.6}/design/apt-hermeticity.md +0 -0
- {boatyard-0.9.5.dev261 → boatyard-0.9.6}/design/mirror-digest-retention.md +0 -0
- {boatyard-0.9.5.dev261 → boatyard-0.9.6}/design/precision-attribution.md +0 -0
- {boatyard-0.9.5.dev261 → boatyard-0.9.6}/design/semver-image-bundle-lines.md +0 -0
- {boatyard-0.9.5.dev261 → boatyard-0.9.6}/publish.yml +0 -0
- {boatyard-0.9.5.dev261 → boatyard-0.9.6}/ruff.base.toml +0 -0
- {boatyard-0.9.5.dev261 → boatyard-0.9.6}/ruff.toml +0 -0
- {boatyard-0.9.5.dev261 → boatyard-0.9.6}/scripts/preflight.py +0 -0
- {boatyard-0.9.5.dev261 → boatyard-0.9.6}/src/boatyard/__init__.py +0 -0
- {boatyard-0.9.5.dev261 → boatyard-0.9.6}/src/boatyard/build.py +0 -0
- {boatyard-0.9.5.dev261 → boatyard-0.9.6}/src/boatyard/cli.py +0 -0
- {boatyard-0.9.5.dev261 → boatyard-0.9.6}/src/boatyard/crane.py +0 -0
- {boatyard-0.9.5.dev261 → boatyard-0.9.6}/src/boatyard/models/__init__.py +0 -0
- {boatyard-0.9.5.dev261 → boatyard-0.9.6}/src/boatyard/models/image.py +0 -0
- {boatyard-0.9.5.dev261 → boatyard-0.9.6}/src/boatyard/models/k8s_pins.py +0 -0
- {boatyard-0.9.5.dev261 → boatyard-0.9.6}/src/boatyard/models/lock_file.py +0 -0
- {boatyard-0.9.5.dev261 → boatyard-0.9.6}/src/boatyard/models/pyproject.py +0 -0
- {boatyard-0.9.5.dev261 → boatyard-0.9.6}/src/boatyard/models/values_file.py +0 -0
- {boatyard-0.9.5.dev261 → boatyard-0.9.6}/src/boatyard/paths.py +0 -0
- {boatyard-0.9.5.dev261 → boatyard-0.9.6}/src/boatyard/publish.py +0 -0
- {boatyard-0.9.5.dev261 → boatyard-0.9.6}/src/boatyard/py.typed +0 -0
- {boatyard-0.9.5.dev261 → boatyard-0.9.6}/src/boatyard/resolve.py +0 -0
- {boatyard-0.9.5.dev261 → boatyard-0.9.6}/src/boatyard/score_generate.py +0 -0
- {boatyard-0.9.5.dev261 → boatyard-0.9.6}/src/boatyard/score_patch_templates/gpu-cuda.tpl +0 -0
- {boatyard-0.9.5.dev261 → boatyard-0.9.6}/src/boatyard/score_patch_templates/gpu-rocm.tpl +0 -0
- {boatyard-0.9.5.dev261 → boatyard-0.9.6}/src/boatyard/score_patch_templates/probe-adapter-healthchecks.tpl +0 -0
- {boatyard-0.9.5.dev261 → boatyard-0.9.6}/src/boatyard/score_patch_templates/restart.tpl +0 -0
- {boatyard-0.9.5.dev261 → boatyard-0.9.6}/src/boatyard/score_patch_templates/scale-to-zero.tpl +0 -0
- {boatyard-0.9.5.dev261 → boatyard-0.9.6}/src/boatyard/temp.py +0 -0
- {boatyard-0.9.5.dev261 → boatyard-0.9.6}/src/boatyard/verbs/__init__.py +0 -0
- {boatyard-0.9.5.dev261 → boatyard-0.9.6}/src/boatyard/verbs/build.py +0 -0
- {boatyard-0.9.5.dev261 → boatyard-0.9.6}/src/boatyard/verbs/bump.py +0 -0
- {boatyard-0.9.5.dev261 → boatyard-0.9.6}/src/boatyard/verbs/lock.py +0 -0
- {boatyard-0.9.5.dev261 → boatyard-0.9.6}/src/boatyard/verbs/matrix.py +0 -0
- {boatyard-0.9.5.dev261 → boatyard-0.9.6}/src/boatyard/verbs/mirror.py +0 -0
- {boatyard-0.9.5.dev261 → boatyard-0.9.6}/src/boatyard/verbs/publish.py +0 -0
- {boatyard-0.9.5.dev261 → boatyard-0.9.6}/src/boatyard/verbs/score.py +0 -0
- {boatyard-0.9.5.dev261 → boatyard-0.9.6}/src/boatyard/verbs/tree_tags.py +0 -0
- {boatyard-0.9.5.dev261 → boatyard-0.9.6}/src/boatyard/verbs/up.py +0 -0
- {boatyard-0.9.5.dev261 → boatyard-0.9.6}/tests/conftest.py +0 -0
- {boatyard-0.9.5.dev261 → boatyard-0.9.6}/tests/test_assembly.py +0 -0
- {boatyard-0.9.5.dev261 → boatyard-0.9.6}/tests/test_daemon_gc.py +0 -0
- {boatyard-0.9.5.dev261 → boatyard-0.9.6}/tests/test_markers.py +0 -0
- {boatyard-0.9.5.dev261 → boatyard-0.9.6}/tests/test_mirror.py +0 -0
- {boatyard-0.9.5.dev261 → boatyard-0.9.6}/tests/test_provisioners.py +0 -0
- {boatyard-0.9.5.dev261 → boatyard-0.9.6}/uv.lock +0 -0
|
@@ -38,13 +38,22 @@ Design intent and silent-failure traps, one fact per bullet.
|
|
|
38
38
|
entry set plus the bare project name, removing the shared network last.
|
|
39
39
|
- The `boatyard-gateway` service does no token validation; re-protection is a bundle-shipped
|
|
40
40
|
oauth2-proxy sidecar treaty.
|
|
41
|
-
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
the
|
|
47
|
-
|
|
41
|
+
- `listeners:` is a workload's one port inventory — `name: port`, or `{port: <int>,
|
|
42
|
+
internal: true}` for an in-container port that never rides the service surface — and every
|
|
43
|
+
port reference names an entry: route claims, probe `httpGet.port`s, and
|
|
44
|
+
`${listeners.<name>.port}` variables. The generation seam derives `service.ports` from the
|
|
45
|
+
non-internal listeners, rewrites the names to their integers, and composes the score tools'
|
|
46
|
+
document from the lens without the `listeners:` and `boatyard:` blocks, so a port integer is
|
|
47
|
+
authored exactly once and every reference is resolvable from the file itself.
|
|
48
|
+
- Routes are claims the serving surface authors against that inventory: a workload's
|
|
49
|
+
`boatyard: {route: {path: /auth/*, port: http, strip: true}}` — the port names a
|
|
50
|
+
non-internal listener — or a provisioner stanza's `route: {path, port, strip}` mapping, the
|
|
51
|
+
port a literal or a whole-string `{{ .State.* }}` template. The compile pass resolves the
|
|
52
|
+
port and spells the claim as the rendered stanza's `boatyard/route-path`,
|
|
53
|
+
`boatyard/route-port`, and `boatyard/route-strip` labels — the interchange the bundle-record
|
|
54
|
+
extraction reads back into route records; nothing hand-copies an upstream, and the
|
|
55
|
+
`boatyard/*` stanza-label vocabulary is closed — the extraction refuses any label outside
|
|
56
|
+
it.
|
|
48
57
|
- The gateway table is compiler output: it orders by path specificity (longest concrete
|
|
49
58
|
prefix first, the `/*` catch-all last), and each claiming workload exports
|
|
50
59
|
`<WORKLOAD>_ROUTE_PATH` (the claim's concrete path) into every rendering's tool env —
|
|
@@ -69,15 +78,18 @@ Design intent and silent-failure traps, one fact per bullet.
|
|
|
69
78
|
declares (group-level `workloads:`; a closure declaring no axis or two axes refuses) or authors
|
|
70
79
|
it (`options:`); the axis lives on the local `base_images` entry — the one spelling across
|
|
71
80
|
the Dockerfile ARG and the k8s selection, never re-described by hand.
|
|
72
|
-
- Plain score-compose silently drops `httpGet` probes; boatyard
|
|
81
|
+
- Plain score-compose silently drops `httpGet` probes; boatyard makes the omission loud
|
|
73
82
|
instead via the workload's `boatyard/probe-adapter` annotation.
|
|
74
|
-
- Substrate needs live in workload files as `boatyard/*` annotations
|
|
75
|
-
|
|
83
|
+
- Substrate needs live in workload files — scalar facts as `boatyard/*` annotations, compound
|
|
84
|
+
facts (routes, publishes, container sources, interpolation targets) in the `boatyard:` block —
|
|
85
|
+
and `boatyard.yml` holds no per-workload runtime fact. The gpu annotation (`"true"`) is
|
|
86
|
+
substrate only
|
|
76
87
|
and the patch templates are its reader; start behavior is a separate annotation —
|
|
77
88
|
`boatyard/autostart: "false"` leaves the container created-stopped instead of
|
|
78
89
|
started by `up`, on any service, gpu or not, recorded in the bundle records as
|
|
79
90
|
held services (lock-time for remote bundles, resolve-time for local and override
|
|
80
|
-
bundles). The lens is `WorkloadDocument.
|
|
91
|
+
bundles). The lens is `WorkloadDocument.model_validate(raw, context={"source": path.name})`
|
|
92
|
+
inside `ConfigFile.load`.
|
|
81
93
|
|
|
82
94
|
## Commands
|
|
83
95
|
|
|
@@ -91,8 +103,8 @@ Quick loop: `uv run pytest`, `uv run ruff check`. Full gate:
|
|
|
91
103
|
- `extra="forbid"` everywhere in pydantic models; per-field shape in `field_validator`s,
|
|
92
104
|
cross-field shape in one `model_validator(mode="after")` per model.
|
|
93
105
|
- Every `load()` takes a full path. YAML kinds go through `load_yaml_model` (`yaml.py` strict load);
|
|
94
|
-
the image set derives inside `ConfigFile.load` over the declared dockerfile edges (
|
|
95
|
-
|
|
106
|
+
the image set derives inside `ConfigFile.load` over the declared dockerfile edges (the
|
|
107
|
+
boatyard block's container sources, provisioner markers, local entries); `LockFile.load(path, config)` reads a
|
|
96
108
|
missing lock as the empty lock.
|
|
97
109
|
- Every pydantic-modeled file kind owns exactly one module in `models/` (boatyard.yml, the lock,
|
|
98
110
|
values, pins, workloads, the pyproject lens). Each module's types run root down, root
|
|
@@ -101,8 +113,8 @@ Quick loop: `uv run pytest`, `uv run ruff check`. Full gate:
|
|
|
101
113
|
`image`/`workload`/`pyproject` ← `config_file` ← `lock_file` ← `lock`.
|
|
102
114
|
- Nothing is caught only to be re-raised as a different exception; guards and third-party
|
|
103
115
|
exceptions surface raw with full traceback; `typer.BadParameter` owns the CLI-flag layer.
|
|
104
|
-
- The build set is the closure over declared edges —
|
|
105
|
-
`dockerfile:` markers, local `base_images` entries — computed inside `ConfigFile` load, never
|
|
116
|
+
- The build set is the closure over declared edges — the boatyard block's container sources,
|
|
117
|
+
provisioner `dockerfile:` markers, local `base_images` entries — computed inside `ConfigFile` load, never
|
|
106
118
|
authored in config and never walked from the tree; a Dockerfile nothing declares is silently
|
|
107
119
|
not built, like an unlisted score file. Every workload file loads exactly once per
|
|
108
120
|
`ConfigFile.load` — one lens serves the declared edges, the derived variants, and both renderings;
|
|
@@ -120,8 +132,8 @@ Quick loop: `uv run pytest`, `uv run ruff check`. Full gate:
|
|
|
120
132
|
key and reference grammar.
|
|
121
133
|
- `models/k8s_pins.py` — pins parsing.
|
|
122
134
|
- `models/pyproject.py` — the toolchain-pin lens over the consumer repo's pyproject.toml.
|
|
123
|
-
- `models/workload.py` — the workload-file lens (`WorkloadDocument
|
|
124
|
-
|
|
135
|
+
- `models/workload.py` — the workload-file lens (`WorkloadDocument`: the `listeners:` inventory
|
|
136
|
+
and `boatyard:` block) plus provisioner-file selection.
|
|
125
137
|
- `models/image.py` — the image and local-base models, the Dockerfile parse, and the tree-tag
|
|
126
138
|
sha machinery.
|
|
127
139
|
- `resolve.py` — the `resolve(config, lock, values)` fold answering the assembly plan
|
|
@@ -32,12 +32,12 @@ from boatyard.models.lock_file import (
|
|
|
32
32
|
)
|
|
33
33
|
from boatyard.models.workload import (
|
|
34
34
|
AUTOSTART_ANNOTATION,
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
35
|
+
PUBLISH_PORT_LABEL,
|
|
36
|
+
ROUTE_PATH_LABEL,
|
|
37
|
+
ROUTE_PATH_PATTERN,
|
|
38
|
+
ROUTE_PORT_LABEL,
|
|
39
|
+
ROUTE_STRIP_LABEL,
|
|
40
|
+
STANZA_LABELS,
|
|
41
41
|
)
|
|
42
42
|
from boatyard.temp import SHA256_DIGEST_REGEX
|
|
43
43
|
from boatyard.yaml import Yaml, is_list, is_mapping, load_yaml_model
|
|
@@ -280,46 +280,67 @@ def extract_bundle_records(texts: list[str]) -> BundleRecords:
|
|
|
280
280
|
_collect_declared_ports(declared_ports, service_name, stanza.get("ports"))
|
|
281
281
|
stanzas.append((service_name, stanza, stanza_annotations(stanza)))
|
|
282
282
|
|
|
283
|
-
# Read the routes and ports from the
|
|
283
|
+
# Read the routes and ports from the interchange labels
|
|
284
284
|
routes: list[Route] = []
|
|
285
285
|
ports: list[PublishedPort] = []
|
|
286
286
|
route_owners: dict[str, str] = {}
|
|
287
287
|
for service_name, _stanza, service_annotations in stanzas:
|
|
288
288
|
if service_annotations.get(AUTOSTART_ANNOTATION) == "false":
|
|
289
289
|
held_services.add(service_name)
|
|
290
|
-
|
|
291
|
-
if
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
290
|
+
unknown = sorted(key for key in service_annotations if key.startswith("boatyard/") and key not in STANZA_LABELS)
|
|
291
|
+
if unknown:
|
|
292
|
+
raise ValueError(
|
|
293
|
+
f"the service {service_name!r} carries the unknown label {unknown[0]!r}; the boatyard/* "
|
|
294
|
+
f"stanza labels are {list(STANZA_LABELS)}"
|
|
295
|
+
)
|
|
296
|
+
route_path = service_annotations.get(ROUTE_PATH_LABEL)
|
|
297
|
+
if route_path is not None:
|
|
298
|
+
if ROUTE_PATH_PATTERN.fullmatch(route_path) is None:
|
|
299
|
+
raise ValueError(
|
|
300
|
+
f"{ROUTE_PATH_LABEL} {route_path!r} must be a /-rooted segment chain, optionally wildcarded as /*"
|
|
301
|
+
)
|
|
302
|
+
route_port = service_annotations.get(ROUTE_PORT_LABEL)
|
|
303
|
+
if route_port is None:
|
|
295
304
|
raise ValueError(
|
|
296
|
-
f"{
|
|
297
|
-
f"{ROUTE_PORT_ANNOTATION} label; re-render the bundle with the claims grammar"
|
|
305
|
+
f"{ROUTE_PATH_LABEL}: the claim on the service {service_name!r} carries no {ROUTE_PORT_LABEL} label"
|
|
298
306
|
)
|
|
299
|
-
|
|
307
|
+
strip_value = service_annotations.get(ROUTE_STRIP_LABEL)
|
|
308
|
+
if strip_value is not None and strip_value not in ("true", "false"):
|
|
309
|
+
raise ValueError(f"{ROUTE_STRIP_LABEL} {strip_value!r} must spell 'true' or 'false'")
|
|
310
|
+
if route_path in route_owners:
|
|
300
311
|
raise ValueError(
|
|
301
|
-
f"{
|
|
312
|
+
f"{ROUTE_PATH_LABEL}: the path {route_path} is claimed by both {route_owners[route_path]} "
|
|
302
313
|
f"and {service_name}"
|
|
303
314
|
)
|
|
304
|
-
route_owners[
|
|
315
|
+
route_owners[route_path] = service_name
|
|
316
|
+
if not route_port.isdigit() or not 1 <= int(route_port) <= 65535:
|
|
317
|
+
raise ValueError(f"{ROUTE_PORT_LABEL} {route_port!r} must be a literal port in the range 1-65535")
|
|
305
318
|
routes.append(
|
|
306
319
|
Route(
|
|
307
|
-
path=
|
|
308
|
-
upstream=f"{service_name}:{
|
|
309
|
-
strip_prefix=
|
|
320
|
+
path=route_path,
|
|
321
|
+
upstream=f"{service_name}:{int(route_port)}",
|
|
322
|
+
strip_prefix=strip_value == "true",
|
|
310
323
|
)
|
|
311
324
|
)
|
|
312
|
-
publish_value = service_annotations.get(
|
|
325
|
+
publish_value = service_annotations.get(PUBLISH_PORT_LABEL)
|
|
313
326
|
if publish_value is not None:
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
protocol=
|
|
327
|
+
for entry in publish_value.split(","):
|
|
328
|
+
if not entry or entry != entry.strip():
|
|
329
|
+
raise ValueError(f"{PUBLISH_PORT_LABEL} entry {entry!r} must be non-empty and unpadded")
|
|
330
|
+
ports_text, protocol_separator, protocol = entry.partition("/")
|
|
331
|
+
if not protocol_separator:
|
|
332
|
+
protocol = "tcp"
|
|
333
|
+
published_text, port_separator, target_text = ports_text.partition(":")
|
|
334
|
+
if not port_separator or not published_text.isdigit() or not target_text.isdigit():
|
|
335
|
+
raise ValueError(f"{PUBLISH_PORT_LABEL} entry {entry!r} must be a published:target port pair")
|
|
336
|
+
ports.append(
|
|
337
|
+
PublishedPort.model_validate({
|
|
338
|
+
"service": service_name,
|
|
339
|
+
"published": int(published_text),
|
|
340
|
+
"target": int(target_text),
|
|
341
|
+
"protocol": protocol,
|
|
342
|
+
})
|
|
320
343
|
)
|
|
321
|
-
for published_port in parse_publish_port_annotation(publish_value)
|
|
322
|
-
)
|
|
323
344
|
return BundleRecords(
|
|
324
345
|
services=services,
|
|
325
346
|
routes=routes,
|
|
@@ -8,7 +8,7 @@ import yaml
|
|
|
8
8
|
from pydantic import BaseModel, ConfigDict
|
|
9
9
|
|
|
10
10
|
from boatyard.models.image import Image, dockerfile_stem, require_dockerfile_spelling
|
|
11
|
-
from boatyard.yaml import Yaml, is_list, is_mapping
|
|
11
|
+
from boatyard.yaml import Yaml, is_list, is_mapping, parse_yaml_text
|
|
12
12
|
|
|
13
13
|
TEXT_MARKER = "include"
|
|
14
14
|
YAML_MARKER = "include-yaml"
|
|
@@ -92,7 +92,7 @@ def include_yaml(value: Yaml, context: MarkerContext) -> Yaml:
|
|
|
92
92
|
path = included_path(value, YAML_MARKER, context)
|
|
93
93
|
|
|
94
94
|
try:
|
|
95
|
-
parsed =
|
|
95
|
+
parsed = parse_yaml_text(path.read_text(encoding="utf-8"), path.as_posix())
|
|
96
96
|
except yaml.YAMLError as error:
|
|
97
97
|
raise ValueError(f"{context.source}: include {value!r} is not valid YAML: {error}") from error
|
|
98
98
|
|
|
@@ -23,14 +23,16 @@ from pydantic import (
|
|
|
23
23
|
)
|
|
24
24
|
import yaml
|
|
25
25
|
|
|
26
|
+
from boatyard.markers import declared_dockerfile_paths
|
|
26
27
|
from boatyard.models.pyproject import PYPROJECT_PATH, PyprojectToml
|
|
27
28
|
from boatyard.models.image import Image, LocalBaseEntry, dockerfile_stem, parse_dockerfile
|
|
28
29
|
from boatyard.models.workload import (
|
|
29
30
|
ROUTE_PATH_PATTERN,
|
|
30
31
|
LoadedWorkload,
|
|
32
|
+
WorkloadDocument,
|
|
31
33
|
)
|
|
32
34
|
from boatyard.temp import PLATFORM_PATTERN, SHA256_DIGEST_REGEX
|
|
33
|
-
from boatyard.yaml import Yaml, is_mapping, load_yaml_model
|
|
35
|
+
from boatyard.yaml import Yaml, is_mapping, load_yaml_model, parse_yaml_text
|
|
34
36
|
|
|
35
37
|
DEV_SENTINEL = "0.0.0.dev0"
|
|
36
38
|
|
|
@@ -472,18 +474,38 @@ def _derive(config: ConfigFile, root: Path) -> None:
|
|
|
472
474
|
if isinstance(reference, str):
|
|
473
475
|
config.base_images[name] = TEMPLATE_KEY_PATTERN.sub(partial(_resolve_template_key, pins), reference)
|
|
474
476
|
|
|
475
|
-
# Load each workload file exactly once
|
|
477
|
+
# Load each workload file exactly once; every lock-sourced container must name a remote
|
|
478
|
+
# base_images key
|
|
476
479
|
score_dir = root / config.score_dir
|
|
477
480
|
local_names = set(config.local_workload_names())
|
|
478
481
|
k8s_names = set(config.k8s.workloads) if config.k8s is not None else set[str]()
|
|
479
|
-
|
|
480
|
-
|
|
481
|
-
|
|
482
|
-
|
|
483
|
-
|
|
484
|
-
|
|
485
|
-
|
|
486
|
-
|
|
482
|
+
workloads: dict[str, LoadedWorkload] = {}
|
|
483
|
+
for name in sorted(local_names | k8s_names):
|
|
484
|
+
path = score_dir / name
|
|
485
|
+
if not path.is_file():
|
|
486
|
+
raise ValueError(f"{path.as_posix()}: the workload file is required")
|
|
487
|
+
raw = parse_yaml_text(path.read_text(encoding="utf-8"), path.as_posix())
|
|
488
|
+
if not is_mapping(raw):
|
|
489
|
+
raise ValueError(f"{path.as_posix()}: a workload file is a mapping")
|
|
490
|
+
document = WorkloadDocument.model_validate(raw, context={"source": path.name})
|
|
491
|
+
for container, (kind, value) in document.container_sources().items():
|
|
492
|
+
if kind == "lock" and value not in remote_bases:
|
|
493
|
+
raise ValueError(f"{path.name} container {container!r}: {value!r} names no remote base_images key")
|
|
494
|
+
workloads[name] = LoadedWorkload(path.name, document)
|
|
495
|
+
config.workloads = workloads
|
|
496
|
+
|
|
497
|
+
# Derive the build set as the closure over declared edges: each workload's container-source
|
|
498
|
+
# dockerfiles and provisioner markers, plus the local base entries' dockerfiles
|
|
499
|
+
declared: list[str] = []
|
|
500
|
+
for workload in config.workloads.values():
|
|
501
|
+
for kind, value in workload.document.container_sources().values():
|
|
502
|
+
if kind == "dockerfile":
|
|
503
|
+
declared.append(value)
|
|
504
|
+
for rendering in ("compose", "k8s"):
|
|
505
|
+
for _name, entries in workload.document.provisioners(score_dir, rendering):
|
|
506
|
+
declared.extend(
|
|
507
|
+
path for entry in entries if is_mapping(entry) for path in declared_dockerfile_paths(entry)
|
|
508
|
+
)
|
|
487
509
|
edges = sorted([*declared, *(entry.dockerfile for entry in local_bases.values())], key=dockerfile_stem)
|
|
488
510
|
by_name = {name: list(paths) for name, paths in groupby(edges, key=dockerfile_stem)}
|
|
489
511
|
for name, paths in by_name.items():
|
|
@@ -537,9 +559,10 @@ def _derive(config: ConfigFile, root: Path) -> None:
|
|
|
537
559
|
continue
|
|
538
560
|
variants_by_axis: dict[str, list[str]] = {}
|
|
539
561
|
image_names = {
|
|
540
|
-
|
|
562
|
+
dockerfile_stem(value)
|
|
541
563
|
for workload_name in member.workloads
|
|
542
|
-
for
|
|
564
|
+
for kind, value in config.workloads[workload_name].document.container_sources().values()
|
|
565
|
+
if kind == "dockerfile"
|
|
543
566
|
}
|
|
544
567
|
for image_name in image_names:
|
|
545
568
|
image = config.images.get(image_name)
|