Commit Graph

126 Commits (master)

Author SHA1 Message Date
Edgar Lee d21254e7f7 Add events for exec op
Signed-off-by: Edgar Lee <edgarl@netflix.com>
2022-03-02 12:05:35 -08:00
Kohei Tokunaga 21aeba6fd6 Support rootless containerd worker
Signed-off-by: Kohei Tokunaga <ktokunaga.mail@gmail.com>
2022-02-21 15:39:14 +09:00
Cory Bennett 559d079902 Allow signals to be sent to gateway exec containers
Signed-off-by: Cory Bennett <cbennett@netflix.com>
2022-02-02 16:57:10 +00:00
Tonis Tiigi dc21885891 hack: enable more linters
Signed-off-by: Tonis Tiigi <tonistiigi@gmail.com>
2022-01-19 12:20:30 -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
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
CrazyMax d81e79540b
update to github.com/mitchellh/hashstructure v2.0.2
Signed-off-by: CrazyMax <crazy-max@users.noreply.github.com>
2021-11-09 09:56:10 +01:00
Akihiro Suda d47b46cf2a
Merge pull request #2432 from crazy-max/gofmt
go fmt: add //go:build
2021-10-29 12:32:52 +09: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
CrazyMax c82ef274bf
cgroup-parent support
Signed-off-by: CrazyMax <crazy-max@users.noreply.github.com>
2021-10-27 23:50:20 +02:00
Tonis Tiigi e82ccdf958 containerdexecutor: fix setting user
Signed-off-by: Tonis Tiigi <tonistiigi@gmail.com>
2021-10-27 11:26:10 -07:00
Tonis Tiigi 58ecc5ce14 executor: make sure supplementary groups are set for unset user
Signed-off-by: Tonis Tiigi <tonistiigi@gmail.com>
2021-10-27 11:03:37 -07:00
CrazyMax 32d95c8ece
deduplicate mounts
Signed-off-by: CrazyMax <crazy-max@users.noreply.github.com>
2021-10-18 10:54:53 +02:00
CrazyMax 87e1fa7ecb
add size to tmpfs mounts
Signed-off-by: CrazyMax <crazy-max@users.noreply.github.com>
2021-10-18 10:54:52 +02:00
CrazyMax 4e32ae5630
Add support for ulimit
Signed-off-by: CrazyMax <crazy-max@users.noreply.github.com>
2021-10-08 11:50:09 +02:00
CrazyMax 6094339341
Add support for shm size
Signed-off-by: CrazyMax <crazy-max@users.noreply.github.com>
2021-10-01 16:07:29 +02: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
coryb 2bd37c8a7d
Merge pull request #2286 from aaronlehmann/exiterror-over-grpc
Allow ExitError type to be transmitted over GRPC
2021-08-11 15:51:23 -07:00
Sebastiaan van Stijn cea791d3fe
replace use of deprecated github.com/docker/docker/pkg/signal
This package was moved to a separate module in github.com/moby/sys/signal

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2021-08-02 12:19:45 +02:00
Aaron Lehmann 890c3f77b6 Allow ExitError type to be transmitted over GRPC
This will allow clients to retrieve exit error codes returned during a
solve without parsing the error messages.

Signed-off-by: Aaron Lehmann <alehmann@netflix.com>
2021-07-28 15:01:05 -07:00
Morlay 18b49fd7dc refactor to use util/bklog instead of using logurs directly
Signed-off-by: Morlay <morlay.null@gmail.com>
2021-07-13 11:42:31 +08:00
Akihiro Suda 1a7543a105
Merge pull request #2163 from tonistiigi/detect-otel-env 2021-07-03 01:01:34 +09:00
Cory Bennett 13c842bab7 ensure containerd io is complete and closed before returning
Signed-off-by: Cory Bennett <cbennett@netflix.com>
2021-06-28 15:39:36 +00:00
Tonis Tiigi d512920c24 support collecting traces from llb.Exec
Signed-off-by: Tonis Tiigi <tonistiigi@gmail.com>
2021-06-20 21:57:35 -07:00
Tonis Tiigi 69a8caa3be add current tracing context detection and exec propagation
Signed-off-by: Tonis Tiigi <tonistiigi@gmail.com>
(cherry picked from commit bc9a83144c83e9fd78007b7bfe92e8082c59d40e)
2021-06-20 21:57:35 -07:00
Sebastiaan van Stijn c98d24b054
Update docker/docker to master / v21.xx-dev (post libnetwork integration)
full diff: https://github.com/docker/docker/compare/v20.10.7..0ad2293d0e5b

