Commit Graph

33 Commits

Author SHA1 Message Date
Justin Chadwell
4065831652 archive: consistently respect value of WithSkipDockerManifest
It was possible to still export the docker-compatible manifest.json
file, if a single platform image (as a standalone manifest) was
exported, even if the WithSkipDockerManifest option was explicitly set.

To resolve this, we remove all references to skipDockerManifest to,
adding it instead to the point-of-writing, simplifying the earlier logic
and making it clear exactly when this manifest file should be written.

Signed-off-by: Justin Chadwell <me@jedevc.com>
2023-03-06 16:27:13 +00:00
Derek McGowan
13bf5565eb
[transfer] update export to use image store references
Signed-off-by: Derek McGowan <derek@mcg.dev>
2023-03-02 11:14:32 -08:00
Akihiro Suda
9b510e9a8f
lint: silence "SA1019: tar.TypeRegA has been deprecated... (staticheck)"
"SA1019: tar.TypeRegA has been deprecated since Go 1.11 and an alternative has been available since Go 1.1:
Use TypeReg instead. (staticcheck)"

Signed-off-by: Akihiro Suda <akihiro.suda.cz@hco.ntt.co.jp>
2023-02-16 03:50:23 +09:00
Samuel Karp
9e4acc0280
importer: stream oci-layout and manifest.json
Signed-off-by: Samuel Karp <samuelkarp@google.com>
2023-01-13 16:14:45 -08:00
Iceber Gu
778e8f2af4 Use the const labels.LabelUncompressed
Signed-off-by: Iceber Gu <wei.cai-nat@daocloud.io>
2023-01-03 18:29:21 +08:00
Derek McGowan
11c1c8e6f4
Update import logic
Signed-off-by: Derek McGowan <derek@mcg.dev>
2022-11-30 12:56:56 -08:00
Samuel Karp
f9c9121e53
archive: validate digests before use
digest.Algorithm() and digest.Encoded() may panic for invalid digests.
Validate prior to calling those methods.

Signed-off-by: Samuel Karp <samuelkarp@google.com>
2022-10-06 19:37:31 -07:00
Maksym Pavlenko
ca3b9b50fe Run gofmt 1.19
Signed-off-by: Maksym Pavlenko <pavlenko.maksym@gmail.com>
2022-08-04 18:18:33 -07:00
Phil Estes
4aff7431fe
Fix possibly incorrect media type default on import
As reported, running import twice without using the compress import
option means that the content store will have existing layers during the
second import and the existing code hardcodes existing layer media type
to compressed. This fixes the issue by actually reading the header bytes
from the store and setting the media type appropriately.

Signed-off-by: Phil Estes <estesp@amazon.com>
2022-01-25 14:11:20 -05: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
Derek McGowan
63b7e5771e
Merge pull request #5973 from Juneezee/deprecate-ioutil
refactor: move from io/ioutil to io and os package
2021-10-01 10:52:06 -07: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
Claudiu Belu
6b0b64a51a ctr: Fixes Windows image import
A previous commit made the Windows containerd/platforms.Default stricter
by requiring the OS Version to have a similar OS Version as the node's OS Version.

However, tar images (from docker save) do not have any OS Version information,
causing the containerd/import.Import's images.FilterPlatforms to filter out the image
entirely, which means that the images.SetChildrenLabels doesn't get to label
any children, which in turn will cause the Garbage Collector to remove content
related to the image.

This sets a default platform for the imported image if it's a Windows image which
doesn't have any OSVersion information, or if there's no platform information at
all.

Signed-off-by: Claudiu Belu <cbelu@cloudbasesolutions.com>
2021-09-02 19:27:28 -07:00
Shiming Zhang
b890f056e8 Fix content.ReaderAt close
Signed-off-by: Shiming Zhang <wzshiming@foxmail.com>
2021-05-08 12:39:09 +08:00
Akihiro Suda
e2e2c5737d
export: add --skip-non-distributable
The flag skips adding non-distributable blobs such as Windows layers to archive.

