question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

query the image digest of a tag from the registry

See original GitHub issue

Environment:

  • 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:closed
  • Created 4 years ago
  • Comments:6 (4 by maintainers)

github_iconTop GitHub Comments

1reaction
tejaskasettycommented, Oct 9, 2019

@chanseokoh I have made the changes. If its fine I will go ahead with making changes to the test cases.

0reactions
aespinosacommented, Oct 18, 2019

thanks! i’ll keep note of that.

Read more comments on GitHub >

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

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found