Commit Graph

222 Commits (594ebbfac035d0345a15c3f13ad3fe2a310cb091)

Author SHA1 Message Date
Paul "TBBle" Hampson 6c824d68f1 Use filesystem-supplied modes for checksumming content
The existing code was spuriously failing unit tests, because it was
stripping non-permission bits off the file mode.

On examination, the behaviour was inherited from similar code in
moby/moby, which was intended to affect the resulting filemodes inside
a Linux-based container built from Windows. However, this code path does
have that effect in BuildKit as we are only calculating checksums here.

Signed-off-by: Paul "TBBle" Hampson <Paul.Hampson@Pobox.com>
2020-07-29 02:50:24 +10:00
Paul "TBBle" Hampson 46995ec794 Don't silently ignore failed wildcard expansion
This was letting mount-related errors slip by, and instead returning
an empty hash.

Signed-off-by: Paul "TBBle" Hampson <Paul.Hampson@Pobox.com>
2020-07-29 02:50:20 +10:00
Paul "TBBle" Hampson b2d3473cba Skip tests on Windows that attempt to bind-mount read-only
Containerd's mounter doesn't yet support bind-mounts on Windows.
BuildKit short-cuts this for read-write mounts, but not read-only
mounts.

Signed-off-by: Paul "TBBle" Hampson <Paul.Hampson@Pobox.com>
2020-07-28 18:07:20 +10:00
Tõnis Tiigi a67af5b10c
Merge pull request #1581 from alexcb/tar-exporter-with-socket-copy-reproduce-error
fix socket handling during copy
2020-07-23 12:07:15 -07:00
Alex Couture-Beil 5382a2056e Treat unix sockets as regular files
This fix is similar to the fix in #1144; but was hit in a different code
path.

Signed-off-by: Alex Couture-Beil <alex@earthly.dev>
2020-07-23 11:25:48 -07:00
Tonis Tiigi 5da4a40ae8 lint: enable more linters
Signed-off-by: Tonis Tiigi <tonistiigi@gmail.com>
2020-07-19 09:28:36 -07:00
Tonis Tiigi 0ed9eb77ce contenthash: fix buffer reuse pool
Signed-off-by: Tonis Tiigi <tonistiigi@gmail.com>
2020-07-19 09:28:36 -07:00
Tonis Tiigi 57abacc68d contenthash: avoid deprecated Xattrs header
Signed-off-by: Tonis Tiigi <tonistiigi@gmail.com>
2020-07-19 09:28:36 -07:00
Tonis Tiigi c8190b1518 lint: enable golint
Signed-off-by: Tonis Tiigi <tonistiigi@gmail.com>
2020-07-19 09:28:24 -07:00
Tonis Tiigi 57a88b0afb lint: add misspell and unused
Signed-off-by: Tonis Tiigi <tonistiigi@gmail.com>
2020-07-18 08:13:57 -07:00
Erik Sipsma 806fddd7f7 remotecache: Only visit each item once when walking results.
Before this change, walkAllResults did not skip an item if it had already been
visited, so walking the graph of results actually followed every single possible
path in the graph instead of just visiting each item once.

On small graphs this wasn't noticeable, but on sufficiently large remote cache
imports this rapidly scaled out of control. For example, I first encountered
this when importing a max-cache from a build of a full linux rootfs from source
(which takes about 30 minutes to build w/out cache on an 18-core machine) and
after 30 minutes the cache import was still running with all CPUs pegged at 100%

To fix this, walkAllResults now keeps a map of already visited items (keyed by
their pointer) and skips visiting an item if it's already been visited, making
it usable on large remote cache imports.

Signed-off-by: Erik Sipsma <erik@sipsma.dev>
2020-07-16 17:49:36 -07:00
Akihiro Suda b2336d60bf
Merge pull request #1568 from tonistiigi/inline-fix
inline cache: fix handling of duplicate blobs
2020-07-16 18:20:02 +09:00
Tonis Tiigi be1a6aaa7a inline cache: fix handling of duplicate blobs
Signed-off-by: Tonis Tiigi <tonistiigi@gmail.com>
2020-07-15 15:45:32 -07:00
Tonis Tiigi 214aa5dbcf pull: allow separate sessions for different parts of pull
Signed-off-by: Tonis Tiigi <tonistiigi@gmail.com>
2020-07-05 00:15:33 -07:00
Tonis Tiigi 2e9987ad16 session: track sessions with a group construct
Avoid hidden session passing and allow one session to drop when
multiple builds share a vertex.

