Commit Graph

423 Commits

Author SHA1 Message Date
Bertrand Paquet
fb339763bc Revert "Problem: can't use anonymous S3 credentials"
Signed-off-by: Bertrand Paquet <bertrand.paquet@gmail.com>
2023-04-13 21:50:11 +02:00
CrazyMax
86c3b26413 Merge pull request #3692 from yrashk/patch-1
Problem: can't use anonymous S3 credentials
2023-03-31 10:34:49 +02:00
coryb
a8aa7b200c use bklog.G(ctx) instead of logrus directly
Signed-off-by: coryb <cbennett@netflix.com>
2023-03-15 12:07:44 -07:00
Yurii Rashkovskii
b70350975a Problem: can't use anonymous S3 credentials
When trying to use S3 cache with anonymous credentials (for example, for importing publicly available layers), the cache is not used.

Solution: enable anonymous credentials

According to the API documentation:

"If using the `NewFromConfig` constructor you'll need to explicitly set
the `Credentials` member to nil, if the external config resolved a
credential provider."

Signed-off-by: Yurii Rashkovskii <yrashk@gmail.com>
2023-03-13 04:41:27 -07:00
Tõnis Tiigi
eb7080c5c4 Merge pull request #3697 from AkihiroSuda/fix-3098
rootless: support Bottlerocket OS
2023-03-10 18:36:59 -08:00
Akihiro Suda
2fed51aea3 rootless: fix up unprivileged mount opts
Port https://github.com/moby/moby/blob/v23.0.1/daemon/oci_linux.go#L430-L460

> // Get the set of mount flags that are set on the mount that contains the given
> // path and are locked by CL_UNPRIVILEGED. This is necessary to ensure that
> // bind-mounting "with options" will not fail with user namespaces, due to
> // kernel restrictions that require user namespace mounts to preserve
> // CL_UNPRIVILEGED locked flags.

Fix issue 3098

Signed-off-by: Akihiro Suda <akihiro.suda.cz@hco.ntt.co.jp>
2023-03-09 21:09:58 +09:00
Akihiro Suda
98deacf59c go.mod: github.com/containerd/containerd v1.7.0-rc.3
Signed-off-by: Akihiro Suda <akihiro.suda.cz@hco.ntt.co.jp>
2023-03-09 15:07:22 +09:00
Yan Song
39bd8c6cf5 fix a possible panic on cache
```
newDesc.Annotations = nil
for _, k := range addAnnotations {
  newDesc.Annotations[k] = desc.Annotations[k]
}
```

The codes may cause buildkitd panic: assignment to entry in nil map

Signed-off-by: Yan Song <imeoer@linux.alibaba.com>
2023-02-24 11:39:57 +00:00
Tõnis Tiigi
0ad8d61575 Merge pull request #3109 from ktock/reuseremotelayers
Fix cache cannot reuse lazy layers
2023-02-14 16:51:41 -08:00
Tonis Tiigi
488791a5a1 gha: avoid range requests with too big offset
Signed-off-by: Tonis Tiigi <tonistiigi@gmail.com>
2023-02-10 19:23:39 -08:00
CrazyMax
82949ae6cc Merge pull request #3607 from crazy-max/remotecache
remotecache: small enhancements
2023-02-10 19:15:58 +01:00
Tõnis Tiigi
a196d7b368 Merge pull request #3566 from tonistiigi/fix-blobonly
cache: don’t link blobonly based on chainid
2023-02-09 09:49:36 -08:00
CrazyMax
1db81665fd remotecache: proper exporter naming for gha, s3 and azblob
Signed-off-by: CrazyMax <crazy-max@users.noreply.github.com>
2023-02-09 18:46:15 +01:00
CrazyMax
cf4e1bb7d2 remotecache: explicit names for registry and local
Signed-off-by: CrazyMax <crazy-max@users.noreply.github.com>
2023-02-09 18:46:15 +01:00
CrazyMax
9081ade948 remotecache: mutualize compression parsing attrs
Signed-off-by: CrazyMax <crazy-max@users.noreply.github.com>
2023-02-09 18:46:14 +01:00
Tonis Tiigi
2c0c429530 cache: add fallback for snapshotID
In older BuildKit versions snapshotID was not always set if record
was not created with GetByBlob method. Old code defaulted to cache
record ID in that case but that broke with the metadata interface
refactor.

