diff --git a/src/batou_ext/oci.py b/src/batou_ext/oci.py index c69a279..b9d038c 100644 --- a/src/batou_ext/oci.py +++ b/src/batou_ext/oci.py @@ -139,22 +139,6 @@ def verify(self): self.assert_no_changes() self.envfile.assert_no_changes() - if self.registry_address: - logintxt, _ = self.cmd( - self.expand( - dedent( - """\ - docker login \\ - {%- if component.registry_user and component.registry_password %} - -u {{component.registry_user}} \\ - -p {{component.registry_password}} \\ - {%- endif %} - {{component.registry_address}} - """ - ) - ) - ) - local_digest, stderr = self.cmd( dedent( """\ @@ -169,6 +153,22 @@ def verify(self): try: valid = self._remote_manifest_cache[image_ident] except KeyError: + if self.registry_address: + logintxt, _ = self.cmd( + self.expand( + dedent( + """\ + docker login \\ + {%- if component.registry_user and component.registry_password %} + -u {{component.registry_user}} \\ + -p {{component.registry_password}} \\ + {%- endif %} + {{component.registry_address}} + """ + ) + ) + ) + try: stdout, stderr = self.cmd( f"docker manifest inspect {image_ident}"