131 Commits

Author SHA1 Message Date
Sebastiaan van Stijn
50b548a135 vendor: migrate to github.com/gohugoio/hashstructure
The github.com/mitchellh/hashstructure/v2 module was archived, and
there's a maintained fork in the gohugoio org.

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2026-06-17 10:02:52 +02:00
Jiří Moravčík
f85c740c2b solver: add per-step CPU and memory resource limits
Add support for setting cgroup resource limits (memory, memory-swap,
cpu-shares, cpu-period, cpu-quota, cpuset-cpus, cpuset-mems) on
individual build steps.

Signed-off-by: Jiří Moravčík <jiri.moravcik@gmail.com>
2026-05-27 11:34:13 +02:00
Jonathan A. Sternberg
265c6e08ff otel: refactor tracing helpers for child processes
Merge the `tracing/env` and `tracing/exec` package into a single package
with some common types shared between the two.

Signed-off-by: Jonathan A. Sternberg <jonathan.sternberg@docker.com>
2026-04-16 10:28:19 -05:00
Tonis Tiigi
b46ee07a5d executor/oci: scope state files to roots
Use os.OpenRoot for resolv.conf and hosts state file creation, and
adapt executor callers and tests to the root-relative helper API.

Signed-off-by: Tonis Tiigi <tonistiigi@gmail.com>
2026-03-25 08:14:31 -07:00
Tonis Tiigi
b61489948c tests: use t.Context in unit tests
Replace context.TODO/background calls in targeted unit tests with
t.Context().

Signed-off-by: Tonis Tiigi <tonistiigi@gmail.com>
2026-02-25 16:41:54 -08:00
CrazyMax
9b68dbe71d simplify resolvconf path resolution
Signed-off-by: CrazyMax <1951866+crazy-max@users.noreply.github.com>
2025-07-23 09:26:32 +02:00
CrazyMax
05c55e56fd move resolvconf package to util
Signed-off-by: CrazyMax <1951866+crazy-max@users.noreply.github.com>
2025-07-23 09:26:31 +02:00
Sebastiaan van Stijn
db725345ce executor/oci: migrate to moby/profiles/seccomp module
The moby/profiles/seccomp module was extracted from the Moby repository
at commit [e1281f09fceec4aab518267c319a7bd4c79cf3c5][1].

