Commit Graph

33 Commits

Author SHA1 Message Date
Laura Brehm
2ead895094
Support gzip and zstd HTTP transport compression to fetch remote resources
Co-authored-by: Nicolas De Loof <nicolas.deloof@gmail.com>
Signed-off-by: Laura Brehm <laurabrehm@hey.com>
2023-11-30 13:51:33 +00:00
Derek McGowan
5fdf55e493
Update go module to github.com/containerd/containerd/v2
Signed-off-by: Derek McGowan <derek@mcg.dev>
2023-10-29 20:52:21 -07:00
Bjorn Neergaard
cdba61603c
remotes: use mediatype helpers
Signed-off-by: Bjorn Neergaard <bjorn.neergaard@docker.com>
2023-09-27 13:12:51 -06:00
Derek McGowan
508aa3a1ef
Move to use github.com/containerd/log
Add github.com/containerd/log to go.mod

Signed-off-by: Derek McGowan <derek@mcg.dev>
2023-09-22 07:53:23 -07:00
Cardy.Tang
50376ec9ff remotes: allow FetchByDigest client to pass mediatype as header
accept mediatype header is required for some layers, add additional field for client.

Signed-off-by: Cardy.Tang <zuniorone@gmail.com>
2023-06-27 16:36:01 +08:00
Akihiro Suda
dfd6a3aa6e
remotes: add FetcherByDigest for fetching blobs without foreknown descriptors
Fetching blobs without foreknown descriptors is useful for using a registry as a general-purpose CAS.

Related: `oras blob fetch` (ORAS v0.15.0)

Signed-off-by: Akihiro Suda <akihiro.suda.cz@hco.ntt.co.jp>
2022-11-04 11:41:07 +09:00
Fu Wei
9b33526ef6
Merge pull request #5681 from kzys/info-url
remotes/docker: log registry URLs as info instead of debug
2022-04-20 14:21:15 +08:00
haoyun
bbe46b8c43 feat: replace github.com/pkg/errors to errors
Signed-off-by: haoyun <yun.hao@daocloud.io>
Co-authored-by: zounengren <zouyee1989@gmail.com>
2022-01-07 10:27:03 +08:00
haoyun
c0d07094be feat: Errorf usage
Signed-off-by: haoyun <yun.hao@daocloud.io>
2021-12-13 14:31:53 +08:00
Kazuyoshi Kato
5d4dc57802 remotes/docker: log registry URLs as info instead of debug
Registry URLs are important and should be logged even the logging level is
info.

Fixes #5486.

Signed-off-by: Kazuyoshi Kato <katokazu@amazon.com>
2021-12-03 10:44:05 -08:00
Kohei Tokunaga
526defb571 Fix containerd fails to pull OCI image with non-http(s):// urls
Signed-off-by: Kohei Tokunaga <ktokunaga.mail@gmail.com>
2021-11-12 09:49:28 +09:00
Eng Zer Jun
50da673592
refactor: move from io/ioutil to io and os package
The io/ioutil package has been deprecated as of Go 1.16, see
https://golang.org/doc/go1.16#ioutil. This commit replaces the existing
io/ioutil functions with their new definitions in io and os packages.

Signed-off-by: Eng Zer Jun <engzerjun@gmail.com>
2021-09-21 09:50:38 +08:00
Shiming Zhang
67d07fe5cf remotes/docker/fetcher.go: Fix missing Close()
Signed-off-by: Shiming Zhang <wzshiming@foxmail.com>
2021-07-21 11:36:23 +08:00
ktock
4b882eb93a Export repository scope helper functions
`docker.Authorizer` requires library clients to configure scope via context.
It is helpful for the clients to use the helper (currently private) functions
for generating scope string and to use that function with the combination of
other scope-related ones (e.g. `docker.WithScope`).

Signed-off-by: Kohei Tokunaga <ktokunaga.mail@gmail.com>
2020-10-06 10:49:01 +09:00
Derek McGowan
adeba792f1
Add namespace query parameter for registry proxying
Proxy registries are designed to serve content from upstreams.
However, the proxy hostname will usually not match the hostname
of the upstream, requiring the proxy to only use a single
upstream or use its own pattern matching to determine the upstream.
To solve this issue, the client will pass along the namespace which
is being used for the request, allowing mirrors to easily map
to multiple upstreams. This query parameter can safely be ignored
if multiple upstreams are not supported.

Signed-off-by: Derek McGowan <derek@mcg.dev>
2020-08-03 09:32:44 -07:00
Alex Price
a022c21819 Improve host fallback behaviour in docker remote
This commit improves the fallback behaviour when resolving and
fetching images with multiple hosts. If an error is encountered
when resolving and fetching images, and more than one host is being
used, we will try the same operation on the next host. The error
from the first host is preserved so that if all hosts fail, we can
display the error from the first host.