This applies the same / similar local changes to buildkit as were made in
the branch that moby is currently vendoring:
https://github.com/moby/buildkit/compare/244e8cde...cpuguy83:update_libnetwork_import

Unfortunately, this (again) requires a "replace" rule (probably until we tagged
a release with this change). Go mod refuses to pick a version from master, and
(without the replace rule), does weird, reverting docker to a very old version,
predating the sirupsen rename:

    > [vendored 4/4] RUN --mount=target=/src,rw   --mount=target=/go/pkg/mod,type=cache   go mod tidy && go mod vendor &&   mkdir /out && cp -r go.mod go.sum vendor /out:
    #10 0.500 go: finding github.com/docker/docker 8dbd90ec00daa26dc45d7da2431c965dec99e8b4
    #10 0.599 warning: ignoring symlink /src/examples/kube-consistent-hash
    #10 1.027 go: github.com/moby/buildkit/util/testutil/integration imports
    #10 1.027       github.com/docker/docker/testutil/daemon imports
    #10 1.027 	github.com/docker/docker/opts imports
    #10 1.027 	github.com/docker/libnetwork/ipamutils imports
    #10 1.027 	github.com/docker/libnetwork/osl imports
    #10 1.027 	github.com/Sirupsen/logrus: github.com/Sirupsen/logrus@v1.8.1: parsing go.mod:
    #10 1.027 	module declares its path as: github.com/sirupsen/logrus
    #10 1.027 	        but was required as: github.com/Sirupsen/logrus
    ------
    error: failed to solve: rpc error: code = Unknown desc = executor failed running [/bin/sh -c go mod tidy && go mod vendor &&   mkdir /out && cp -r go.mod go.sum vendor /out]: exit code: 1
    make: *** [vendor] Error 1

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2021-06-09 19:31:25 +02:00
Brian Goff d9834f872c
Add support for apparmor/selinux
Set's an apparmor profile on the OCI spec if one is configred on the
worker.
Adds selinux labels to containers (only added if selinux is enabled on
the system).

This assumes that the specified apparmor profile is already loaded on
the system and does not try to load it or even check if it is loaded.

SELinux support requires the `selinux` build tag to be added.
Likewise, `runc` would require both the `apparmor` and `selinux` build
tags.

Signed-off-by: Brian Goff <cpuguy83@gmail.com>

Vendored go-selinux to v1.8.0
Fixed tests

Signed-off-by: Tibor Vass <tibor@docker.com>
(cherry picked from commit 68bb095353)
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2021-02-04 22:01:34 +01:00
Cory Bennett 9d3f55c400 move ExitError from solver/errdefs to frontend/gateway/errdefs
Signed-off-by: Cory Bennett <cbennett@netflix.com>
2020-12-07 01:09:59 +00:00
Sebastiaan van Stijn a1a85daeb5
executor: switch to docker seccomp profile
While we try to keep the containerd and docker seccomp profiles in sync,
they may not always be; this switches the executor to use the docker
seccomp profile, so that buildkit (when vendored in docker) will use
the same default seccomp profile as is used for containers.

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2020-11-18 10:05:36 +01:00
Sebastiaan van Stijn 67bcfe699a
copy containerd.UnknownExitStatus to local const
Copy this const to a local constant to prevent importing the containerd
client in the front-end.

For consistency, I also updated the executor code to use the same const,
although not strictly needed.

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2020-11-18 00:11:09 +01:00
Tonis Tiigi bdcee17437 executor: change mount to struct
Allows readonly passed cleanly.

