Open hanikesn opened 4 months ago
It can often be quite useful to resolve a tag to the digest where an artifact is stored in the registry. To solve this I duplicated the code of Registry.get_manifest and compute the hash client side:
Registry.get_manifest
@decorator.ensure_container def get_digest(self, container): self.load_configs(container) allowed_media_type = [defaults.default_manifest_media_type] headers = {"Accept": ";".join(allowed_media_type)} headers.update(self.headers) get_manifest = f"{self.prefix}://{container.manifest_url()}" # type: ignore response = self.do_request(get_manifest, "GET", headers=headers) self._check_200_response(response) return f"sha256:{hashlib.sha256(response.content).hexdigest()}"
This would be good to add to the repository, perhaps as an example or helper script?
It can often be quite useful to resolve a tag to the digest where an artifact is stored in the registry. To solve this I duplicated the code of
Registry.get_manifest
and compute the hash client side: