Skip to content

V2 registry fallback#18

Open
dmcgowan wants to merge 4 commits into
v2-registryfrom
v2-registry-fallback
Open

V2 registry fallback#18
dmcgowan wants to merge 4 commits into
v2-registryfrom
v2-registry-fallback

Conversation

@dmcgowan
Copy link
Copy Markdown
Owner

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.

@stevvooe
Copy link
Copy Markdown
Collaborator

LGTM!

@dmcgowan dmcgowan force-pushed the v2-registry-fallback branch from b9b4f6c to 6c30456 Compare January 16, 2015 01:45
@dmcgowan
Copy link
Copy Markdown
Owner Author

@stevvooe I fixed up your commit to get it to compile, was expected a string array instead of just a string, see []string{"push"}

Tested and it does fallback when endpoint not found is returned, still need to test when /v2/ returns a 404

@dmcgowan dmcgowan force-pushed the v2-registry-fallback branch from 6c30456 to 1dca7b6 Compare January 16, 2015 03:18
@stevvooe
Copy link
Copy Markdown
Collaborator

@dmcgowan Sounds great. Do you need a registry that has this behavior or can you mock with net/http or nginx?

@dmcgowan
Copy link
Copy Markdown
Owner Author

@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.

@dmcgowan dmcgowan force-pushed the v2-registry-fallback branch from 1dca7b6 to 65615da Compare January 16, 2015 19:38
dmcgowan and others added 4 commits January 16, 2015 15:39
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)
@dmcgowan dmcgowan force-pushed the v2-registry-fallback branch from 829b51f to c23b58c Compare January 16, 2015 23:40
@dmcgowan
Copy link
Copy Markdown
Owner Author

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.

Comment thread graph/push.go
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Subtle.

Copy link
Copy Markdown
Owner Author

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.

@stevvooe
Copy link
Copy Markdown
Collaborator

LGTM!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants