Commit Graph

489 Commits (b92a6170cf1413f37b51b0a874ba8216746b30ba)

Author SHA1 Message Date
Tonis Tiigi cab33b1e31 exporter: support for compression-level
compression-level option can be set on export to
define the preferred speed vs compression ratio. The
value is a number dependent on the compression algorithm.

Signed-off-by: Tonis Tiigi <tonistiigi@gmail.com>
2022-02-01 15:21:46 -08:00
CrazyMax 07dea88ee0
otel: update semconv
Signed-off-by: CrazyMax <crazy-max@users.noreply.github.com>
2022-01-28 10:19:00 +01:00
Tonis Tiigi ffce8218e3 keep buffer of logs to show on failure when regular logs are clipped
Signed-off-by: Tonis Tiigi <tonistiigi@gmail.com>
2022-01-24 21:30:46 -08:00
Tõnis Tiigi c18af390ef
Merge pull request #2572 from tonistiigi/tracing-env-update
tracing: move to newer env names
2022-01-20 12:58:05 -08:00
Tonis Tiigi f5dbcf6e99 tracing: move to newer env names
open-telemetry/opentelemetry-specification#740 has decided to
promote different set of env for CLI propagation.

Switch to use them so we are more consistent with other
tools. Old ones should be removed in a future release.

Signed-off-by: Tonis Tiigi <tonistiigi@gmail.com>
2022-01-19 21:46:10 -08:00
Tonis Tiigi dc21885891 hack: enable more linters
Signed-off-by: Tonis Tiigi <tonistiigi@gmail.com>
2022-01-19 12:20:30 -08:00
Tonis Tiigi 01e935cff5 hack: update linter to v1.43
Signed-off-by: Tonis Tiigi <tonistiigi@gmail.com>
2022-01-19 11:48:57 -08:00
Akihiro Suda 15fb1145af
Merge pull request #2491 from ktock/overlayfs-redirect
Disable redirect_dir for avoiding incorrect diff
2022-01-05 14:03:04 +09:00
Kohei Tokunaga bc5cfe960b Disable redirect_dir for overlayfs snapshotter
Signed-off-by: Kohei Tokunaga <ktokunaga.mail@gmail.com>
2021-12-24 11:58:44 +09:00
Tõnis Tiigi 76234fa1c7
Merge pull request #2498 from tonistiigi/warnings-updates
Updates to warnings handling
2021-12-14 17:01:46 -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
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
Tonis Tiigi 86b4bdbca4 archutil: update generator
Signed-off-by: Tonis Tiigi <tonistiigi@gmail.com>
2021-12-06 22:25:25 -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
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
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
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
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 fce4a32258
Merge pull request #2335 from sipsma/mergeop-impl
MergeOp
2021-11-18 11:52:15 -08:00
Erik Sipsma d73e62f878 Add initial MergeOp implementation.
This consists of just the base MergeOp with support for merging LLB
results that include deletions using hardlinks as the efficient path
and copies as fallback.

Signed-off-by: Erik Sipsma <erik@sipsma.dev>
2021-11-18 11:10:48 -08:00
Tonis Tiigi b449431019 imageutil: make mediatype detection more stricter
Signed-off-by: Tonis Tiigi <tonistiigi@gmail.com>
2021-11-17 15:44:18 -08:00
Erik Sipsma 982f4b8687 Move overlay diff to util package.
This allows the overlay diff logic to be re-used by the snapshot package
as part of merge+diff op.

Signed-off-by: Erik Sipsma <erik@sipsma.dev>
2021-11-15 14:19:37 -08:00
Tonis Tiigi faf5ad9e96 push: workaround deadlock in containerd pusher
Signed-off-by: Tonis Tiigi <tonistiigi@gmail.com>
2021-11-12 17:33:08 -08:00
CrazyMax 54b8ff2fc8
go fmt: add //go:build
Signed-off-by: CrazyMax <crazy-max@users.noreply.github.com>
2021-10-28 13:26:43 +02:00
Tõnis Tiigi 4b86211bed
Merge pull request #2405 from ktock/cachecompression
Propagate compression options to the inline cache export
2021-10-27 20:58:53 -07:00
Tõnis Tiigi 8a8b4cbf17
Merge pull request #2427 from crazy-max/update-containerd
update to containerd v1.6.0-beta.1
2021-10-27 18:27:36 -07:00
Jacob MacElroy 5279e683a5 Handling parsing of multiple scopes combined in a single string.
It is possible for challenge headers to contain multiple scopes in a single string. This change ensures that this case is handled when parsing the scopes by splitting out scopes combined in a single string.

