Commit Graph

3700 Commits (1fbdce1d0576bc2786be6d7a0df108a110a6623b)

Author SHA1 Message Date
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
Tonis Tiigi 45d02301c2 dockerfile: show target platform on cross compiling
Signed-off-by: Tonis Tiigi <tonistiigi@gmail.com>
2022-01-23 21:55:19 -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
CrazyMax 3df7865fbb
Merge pull request #2571 from tonistiigi/lint-update
hack: update linter to v1.43
2022-01-20 17:23:10 +01: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
Erik Sipsma eb473d0a62
Merge pull request #2563 from sipsma/diffref-fix
cache: improve diff ref release logic.
2022-01-19 14:28:14 -08:00
Erik Sipsma 417ba9e0ed cache: improve diff ref release logic.
Before this change, the lower and upper parents provided to the cache
manager Diff method were not cloned, which resulted in some code paths
incorrectly providing them directly as the parents of the returned ref.
This meant that if they were released after the call to Diff, the diff
ref could become incorrectly invalidated.

Now, the lower and upper are cloned and unit test coverage has been
added to test that ref release is handled correctly.

Signed-off-by: Erik Sipsma <erik@sipsma.dev>
2022-01-19 14:03:49 -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 9f2d744354
Merge pull request #2569 from tonistiigi/platforms-compare-fix
exec: check full platform vector when checking for emulator
2022-01-19 19:10:06 +09:00
Tõnis Tiigi e47e047569
Merge pull request #2564 from sipsma/fix-2557
cache: handle crash after snapshot commit
2022-01-19 00:41:04 -08:00
Tonis Tiigi 082c666bdb exec: check full platform vector when checking for emulator
Instead of doing a direct string comparison we should
use `platforms.Only` so that we can also detect the
variants that are compatible but don’t match directly.

Signed-off-by: Tonis Tiigi <tonistiigi@gmail.com>
2022-01-18 23:54:24 -08:00
Erik Sipsma eb935e525f cache: handle crash after snapshot commit
Before this, there could be crash during a call to finalize a ref that
occured after the snapshot was committed but before committing the
metadata that indicates the immutable ref no longer had an
equalMutable. This resulted in a situation where any future calls to
finalize that ref would fail.

Now, if that situation happens, the cache will notice when it's
initially loaded that the ref has an equalMutable that's missing its
snapshot and that its own snapshot exists. It will then just use the
correctly committed snapshot and clear the equalMutable field.

Signed-off-by: Erik Sipsma <erik@sipsma.dev>
2022-01-18 12:22:52 -08:00
Tõnis Tiigi 17c237d69a
Merge pull request #2565 from sipsma/test-mount-ro
cache: add coverage for Mount readonly parameter.
2022-01-17 22:37:13 -08:00
Erik Sipsma 0eca53360b cache: add coverage for Mount readonly parameter.
This adds test coverage for ensuring the readonly parameter is honored
as expected in the ref Mount methods. There was a regression introduced
during #2335 that went unnoticed until identified and fixed in #2562.
This test coverage should help prevent similar regressions in the
future.

Signed-off-by: Erik Sipsma <erik@sipsma.dev>
2022-01-17 16:47:44 -08:00
Erik Sipsma 6471f316d3
Merge pull request #2562 from ktock/refmountcachero
cache: do not ignore readonly option
2022-01-16 16:37:34 -08:00
Tõnis Tiigi cfdaaa42d2
Merge pull request #2501 from sipsma/mergeop-inline-cache
remote cache: support arbitrary layers as results
2022-01-15 21:07:41 -08:00
Kohei Tokunaga f8c9a756e3 cache: do not ignore readonly option
Signed-off-by: Kohei Tokunaga <ktokunaga.mail@gmail.com>
2022-01-16 13:20:17 +09:00
Tõnis Tiigi 2dc3e743fd
Merge pull request #2553 from shizhMSFT/fix_auth
Refine FetchToken Logic
2022-01-13 18:45:54 -08:00
Tõnis Tiigi 7b27cb62cb
Merge pull request #2550 from tonistiigi/context-dockerignore
dockerfile: apply dockerignore on loading local contexts
2022-01-13 18:45:42 -08:00
Shiwei Zhang 9ae05d8e1d refine auth logic
Signed-off-by: Shiwei Zhang <shizh@microsoft.com>
2022-01-14 10:07:37 +08:00
Tõnis Tiigi e5e39c3319
Merge pull request #2556 from hinshun/scheduler-inf-loop
Remove goto statements causing failed edges to never unpark
2022-01-12 16:53:36 -08:00
Edgar Lee 465a30a31d Remove goto statements causing failed edges to never unpark
Signed-off-by: Edgar Lee <edgarhinshunlee@gmail.com>
2022-01-12 15:59:20 -08:00
Erik Sipsma ce012ab70c remote cache: support arbitrary layers as results
This change enables inline cache to work as expected with MergeOp by
supporting a new type of result, DiffResult, which enables results to be
specified as a specific ordered set of layers inside an image.
Previously, results could only be specified with a singe layer index,
which meant that they had to start at the image's base layer and end at
that index. That meant that merge inputs couldn't be specified as they
are often a subset of the image layers that don't begin at the base.