Signed-off-by: Tonis Tiigi <tonistiigi@gmail.com>
2020-07-05 00:15:25 -07:00
Erik Sipsma 61bd44337b image export: Use correct media type when creating new layer blobs.
There are a few bugs in the image export related code being fixed here.
GetMediaTypeForLayers was iterating over diffPairs in the wrong order, resulting
in it always returning nil for images with more than one layer. This actually
worked most of the time because it accidentally triggered a separate codepath
meant to handle v0.6 migrations where mediatypes left empty get filled in.
However, fixing that bug revealed another existing bug where the "oci" parameter
in the image exporter was not being honored except when the v0.6 codepath got
followed, resulting in images to always have oci layer media types even when
docker types are used for the rest of the image descriptors.

Due to the interaction between these various bugs, the only practical end effect
previously was that single-layer images could use the wrong layer media type. An
existing test has been expanded to cover that case in a previous commit.

Signed-off-by: Erik Sipsma <erik@sipsma.dev>
2020-06-24 12:07:00 -07:00
Tonis Tiigi 99e77a889e cache: avoid snapshot migration on shallow refs
Signed-off-by: Tonis Tiigi <tonistiigi@gmail.com>
2020-06-12 17:59:30 -07:00
Tonis Tiigi b0d3737627 contenthash: allow security.capability in cache checksum
Signed-off-by: Tonis Tiigi <tonistiigi@gmail.com>
2020-06-07 22:16:56 -07:00
Tonis Tiigi 8cd41468c0 cache: avoid nil dereference
Signed-off-by: Tonis Tiigi <tonistiigi@gmail.com>
2020-05-27 14:58:16 -07:00
Sebastiaan van Stijn 3ddd1fc23c
Fix goimports linting
```
[5/5] RUN --mount=target=/go/src/github.com/moby/buildkit 	gometalinter ...
0.435 util/rootless/specconv/specconv_linux.go:1:⚠️ file is not goimported (goimports)
1.320 cache/manager.go:1:⚠️ file is not goimported (goimports)
1.335 cache/manager_test.go:1:⚠️ file is not goimported (goimports)
1.337 cache/migrate_v2.go:1:⚠️ file is not goimported (goimports)
1.342 cache/refs.go:1:⚠️ file is not goimported (goimports)
1.454 cache/remotecache/registry/registry.go:1:⚠️ file is not goimported (goimports)
2.285 cmd/buildctl/build.go:1:⚠️ file is not goimported (goimports)
3.082 executor/oci/user.go:1:⚠️ file is not goimported (goimports)
4.333 session/content/content_test.go:1:⚠️ file is not goimported (goimports)
4.614 snapshot/containerd/content.go:1:⚠️ file is not goimported (goimports)
4.721 solver/errdefs/vertex.go:1:⚠️ file is not goimported (goimports)
6.066 util/network/cniprovider/cni.go:1:⚠️ file is not goimported (goimports)
ERROR: executor failed running [/bin/sh -c gometalinter --config=gometalinter.json ./...]: buildkit-runc did not terminate successfully
```

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2020-05-13 17:38:56 +02:00
Tonis Tiigi 37b8832d00 upgrade errors checks to Is()
Signed-off-by: Tonis Tiigi <tonistiigi@gmail.com>
2020-04-18 22:53:38 -07:00
Tonis Tiigi 2c3cf11fde resolver: update to new registryhosts based config
Signed-off-by: Tonis Tiigi <tonistiigi@gmail.com>
2020-03-05 19:56:43 -08:00
Tonis Tiigi 81e711302a contenthash: ignore system and security xattrs in calculation
Signed-off-by: Tonis Tiigi <tonistiigi@gmail.com>
2020-03-03 19:37:28 -08:00
Akihiro Suda 7b579cdb98 vendor: update containerd (and various packages)
Signed-off-by: Akihiro Suda <akihiro.suda.cz@hco.ntt.co.jp>
2020-02-28 10:24:10 +09:00
HowJMay b19698c4fc fix: Fix typo
fix typo in code

Signed-off-by: HowJMay <vulxj0j8j8@gmail.com>
2020-01-25 15:53:07 +08:00
Wei Fu 65388edc6c exporter: support compression for layer blob data
Allow user to choose the compression type for layer data. Gzip is
default compression for layer exporter, which consume more Cpu resources
and take long time to export. With compression option, user can use
nocompressed option to export to save time. And future, zstd is one new
option for end-user.

