@@ -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