Commit Graph

3647 Commits (e99111112725e9d74232c044bedff0ea98ca229d)

Author SHA1 Message Date
Tõnis Tiigi e89482149f
Merge pull request #2519 from aaronlehmann/dedup-mounts-panic
Fix out-of-bounds panic in dedupMounts
2021-12-10 10:53:15 -08:00
Tõnis Tiigi ccd6964323
Merge pull request #2517 from sipsma/diffop-prep
DiffOp Preparation Commits
2021-12-10 10:50:41 -08:00
Aaron Lehmann 9534552955 Fix out-of-bounds panic in dedupMounts
It looks like the intent is to keep track of the index in 'ret' where a
destination was written, but that's not what the current code is doing.

Signed-off-by: Aaron Lehmann <alehmann@netflix.com>
2021-12-10 09:26:30 -08:00
Shingo Omura ccbf7f3386
Setting just servername to :authority pseudo header in client when using tls.
HTTP/2(RFC7540) defines :authority pseudo header includes the authority portion
of target URI but it must not include userinfo part (i.e. url.Host).

However, when TLS certificate specified, grpc-go requires it must match
with its servername specified for certificate validation.

Signed-off-by: Shingo Omura <everpeace@gmail.com>
2021-12-10 21:13:25 +09:00
Erik Sipsma 0ddfb544b5 snapshot: cleanup diffApply and prepare for DiffOp
This breaks the giant blob that was the diffApply function into two
separate parts, a differ and an applier, which results in more modular
code that should be easier to follow and easier to make any future
updates to. For example, if we want to optimize by allowing differ and
applier to run in parallel in the future, that's straightforward now.

There are also some fixes that weren't needed for MergeOp, but will be
for DiffOp, such as correctly handling the case where a deletion is
applied that is under parent directories which don't exist yet (the
correct behavior is, surprisingly, to create the parent directories as
that is what the image import/export code ends up doing).

Signed-off-by: Erik Sipsma <erik@sipsma.dev>
2021-12-09 21:21:35 -08:00
Erik Sipsma abf373a3b6 cache: Disable overlay diff for native snapshotter
Before this change, test cases were running with an env var that forces
the overlay differ to be on even when the native snapshotter was being
used, which resulted in failures. Now, that env var is skipped when
using the native snapshotter.

Additionally, this includes a related change to skip even trying to use
the overlay differ when the native snapshotter is in use. Previously,
the blob creation code first tried to use the overlay differ and then
failed and fell back to the double-walking differ. Now, it just jumps
right to the double-walking differ when the native snapshotter is in
use.

Signed-off-by: Erik Sipsma <erik@sipsma.dev>
2021-12-09 21:02:44 -08:00
Erik Sipsma 2bfad4b0dc Change integration.Test from a func to a interface
Using an interface instead of a func is more flexible while achieving
the same effect. It allows you to succintly define a large number of
test cases as structs, as is common in table-driven testing.

A helper func is added that converts the existing test funcs into the
interface, so the change is fairly seamless.

Signed-off-by: Erik Sipsma <erik@sipsma.dev>
2021-12-09 20:35:48 -08:00
Alex Couture-Beil 390c6886f4
update fsutil and docker
update fsutils to 61a57076b9b065af88eb10f699926d7e8793910c
which is required to pull in moby/moby#43047

Signed-off-by: Alex Couture-Beil <alex@earthly.dev>
2021-12-08 11:01:10 -08:00
Alex Couture-Beil c55a0b888c
use newer MatchesUsingParentResults
switch to using newer MatchesUsingParentResults methods which were
introduced in https://github.com/moby/moby/pull/43037

Signed-off-by: Alex Couture-Beil <alex@earthly.dev>
2021-12-08 09:41:55 -08:00
Alex Couture-Beil 197f619956
update fsutil and docker
update fsutil to include this patch: d952e50eae

docker also had to be updated due to 2d121ce88f