Signed-off-by: Erik Sipsma <erik@sipsma.dev>
2022-01-11 13:27:05 -08:00
Tonis Tiigi 507d18188c dockerfile: apply dockerignore on loading local contexts
Signed-off-by: Tonis Tiigi <tonistiigi@gmail.com>
2022-01-07 18:16:45 -08:00
Tõnis Tiigi ffe2301031
Merge pull request #2549 from tonistiigi/img-name-fix
dockerfile: fix image name when loaded named context
2022-01-07 12:17:44 -08:00
Tonis Tiigi 4ae6df86f1 dockerfile: fix image name when loaded named context
Signed-off-by: Tonis Tiigi <tonistiigi@gmail.com>
2022-01-06 19:49:18 -08:00
Tõnis Tiigi a2528b9772
Merge pull request #2434 from sipsma/diffop
DiffOp
2022-01-06 12:33:03 -08:00
Erik Sipsma 0ec885106f Add DiffOp test cases.
Signed-off-by: Erik Sipsma <erik@sipsma.dev>
2022-01-06 11:05:51 -08:00
Erik Sipsma 1835ef5118 solver: fix nil result handling
Before this, you could return worker ref results from ops that have nil
refs but once they were attempted to be used, various nil exceptions
would get hit. Now, those cases should be handled.

Signed-off-by: Erik Sipsma <erik@sipsma.dev>
2022-01-06 11:05:51 -08:00
Erik Sipsma 8c1e411d01 Add DiffOp support to solver and client.
Signed-off-by: Erik Sipsma <erik@sipsma.dev>
2022-01-06 11:05:51 -08:00
Erik Sipsma 5c4dcb2741 cache: add support for Diff refs.
This allows you to create refs that are single layers representing the
diff between any two arbitrary refs. The primary use case for this is
to allows users to extract the changes created by ops like Exec and
rebase them elsewhere through MergeOp. However, there is no restriction
on the inputs to DiffOp and the resulting ref's layer is simply the
layer created by running the differ on the two inputs refs
(specifically, the same differ used during exports).

A Diff ref can be mounted by itself, in which case it is defined as the
result of applying the diff to Scratch. Most use cases though will use
Diff refs as the input to a MergeOp, in which case the diff is just
applied on top of the lower merge inputs, as was the case before.

In cases like Diff(A, A->B->C) (i.e. cases where the diff is between two
refs where the lower is an ancestor of upper), the diff will be defined
as the layers separating the two refs. In other cases, the diff is just
a single layer, not re-used from the inputs, representing the diff
between the two refs (which can be defined as the layer "Diff(A,B)" that
satisfies "Merge(A, Diff(A,B)) == B").

Note that there is technically a meaningful difference between the
"unmerge" behavior of extracting the layers separating diffs and the
"simple diff" of just running the differ on the two refs. Namely, in the
case where there are "intermediate deletes" (i.e. deletes that only
exist in layers between A and B but not between A and B by themselves),
then the simple diff and unmerge can create different results when
plugged into a MergeOp. This is due to the fact that intermediate
deletes will apply to the merge when using the unmerge behavior, but not
when using the simple diff. This is on top of the fact that the simple
diff inherently has a "flattening" behavior where multiple layers are
squashed into a single one.

So, in the case where lower is an ancestor of upper, we choose to follow
the unmerge behavior, but it's possible users may prefer the simple diff
behavior. As of right now, they won't be able to do so, but if needed we
can add the ability to choose which behavior is followed in the future.
This could be done through a flag provided to DiffOp or possibly by
adapting llb.Copy to support this type of behavior with the same
efficiency as DiffOp.