Signed-off-by: Tonis Tiigi <tonistiigi@gmail.com>
2023-02-08 12:54:47 -08:00
Tonis Tiigi
39ff1c04fe inline cache: fix blob indexes by uncompressed digest
Signed-off-by: Tonis Tiigi <tonistiigi@gmail.com>
2023-02-03 18:07:50 -08:00
Tonis Tiigi
99bd0d8046 cache: don’t link blobonly based on chainid
Signed-off-by: Tonis Tiigi <tonistiigi@gmail.com>
2023-02-01 12:10:04 -08:00
Tõnis Tiigi
fd0c25c747 Merge pull request #3493 from ktock/unlazylocal
Make local cache importer non-lazy
2023-01-26 09:10:16 -08:00
Kohei Tokunaga
085bd8af7f Fix cache cannot reuse lazy layers
Signed-off-by: Kohei Tokunaga <ktokunaga.mail@gmail.com>
2023-01-24 16:23:56 +09:00
Justin Chadwell
d301d3709d cache: add registry.insecure option to registry exporter
Signed-off-by: Justin Chadwell <me@jedevc.com>
2023-01-12 11:42:01 +00:00
Kohei Tokunaga
c68af33fb6 Make local cache non-lazy
Signed-off-by: Kohei Tokunaga <ktokunaga.mail@gmail.com>
2023-01-11 23:25:08 +09:00
CrazyMax
ef0a35260e azblob cache: account_name attribute
By default account name is parsed from request uri host (account url)
but when product style url is disabled, account name is not part of the
host. This new attribute allows to specify the account name in such case.

Also return error if account name is empty.

Signed-off-by: CrazyMax <crazy-max@users.noreply.github.com>
2023-01-10 13:51:39 +01:00
lomot
f3512a696f fix: updated_at -> updated-at
Signed-off-by: lomot <lomot@qq.com>
2022-12-31 11:24:24 +08:00
Tonis Tiigi
ab0d1a6eea cache: make sure mutable refs are not finalized on exporting cache
Signed-off-by: Tonis Tiigi <tonistiigi@gmail.com>
2022-12-12 22:15:41 -08:00
Tõnis Tiigi
1bc934e23b Merge pull request #3258 from jedevc/sbom-filelist
Supplement generated SBOMs with layer information post-build
2022-11-23 12:17:02 -08:00
Tõnis Tiigi
6f13ac6232 Merge pull request #3305 from jedevc/errors-linting
chore: remove fmt.Errorf across the codebase in preference of errors.Errorf/Wrap
2022-11-23 10:06:27 -08:00
Tonis Tiigi
71a62a9ffe cache: add filelist methods for file to layer mapping
Signed-off-by: Tonis Tiigi <tonistiigi@gmail.com>
2022-11-23 17:16:14 +00:00
Justin Chadwell
b79f6f64bd chore: refactor azblob cache to use errors pkg
Signed-off-by: Justin Chadwell <me@jedevc.com>
2022-11-23 12:29:27 +00:00
Justin Chadwell
feaba880de chore: refactor cache to use errors pkg
Signed-off-by: Justin Chadwell <me@jedevc.com>
2022-11-23 12:29:27 +00:00
Tonis Tiigi
f84058eb1f contenthash: fix uid/gid in contenthash
Signed-off-by: Tonis Tiigi <tonistiigi@gmail.com>
2022-11-22 22:25:43 -08:00
Tonis Tiigi
a20e48f36d provenance: add layers support
Signed-off-by: Tonis Tiigi <tonistiigi@gmail.com>
2022-11-15 19:37:03 -08:00
Alex Couture-Beil
0bb8505e86 Skip boltdb update call when queue is empty
This prevents unnecessary calls (and disk writes) to the metadata cache db when there are
no items in the queue.

Signed-off-by: Alex Couture-Beil <alex@earthly.dev>
2022-11-08 12:29:11 -08:00
Tõnis Tiigi
5b7315c381 Merge pull request #2581 from imeoer/nydus-compression-type
Support for exporting nydus compression type
2022-11-07 22:21:33 -08:00
a-palchikov
cf45d2842d Add support for multiple cache exports.
Fix cache import/export tests w.r.t inline caching.

Signed-off-by: a-palchikov <deemok@gmail.com>
2022-11-03 14:10:52 +01:00
Yan Song
3e9e898782 nydus: adjust code structure for independence
Signed-off-by: Yan Song <imeoer@linux.alibaba.com>
2022-11-03 02:50:17 +00:00
Yan Song
cf70ab6723 cache: support nydus compression type
Nydus image is a container accelerated image format provided by the
Dragonfly image-service project, which offers the ability to pull
image data on demand, without waiting for the entire image pull to
complete and then start the container. It has been put in production
usage and shown vast improvements over the old OCI image format in
terms of container launching speed, image space, and network bandwidth
efficiency, as well as data integrity. Nydus image can be flexibly
configured as a FUSE-based user-space filesystem or in-kernel
EROFS (from Linux kernel v5.16) with Nydus daemon in user-space,
integrating with VM-based container runtime like KataContainers
is much easier.

Nydus has provided a conversion tool Nydusify for converting OCIv1
image to Nydus image and integrated into Harbor Acceld as a conversion
driver, which assumes that the OCI image is already available in the
registry, but a better way would be to build the Nydus images directly
from the build system instead of using the conversion tool, which would
increase the speed of the image export, so we experimentally integrated
the Nydus export in Buildkit.

