-
Notifications
You must be signed in to change notification settings - Fork 545
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
add remote.Head #770
add remote.Head #770
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks like the example test failed -- it talks to dockerhub, which we should fix.
You can just skip it to fix travis for now.
One thing I noticed when trying to use this: for multi-platform images, the digest you'll get back from The former is the digest of the "manifest list", while the latter is the digest of the manifest for your particular platform, contained in said list. I'm guessing there's no real way around this, since the platforms are discovered through the manifest, and the whole point of this is to not fetch the manifest. It's probably fine for our use case - it just means that the digest will change when any of the platforms change. |
I don't believe there is a general solution to this. As you said, the platform resolution fundamentally requires parsing the manifest. It's possible to request the amd64/linux image from the registry by not including manifest lists in the accept headers, but that only solves a subset of the problem and (IMO) makes things messier... I'm also pretty sure it only works if you request schema 1 images, which are deprecated, so probably not even a partial solution here.
https://docs.docker.com/registry/spec/manifest-v2-2/#backward-compatibility
In my experience, child manifests usually change together, so I imagine the false positive rate would be low. If you wanted, you could check the mediaType and resolve the list to whichever image you care about for manifest lists, but you need to know the desired platform ahead of time. I'm not familiar enough with your system to know if that's possible. If possible, I'd just use the digest of the manifest list everywhere. Runtimes should know how to pull manifest lists, so the end result tends to be the same. I ran into issues with this on cri-o last year but they've since been resolved: knative/serving#3997 cc @julz you may want to pick up this PR for knative digest resolution once it merges |
this is useful for fetching a reference's digest/size/type via a HEAD request, which does not count towards Docker Hub image pull rate limits Signed-off-by: Alex Suraci <suraci.alex@gmail.com>
5fd89ab
to
e9d76a2
Compare
|
Signed-off-by: Alex Suraci <suraci.alex@gmail.com>
Woops! I ran it and saw the same failures but didn't expect my changes to affect any dependencies, so I assumed something was wrong on my machine. Pushed a commit to resolve this. Side note: I haven't skipped the failing test from before but I'll push a commit for that too if it flakes out again. Thanks for your help! |
Codecov Report
@@ Coverage Diff @@
## master #770 +/- ##
==========================================
- Coverage 79.02% 78.86% -0.17%
==========================================
Files 102 102
Lines 4735 4778 +43
==========================================
+ Hits 3742 3768 +26
- Misses 550 559 +9
- Partials 443 451 +8
Continue to review full report at Codecov.
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you for doing this!
fixes #769
Lend me your nitpicks! There's a bit of copypasta here but I didn't want to over-aggressively DRY things up.