fixes #3850

Signed-off-by: Alex Price <aprice@atlassian.com>
2019-12-13 11:42:32 +11:00
Michael Crosby
901bcb2231 Add distribution subpkgs to core
Ref: #3554

Signed-off-by: Michael Crosby <crosbymichael@gmail.com>
2019-10-07 13:38:12 -04:00
Derek McGowan
394db03f15
Fix all media types in Accept header to match RFC
Fixes the media type to align with Accept HTTP header
RFC which specifies glob syntax */*

See https://www.w3.org/Protocols/rfc2616/rfc2616-sec14.html

Signed-off-by: Derek McGowan <derek@mcgstyle.net>
2019-09-26 14:48:42 -07:00
Derek McGowan
0b29c9c371
Update resolver to handle endpoint configuration
Adds support for registry mirrors
Adds support for multiple pull endpoints
Adds capabilities to limit trust in public mirrors
Fixes user agent header missing


Signed-off-by: Derek McGowan <derek@mcgstyle.net>
2019-07-16 11:28:23 -07:00
Michael Crosby
de1da8be32 Update handling of registry errors
Update to #3109

Signed-off-by: Michael Crosby <crosbymichael@gmail.com>
2019-04-04 14:51:03 -04:00
Jack Baines
d15832a4c2 Address review comments
-Fix whitespace on imports
-Fix test case naming

Signed-off-by: Jack Baines <jack.baines@uk.ibm.com>
2019-03-21 15:59:49 +00:00
Jack Baines
908b771086 Add code to return message field of returned registry errors
Docker registries return errors in a know format so this change now checks for these
errors and returns the message field. If the error is not in the expected format fall
back to the original behaviour.

https://github.com/containerd/containerd/issues/3076

Signed-off-by: Jack Baines <jack.baines@uk.ibm.com>
2019-03-19 21:05:36 +00:00
nashasha1
7f03ad6579 Fix typos
Signed-off-by: nashasha1 <a4012017@sina.com>
2018-09-07 16:59:42 +08:00
Derek McGowan
59740d8985
Fix invalid length bug with some registries
Ensures that the client can handle cases where the
registry ignores content length.

Signed-off-by: Derek McGowan <derek@mcgstyle.net>
2018-05-26 23:41:56 -07:00
Kunal Kushwaha
b12c3215a0 Licence header added
Signed-off-by: Kunal Kushwaha <kushwaha_kunal_v7@lab.ntt.co.jp>
2018-02-19 10:32:26 +09:00
Stephen J Day
682151b166 remotes/docker: implement seekable http requests
To support resumable download, the fetcher for a remote must implement
`io.Seeker`. If implemented the `content.Copy` function will detect the
seeker and begin from where the download was terminated by a previous
attempt.

Signed-off-by: Stephen J Day <stephen.day@docker.com>
2017-11-16 16:13:06 -05:00
Stephen Day
709d34f882 Merge pull request #1537 from allencloud/add-reponse-body-close
add a response body close
2017-09-21 18:32:56 -07:00
Allen Sun
c6d55954e0 add a response body close
Signed-off-by: Allen Sun <shlallen1990@gmail.com>
2017-09-22 09:25:31 +08:00
Stephen J Day
13771fba83
images, remotes: add support for foreign layers
Add support for downloading layers with external URLs and
foreign/non-distributable mediatypes. This ensures that encountered
windows images are downloaded correctly. We still need to filter out the
extra windows resources when pulling linux, but this is a step towards
correctly supporting multi-platform images.

Signed-off-by: Stephen J Day <stephen.day@docker.com>
2017-09-20 17:06:13 -07:00
Akihiro Suda
2f08032924 remotes/docker: add scope (registry:foo/bar:pull)
Signed-off-by: Akihiro Suda <suda.akihiro@lab.ntt.co.jp>
2017-09-07 05:10:48 +00:00
Andrew Pennebaker
1d2a079f08
update to github.com/sirupsen/logrus v1.0.0
Signed-off-by: Andrew Pennebaker <apennebaker@datapipe.com>
2017-07-21 15:39:14 -07:00
Derek McGowan
9f90d8a9b4
Add schema1 conversion on pull
closes #851

Signed-off-by: Derek McGowan <derek@mcgstyle.net>
2017-06-14 10:07:39 -07:00
Derek McGowan
735b0e515e
Add push object
Split resolver to only return a name with separate methods
for getting a fetcher and pusher. Add implementation for
push.

Signed-off-by: Derek McGowan <derek@mcgstyle.net>
2017-05-23 10:52:51 -07:00