Unlike other compression formats (gzip, estargz, etc.) in OCI image,
nydus is divided into two types of layer, blob, and bootstrap, where
blob serves as the data part of each layer of the image, and bootstrap
serves as the metadata of the whole image, the bootstrap is equivalent
to the view of the whole image filesystem after all layers overlay. For
example, for an OCI image with 3 layers, the corresponding nydus image
is 4 layers (3 layers of blob + 1 layer of bootstrap).

The nydus-snapshotter project provides a package to do the actual layer
compression, this commit imports the package to implement the export of
nydus compression type.

Signed-off-by: Yan Song <imeoer@linux.alibaba.com>
2022-11-01 03:20:23 +00:00
Tõnis Tiigi
9940833aea Merge pull request #3227 from gabriel-samfira/fix-contenthash-on-windows
Use path.Join to generate cache keys
2022-10-28 15:47:53 -07:00
Gabriel Adrian Samfira
b1d33dd474 Use path.Join to generate cache keys
Using filepath.Join() breaks convertPathToKey() on Windows.
Windows should be able to deal with both forward and backslashes.
Using backslashes in paths here, will break the way we generate
cache keys. convertPathToKey() currently replaces '/' with 0.
Changing every code path to accomodate the Windows specific path
separator is a lot more involved than allowing Windows to just
handle the forward slash paths.

Signed-off-by: Gabriel Adrian Samfira <gsamfira@cloudbasesolutions.com>
2022-10-27 10:09:38 +03:00
Tõnis Tiigi
99f3663717 Merge pull request #3136 from imeoer/compression-type-interface
compression: introduce compression.Type interface
2022-10-25 19:40:33 -07:00
Justin Chadwell
6ef0db91e7 lint: add nolintlint and fix violations
We should be able to detect nolint comments that point to linters that
are disabled (such as with the removed structcheck).

Signed-off-by: Justin Chadwell <me@jedevc.com>
2022-10-19 19:39:37 +01:00
Yan Song
1cfbf1059b iohelper: move some public codes into
Signed-off-by: Yan Song <imeoer@linux.alibaba.com>
2022-10-19 08:46:25 +00:00
Yan Song
6a1430e7cf compression: introduce compression.Type interface
Introduce a new compression.Type interface, which needs
to be implemented for each compression type, by that we can
reduce the number of switch case statements and ensure that
we don't miss the handle of any compression types, and also
make more easily for supporting new compression types.

This is a commit for code improvement, so no logical changes.

Signed-off-by: Yan Song <imeoer@linux.alibaba.com>
2022-10-19 08:46:00 +00:00
Sebastiaan van Stijn
d7d2a32ab1 cache: replace pkg/fileutils with github.com/moby/patternmatcher
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2022-10-06 16:51:28 +02:00
Tõnis Tiigi
91145270d4 Merge pull request #3010 from amrmahdi/pranavp/azblob-rebase
[remotecache] Add Azure Blob Storage support
2022-09-01 22:11:11 -07:00
CrazyMax
cc2553bf1a cache(s3): handle session token for temporary credentials
Signed-off-by: CrazyMax <crazy-max@users.noreply.github.com>
2022-08-25 19:55:10 +02:00
Pranav Pandit
522573b29c [remotecache] Add Azure Blob Storage support
This adds experimental support for Azure Blob Storage based remote cache to buildkit. For usage instructions please refer to the updated Readme. We have tried to keep it similar to the S3 based implementation while using equivalent Azure Blob Storage specific semantics where appropriate.
This also adds end-to-end tests to exercise the Azure Blob Storage based cache using the [Azurite emulator](https://docs.microsoft.com/en-us/azure/storage/common/storage-use-azurite).

Co-authored-by: Amr Mahdi <amrh@microsoft.com>
Co-authored-by: Pranav Pandit <pranavp@microsoft.com>
Signed-off-by: Pranav Pandit <pranavp@microsoft.com>
2022-08-25 06:20:22 -07:00
CrazyMax
4a15e742d8 update golangci-lint to 1.48.0 (go 1.19 support) and fix linting issues
Signed-off-by: CrazyMax <crazy-max@users.noreply.github.com>
2022-08-19 10:26:52 +02:00
CrazyMax
00ee28175c progress: mutualize OneOff helper
Signed-off-by: CrazyMax <crazy-max@users.noreply.github.com>
2022-08-08 12:52:59 +02:00
Eng Zer Jun
be6501b654 test: use T.TempDir to create temporary test directory
This commit replaces `os.MkdirTemp` with `t.TempDir` in tests. The
directory created by `t.TempDir` is automatically removed when the test
and all its subtests complete.

Prior to this commit, temporary directory created using `os.MkdirTemp`
needs to be removed manually by calling `os.RemoveAll`, which is omitted
in some tests. The error handling boilerplate e.g.
	defer func() {
		if err := os.RemoveAll(dir); err != nil {
			t.Fatal(err)
		}
	}
is also tedious, but `t.TempDir` handles this for us nicely.

Reference: https://pkg.go.dev/testing#T.TempDir
Signed-off-by: Eng Zer Jun <engzerjun@gmail.com>
2022-07-24 02:27:26 +08:00