[1]: e1281f09fc

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-07-22 18:14:12 +02:00
Sebastiaan van Stijn
4e1e0fe7f6 executor/oci: use buildkit bklog instead of containerd/log
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-07-21 15:11:16 +02:00
Sebastiaan van Stijn
2614833a2a executor/oci: resolvconf: use buildkit errdefs
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-07-21 15:08:40 +02:00
Sebastiaan van Stijn
ce4e767ffe executor/oci: resolvconf: remove unused code
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-07-21 15:08:40 +02:00
Sebastiaan van Stijn
b2d103fecf executor/oci: use fork of libnetwork/resolvconf
Rewrite the resolvconf code to use libnetwork's internal packege, which
allows us to skip some of the moby-specific handling (writing to a file,
creating a hash of the file to detect changes made by the user (not
supported by BuildKit, which always mounts read-only).

This rewrite also allows us to skip GetNameservers, GetSearchDomains, GetOptions,
and FilterResolvDNS, which repeatedly would parse the resolvconf file for
each of them.

The new code parses the original resolvconf once, after which mutations
(overrides) are done in memory, after which we generate the resolv.conf to
write to disk.

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-07-21 15:08:40 +02:00
Sebastiaan van Stijn
504b10d47b executor/oci: resolvconf: rewrite tests using testify
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-07-21 15:08:39 +02:00
Sebastiaan van Stijn
44a7014d69 executor/oci: add fork of moby resolvconf (does not compile)
Add a fork of github.com/docker/docker/daemon/libnetwork/internal/resolvconf,
taken at commit [254f64ded64027db0d2d1531a8ef9015de68e2f2]. I did not
preserve git history for this one (just a copy), but history can be found
in the Moby repository if needed.

[254f64ded64027db0d2d1531a8ef9015de68e2f2]: 254f64ded6

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2025-07-21 15:08:39 +02:00
Tonis Tiigi
9fcedf9807 update gopls to go1.24 compatible version
Signed-off-by: Tonis Tiigi <tonistiigi@gmail.com>
2025-05-07 18:23:20 -07:00
Jonathan A. Sternberg
66016a8c63 vendor: switch from idtools to moby/sys/user
Convert usages of `github.com/docker/docker/pkg/idtools` to
`github.com/moby/sys/user` in order to break the dependency between
buildkit and docker.

Signed-off-by: Jonathan A. Sternberg <jonathan.sternberg@docker.com>
2025-04-02 10:22:02 -05:00
Tonis Tiigi
b5286f8dcb apply x/tools/modernize fixes
Autogenerated with couple of manual patches.

Signed-off-by: Tonis Tiigi <tonistiigi@gmail.com>
2025-03-07 08:18:45 -08:00
Anthony Nandaa
877d8a771e feat: wcow: add support for bind and cache mounts
Currently, mounts are not supported for WCOW builds,
see #5678. This commit introduces support for
bind and cache mounts. The remaining two require
a little more work and consultation with the platform
teams for enlightment.

WIP Checklist:

- [x] Support for bind mounts
- [x] Support for cache mounts
- [x] add frontend/dockerfile integration tests
- [x] add client integration tests (not all, `llb.AddMount` not
  complete)

Fixes #5603

Signed-off-by: Anthony Nandaa <profnandaa@gmail.com>
2025-02-20 21:19:03 +03:00
CrazyMax
3c072dcffc cdi: support custom and wildcard class for injection
Signed-off-by: CrazyMax <1951866+crazy-max@users.noreply.github.com>
2025-02-11 16:38:23 +01:00
Tonis Tiigi
f61e01c14c llbsolver: on-demand CDI devices with automatic setup
Signed-off-by: Tonis Tiigi <tonistiigi@gmail.com>
2025-02-11 11:21:48 +01:00
CrazyMax
6667434ec4 cdi: support optional devices
Signed-off-by: CrazyMax <1951866+crazy-max@users.noreply.github.com>
2025-02-11 11:21:47 +01:00
CrazyMax
d69cc70521 cdi: use worker cdi manager when generating devices oci spec
Signed-off-by: CrazyMax <1951866+crazy-max@users.noreply.github.com>
2025-02-11 11:21:47 +01:00
Tonis Tiigi
3adcf53d1a enable CDI by default for buildkitd
Access should be managed by entitlements checks

Signed-off-by: Tonis Tiigi <tonistiigi@gmail.com>
2025-02-11 11:21:46 +01:00
CrazyMax
319bf56d8d exec: cdi device support
Signed-off-by: CrazyMax <1951866+crazy-max@users.noreply.github.com>
2025-02-11 11:21:44 +01:00
Marat Radchenko
5be7edb69c Upgrade to containerd 2
Co-authored-by: Derek McGowan <derek@mcg.dev>
Signed-off-by: Marat Radchenko <marat@slonopotamus.org>
2025-01-13 16:42:48 -08:00
Marat Radchenko
0a5a80cfec Remove pre-Go 1.17 build tags
Signed-off-by: Marat Radchenko <marat@slonopotamus.org>
2024-11-21 10:58:27 +03:00
MohammadHasan Akbari
41124702e0 fix: lint ci issue
Signed-off-by: MohammadHasan Akbari <jarqvi.jarqvi@gmail.com>
2024-10-02 09:12:27 +00:00
MohammadHasan Akbari
b4fd6b4f76 chore: return an error when AppArmor is unsupported and profile specifie
Signed-off-by: MohammadHasan Akbari <jarqvi.jarqvi@gmail.com>
2024-10-01 06:19:40 +00:00
Tõnis Tiigi
734a6cc656 Merge pull request #5276 from slonopotamus/darwin
Add stub implementations to make buildkitd buildable for Darwin
2024-09-16 14:25:57 -07:00
Marat Radchenko
64f4631d8b Add stub implementations to make buildkitd build for Darwin
Signed-off-by: Marat Radchenko <marat@slonopotamus.org>
2024-09-16 12:18:36 +03:00
CrazyMax
d09677c568 Merge pull request #5207 from Ka0o0/fix-resolvd-host-network
fix: check network mode when choosing resolv.conf
2024-09-02 09:16:59 +02:00
Kai Takac
fa157f452d In host networking mode, unconditionally use "/etc/resolv.conf"
Signed-off-by: Kai Takac <kai.takac@gmail.com>
2024-08-12 09:01:37 +02:00
thompson-shaun
b9992472a4 Merge pull request #5179 from tonistiigi/executor-err-upt
executor error improvements
2024-08-09 11:27:35 -04:00
Sebastiaan van Stijn
b4a189390e migrate to github.com/moby/sys/userns
Commit 4b85f11164 migrated the use of the
userns package to the github.com/moby/sys/user module.

After further discussion with maintainers, it was decided to move the
userns package to a separate module, as it has no direct relation with
"user" operations (other than having "user" in its name).

This patch migrates our code to use the new module.

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2024-08-08 12:36:57 +02:00
Sebastiaan van Stijn
86b550e427 migrate to github.com/moby/sys/user/userns
The userns package in libcontainer was integrated into the moby/sys/user
module at commit [3778ae603c706494fd1e2c2faf83b406e38d687d][1].

The userns package is used in many places, and currently either depends
on runc/libcontainer, or on containerd, both of which have a complex
dependency tree. This patch is part of a series of patches to unify the
implementations, and to migrate toward that implementation to simplify
the dependency tree.

[1]: 3778ae603c

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2024-07-25 14:11:04 +02:00
Tonis Tiigi
2f8ab30774 executor: rebase the path of submount error
Signed-off-by: Tonis Tiigi <tonistiigi@gmail.com>
2024-07-22 12:34:31 -07:00
Tonis Tiigi
a7720ed2b1 executor: ensure deeper stacktraces for system errors
Signed-off-by: Tonis Tiigi <tonistiigi@gmail.com>
2024-07-22 12:34:31 -07:00
Tonis Tiigi
03c7a6d769 lint: fix some testifylint warnings
This does not cover all warning yet but split
into chunks to ease review.

Signed-off-by: Tonis Tiigi <tonistiigi@gmail.com>
2024-05-30 11:32:55 -07:00
Tonis Tiigi
265d18f2e6 lint: enable gocritic
Signed-off-by: Tonis Tiigi <tonistiigi@gmail.com>
2024-05-15 16:44:38 -07:00
Akihiro Suda
5a19fb4759 Merge pull request #4829 from tonistiigi/gopls-linters
add extra linters from gopls
2024-04-12 06:25:34 +09:00
Tonis Tiigi
8665364c6c lint: unusedparams fixes for freebsd
Signed-off-by: Tonis Tiigi <tonistiigi@gmail.com>
2024-04-09 07:23:16 -07:00
Tonis Tiigi
a07a92e157 lint: unusedparams fixes for windows
Signed-off-by: Tonis Tiigi <tonistiigi@gmail.com>
2024-04-09 07:23:16 -07:00
Sebastiaan van Stijn
137269cb78 vendor: github.com/docker/docker v26.0.0
full diff: https://github.com/docker/docker/compare/v26.0.0-rc1...v26.0.0

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2024-04-09 13:13:44 +02:00
Tonis Tiigi
1510288571 oci: fix missing release call
Signed-off-by: Tonis Tiigi <tonistiigi@gmail.com>
2024-04-01 16:16:17 -07:00
Tonis Tiigi
2c9d934e5d executor: fix overlay layer limit for non-rootfs mounts
Historic layer limit for Docker images is 127. Because in
overlayfs mounting 127 layers usually reaches the page size
limit of mount options in Linux kernel, there is special code
to work around the limitation.

This custom code was used for rootfs of container because
runc takes rootfs as a directory path, meaning buildkit needs
to mount it and then pass the path. For non-rootfs mounts
runc takes them as direct mount configuration and performs
the mount itself. As runc does not have this special way to
mount long overlayfs mounts it will perform the mount with clipped
options what will fail in some way in kernel depending on the
precise cutoff point.

Workaround is to detect when the mount passed to runc is too
long for runc to mount it itself and it that case let
BuildKit mount it and in runc perform bind of the BuildKit mount.

Signed-off-by: Tonis Tiigi <tonistiigi@gmail.com>
2024-03-31 17:34:04 -07:00
Tonis Tiigi
33b347a8fb oci: make mounting oci socket optional
The source path changed in v0.13 and there are reports
that new path can cause error on starting a container. While
this is investigated, check for missing path and make
mounting optional like it was in v0.12.

Signed-off-by: Tonis Tiigi <tonistiigi@gmail.com>
2024-03-18 11:12:52 -07:00
CrazyMax
b5506327cf keep local dns in resolv.conf when host network enabled
Signed-off-by: CrazyMax <1951866+crazy-max@users.noreply.github.com>
2024-02-09 09:27:39 +01:00
Tonis Tiigi
c82ace1296 exec: add extra validation for submount sources
While submount paths were already validated there are some
cases where the parent mount may not be immutable while the
submount is created.

Signed-off-by: Tonis Tiigi <tonistiigi@gmail.com>
(cherry picked from commit 2529ec4121bcd8c35bcd96218083da175c2e5b77)
2024-01-31 12:39:48 -08:00
Tonis Tiigi
42d866ef3b oci: fix error handling on submount calls
Signed-off-by: Tonis Tiigi <tonistiigi@gmail.com>
2024-01-24 15:05:14 -08:00
Justin Chadwell
4dcbc22d31 chore: move linux-specific oci spec to spec_linux.go
These functions are unused on windows and so cause linting issues.

Signed-off-by: Justin Chadwell <me@jedevc.com>
2023-11-02 10:45:34 +00:00