boatyard 0.8.2.dev243__tar.gz → 0.8.3.dev245__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.8.2.dev243 → boatyard-0.8.3.dev245}/AGENTS.md +5 -1
- {boatyard-0.8.2.dev243 → boatyard-0.8.3.dev245}/PKG-INFO +1 -1
- {boatyard-0.8.2.dev243 → boatyard-0.8.3.dev245}/pyproject.toml +1 -1
- {boatyard-0.8.2.dev243 → boatyard-0.8.3.dev245}/src/boatyard/build.py +7 -2
- {boatyard-0.8.2.dev243 → boatyard-0.8.3.dev245}/src/boatyard/lock.py +11 -15
- {boatyard-0.8.2.dev243 → boatyard-0.8.3.dev245}/src/boatyard/models/lock_file.py +16 -5
- {boatyard-0.8.2.dev243 → boatyard-0.8.3.dev245}/src/boatyard/models/values_file.py +1 -0
- {boatyard-0.8.2.dev243 → boatyard-0.8.3.dev245}/src/boatyard/resolve.py +2 -2
- {boatyard-0.8.2.dev243 → boatyard-0.8.3.dev245}/src/boatyard/score_compose.py +1 -1
- {boatyard-0.8.2.dev243 → boatyard-0.8.3.dev245}/src/boatyard/score_k8s.py +3 -2
- {boatyard-0.8.2.dev243 → boatyard-0.8.3.dev245}/src/boatyard/verbs/mirror.py +4 -2
- {boatyard-0.8.2.dev243 → boatyard-0.8.3.dev245}/src/boatyard/verbs/publish.py +1 -1
- {boatyard-0.8.2.dev243 → boatyard-0.8.3.dev245}/tests/test_build_docker.py +22 -0
- {boatyard-0.8.2.dev243 → boatyard-0.8.3.dev245}/tests/test_compose.py +17 -13
- {boatyard-0.8.2.dev243 → boatyard-0.8.3.dev245}/tests/test_lock.py +56 -52
- {boatyard-0.8.2.dev243 → boatyard-0.8.3.dev245}/tests/test_mirror.py +25 -21
- {boatyard-0.8.2.dev243 → boatyard-0.8.3.dev245}/tests/test_publish_compose.py +5 -4
- {boatyard-0.8.2.dev243 → boatyard-0.8.3.dev245}/tests/test_score_generate.py +19 -15
- {boatyard-0.8.2.dev243 → boatyard-0.8.3.dev245}/tests/test_values.py +25 -9
- {boatyard-0.8.2.dev243 → boatyard-0.8.3.dev245}/uv.lock +1 -1
- {boatyard-0.8.2.dev243 → boatyard-0.8.3.dev245}/.gitattributes +0 -0
- {boatyard-0.8.2.dev243 → boatyard-0.8.3.dev245}/.github/workflows/cleanup-pr-releases.yml +0 -0
- {boatyard-0.8.2.dev243 → boatyard-0.8.3.dev245}/.github/workflows/integrate.yml +0 -0
- {boatyard-0.8.2.dev243 → boatyard-0.8.3.dev245}/.github/workflows/merge-gate.yml +0 -0
- {boatyard-0.8.2.dev243 → boatyard-0.8.3.dev245}/.github/workflows/release.yml +0 -0
- {boatyard-0.8.2.dev243 → boatyard-0.8.3.dev245}/.gitignore +0 -0
- {boatyard-0.8.2.dev243 → boatyard-0.8.3.dev245}/.python-version +0 -0
- {boatyard-0.8.2.dev243 → boatyard-0.8.3.dev245}/CLAUDE.md +0 -0
- {boatyard-0.8.2.dev243 → boatyard-0.8.3.dev245}/LICENSE +0 -0
- {boatyard-0.8.2.dev243 → boatyard-0.8.3.dev245}/NOTICE +0 -0
- {boatyard-0.8.2.dev243 → boatyard-0.8.3.dev245}/README.md +0 -0
- {boatyard-0.8.2.dev243 → boatyard-0.8.3.dev245}/design/AGENTS.md +0 -0
- {boatyard-0.8.2.dev243 → boatyard-0.8.3.dev245}/design/CLAUDE.md +0 -0
- {boatyard-0.8.2.dev243 → boatyard-0.8.3.dev245}/design/apt-hermeticity.md +0 -0
- {boatyard-0.8.2.dev243 → boatyard-0.8.3.dev245}/design/mirror-digest-retention.md +0 -0
- {boatyard-0.8.2.dev243 → boatyard-0.8.3.dev245}/design/precision-attribution.md +0 -0
- {boatyard-0.8.2.dev243 → boatyard-0.8.3.dev245}/design/semver-image-bundle-lines.md +0 -0
- {boatyard-0.8.2.dev243 → boatyard-0.8.3.dev245}/publish.yml +0 -0
- {boatyard-0.8.2.dev243 → boatyard-0.8.3.dev245}/ruff.base.toml +0 -0
- {boatyard-0.8.2.dev243 → boatyard-0.8.3.dev245}/ruff.toml +0 -0
- {boatyard-0.8.2.dev243 → boatyard-0.8.3.dev245}/scripts/preflight.py +0 -0
- {boatyard-0.8.2.dev243 → boatyard-0.8.3.dev245}/src/boatyard/__init__.py +0 -0
- {boatyard-0.8.2.dev243 → boatyard-0.8.3.dev245}/src/boatyard/cli.py +0 -0
- {boatyard-0.8.2.dev243 → boatyard-0.8.3.dev245}/src/boatyard/crane.py +0 -0
- {boatyard-0.8.2.dev243 → boatyard-0.8.3.dev245}/src/boatyard/markers.py +0 -0
- {boatyard-0.8.2.dev243 → boatyard-0.8.3.dev245}/src/boatyard/models/__init__.py +0 -0
- {boatyard-0.8.2.dev243 → boatyard-0.8.3.dev245}/src/boatyard/models/config_file.py +0 -0
- {boatyard-0.8.2.dev243 → boatyard-0.8.3.dev245}/src/boatyard/models/image.py +0 -0
- {boatyard-0.8.2.dev243 → boatyard-0.8.3.dev245}/src/boatyard/models/k8s_pins.py +0 -0
- {boatyard-0.8.2.dev243 → boatyard-0.8.3.dev245}/src/boatyard/models/pyproject.py +0 -0
- {boatyard-0.8.2.dev243 → boatyard-0.8.3.dev245}/src/boatyard/models/workload.py +0 -0
- {boatyard-0.8.2.dev243 → boatyard-0.8.3.dev245}/src/boatyard/paths.py +0 -0
- {boatyard-0.8.2.dev243 → boatyard-0.8.3.dev245}/src/boatyard/publish.py +0 -0
- {boatyard-0.8.2.dev243 → boatyard-0.8.3.dev245}/src/boatyard/py.typed +0 -0
- {boatyard-0.8.2.dev243 → boatyard-0.8.3.dev245}/src/boatyard/score.py +0 -0
- {boatyard-0.8.2.dev243 → boatyard-0.8.3.dev245}/src/boatyard/score_generate.py +0 -0
- {boatyard-0.8.2.dev243 → boatyard-0.8.3.dev245}/src/boatyard/score_patch_templates/gpu-cuda.tpl +0 -0
- {boatyard-0.8.2.dev243 → boatyard-0.8.3.dev245}/src/boatyard/score_patch_templates/gpu-pod.tpl +0 -0
- {boatyard-0.8.2.dev243 → boatyard-0.8.3.dev245}/src/boatyard/score_patch_templates/gpu-rocm.tpl +0 -0
- {boatyard-0.8.2.dev243 → boatyard-0.8.3.dev245}/src/boatyard/score_patch_templates/probe-adapter-healthchecks.tpl +0 -0
- {boatyard-0.8.2.dev243 → boatyard-0.8.3.dev245}/src/boatyard/score_patch_templates/restart.tpl +0 -0
- {boatyard-0.8.2.dev243 → boatyard-0.8.3.dev245}/src/boatyard/score_patch_templates/scale-to-zero.tpl +0 -0
- {boatyard-0.8.2.dev243 → boatyard-0.8.3.dev245}/src/boatyard/temp.py +0 -0
- {boatyard-0.8.2.dev243 → boatyard-0.8.3.dev245}/src/boatyard/verbs/__init__.py +0 -0
- {boatyard-0.8.2.dev243 → boatyard-0.8.3.dev245}/src/boatyard/verbs/build.py +0 -0
- {boatyard-0.8.2.dev243 → boatyard-0.8.3.dev245}/src/boatyard/verbs/bump.py +0 -0
- {boatyard-0.8.2.dev243 → boatyard-0.8.3.dev245}/src/boatyard/verbs/down.py +0 -0
- {boatyard-0.8.2.dev243 → boatyard-0.8.3.dev245}/src/boatyard/verbs/lock.py +0 -0
- {boatyard-0.8.2.dev243 → boatyard-0.8.3.dev245}/src/boatyard/verbs/matrix.py +0 -0
- {boatyard-0.8.2.dev243 → boatyard-0.8.3.dev245}/src/boatyard/verbs/score.py +0 -0
- {boatyard-0.8.2.dev243 → boatyard-0.8.3.dev245}/src/boatyard/verbs/tree_tags.py +0 -0
- {boatyard-0.8.2.dev243 → boatyard-0.8.3.dev245}/src/boatyard/verbs/up.py +0 -0
- {boatyard-0.8.2.dev243 → boatyard-0.8.3.dev245}/src/boatyard/yaml.py +0 -0
- {boatyard-0.8.2.dev243 → boatyard-0.8.3.dev245}/tests/conftest.py +0 -0
- {boatyard-0.8.2.dev243 → boatyard-0.8.3.dev245}/tests/test_assembly.py +0 -0
- {boatyard-0.8.2.dev243 → boatyard-0.8.3.dev245}/tests/test_bump.py +0 -0
- {boatyard-0.8.2.dev243 → boatyard-0.8.3.dev245}/tests/test_config.py +0 -0
- {boatyard-0.8.2.dev243 → boatyard-0.8.3.dev245}/tests/test_daemon_gc.py +0 -0
- {boatyard-0.8.2.dev243 → boatyard-0.8.3.dev245}/tests/test_image_builds.py +0 -0
- {boatyard-0.8.2.dev243 → boatyard-0.8.3.dev245}/tests/test_markers.py +0 -0
- {boatyard-0.8.2.dev243 → boatyard-0.8.3.dev245}/tests/test_matrix.py +0 -0
- {boatyard-0.8.2.dev243 → boatyard-0.8.3.dev245}/tests/test_provisioners.py +0 -0
- {boatyard-0.8.2.dev243 → boatyard-0.8.3.dev245}/tests/test_tree_tags.py +0 -0
|
@@ -20,7 +20,11 @@ Design intent and silent-failure traps, one fact per bullet.
|
|
|
20
20
|
From 1.0 on, breaking changes ship with a manually bumped `major_minor`.
|
|
21
21
|
- Third-party images and charts are consumed through the org mirror namespace (upstream
|
|
22
22
|
manifests get GC'd). CI is the single writer — engineers never push, and error text never
|
|
23
|
-
teaches them to. The
|
|
23
|
+
teaches them to. The lock pins each reference at its upstream spelling; the mirror prefix
|
|
24
|
+
is decoration the lock accessors apply at consumption. The gitignored values file's
|
|
25
|
+
`bypass_image_mirror: true` is the one machine-local escape: `build` skips the decoration
|
|
26
|
+
and pulls base images from upstream at the locked digests, for a declaration the mirror
|
|
27
|
+
job has not copied yet; CI behavior is unchanged (its checkouts carry no values file). The one exception is boatyard's own machinery: the barrier and gateway
|
|
24
28
|
caddy pins live in boatyard's code as upstream tags, never in a consumer lock or mirror
|
|
25
29
|
(the barrier rides the global `BOATYARD_BARRIER_IMAGE` slot, minted at resolve; the
|
|
26
30
|
gateway document renders its pin literally); boatyard hosting its own mirror retires the
|
|
@@ -18,6 +18,8 @@ from build_artifact_registry.setup_oras import install_oras
|
|
|
18
18
|
from pydantic import BaseModel, ConfigDict, Field, RootModel, field_validator, model_validator
|
|
19
19
|
|
|
20
20
|
from boatyard.models.config_file import ConfigFile
|
|
21
|
+
from boatyard.models.values_file import ValuesFile
|
|
22
|
+
from boatyard.paths import VALUES_FILE
|
|
21
23
|
from boatyard.yaml import Yaml
|
|
22
24
|
from boatyard.models.image import Image
|
|
23
25
|
from boatyard.lock import relock
|
|
@@ -149,8 +151,11 @@ def run_build(
|
|
|
149
151
|
f"other arches require --targets. Images: {_address_vocabulary(config.images)}"
|
|
150
152
|
)
|
|
151
153
|
|
|
152
|
-
#
|
|
153
|
-
|
|
154
|
+
# Refresh the lock and expose its entries to bake as environment
|
|
155
|
+
references = relock(config)
|
|
156
|
+
values_path = config.root / VALUES_FILE
|
|
157
|
+
bypass_image_mirror = values_path.is_file() and ValuesFile.load(values_path).bypass_image_mirror
|
|
158
|
+
os.environ.update(references.index_references(None if bypass_image_mirror else config.mirror_prefix))
|
|
154
159
|
|
|
155
160
|
# Render the bake services for every target.
|
|
156
161
|
namespace = destination if destination is not None else config.repository
|
|
@@ -19,7 +19,6 @@ from boatyard.models.config_file import (
|
|
|
19
19
|
artifact_slots,
|
|
20
20
|
bundle_lock_key,
|
|
21
21
|
chart_lock_key,
|
|
22
|
-
mirrored_ref,
|
|
23
22
|
refuse_unresolved_references,
|
|
24
23
|
)
|
|
25
24
|
from boatyard.crane import install_crane
|
|
@@ -110,7 +109,6 @@ class BundleRecords(NamedTuple):
|
|
|
110
109
|
def relock(config: ConfigFile, *, upgrade: bool = False, check: bool = False) -> LockFile:
|
|
111
110
|
# Install the pinned crane
|
|
112
111
|
install_crane()
|
|
113
|
-
prefix = config.mirror_prefix
|
|
114
112
|
|
|
115
113
|
# Read the committed lock schema-only
|
|
116
114
|
committed_path = config.root / LOCK_PATH
|
|
@@ -150,21 +148,20 @@ def relock(config: ConfigFile, *, upgrade: bool = False, check: bool = False) ->
|
|
|
150
148
|
images: dict[str, ConfigLockEntry] = {}
|
|
151
149
|
refuse_local_lock_entries(committed, config, committed_path.as_posix())
|
|
152
150
|
|
|
153
|
-
# Resolve each remote base image
|
|
151
|
+
# Resolve each remote base image at its upstream spelling
|
|
154
152
|
for name, reference in config.remote_base_images.items():
|
|
155
|
-
base = mirrored_ref(reference, prefix)
|
|
156
153
|
committed_entry = committed.images.get(name)
|
|
157
154
|
|
|
158
|
-
# Record a digest-pinned declaration as-is
|
|
155
|
+
# Record a digest-pinned declaration as-is
|
|
159
156
|
if DIGEST_TAIL_PATTERN.search(reference):
|
|
160
|
-
images[name] = ConfigLockEntry(index=
|
|
157
|
+
images[name] = ConfigLockEntry(index=reference, platforms=dict.fromkeys(config.platforms, reference))
|
|
161
158
|
continue
|
|
162
159
|
|
|
163
160
|
# If the committed pin still matches the tag and platforms, freeze it forward
|
|
164
161
|
if (
|
|
165
162
|
committed_entry is not None
|
|
166
163
|
and not upgrade
|
|
167
|
-
and committed_entry.index.startswith(
|
|
164
|
+
and committed_entry.index.startswith(reference + "@")
|
|
168
165
|
and set(committed_entry.platforms) == set(config.platforms)
|
|
169
166
|
):
|
|
170
167
|
images[name] = committed_entry
|
|
@@ -205,10 +202,10 @@ def relock(config: ConfigFile, *, upgrade: bool = False, check: bool = False) ->
|
|
|
205
202
|
raise ValueError(f"image pin {name}: upstream index child must carry a digest ({child!r})")
|
|
206
203
|
selected[platform] = child.digest
|
|
207
204
|
|
|
208
|
-
# Record the
|
|
205
|
+
# Record the index and one reference per platform
|
|
209
206
|
images[name] = ConfigLockEntry(
|
|
210
|
-
index=f"{
|
|
211
|
-
platforms={platform: f"{
|
|
207
|
+
index=f"{reference}@{index_digest}",
|
|
208
|
+
platforms={platform: f"{reference}@{digest}" for platform, digest in selected.items()},
|
|
212
209
|
)
|
|
213
210
|
|
|
214
211
|
# Freeze or resolve each declared chart
|
|
@@ -216,20 +213,19 @@ def relock(config: ConfigFile, *, upgrade: bool = False, check: bool = False) ->
|
|
|
216
213
|
for name, reference in config.declared_charts.items():
|
|
217
214
|
key = chart_lock_key(name)
|
|
218
215
|
reference = reference.removeprefix(OCI_REFERENCE_PREFIX)
|
|
219
|
-
base = mirrored_ref(reference, prefix)
|
|
220
216
|
committed_entry = committed.charts.get(key)
|
|
221
217
|
|
|
222
|
-
# Record a digest-pinned declaration as-is
|
|
218
|
+
# Record a digest-pinned declaration as-is
|
|
223
219
|
if DIGEST_TAIL_PATTERN.search(reference):
|
|
224
|
-
charts[key] =
|
|
220
|
+
charts[key] = reference
|
|
225
221
|
continue
|
|
226
222
|
|
|
227
223
|
# If the committed pin still matches the tag, freeze it forward
|
|
228
|
-
if committed_entry is not None and not upgrade and committed_entry.startswith(
|
|
224
|
+
if committed_entry is not None and not upgrade and committed_entry.startswith(reference + "@"):
|
|
229
225
|
charts[key] = committed_entry
|
|
230
226
|
continue
|
|
231
227
|
|
|
232
|
-
charts[key] = f"{
|
|
228
|
+
charts[key] = f"{reference}@{resolve_remote_digest(reference)}"
|
|
233
229
|
|
|
234
230
|
# Assemble the lock and render its canonical form
|
|
235
231
|
lock = LockFile(platforms=list(config.platforms), images=images, charts=charts, bundles=bundles)
|
|
@@ -14,6 +14,7 @@ from boatyard.models.config_file import (
|
|
|
14
14
|
Slot,
|
|
15
15
|
bundle_lock_key,
|
|
16
16
|
chart_lock_key,
|
|
17
|
+
mirrored_ref,
|
|
17
18
|
)
|
|
18
19
|
from boatyard.paths import LOCK_PATH, VALUES_FILE
|
|
19
20
|
from boatyard.temp import PLATFORM_PATTERN, SHA256_DIGEST_REGEX
|
|
@@ -93,10 +94,13 @@ class LockFile(BaseModel):
|
|
|
93
94
|
return self.bundles[name]
|
|
94
95
|
raise ValueError(f"{subject}: {LOCK_PATH.as_posix()} lacks the {name} entry")
|
|
95
96
|
|
|
96
|
-
def index_references(self) -> dict[str, str]:
|
|
97
|
-
return {
|
|
97
|
+
def index_references(self, mirror_prefix: str | None) -> dict[str, str]:
|
|
98
|
+
return {
|
|
99
|
+
**{name: _decorated(entry.index, mirror_prefix) for name, entry in self.images.items()},
|
|
100
|
+
**{name: _decorated(reference, mirror_prefix) for name, reference in self.charts.items()},
|
|
101
|
+
}
|
|
98
102
|
|
|
99
|
-
def manifest_references(self, platform: str | None) -> dict[str, str]:
|
|
103
|
+
def manifest_references(self, platform: str | None, mirror_prefix: str | None) -> dict[str, str]:
|
|
100
104
|
resolved: str | None
|
|
101
105
|
if platform is None:
|
|
102
106
|
if not self.platforms:
|
|
@@ -112,11 +116,14 @@ class LockFile(BaseModel):
|
|
|
112
116
|
else:
|
|
113
117
|
resolved = platform
|
|
114
118
|
if resolved is None:
|
|
115
|
-
return self.index_references()
|
|
119
|
+
return self.index_references(mirror_prefix)
|
|
116
120
|
missing = [name for name, entry in self.images.items() if resolved not in entry.platforms]
|
|
117
121
|
if missing:
|
|
118
122
|
raise ValueError(f"image entry {missing[0]} lacks the {resolved} manifest")
|
|
119
|
-
return {
|
|
123
|
+
return {
|
|
124
|
+
**{name: _decorated(entry.platforms[resolved], mirror_prefix) for name, entry in self.images.items()},
|
|
125
|
+
**{name: _decorated(reference, mirror_prefix) for name, reference in self.charts.items()},
|
|
126
|
+
}
|
|
120
127
|
|
|
121
128
|
|
|
122
129
|
class ConfigLockEntry(BaseModel):
|
|
@@ -174,5 +181,9 @@ def _source(info: ValidationInfo) -> str:
|
|
|
174
181
|
return str(context.get("path", "the image lock"))
|
|
175
182
|
|
|
176
183
|
|
|
184
|
+
def _decorated(reference: str, mirror_prefix: str | None) -> str:
|
|
185
|
+
return mirrored_ref(reference, mirror_prefix) if mirror_prefix is not None else reference
|
|
186
|
+
|
|
187
|
+
|
|
177
188
|
def _digest_pinned(reference: str) -> bool:
|
|
178
189
|
return re.fullmatch(SHA256_DIGEST_REGEX, reference.rpartition("@")[2]) is not None
|
|
@@ -53,6 +53,7 @@ class ValuesFile(BaseModel):
|
|
|
53
53
|
public_port: PortNumber | None = None
|
|
54
54
|
public_url_path: str | None = None
|
|
55
55
|
platform: str | None = None
|
|
56
|
+
bypass_image_mirror: bool = False
|
|
56
57
|
gateway_port: PortNumber | None = None
|
|
57
58
|
ports: dict[str, PortNumber] = Field(default_factory=dict)
|
|
58
59
|
values: ValuesMap = Field(default_factory=dict)
|
|
@@ -84,7 +84,7 @@ def resolve(config: ConfigFile, lock: LockFile, values: ValuesFile) -> AssemblyP
|
|
|
84
84
|
hand = values.values
|
|
85
85
|
public_face = _public_face(config, values)
|
|
86
86
|
minted = _minted(config, values)
|
|
87
|
-
consumer_manifests = lock.manifest_references(values.platform)
|
|
87
|
+
consumer_manifests = lock.manifest_references(values.platform, config.mirror_prefix)
|
|
88
88
|
service_entries = config.service_entries
|
|
89
89
|
root = config.root
|
|
90
90
|
|
|
@@ -239,7 +239,7 @@ def resolve(config: ConfigFile, lock: LockFile, values: ValuesFile) -> AssemblyP
|
|
|
239
239
|
producer_lock = LockFile.load(producer_root / LOCK_PATH, producer_config)
|
|
240
240
|
sources = BundleSources(
|
|
241
241
|
bundle_path=bundle_path,
|
|
242
|
-
lock_references=producer_lock.manifest_references(values.platform),
|
|
242
|
+
lock_references=producer_lock.manifest_references(values.platform, producer_config.mirror_prefix),
|
|
243
243
|
tree_root=producer_root,
|
|
244
244
|
images=producer_config.images,
|
|
245
245
|
)
|
|
@@ -129,7 +129,7 @@ def generate_compose(config: ConfigFile, lock: LockFile) -> list[Path]:
|
|
|
129
129
|
values_path = config.root / VALUES_FILE
|
|
130
130
|
# The values file answers only its platform here; the full validation is up's
|
|
131
131
|
platform = ValuesFile.load(values_path).platform if values_path.is_file() else None
|
|
132
|
-
images = lock.manifest_references(platform)
|
|
132
|
+
images = lock.manifest_references(platform, config.mirror_prefix)
|
|
133
133
|
|
|
134
134
|
# The build-set slot supply mints the barrier; a workload ${X_SHA} naming no build
|
|
135
135
|
# refuses at render_score's leftover check.
|
|
@@ -16,6 +16,7 @@ from boatyard.models.config_file import (
|
|
|
16
16
|
K8sConfig,
|
|
17
17
|
ConfigFile,
|
|
18
18
|
chart_lock_key,
|
|
19
|
+
mirrored_ref,
|
|
19
20
|
)
|
|
20
21
|
from boatyard.models.image import dockerfile_stem
|
|
21
22
|
from boatyard.models.k8s_pins import load_pins
|
|
@@ -59,7 +60,7 @@ def generate_k8s(
|
|
|
59
60
|
lock: LockFile,
|
|
60
61
|
local: bool,
|
|
61
62
|
) -> tuple[Path, set[str]]:
|
|
62
|
-
index_images = lock.index_references()
|
|
63
|
+
index_images = lock.index_references(config.mirror_prefix)
|
|
63
64
|
workloads = [config.workloads[name] for name in k8s.workloads]
|
|
64
65
|
|
|
65
66
|
# The pins demand is the k8s rendering's whole dockerfile closure: the workloads'
|
|
@@ -121,7 +122,7 @@ def generate_k8s(
|
|
|
121
122
|
split_documents(
|
|
122
123
|
bash_output(
|
|
123
124
|
f"helm template {chart_name} oci://"
|
|
124
|
-
f"{lock.require(chart_lock_key(chart_name), f'chart {chart_name!r}')}"
|
|
125
|
+
f"{mirrored_ref(lock.require(chart_lock_key(chart_name), f'chart {chart_name!r}'), config.mirror_prefix)}"
|
|
125
126
|
f" --values {values_path.as_posix()}"
|
|
126
127
|
)
|
|
127
128
|
)
|
|
@@ -26,9 +26,11 @@ def mirror() -> None:
|
|
|
26
26
|
lock = LockFile.load(root / LOCK_PATH, config)
|
|
27
27
|
mirror_targets: list[tuple[str, list[str]]] = []
|
|
28
28
|
for name, reference in sorted(config.remote_base_images.items(), key=lambda item: item[1]):
|
|
29
|
-
|
|
29
|
+
probes = [mirrored_ref(recorded, prefix) for recorded in lock.images[name].recorded_digests]
|
|
30
|
+
mirror_targets.append((reference, probes))
|
|
30
31
|
for chart_name, chart_ref in sorted(config.declared_charts.items()):
|
|
31
|
-
|
|
32
|
+
probes = [mirrored_ref(lock.charts[chart_lock_key(chart_name)], prefix)]
|
|
33
|
+
mirror_targets.append((chart_ref.removeprefix("oci://"), probes))
|
|
32
34
|
|
|
33
35
|
if not mirror_targets:
|
|
34
36
|
raise ValueError("nothing is declared to mirror (base_images and k8s.charts are empty)")
|
|
@@ -84,7 +84,7 @@ def publish_compose(
|
|
|
84
84
|
branch_tag = (branch or bash_output("git rev-parse --abbrev-ref HEAD").strip()).replace("/", "-")
|
|
85
85
|
|
|
86
86
|
image_shas = {image.sha_env: image.compute_sha(config.root) for image in config.images.values()}
|
|
87
|
-
lock_entries = LockFile.load(root / LOCK_PATH, config).index_references()
|
|
87
|
+
lock_entries = LockFile.load(root / LOCK_PATH, config).index_references(config.mirror_prefix)
|
|
88
88
|
|
|
89
89
|
published: list[PublishedEntry] = []
|
|
90
90
|
for bundle_name, output in bundles:
|
|
@@ -16,6 +16,7 @@ from boatyard import build as build_module
|
|
|
16
16
|
from boatyard import lock as lock_module
|
|
17
17
|
from boatyard.models.lock_file import LOCK_PATH
|
|
18
18
|
from boatyard.models.image import Image
|
|
19
|
+
from boatyard.paths import VALUES_FILE
|
|
19
20
|
|
|
20
21
|
DIGEST_A = "sha256:" + "a" * 64
|
|
21
22
|
HEAD_SHA = "1111111111111111111111111111111111111111"
|
|
@@ -195,11 +196,13 @@ class BakeRunner:
|
|
|
195
196
|
self.extras = extras or {}
|
|
196
197
|
self.commands: list[str] = []
|
|
197
198
|
self.rendered = ""
|
|
199
|
+
self.bake_env: dict[str, str] = {}
|
|
198
200
|
self.shelve = ShelveRecorder()
|
|
199
201
|
|
|
200
202
|
def run(self, command: str) -> None:
|
|
201
203
|
self.commands.append(command)
|
|
202
204
|
if command.startswith("docker buildx bake"):
|
|
205
|
+
self.bake_env = {key: value for key, value in os.environ.items() if key.endswith("_IMAGE")}
|
|
203
206
|
words = command.split()
|
|
204
207
|
bake_file = Path(words[words.index("-f") + 1])
|
|
205
208
|
self.rendered = bake_file.read_text(encoding="utf-8")
|
|
@@ -237,6 +240,7 @@ def _prepare(
|
|
|
237
240
|
base_images: dict[str, Any] | None = None,
|
|
238
241
|
platforms: list[str] | None = None,
|
|
239
242
|
axes: dict[str, list[str]] | None = None,
|
|
243
|
+
values: dict[str, Any] | None = None,
|
|
240
244
|
) -> BakeRunner:
|
|
241
245
|
recorder = BakeRunner()
|
|
242
246
|
monkeypatch.setattr(build_module, "bash", recorder.run)
|
|
@@ -258,6 +262,8 @@ def _prepare(
|
|
|
258
262
|
platforms=platforms,
|
|
259
263
|
axes=axes,
|
|
260
264
|
)
|
|
265
|
+
if values is not None:
|
|
266
|
+
(tmp_path / VALUES_FILE).write_text(yaml.safe_dump(values), encoding="utf-8")
|
|
261
267
|
|
|
262
268
|
result = runner.invoke(app, ["build", *arguments])
|
|
263
269
|
|
|
@@ -688,6 +694,22 @@ class TestBakeSeesLockValues:
|
|
|
688
694
|
assert probe.uv_image == f"{MIRROR_PREFIX}/ghcr.io/astral-sh/uv:0.12.15@{DIGEST_A}"
|
|
689
695
|
|
|
690
696
|
|
|
697
|
+
class TestBypassImageMirror:
|
|
698
|
+
def test_mirror_refs_ride_the_bake_env_without_the_key(self, tmp_path: Path, monkeypatch: pytest.MonkeyPatch):
|
|
699
|
+
recorder = _prepare(monkeypatch, tmp_path, [], dockerfiles={"api": EXTERNAL})
|
|
700
|
+
|
|
701
|
+
assert recorder.bake_env["ALPINE_IMAGE"] == f"{MIRROR_PREFIX}/docker.io/library/alpine:3.20@{DIGEST_A}"
|
|
702
|
+
|
|
703
|
+
def test_the_values_key_rewrites_the_bake_env_to_upstream_refs(
|
|
704
|
+
self, tmp_path: Path, monkeypatch: pytest.MonkeyPatch
|
|
705
|
+
):
|
|
706
|
+
recorder = _prepare(
|
|
707
|
+
monkeypatch, tmp_path, [], dockerfiles={"api": EXTERNAL}, values={"bypass_image_mirror": True}
|
|
708
|
+
)
|
|
709
|
+
|
|
710
|
+
assert recorder.bake_env["ALPINE_IMAGE"] == f"docker.io/library/alpine:3.20@{DIGEST_A}"
|
|
711
|
+
|
|
712
|
+
|
|
691
713
|
def _rendered_services(rendered: str) -> dict[str, Any]:
|
|
692
714
|
return yaml.safe_load(rendered)["services"]
|
|
693
715
|
|
|
@@ -346,22 +346,20 @@ def _write_producer(
|
|
|
346
346
|
|
|
347
347
|
def _producer_lock(platforms: list[str]) -> dict[str, object]:
|
|
348
348
|
loki_manifests = {
|
|
349
|
-
platform: f"
|
|
349
|
+
platform: f"docker.io/library/loki:3.0@{digest}"
|
|
350
350
|
for platform, digest in (("linux/amd64", LOKI_AMD64_DIGEST), ("linux/arm64", LOKI_ARM64_DIGEST))
|
|
351
351
|
if platform in platforms
|
|
352
352
|
}
|
|
353
|
-
alpine_manifests = dict.fromkeys(
|
|
354
|
-
platforms, f"{MIRROR_PREFIX}/docker.io/library/alpine:3.20@{PRODUCER_ALPINE_DIGEST}"
|
|
355
|
-
)
|
|
353
|
+
alpine_manifests = dict.fromkeys(platforms, f"docker.io/library/alpine:3.20@{PRODUCER_ALPINE_DIGEST}")
|
|
356
354
|
return {
|
|
357
355
|
"platforms": list(platforms),
|
|
358
356
|
"images": {
|
|
359
357
|
"LOKI_IMAGE": {
|
|
360
|
-
"index": f"
|
|
358
|
+
"index": f"docker.io/library/loki:3.0@{FAKE_DIGEST}",
|
|
361
359
|
"platforms": loki_manifests,
|
|
362
360
|
},
|
|
363
361
|
"ALPINE_IMAGE": {
|
|
364
|
-
"index": f"
|
|
362
|
+
"index": f"docker.io/library/alpine:3.20@{PRODUCER_ALPINE_DIGEST}",
|
|
365
363
|
"platforms": alpine_manifests,
|
|
366
364
|
},
|
|
367
365
|
},
|
|
@@ -1178,8 +1176,9 @@ class TestLockRequirement:
|
|
|
1178
1176
|
|
|
1179
1177
|
|
|
1180
1178
|
class TestLockEnvSynthesis:
|
|
1181
|
-
ALPINE_INDEX =
|
|
1182
|
-
ALPINE_MANIFEST =
|
|
1179
|
+
ALPINE_INDEX = "docker.io/library/alpine:3.20@" + FAKE_DIGEST
|
|
1180
|
+
ALPINE_MANIFEST = "docker.io/library/alpine:3.20@" + PLATFORM_DIGEST
|
|
1181
|
+
MIRRORED_ALPINE_MANIFEST = MIRROR_PREFIX + "/docker.io/library/alpine:3.20@" + PLATFORM_DIGEST
|
|
1183
1182
|
|
|
1184
1183
|
def _invoke_up_with_lock(self, tmp_path: Path, monkeypatch: pytest.MonkeyPatch) -> UpSpy:
|
|
1185
1184
|
spy = UpSpy().spy_up(monkeypatch)
|
|
@@ -1209,7 +1208,9 @@ class TestLockEnvSynthesis:
|
|
|
1209
1208
|
|
|
1210
1209
|
assert result.exit_code == 0, result.output
|
|
1211
1210
|
assert spy.env_content == (
|
|
1212
|
-
f"APPS_CORE__BOATYARD_LOCK__ALPINE_IMAGE={self.
|
|
1211
|
+
f"APPS_CORE__BOATYARD_LOCK__ALPINE_IMAGE={self.MIRRORED_ALPINE_MANIFEST}\n"
|
|
1212
|
+
+ BARRIER_MINT_LINE
|
|
1213
|
+
+ EDGE_BASE_URL_LINE
|
|
1213
1214
|
)
|
|
1214
1215
|
|
|
1215
1216
|
def test_a_selected_local_entry_reads_its_lock_keys_under_the_entry_prefix(
|
|
@@ -1235,7 +1236,9 @@ class TestLockEnvSynthesis:
|
|
|
1235
1236
|
|
|
1236
1237
|
assert result.exit_code == 0, result.output
|
|
1237
1238
|
assert spy.env_content == (
|
|
1238
|
-
f"APPS_CORE__BOATYARD_LOCK__ALPINE_IMAGE={self.
|
|
1239
|
+
f"APPS_CORE__BOATYARD_LOCK__ALPINE_IMAGE={self.MIRRORED_ALPINE_MANIFEST}\n"
|
|
1240
|
+
+ BARRIER_MINT_LINE
|
|
1241
|
+
+ EDGE_BASE_URL_LINE
|
|
1239
1242
|
)
|
|
1240
1243
|
|
|
1241
1244
|
def test_a_selected_local_entry_carries_its_tree_tags_under_the_entry_prefix(
|
|
@@ -1275,7 +1278,7 @@ class TestLockEnvSynthesis:
|
|
|
1275
1278
|
|
|
1276
1279
|
assert result.exit_code == 0, result.output
|
|
1277
1280
|
assert spy.env_content == (
|
|
1278
|
-
f"APPS_CORE__BOATYARD_LOCK__ALPINE_IMAGE={self.
|
|
1281
|
+
f"APPS_CORE__BOATYARD_LOCK__ALPINE_IMAGE={self.MIRRORED_ALPINE_MANIFEST}\n"
|
|
1279
1282
|
"APPS_CORE__BOATYARD_TREE__API_SHA=tree-consumer\n" + BARRIER_MINT_LINE + EDGE_BASE_URL_LINE
|
|
1280
1283
|
)
|
|
1281
1284
|
assert " -u APPS_CORE__BOATYARD_TREE__API_SHA " in spy.commands[0]
|
|
@@ -1307,11 +1310,12 @@ class TestLockEnvSynthesis:
|
|
|
1307
1310
|
)
|
|
1308
1311
|
_write_bundle_output(tmp_path, "apps-core", ["api"])
|
|
1309
1312
|
_write_workload(tmp_path, "api.yaml", "api")
|
|
1313
|
+
arm64_recorded = "docker.io/library/alpine:3.20@" + PLATFORM_DIGEST
|
|
1310
1314
|
arm64_manifest = MIRROR_PREFIX + "/docker.io/library/alpine:3.20@" + PLATFORM_DIGEST
|
|
1311
1315
|
_write_lock(
|
|
1312
1316
|
tmp_path,
|
|
1313
1317
|
{"ALPINE_IMAGE": self.ALPINE_INDEX},
|
|
1314
|
-
{"linux/amd64": self.ALPINE_MANIFEST, "linux/arm64":
|
|
1318
|
+
{"linux/amd64": self.ALPINE_MANIFEST, "linux/arm64": arm64_recorded},
|
|
1315
1319
|
)
|
|
1316
1320
|
_write_values_file(tmp_path, {"bundles": ["apps-core"], "platform": "linux/arm64"})
|
|
1317
1321
|
spy = self._invoke_up_with_lock(tmp_path, monkeypatch)
|
|
@@ -1494,7 +1498,7 @@ class TestBundleOverrides:
|
|
|
1494
1498
|
consumer,
|
|
1495
1499
|
{"path_overrides": {"placeframe-cuda": OVERRIDE_PATH}},
|
|
1496
1500
|
platforms=["linux/amd64"],
|
|
1497
|
-
lock_images={"LOKI_IMAGE":
|
|
1501
|
+
lock_images={"LOKI_IMAGE": "docker.io/library/loki:3.0@" + CONSUMER_ALPINE_DIGEST},
|
|
1498
1502
|
)
|
|
1499
1503
|
spy = self._invoke_up(monkeypatch, consumer)
|
|
1500
1504
|
|