Signed-off-by: Alex Couture-Beil <alex@earthly.dev>
2021-12-08 09:41:52 -08:00
Tõnis Tiigi 90690ca0c9
Merge pull request #2509 from tonistiigi/archutil-bullseye
archutil: update generator
2021-12-07 20:39:38 -08:00
Tõnis Tiigi 70d7ac4ced
Merge pull request #2489 from thisismydesign/patch-1
Clarify Export cache docs
2021-12-07 20:39:28 -08:00
Tõnis Tiigi bfd3cfb6a0
Merge pull request #2507 from sipsma/mobymerge
Update tests for consistency w/ dockerd.
2021-12-07 10:34:18 -08:00
Tonis Tiigi 86b4bdbca4 archutil: update generator
Signed-off-by: Tonis Tiigi <tonistiigi@gmail.com>
2021-12-06 22:25:25 -08:00
Erik Sipsma 0539181757 Update tests for consistency w/ dockerd.
When vendored into moby, the local exporter uses a user map that results
in all files being given at most 755 permissions. This change updates
the test to use permissions less than or equal to that to make tests
equivalent whether running w/ dockerd worker or any other type.

Additionally, add assertions that exported images also have the expected
contents, which helps ensures consistency between images created by
dockerd and those created by vanilla buildkit.

Signed-off-by: Erik Sipsma <erik@sipsma.dev>
2021-12-06 19:18:16 -08:00
Akihiro Suda 539558b58d
Merge pull request #2506 from tonistiigi/update-actions-cache
vendor: update go-actions-cache to 96427041
2021-12-06 14:26:24 +09:00
Csaba Apagyi 44fe33967e Clarify export cache docs
Signed-off-by: Csaba Apagyi <csaba.apagyi@gmail.com>
2021-12-04 16:25:37 +01:00
Tonis Tiigi f0c28eaf00 vendor: update go-actions-cache to 96427041
Signed-off-by: Tonis Tiigi <tonistiigi@gmail.com>
2021-12-03 15:57:46 -08:00
Tõnis Tiigi f24f0a87b5
Merge pull request #2505 from thaJeztah/update_crypto_ssh
go.mod: golang.org/x/crypto v0.0.0-20211202192323-5770296d904e
2021-12-03 10:33:14 -08:00
Sebastiaan van Stijn 367ae027cf
go.mod: golang.org/x/crypto v0.0.0-20211202192323-5770296d904e
full diff: 0c34fe9e7d...5770296d90

includes a fix in golang.org/x/crypto/ssh for CVE-2021-43565

- golang/go#49932
- 5770296d90

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2021-12-03 09:09:16 +01:00
Tõnis Tiigi d68e5d8d10
Merge pull request #2499 from djds/master
hack: update install-buildx
2021-12-02 18:20:12 -08:00
Tonis Tiigi 71316c6f29 split warning message into short and detail
Signed-off-by: Tonis Tiigi <tonistiigi@gmail.com>
2021-12-02 18:17:35 -08:00
Tõnis Tiigi 188b696ac3
Merge pull request #2493 from ktock/bump-stargz-snapshotter-v0.10.1 2021-12-02 13:41:45 -08:00
Erik Sipsma c64578c23f
Merge pull request #2503 from sipsma/fix-merge-blobchainid
Fix merge blobchainid
2021-12-02 13:11:18 -08:00
Erik Sipsma 441f1e7b27 cache: log missing providers for blobchainID ref
Before this, if you try to get a ref with an equal blobchain in
GetByBlob but hit a missing provider, the error was just returned. While
we never expect this situation to happen (you shouldn't be able to hit
this line if you didn't already have providers for each blob in the
chain), it technically shouldn't fail the build as you can just continue
on without re-using the ref with equal blobchainID.

Now, we log this at error level but allow the build to continue.

Signed-off-by: Erik Sipsma <erik@sipsma.dev>
2021-12-02 12:28:28 -08:00
Erik Sipsma 5872bf3dd1 cache: fix merge ref chain IDs.
This fixes an issue where merge refs were incorrectly setting their
chain IDs to their last input's ID. This resulted in errors where
GetByBlob thought the merge ref and the final input ref were equivalent.

Now, merge refs have their chain IDs computed by digesting each blob in
the full chain.

Signed-off-by: Erik Sipsma <erik@sipsma.dev>
2021-12-02 12:21:44 -08:00
Kohei Tokunaga ae565231a0 Bump up github.com/containerd/stargz-snapshotter to v0.10.1
Signed-off-by: Kohei Tokunaga <ktokunaga.mail@gmail.com>
2021-12-02 13:51:22 +09:00
Tõnis Tiigi dea9a4a9da
Merge pull request #2500 from thaJeztah/lint_nits
util/sshutil: minor linting / warning nits
2021-12-01 12:35:36 -08:00
Sebastiaan van Stijn 314bedc808
util/sshutil: minor linting / warning nits
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2021-12-01 17:01:15 +01:00
Davis Schirmer a507923951
Update buildx version 0.5.1 => 0.7.1
https://github.com/docker/buildx/releases/tag/v0.7.1
Signed-off-by: Davis Schirmer <djds@bghost.xyz>
2021-12-01 02:36:32 -05:00
Davis Schirmer b479dc75c6
Fix unbound var error for BINDIR, PREFIX
Signed-off-by: Davis Schirmer <djds@bghost.xyz>
2021-12-01 02:36:31 -05:00
Tonis Tiigi 0dd260bcf5 progessui: return warnings from printer
Signed-off-by: Tonis Tiigi <tonistiigi@gmail.com>
2021-11-30 21:58:37 -08:00
Tonis Tiigi d100814aad progressui: show warnings
Signed-off-by: Tonis Tiigi <tonistiigi@gmail.com>
2021-11-30 21:58:37 -08:00
Tonis Tiigi 50963e289e dockerfile: show redirect parser warnings
Signed-off-by: Tonis Tiigi <tonistiigi@gmail.com>
2021-11-30 21:58:37 -08:00
Tonis Tiigi 7ee783e90c add source mapping support to warnings
Signed-off-by: Tonis Tiigi <tonistiigi@gmail.com>
2021-11-30 21:58:37 -08:00
Tõnis Tiigi 2d63c3559a
Merge pull request #2482 from tonistiigi/warnings
support setting warnings from frontends
2021-11-30 21:58:22 -08:00
Erik Sipsma 159bb1e677
Merge pull request #2480 from sipsma/overlay-diff-file-fix
overlay differ: Do file comparison in some cases.
2021-11-24 18:24:45 -08:00
Erik Sipsma 18292913c4 overlay differ: Do file comparison in some cases.
This change results in the overlay differ comparing files to determine
if they are actually part of the diff. This is needed to resolve
differences between the blobs created by the overlay differ and the
double-walking differ.

