query the image digest of a tag from the registry
See original GitHub issueEnvironment:
- Jib version: jib-core 0.11.0
- Build tool: maven 3.6
- OS: macos
Description of the issue:
Looking at https://github.com/GoogleContainerTools/jib/blob/master/jib-core/src/main/java/com/google/cloud/tools/jib/registry/ManifestPuller.java#L89-L94 the ManifestPuller doesn’t read the response header of Docker-Content-Digest
to get the sha256 digest you can use and pass to tools like docker pull <image-name>@sha256:....
or kubectl set image deployment/name container=<image-name>@sha256...
for CI/ CD purposes.
Expected behavior:
A new method getDigest()
from the puller
Steps to reproduce: Run the following test:
public class RegistryTest {
@Test
public void registryDigest() throws IOException, RegistryException {
RegistryClient.Factory factory = RegistryClient.factory(EventHandlers.NONE, "registry-1.docker.io", "library/centos");
Authorization auth = factory.newRegistryClient().getRegistryAuthenticator().get().authenticatePull(null);
factory.setAuthorization(auth);
RegistryClient client = factory.newRegistryClient();
V22ManifestListTemplate manifest = client.pullManifest("7", V22ManifestListTemplate.class);
// If this gets stale, update by getting the output of
// skopeo inspect docker://centos:7 | jq '.Digest' -r
Assertions.assertEquals("sha256:307835c385f656ec2e2fec602cf093224173c51119bbebd602c53c3653a3d6eb", manifest.getDigest());
// These refer to other digests found in the manifest.json
// Assertions.assertEquals("foo", manifest.getDigestsForPlatform("amd64", "linux"));
// V22ManifestTemplate manifest = client.pullManifest("7", V22ManifestTemplate.class);
// Assertions.assertEquals("foo", manifest.getContainerConfiguration().getDigest());
}
}
Log output:
none, the code doesn’t compile
Issue Analytics
- State:
- Created 4 years ago
- Comments:6 (4 by maintainers)
Top Results From Across the Web
Find all digests of an Image Tag on a Docker Registry
A client is able to pull these different versions of the same image tag by using the digest value. Is there a way...
Read more >How to find a container image tag/label from its hash
Note that the image digest command here only runs a HEAD request to the registry, so it doesn't download the image and should...
Read more >Using container image digests | Cloud Architecture Center
Exploring image manifests, digests, and tags. This section explores existing images in registries using command-line tools such as curl and ...
Read more >Tag - Get List - REST API (Azure Container Registry)
Name of the image (including the namespace). url. path, True. string. Registry login URL. digest. query. string. filter by digest. last. query.
Read more >describe-images — AWS CLI 1.27.27 Command Reference
The sha256 digest of the image manifest. imageTag -> (string). The tag used for the image. Shorthand Syntax:.
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
@chanseokoh I have made the changes. If its fine I will go ahead with making changes to the test cases.
thanks! i’ll keep note of that.