Skip to content
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 blob copy capability #54

Open
wants to merge 19 commits into
base: master
Choose a base branch
from

Conversation

myw
Copy link

@myw myw commented Jan 12, 2019

Meant to be merged in after #53.

This PR adds a method to the V2 BaseClient: copy_blob. The method takes advantage of the Registry API's cross-repository blob mount feature to copy blobs that already exist in the registry from one repo to another without actually downloading and re-uploading them.

A unit test is included.

Other minor changes in this PR:

  • add a check_manifest method to test for the existence of a manifest
  • resolve the unit tests failing with HTTP 500 codes on put_manifest (Root cause was a Docker Registry config issue in testing)
  • clean up a minor issue conflating tags and references in put_manifest: now consumers can put manifests using their digest as a reference without updating the tag to be the same as the digest (which was the former, erroneous behavior)
  • add a manifest digestion utility function (manifest.digest) to enable users to PUT manifests by digest.

myw added 12 commits January 8, 2019 23:37
The way that the auth url was being used by AuthorizationService was too restrictive
and made too many assumptions about the format of the URL; GitLab, for example, uses
a different URL format and does not name the service the same as DockerHub does.

These changes add a parameter, 'auth_service_name', which allows custom service names
that are not simply the same as the registry's host name (e.g. GitlLab uses
'container_registry'), and also changes the URL so that the 'v2/token' location is
not necessarily assumed.

*This is necessarily a breaking change for existing consumers and will require a majorversion bump*.
This prevents the access token from being sent by the requests library
Rather than forcing command-line and API consumers to change their code, we keep the old arguments
and behavior in, but add a warning, allowing the new behavior to be triggered with new arguments
This puts it in the user's PATH upon package installation
Put errors checking before status checking
This takes advantage of the Registry API's cross-repository mount feature to
copy blobs from one repo to another without actually downloading and reuploading
them.

Unit test included.
@myw
Copy link
Author

myw commented Jan 12, 2019

Hello @graingert, this is the PR for the feature I described in the last one: cross-repositiory blob mounting. Please let me know if it requires any changes.

Thanks!

myw added 7 commits January 13, 2019 12:06
This method checks for the existence of a manifest without downloading it
by sending a HEAD request rather than a GET request to the manifest endpoint
This allows consumers to calculate their own digests and put a tag to its digest location, without changing the tag
@djmattyg007
Copy link

Hello. Since this package appears to be abandoned, I forked it and made several improvements. This includes dropping support for v1 registries, and introducing first-class support for v2 manifests (incluidng multi-arch manifests).

If you're still feeling up to it, I'd be happy to review an updated PR against my fork:

https://github.com/djmattyg007/dreg-client

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