Signed-off-by: Jacob MacElroy <jacob@okteto.com>
2021-10-27 16:32:36 -06:00
CrazyMax 7b171f6b6a
update to containerd v1.6.0-beta.1
Signed-off-by: CrazyMax <crazy-max@users.noreply.github.com>
2021-10-26 22:48:51 +02:00
Kohei Tokunaga f9e0346b34 Propagate compression options to the inline cache export
Co-authored-by: Tonis Tiigi <tonistiigi@gmail.com>
Signed-off-by: Kohei Tokunaga <ktokunaga.mail@gmail.com>
2021-10-22 15:43:32 +09:00
Andrey Smirnov a5d1cfc1e4
fix: provide only available capabilities to insecure environment
The problem this change is trying to fix are the environments where some
capabilities are already dropped, so they can't be granted to the
job with `--security=insecure`.

I know that probably fixed set of capabilities was implemented to
provide a stable build environment, but at the same time this breaks
environments with reduced capabilities.

Signed-off-by: Andrey Smirnov <andrey.smirnov@talos-systems.com>
2021-10-15 19:57:32 +03:00
Tonis Tiigi 7153f5a9bb limited: fix possible deadlock when pushhandler calls fetcher
Signed-off-by: Tonis Tiigi <tonistiigi@gmail.com>
2021-10-06 22:46:37 -07:00
Tonis Tiigi 066a011c01 gha: handle missing blob gracefully
FromRemote now calls CheckDescriptor to validate
if the blob still exists. Otherwise cache loading
fallback does not get triggered because cache is
actually lazily pulled in only on exporting phase.

Signed-off-by: Tonis Tiigi <tonistiigi@gmail.com>
2021-10-02 14:52:09 -07:00
CrazyMax 73625be54a
Move resolver config to a dedicated package
Signed-off-by: CrazyMax <crazy-max@users.noreply.github.com>
2021-09-27 19:41:38 +02:00
CrazyMax 1031116f12
Merge pull request #2368 from crazy-max/ansi-color
Enhance ANSI colors for progress ui
2021-09-24 13:58:26 +02:00
CrazyMax 165e70568e
Enhance ANSI color for progress ui
Signed-off-by: CrazyMax <crazy-max@users.noreply.github.com>
2021-09-23 18:51:37 +02:00
Akihiro Suda 44891f4cb9
Merge pull request #2369 from tonistiigi/resolver-timeout-fixes
resolver timeout fixes
2021-09-21 14:29:01 +09:00
Tonis Tiigi f62bb55245 resolver: make sure authorizer is not overwritten on other resolvers
Authorizer stores the current session.Group so if it is
overwritten for another resolver it means that session might
have been dropped and authentication will fail.

Signed-off-by: Tonis Tiigi <tonistiigi@gmail.com>
2021-09-18 21:22:32 -07:00
Tonis Tiigi 6bd2eb5046 resolver: use different mutext for handlers and hosts
hosts mutex is called on initialization, meaning `GetResolver` might
block if it is in the middle of auth exchange. This is currently bad
in the case where Job initialization needs to register a name before
timeout is reached.

Signed-off-by: Tonis Tiigi <tonistiigi@gmail.com>
2021-09-18 21:04:16 -07:00
CrazyMax 5fcc94454f
Generate and embed build sources
Signed-off-by: CrazyMax <crazy-max@users.noreply.github.com>
2021-09-18 01:39:35 +02:00
CrazyMax 8bb242e7ac
Refactor url redacting util
Signed-off-by: CrazyMax <crazy-max@users.noreply.github.com>
2021-09-14 17:39:07 +02:00
Morlay 0f52917bf3 bklog: only log tracing ids when span exporter not nil
Signed-off-by: Morlay <morlay.null@gmail.com>
2021-09-09 09:32:39 +08:00
Tonis Tiigi 8b5c4d74ef exporter: support creating blobs with zstd compression
Signed-off-by: Tonis Tiigi <tonistiigi@gmail.com>
2021-09-05 22:43:15 -07:00
Tõnis Tiigi cf80727e5c
Merge pull request #2181 from ktock/overlaydiff
Compute diff from the upper directory of overlayfs-based snapshotter
2021-09-02 16:04:52 -07:00
Kohei Tokunaga d586efd5db Compute diff from the upper dir of overlayfs-based snapshotter
Signed-off-by: Kohei Tokunaga <ktokunaga.mail@gmail.com>
2021-09-02 17:58:12 +09:00
Sebastiaan van Stijn d782dd8d78
Use containerd/pkg/seccomp.IsEnabled()
This replaces the local SeccompSupported() utility for the implementation
in containerd, which performs the same check.

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2021-08-28 12:56:18 +02:00
Kohei Tokunaga f8d30d567e Add `estargz` compression type
Signed-off-by: Kohei Tokunaga <ktokunaga.mail@gmail.com>
2021-08-24 14:10:09 +09:00
Tonis Tiigi ac61da5890 update go to 1.17
Signed-off-by: Tonis Tiigi <tonistiigi@gmail.com>
2021-08-16 19:56:45 -07:00