Signed-off-by: Akihiro Suda <akihiro.suda.cz@hco.ntt.co.jp>
2021-01-01 06:32:01 +09:00
Xiaodong Ye
c4ed3ff1ed Replace ocispec.MediaTypeImageManifest with manifest.MediaType
Signed-off-by: Xiaodong Ye <xiaodongy@vmware.com>
2019-12-20 10:26:13 +08: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
yuxiaobo
0cb7e4d5fd Perfect documentations
Signed-off-by: yuxiaobo <yuxiaobogo@163.com>
2019-09-30 09:29:04 +08:00
yuxiaobo
a0ae24b984 Word spelling correction
Signed-off-by: yuxiaobo <yuxiaobogo@163.com>
2019-09-25 16:49:54 +08:00
Derek McGowan
3e52e29025
Fix bug in export named manifest option
When providing multiple names, the shared annotation map was
causing the names to get overridden.
Combined the WithManifest options which had compatible interfaces.

Signed-off-by: Derek McGowan <derek@mcgstyle.net>
2019-08-01 15:34:07 -07:00
Derek McGowan
02826345cf
Add option to compress blobs on import
Change the default back to leave uncompressed and add
option to do the compression.

Signed-off-by: Derek McGowan <derek@mcgstyle.net>
2019-07-25 12:05:38 -07:00
Phil Estes
129942ca4d
Merge pull request #3135 from dmcgowan/archive-importer-docker-types
Compress import blobs in Docker compatibility code
2019-07-17 09:25:40 -04:00
Maksym Pavlenko
ef7f46eb7b Fix linter errors
Signed-off-by: Maksym Pavlenko <makpav@amazon.com>
2019-07-14 20:49:40 -07:00
Derek McGowan
5e2d7efd82
Use a single custom annotation for export
Remove annotation prefix and add multiple index records
for manifests with multiple image names. This makes the
custom annotation more consistent with the OCI image
annotation. Additionally, ensure the OCI image annotation
always represents the tag (partial image name) as recommended
by the specification. The containerd image name annotation
will always contain the full image name.

Signed-off-by: Derek McGowan <derek@mcgstyle.net>
2019-05-21 17:21:26 -07:00
Wei Fu
e61f7f4913
Merge pull request #3172 from dmcgowan/export-docker-compatibility
Update image export to support Docker format
2019-05-17 14:30:54 +08:00
Davor Kapsa
cfc36388b3 Remove redundant error checks
Signed-off-by: Davor Kapsa <davor.kapsa@gmail.com>
2019-04-30 21:28:51 +02:00
Derek McGowan
4754d2aeee
Update image export to support Docker format
Add manifest.json file which is used by Docker
to import images.

Signed-off-by: Derek McGowan <derek@mcgstyle.net>
2019-04-04 15:23:06 -07:00
Derek McGowan
8d1ae237eb
Always add compressed blobs to Docker import manifest
Ensure the manifest which gets created using the Docker
compatibility code compresses the blob before creating
the manifest. This ensures consistency with manifests
used by Docker.

Signed-off-by: Derek McGowan <derek@mcgstyle.net>
2019-04-04 10:35:01 -07:00
Sebastiaan van Stijn
525802f9ce
Use distribution's reference.ParseDockerRef
Using the cri utility caused other project to have
containerd/cri as a dependency, only for this utility.

The new `reference.ParseDockerRef` function does the
same (other than having a different name).

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2019-02-07 13:13:25 +01:00
Gábor Lipták
9d01160902
Correct spelling
Signed-off-by: Gábor Lipták <gliptak@gmail.com>
2018-10-19 17:06:43 -04:00
Derek McGowan
b6107dca86
Add import integration test
Move tar creation test utilities to separate package
Test all supported formats for import

Signed-off-by: Derek McGowan <derek@mcgstyle.net>
2018-10-01 11:47:10 -07:00
Derek McGowan
a62be324b7
Unify docker and oci importer
Signed-off-by: Derek McGowan <derek@mcgstyle.net>
2018-09-17 14:41:43 -07:00