Before this change, the overlay differ always just assumed that if a
file was in the upperdir it must be part of the diff and included it as
an add or a modify change. However, there are situations in which files
can appear in the upperdir without having been modified or even opened.
For example, if "foo" is a file or dir present in the lowerdirs of an
overlay mount and you run "mv foo footmp; mv footmp foo", then the
upperdir will contain foo (in addition to any files found under foo if
it's a dir). In this situation, the double-walking differ would not
include foo as part of the diff, but the overlay differ would.

This meant that the overlay differ would potentially include extra files
in each blob for such diffs relative to the double-walking differ. As of
now, while this does increase image size, it doesn't result in any
inconsistencies in terms of the contents of images because it just
results in files/dirs getting duplicated on top of their equivalents.

However, for the upcoming DiffOp support, this inconsistency could
actually result in the same operation producing mounts with different
contents depending on which differ is used. This change is therefore
necessary in order to enforce DiffOp consistency (on top of the possible
improvements to exported image size).

The main concern here is that this could undo the performance benefits
that the overlay differ was intended to fix. However, in practice the
situations where this has worse performance are quite obscure and the
benefits should still be present.

First, consider the case where foo is a directory and the user does the
equivalent of "mv foo footmp; mv footmp foo". Even before this change,
the overlay differ would see that foo is marked as opaque and thus fall
back to using the double-walking differ. So there's no performance
regression in this case as the double-walking differ does the same
file comparisons as were added in this commit.

For the case where the user shuffles a file back and forth, there will
potentially be a slow file content based comparison if the underlying
file has a truncated nanosecond timestamp (i.e. it was unpacked from a
tar file). However, the situations in which you shuffle an individual
file without changing it (or open it for writing but then write nothing)
that is large enough in size for content comparisons to be slow are
obscure. Additionally, while the content comparison may be slow, there
will be time saved during export because the file won't be included
unnecessarily in the exported blob, so it's a tradeoff rather than a
pure loss.

In situations where the user actually did change a file and it shows up
in the upperdir, it should be extremely rare that the content comparison
code path is followed. It would require that the user changed no other
metadata of the file, including size, and both mod timestamps were the
same (which could only really happen if their underlying filesystem
lacked support for nanosecond precision and they modified the file
within 1 second of its modification in the lowerdir or they manually
changed the modtime with chtimes).

Signed-off-by: Erik Sipsma <erik@sipsma.dev>
2021-11-24 11:27:32 -08:00
Tonis Tiigi 6cad384e93 support setting warnings from frontends
Signed-off-by: Tonis Tiigi <tonistiigi@gmail.com>
2021-11-24 00:19:43 -08:00
Akihiro Suda 79ac30b979
Merge pull request #2481 from alexcb/acb/update-containerd-continuity
update containerd to latest version (v1.6.0-beta.3)
2021-11-24 10:56:09 +09:00
Alex Couture-Beil cb63ca84fa
update containerd to latest version (v1.6.0-beta.3)
This updates containerd to v1.6.0-beta.3; done by running:

    go get -u github.com/containerd/containerd
    ./hack/update-vendor

Signed-off-by: Alex Couture-Beil <alex@earthly.dev>
2021-11-23 15:50:03 -08:00
Tõnis Tiigi d5b7ce35d8
Merge pull request #2473 from afbjorklund/systemd-rootless
Add systemd support for rootless buildkitd
2021-11-22 16:43:45 -08:00
Tõnis Tiigi f9cb2b7b4a
Merge pull request #2456 from sunchunming/fix_grpc_message_overflow
limit vertex size with 50000 to avoid huge grpc message making client…
2021-11-19 00:01:33 -08:00
Anders F Björklund 4d6a45bfae Isolate systemd user network namespace from host
Signed-off-by: Anders F Björklund <anders.f.bjorklund@gmail.com>
2021-11-19 07:59:19 +01:00
sunchunming bb24010f6e limit log vertex size with 1M to avoid huge grpc message making client buffer overflow
Signed-off-by: sunchunming <sunchunming1@jd.com>
2021-11-19 14:49:31 +08:00
Tõnis Tiigi 3a9963bf0e
Merge pull request #2475 from aaronlehmann/ticker-leak
Fix ticker leak in DisplaySolveStatus
2021-11-18 17:37:39 -08:00
Aaron Lehmann f71293f5de Fix ticker leak in DisplaySolveStatus
The "defer" is bound to the original value of the ticker, and won't stop
a ticker that's created later in the function. Example:
https://play.golang.org/p/puat5JEf5Jw

Ran into this in a health checker that periodically created buildkit
clients.

Signed-off-by: Aaron Lehmann <alehmann@netflix.com>
2021-11-18 15:36:46 -08:00
Tõnis Tiigi 8d02e473a4
Merge pull request #2474 from sipsma/file-rm-no-follow
Remove symlink, not target, in FileOp.Rm.
2021-11-18 14:08:22 -08:00
Erik Sipsma 43a74261b3 Remove symlink, not target, in FileOp.Rm.
Before this change, if the path provided to FileOp.Rm was a symlink then
the target of the symlink would be removed instead of the symlink
itself. Now, the symlink will be removed instead. However, any symlinks
present in the parent dirs of the specified path will still be resolved
before calling os.Remove; this change only results in the base of the
specified path not being followed.

Signed-off-by: Erik Sipsma <erik@sipsma.dev>
2021-11-18 12:44:12 -08:00
Tõnis Tiigi fce4a32258
Merge pull request #2335 from sipsma/mergeop-impl
MergeOp
2021-11-18 11:52:15 -08:00