Signed-off-by: Wei Fu <fuweid89@gmail.com>
2019-12-09 23:51:38 +08:00
Tonis Tiigi 1955890445 cache: fix possible concurrent maps write on parent release
Signed-off-by: Tonis Tiigi <tonistiigi@gmail.com>
2019-11-12 13:41:50 -08:00
Tonis Tiigi 565deba342 blobs: allow alternative compare-with-parent diff
Signed-off-by: Tonis Tiigi <tonistiigi@gmail.com>
2019-11-06 17:34:42 -08:00
Tonis Tiigi 1d867ebdb1 cache: follow-up updates to storage leases
Signed-off-by: Tonis Tiigi <tonistiigi@gmail.com>
2019-10-21 17:19:44 -07:00
Tonis Tiigi 339d4b2fef leaseutil: mark temporary leases with timestamps
Signed-off-by: Tonis Tiigi <tonistiigi@gmail.com>
2019-10-16 10:35:50 -07:00
Tonis Tiigi 31a9aeea88 cache: add migration flow to new lease based format
Signed-off-by: Tonis Tiigi <tonistiigi@gmail.com>
2019-10-16 10:35:49 -07:00
Tonis Tiigi d35d2c1c94 blobs: ensure lease is held on GetDiffPairs
Signed-off-by: Tonis Tiigi <tonistiigi@gmail.com>
2019-10-16 10:35:48 -07:00
Tonis Tiigi c6d0a57d51 cache: correct parent releasing
Signed-off-by: Tonis Tiigi <tonistiigi@gmail.com>
2019-10-16 10:35:46 -07:00
Tonis Tiigi 3cedd2c0e5 cache: fix image share checker ref leak
Signed-off-by: Tonis Tiigi <tonistiigi@gmail.com>
2019-10-16 10:34:53 -07:00
Tonis Tiigi 08194783e0 cache: update unit tests to new cache manager constructor
Signed-off-by: Tonis Tiigi <tonistiigi@gmail.com>
2019-10-16 10:34:50 -07:00
Tonis Tiigi c005fb08eb cache: better error management
Signed-off-by: Tonis Tiigi <tonistiigi@gmail.com>
2019-10-16 10:33:02 -07:00
Tonis Tiigi 6be136db6e cleanup unused code
Signed-off-by: Tonis Tiigi <tonistiigi@gmail.com>
2019-10-16 10:33:01 -07:00
Tonis Tiigi a9209caa93 clean up temporary leases on startup after crash
Signed-off-by: Tonis Tiigi <tonistiigi@gmail.com>
2019-10-16 10:32:57 -07:00
Tonis Tiigi 7390a41a5b cache: track views with a lease
Signed-off-by: Tonis Tiigi <tonistiigi@gmail.com>
2019-10-16 10:32:55 -07:00
Tonis Tiigi 688e2c2272 cache: update components to new lease based cache manager
Signed-off-by: Tonis Tiigi <tonistiigi@gmail.com>
2019-10-16 10:32:04 -07:00
Tonis Tiigi b9ec2bc4d4 cache: update manager to use leases instead of root labels
Signed-off-by: Tonis Tiigi <tonistiigi@gmail.com>
2019-10-16 10:31:51 -07:00
Tonis Tiigi 481d39c176 add cross-repo push support
Signed-off-by: Tonis Tiigi <tonistiigi@gmail.com>
2019-08-22 17:25:13 -07:00
Tibor Vass 588c73e1e4
Merge pull request #1140 from tonistiigi/fix-symlink-parent
contenthash: fix symlinks with unscanned parents
2019-08-19 13:56:08 -07:00
Tonis Tiigi 3504fae6f2 contenthash: fix symlinks with unscanned parents
Signed-off-by: Tonis Tiigi <tonistiigi@gmail.com>
2019-08-16 15:03:14 -07:00
Tonis Tiigi a0dead0809 fix possible double release on mountable
Refactor the interface to avoid such issues in the future.

BuildKit own mounts are stateless and not affected but
a different mountable implementation could get confused.

Signed-off-by: Tonis Tiigi <tonistiigi@gmail.com>
2019-08-16 08:03:16 -07:00
Tonis Tiigi 0d45d77756 remotecache: fix concurrent write
Signed-off-by: Tonis Tiigi <tonistiigi@gmail.com>
2019-08-14 17:02:16 -07:00
Tonis Tiigi c114e438f5 remotecache: fix inline cache in manifest lists
Signed-off-by: Tonis Tiigi <tonistiigi@gmail.com>
2019-08-13 16:25:08 -07:00
Mark Gordon 3c3dac0a5b remotecache: other fix to record sorting
Signed-off-by: Mark Gordon <msg555@gmail.com>
2019-08-08 12:33:31 -04:00
Tonis Tiigi 27990cc6a3 remotecache: fix records sorting
Signed-off-by: Tonis Tiigi <tonistiigi@gmail.com>
2019-08-06 12:25:15 -07:00
Tõnis Tiigi 4b7741dc29
Merge pull request #1100 from tonistiigi/overlay-readonly
cache: force overlay readonly by removing upperdir
2019-07-30 15:11:48 -07:00