Signed-off-by: Erik Sipsma <erik@sipsma.dev>
2022-01-06 11:05:51 -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
coryb 1725efc1f4
Merge pull request #2545 from coryb/umask-git-panic
fix panic from umask-git on invalid ref
2022-01-04 08:48:43 -08:00
coryb 397c98bdf8 fix panic from umask-git on invalid ref
If the ref is invalid we are seeing a panic from `umask-git` because
the error type is not always a unix.WaitStatus:
```
    #1 0.227 fatal: Not a valid object name 000111222333444555666777888999aaabbbcccd^{commit}
    #1 0.229 panic: interface conversion: interface {} is syscall.WaitStatus, not unix.WaitStatus
    #1 0.229
    #1 0.229 goroutine 1 [running]:
    #1 0.229 github.com/moby/buildkit/source/git.gitMain()
    #1 0.229 	/src/source/git/gitsource_unix.go:66 +0x27d
    #1 0.229 github.com/docker/docker/pkg/reexec.Init(...)
    #1 0.229 	/src/vendor/github.com/docker/docker/pkg/reexec/reexec.go:26
    #1 0.229 main.init.0()
    #1 0.229 	/src/cmd/buildkitd/main.go:76 +0xf6
    #1 0.633 fatal: reference is not a tree: 000111222333444555666777888999aaabbbcccd
    #1 0.635 panic: interface conversion: interface {} is syscall.WaitStatus, not unix.WaitStatus
    #1 0.635
    #1 0.635 goroutine 1 [running]:
    #1 0.635 github.com/moby/buildkit/source/git.gitMain()
    #1 0.635 	/src/source/git/gitsource_unix.go:66 +0x27d
    #1 0.635 github.com/docker/docker/pkg/reexec.Init(...)
    #1 0.635 	/src/vendor/github.com/docker/docker/pkg/reexec/reexec.go:26
    #1 0.635 main.init.0()
    #1 0.635 	/src/cmd/buildkitd/main.go:76 +0xf6
```

This is from trying to solve:
```
    llb.Git("https://github.com/moby/buildkit.git", "000111222333444555666777888999aaabbbcccd")
```

Signed-off-by: coryb <cbennett@netflix.com>
2022-01-03 15:59:26 -08:00
Akihiro Suda a8278dd166
Merge pull request #2521 from tonistiigi/dockerfile-named-contexts
dockerfile: add support for named contexts
2021-12-27 20:24:02 +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 d6b191e33a
Merge pull request #2531 from crazy-max/hack-skip-platform
hack: use local platform if none defined
2021-12-21 21:51:58 -08:00
CrazyMax cd8c2cb198
hack: use local platform if none defined
Signed-off-by: CrazyMax <crazy-max@users.noreply.github.com>
2021-12-20 22:39:26 +01:00
Tonis Tiigi 23709ef316 dockerfile: set current platform on image based named context
Signed-off-by: Tonis Tiigi <tonistiigi@gmail.com>
2021-12-15 20:56:46 -08:00
Tonis Tiigi 20285bb53e dockerfile: test named contexts with multi-platform
Signed-off-by: Tonis Tiigi <tonistiigi@gmail.com>
2021-12-15 20:55:51 -08:00
Tonis Tiigi 4eadeaf0f2 dockerfile: add support for named contexts
Stages and implicit stages from image names can be
redefined with build options.

This enables using more that one source directory
and reusing results from other builds. This can also
be used to use a local image from other build without
including a registry.

Contexts need to be defined as `context:name=` frontend
options. The value can be image, git repository,
URL, local directory or a frontend input.

Signed-off-by: Tonis Tiigi <tonistiigi@gmail.com>
2021-12-15 20:51:01 -08:00
Tõnis Tiigi 539be17089
Merge pull request #2428 from tonistiigi/default-user-groups
executor: make sure supplementary groups are set for unset user
2021-12-14 17:02:09 -08: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
Tonis Tiigi 872518e334 update warning type definition
Detail is now an array and URL is a separate field.

Signed-off-by: Tonis Tiigi <tonistiigi@gmail.com>
2021-12-13 21:38:20 -08:00
Tõnis Tiigi 4a1cbd73b0
Merge pull request #2522 from csweichel/master
README.md: Add Gitpod as consuming project
2021-12-13 10:40:30 -08:00
Tõnis Tiigi d4cc369928
Merge pull request #2523 from AkihiroSuda/buildkit-nix
README.md: add buildkit-nix frontend
2021-12-13 10:39:51 -08:00
Akihiro Suda 4d09c1ea8e
README.md: add buildkit-nix frontend
Signed-off-by: Akihiro Suda <akihiro.suda.cz@hco.ntt.co.jp>
2021-12-13 21:31:58 +09:00
Christian Weichel 90ae971b5b README.md: Add Gitpod as consuming project
Signed-off-by: Christian Weichel <chris@gitpod.io>
2021-12-13 12:02:01 +00:00
Tõnis Tiigi 8700be3961
Merge pull request #2520 from hansbogert/patch-1
doc(buildkitd.toml.md): Add mirror configuration
2021-12-11 11:03:10 -08:00