Skip to content

Commit c82d6a7

Browse files
committed
reenable building what is required only
1 parent 7bd18ee commit c82d6a7

File tree

3 files changed

+13
-17
lines changed

3 files changed

+13
-17
lines changed

bin/ci-builder

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -167,10 +167,9 @@ print(hash.decode())
167167
cache_tag=cache-$flavor-$rust_version-$arch_go
168168

169169
image_registry="materialize"
170-
# TODO: Reenable
171-
# if is_truthy "${CI:-0}"; then
172-
# image_registry="ghcr.io/materializeinc/materialize"
173-
# fi
170+
if is_truthy "${CI:-0}" || is_truthy "${MZ_GHCR:-0}"; then
171+
image_registry="ghcr.io/materializeinc/materialize"
172+
fi
174173

175174
case "$cmd" in
176175
build)

ci/mkpipeline.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -183,8 +183,7 @@ def fetch_hashes() -> None:
183183
check_depends_on(pipeline, args.pipeline)
184184
add_version_to_preflight_tests(pipeline)
185185
trim_builds_prep_thread.join()
186-
# TODO: Reenable
187-
# trim_builds(pipeline, hash_check)
186+
trim_builds(pipeline, hash_check)
188187
add_cargo_test_dependency(
189188
pipeline,
190189
args.pipeline,

misc/python/materialize/mzbuild.py

Lines changed: 9 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -857,12 +857,10 @@ def try_pull(self, max_retries: int) -> bool:
857857

858858
def is_published_if_necessary(self) -> bool:
859859
"""Report whether the image exists on Docker Hub if it is publishable."""
860-
# TODO: Put back the original implementation
861-
return self.publish
862-
# if self.publish and is_docker_image_pushed(self.spec()):
863-
# ui.say(f"{self.spec()} already exists")
864-
# return True
865-
# return False
860+
if self.publish and is_docker_image_pushed(self.spec()):
861+
ui.say(f"{self.spec()} already exists")
862+
return True
863+
return False
866864

867865
def run(
868866
self,
@@ -968,6 +966,8 @@ def fingerprint(self) -> Fingerprint:
968966
self_hash.update(f"arch={self.image.rd.arch}".encode())
969967
self_hash.update(f"coverage={self.image.rd.coverage}".encode())
970968
self_hash.update(f"sanitizer={self.image.rd.sanitizer}".encode())
969+
# This exists to make sure all hashes from before we had a GHCR mirror are invalidated, so that we rebuild when an image doesn't exist on GHCR yet
970+
self_hash.update(b"mirror=ghcr")
971971

972972
full_hash = hashlib.sha1()
973973
full_hash.update(self_hash.digest())
@@ -1084,9 +1084,7 @@ def ensure(self, pre_build: Callable[[list[ResolvedImage]], None] | None = None)
10841084
)
10851085
)
10861086

1087-
# TODO: Reenable
1088-
# deps_to_build = [dep for dep, should_build in futures if should_build]
1089-
deps_to_build = [dep for dep, should_build in futures]
1087+
deps_to_build = [dep for dep, should_build in futures if should_build]
10901088

10911089
prep = self._prepare_batch(deps_to_build)
10921090
if pre_build:
@@ -1177,7 +1175,7 @@ def __init__(
11771175
sanitizer: Sanitizer = Sanitizer.none,
11781176
image_registry: str = (
11791177
"ghcr.io/materializeinc/materialize"
1180-
if ui.env_is_truthy("CI")
1178+
if ui.env_is_truthy("CI") or ui.env_is_truthy("MZ_GHCR")
11811179
else "materialize"
11821180
),
11831181
image_prefix: str = "",
@@ -1283,7 +1281,7 @@ def install_arguments(parser: argparse.ArgumentParser) -> None:
12831281
"--image-registry",
12841282
default=(
12851283
"ghcr.io/materializeinc/materialize"
1286-
if ui.env_is_truthy("CI")
1284+
if ui.env_is_truthy("CI") or ui.env_is_truthy("MZ_GHCR")
12871285
else "materialize"
12881286
),
12891287
help="the Docker image registry to pull images from and push images to",

0 commit comments

Comments
 (0)