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
Adds cross-repository blob mounting behavior #1269
Adds cross-repository blob mounting behavior #1269
Conversation
f8450cb
to
95ab2c0
Compare
t.Errorf("Unexpected error type stat-ing deleted manifest: %#v", err) | ||
} | ||
} | ||
|
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.
If it's not too difficult, it would be great to have a test that ensures that an attempt to mount a source image outside the authorization scope fails.
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.
Can that be broken out into a specific test? It will need a mocked auth implementation to test this properly.
blobs := buh.Repository.Blobs(buh) | ||
|
||
if mountDigest != "" && fromRepo != "" { |
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.
Could we put this in a separate method?
95ab2c0
to
ccf10a9
Compare
@BrianBland Have we updated the specification for these additions? |
|
ac72830
to
9a7e897
Compare
defer resp.Body.Close() | ||
|
||
if SuccessStatus(resp.StatusCode) { | ||
// TODO(brianbland): Check for possible Accepted response (legacy create) |
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.
We also need a mechanism here to create and get httpBlobUpload
. Possibly cache it and have the next call to Create
use it. Returning it as part of an error does not seem like an ideal solution for fallback.
9a7e897
to
3d5f09e
Compare
Current coverage is
|
cc @jwhonce |
80c0b4c
to
16b3ef1
Compare
16b3ef1
to
bf453e2
Compare
@@ -1023,7 +1051,7 @@ A list of methods and URIs are covered in the table below: | |||
|------|----|------|-----------| | |||
| GET | `/v2/` | Base | Check that the endpoint implements Docker Registry API V2. | | |||
| GET | `/v2/<name>/tags/list` | Tags | Fetch the tags under the repository identified by `name`. | | |||
| GET | `/v2/<name>/manifests/<reference>` | Manifest | Fetch the manifest identified by `name` and `reference` where `reference` can be a tag or digest. | | |||
| GET | `/v2/<name>/manifests/<reference>` | Manifest | Fetch the manifest identified by `name` and `reference` where `reference` can be a tag or digest. A `HEAD` request can also be issued to this endpoint to obtain resource information without receiving all data. | |
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.
This is redundant. That is the definition of a HEAD request. Would it be better to state somewhere at the start that all GET should support HEAD?
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.
Hmm, this was already in the api descriptors file but had not been filled into the spec template. We can update this descriptor, but it probably belongs in a separate PR.
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.
O, ick. Separate PR. This should be removed.
d780bdc
to
d5127c3
Compare
@@ -21,6 +21,7 @@ Ben Firshman <ben@firshman.co.uk> | |||
bin liu <liubin0329@gmail.com> |
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.
Don't include AUTHORS update in your PR. We do this at release time.
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.
👍 removing this
d5127c3
to
ebc5b79
Compare
After writing #1269 (comment), I realized it might be a good idea to have an event specific to the mount call on the target repository. It may be sufficient to use the url to detect this but we may want to consider adding an action. Looking here, we just need to have an action for "mount" and a source indicating where the mount happened from. Optionally, it may be okay to leave these as "push" but then populate a "from" field on target. |
88aebc8
to
553d03d
Compare
Extends blob upload POST endpoint to support mount and from query parameters as described in distribution#634 Signed-off-by: Brian Bland <brian.bland@docker.com>
When an auth request provides the "from" query parameter, the token handler will add a "pull" scope for the provided repository, refreshing the token if the overall scope has increased Signed-off-by: Brian Bland <brian.bland@docker.com>
Adds an optional "fromRepository" field to the event target Signed-off-by: Brian Bland <brian.bland@docker.com>
553d03d
to
613cfc8
Compare
@@ -604,6 +621,45 @@ func (bs *blobs) Resume(ctx context.Context, id string) (distribution.BlobWriter | |||
panic("not implemented") | |||
} | |||
|
|||
func (bs *blobs) Mount(ctx context.Context, sourceRepo string, dgst digest.Digest) (distribution.Descriptor, error) { |
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.
I think sourceRepo
should be reference.Named
rather than a string. Perhaps the digest should also be incorporated into this argument (in that case, it would be reference.Canonical
). Not sure if that makes sense here, since canonical references are usually used for identifying manifests, not blobs. @dmcgowan @stevvooe WDYT?
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.
As is this use of string
is consistent with the rest of the client package. I would agree though that it would be desirable to refactor the interfaces to use the reference
package, I would not enforce that here.
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.
Yeah, I got confused about this. I remembered refactoring everything to use the reference package in #1270, but it turns out that didn't get merged and I closed it until other PRs got merged. I'll reopen that PR and bring it up to date, but this PR can go in as-is first.
LGTM |
2 similar comments
LGTM |
LGTM |
Adds cross-repository blob mounting behavior
Adds cross-repository blob mounting behavior
Adds cross-repository blob mounting behavior
Extends blob upload POST endpoint to support mount and from query
parameters as described in #634