-
Notifications
You must be signed in to change notification settings - Fork 2
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
V2 registry fallback #18
base: v2-registry
Are you sure you want to change the base?
Conversation
LGTM! |
b9b4f6c
to
6c30456
Compare
@stevvooe I fixed up your commit to get it to compile, was expected a string array instead of just a string, see Tested and it does fallback when endpoint not found is returned, still need to test when /v2/ returns a 404 |
6c30456
to
1dca7b6
Compare
@dmcgowan Sounds great. Do you need a registry that has this behavior or can you mock with |
@stevvooe the plan right now is to mock it. The only way I have tested so far is to force the error through altering the code. |
1dca7b6
to
65615da
Compare
Signed-off-by: Derek McGowan <derek@mcgstyle.net> (github: dmcgowan)
To allow remotes to understand the operation being carried out during an API request to the registry, we've added a header indicating the engine command. Mostly, this is advisory but a registry may take action based on the field. This changeset only adds this for the "push" command. Signed-off-by: Stephen J Day <stephen.day@docker.com>
Signed-off-by: Derek McGowan <derek@mcgstyle.net> (github: dmcgowan)
Signed-off-by: Derek McGowan <derek@mcgstyle.net> (github: dmcgowan)
829b51f
to
c23b58c
Compare
Tested and added a fix to an error discovered in testing. Tested using nginx in front of a v1 and v2 registry and forcing a 404 when the push header is given. |
// present, the remote may act on the field but this is mostly advisory. | ||
metaHeaders["Docker-Command"] = []string{"push"} | ||
|
||
repoInfo.Index.Headers = metaHeaders |
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.
Subtle.
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.
Dirty. I really don't like it but doing it right will require (imo) the refactor we discussed, having the endpoint be the top level value from which sessions and factories are derived.
LGTM! |
Add support for fallback to v1 on push
An HTTP header "Docker-Command" is added to specify the command as "push". When the server returns a 404 from the v2 endpoint, the client should fallback to v1 and push to the v1 endpoint.