Signed-off-by: Tonis Tiigi <tonistiigi@gmail.com>
2020-11-02 22:20:51 -08:00
Tonis Tiigi e3b05289d8 add session injection to remote loading
Signed-off-by: Tonis Tiigi <tonistiigi@gmail.com>
2020-11-02 22:20:44 -08:00
Cory Bennett 43d59b4aa1 update go-runc mod, use runc Started chan
Signed-off-by: Cory Bennett <cbennett@netflix.com>
2020-10-21 19:12:56 +00:00
Akihiro Suda dda009a58c
Merge pull request #1739 from tonistiigi/empty-layer
clear file mount stubs and fix empty layer cases
2020-10-21 00:42:45 +09:00
Cory Bennett b464f1e315 update go-runc to use runc.ExitError for container exec status
Signed-off-by: Cory Bennett <cbennett@netflix.com>
2020-10-20 06:44:29 +00:00
Edgar Lee 5eaecb905c
Merge pull request #1731 from coryb/issue-1714
add tty support for runc executor
2020-10-19 14:52:31 -07:00
Cory Bennett 74db85d357 syscall.Errno(0x5) == syscall.EIO
Signed-off-by: Cory Bennett <cbennett@netflix.com>
2020-10-19 21:28:39 +00:00
Tonis Tiigi 17b4ca1edf executor: remove stub files from rootfs
Signed-off-by: Tonis Tiigi <tonistiigi@gmail.com>
2020-10-18 23:39:17 -07:00
Cory Bennett e308ef7874 add tty support for runc executor
Signed-off-by: Cory Bennett <cbennett@netflix.com>
2020-10-16 17:36:56 +00:00
Lu Jingxiao 5e7ae230b2 Add hostname specifying for building
Fix: #1301

Signed-off-by: Lu Jingxiao <lujingxiao@huawei.com>
2020-10-14 14:45:36 +08:00
Cory Bennett 355e937e15 update gateway to add ability to run and exec into containers
Signed-off-by: Cory Bennett <cbennett@netflix.com>
2020-08-31 21:13:59 +00:00
Cory Bennett 19c0077b49 update container resize events in sequence, also move it out of exit/cancel loop to prevent blocking.
Signed-off-by: Cory Bennett <cbennett@netflix.com>
2020-08-03 01:37:38 +00:00
Cory Bennett 86e246a874 only warn on resize errors
prevent resize from blocking exit
fix edgecase where kill signal never reaches process

Signed-off-by: Cory Bennett <cbennett@netflix.com>
2020-08-01 22:40:57 +00:00
Cory Bennett f781f83a89 fix containerd executor Run/Exec to close container input on eof from stdin
Signed-off-by: Cory Bennett <cbennett@netflix.com>
2020-08-01 17:21:40 +00:00
Cory Bennett 93344a9d24 remove *pixel from winsize struct, tweak ExitError handling for ctx.Err
Signed-off-by: Cory Bennett <cbennett@netflix.com>
2020-07-31 20:22:12 +00:00
Cory Bennett 4b456f17f4 wrap errors from executor Run/Exec to allow access to exit code
Signed-off-by: Cory Bennett <cbennett@netflix.com>
2020-07-31 19:14:30 +00:00
Paul "TBBle" Hampson 603e1d7100 Don't ignore failure to setup networking
Signed-off-by: Paul "TBBle" Hampson <Paul.Hampson@Pobox.com>
2020-07-31 02:49:39 +10:00
Paul "TBBle" Hampson 8cd927c788 Refactor OCI Spec generation to use oci.SpecOpts more
This has the nice side-effect of unifying the mount- and
non-mount-changes made due to processMode and securityMode.

Signed-off-by: Paul "TBBle" Hampson <Paul.Hampson@Pobox.com>
2020-07-31 02:49:39 +10:00
Paul "TBBle" Hampson 59edca02f3 Fix linter warning about comment mismatch
Signed-off-by: Paul "TBBle" Hampson <Paul.Hampson@Pobox.com>
2020-07-31 02:49:39 +10:00
Paul "TBBle" Hampson 1527525110 Unify OCI Spec generation across all host platforms
There's only a couple of things that are host-platform limited, i.e.,
security and process modes.

Everything else is specific to a target-platform. We can tell if we're
targeting a Linux platform, either on Linux or LCOW, by the presence of
the Linux key in the generated spec.

This doesn't introduce support for LCOW, as we'd need to plumb that down
from the caller. It will probably also need massaging to work with LCOW,
as some of the setup code here is probably incorrect for LCOW, e.g.,
the bind-mounts list may be incorrect.

Signed-off-by: Paul "TBBle" Hampson <Paul.Hampson@Pobox.com>
2020-07-31 02:49:23 +10:00