summaryrefslogtreecommitdiff
path: root/builder
Commit message (Collapse)AuthorAgeFilesLines
* Merge pull request #45473 from zhangguanzhang/master-commentStrAkihiro Suda2023-05-121-1/+1
|\ | | | | [builder] make chownComment easy to read
| * make chownComment easy to readzhangguanzhang2023-05-051-1/+1
| | | | | | | | Signed-off-by: zhangguanzhang <zhangguanzhang@qq.com>
* | c8d: implement classic builderLaura Brehm2023-05-114-6/+23
| | | | | | | | | | Co-authored-by: Djordje Lukic <djordje.lukic@docker.com> Signed-off-by: Laura Brehm <laurabrehm@hey.com>
* | Merge pull request #45304 from crazy-max/buildkit-version-buildinfoBrian Goff2023-05-101-1/+4
|\ \ | | | | | | Set BuildKit version using buildinfo
| * | Set BuildKit version using buildinfoCrazyMax2023-04-251-1/+4
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This sets BuildKit version from the build information embedded in running binary so we are aligned with the expected vendoring. We iterate over all dependencies and find the BuildKit one and set the right version. We also check if the module is replaced and use it this case. There is also additional checks if a pseudo version is detected. See comments in code for more info. Signed-off-by: CrazyMax <crazy-max@users.noreply.github.com>
* | | Merge pull request #45507 from corhere/cleanup-reexec-initsSebastiaan van Stijn2023-05-102-4/+10
|\ \ \ | | | | | | | | [chore] clean up reexec.Init() calls
| * | | [chore] clean up reexec.Init() callsCory Snider2023-05-092-4/+10
| | |/ | |/| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Now that most uses of reexec have been replaced with non-reexec solutions, most of the reexec.Init() calls peppered throughout the test suites are unnecessary. Furthermore, most of the reexec.Init() calls in test code neglects to check the return value to determine whether to exit, which would result in the reexec'ed subprocesses proceeding to run the tests, which would reexec another subprocess which would proceed to run the tests, recursively. (That would explain why every reexec callback used to unconditionally call os.Exit() instead of returning...) Remove unneeded reexec.Init() calls from test and example code which no longer needs it, and fix the reexec.Init() calls which are not inert to exit after a reexec callback is invoked. Signed-off-by: Cory Snider <csnider@mirantis.com>
* | | fixing consistent aliases for OCI spec importsJeyanthinath Muthuram2023-05-086-22/+22
|/ / | | | | | | Signed-off-by: Jeyanthinath Muthuram <jeyanthinath10@gmail.com>
* | Use the image service instead of the reference store for taggingDjordje Lukic2023-04-263-13/+18
| | | | | | | | | | | | | | | | The image store sends events when a new image is created/tagged, using it instead of the reference store makes sure we send the "tag" event when a new image is built using buildx. Signed-off-by: Djordje Lukic <djordje.lukic@docker.com>
* | Merge pull request #45294 from vvoland/builder-fix-prune-timestampSebastiaan van Stijn2023-04-251-3/+19
|\ \ | |/ |/| builder-next/prune: Handle `until` filter timestamps
| * builder: use typed error for invalid "until" valuePaweł Gronowski2023-04-211-2/+12
| | | | | | | | Signed-off-by: Paweł Gronowski <pawel.gronowski@docker.com>
| * builder-next/prune: Handle "until" filter timestampsPaweł Gronowski2023-04-201-3/+9
| | | | | | | | | | | | | | | | | | | | | | Fixes `docker system prune --filter until=<timestamp>`. `docker system prune` claims to support "until" filter for timestamps, but it doesn't work because builder "until" filter only supports duration. Use the same filter parsing logic and then convert the timestamp to a relative "keep-duration" supported by buildkit. Signed-off-by: Paweł Gronowski <pawel.gronowski@docker.com>
* | vendor: update buildkit to v0.11.6Tonis Tiigi2023-04-201-1/+1
|/ | | | Signed-off-by: Tonis Tiigi <tonistiigi@gmail.com>
* builder-next: fix buildkit versionSebastiaan van Stijn2023-04-141-1/+1
| | | | | | | Update the version manually (we don't have automation for this yet), and add a comment to vendor.mod to help users remind to update it. Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
* use consistent alias for containerd's errdefs packageSebastiaan van Stijn2023-04-082-5/+5
| | | | | | | | | | The signatures of functions in containerd's errdefs packages are very similar to those in our own, and it's easy to accidentally use the wrong package. This patch uses a consistent alias for all occurrences of this import. Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
* builder-next: disable mergeop and diffopTonis Tiigi2023-03-161-0/+15
| | | | | Signed-off-by: Tonis Tiigi <tonistiigi@gmail.com> Signed-off-by: Bjorn Neergaard <bneergaard@mirantis.com>
* c8d/builder: Store untagged images as danglingPaweł Gronowski2023-03-081-2/+6
| | | | | | | | Set `dangling-name-prefix` exporter attribute to `moby-dangling` which makes it create an containerd image even when user didn't provide any name for the new image. Signed-off-by: Paweł Gronowski <pawel.gronowski@docker.com>
* builder/overrides: Add consts for attribute key namesPaweł Gronowski2023-03-081-3/+10
| | | | Signed-off-by: Paweł Gronowski <pawel.gronowski@docker.com>
* builder-next: enable more cache backendsTonis Tiigi2023-03-071-2/+8
| | | | | | Signed-off-by: Tonis Tiigi <tonistiigi@gmail.com> Co-authored-by: Sebastiaan van Stijn <github@gone.nl> Signed-off-by: Paweł Gronowski <pawel.gronowski@docker.com>
* c8d: Make build and buildx workDjordje Lukic2023-03-079-35/+262
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | - Only use the image exporter in build if we don't use containerd Without this "docker build" fails with: Error response from daemon: exporter "image" could not be found - let buildx know we support containerd snapshotter - Pass the current snapshotter to the buildkit worker If buildkit uses a different snapshotter we can't list the images any more because we can't find the snapshot. builder/builder-next: make ContainerdWorker a minimal wrapper Note that this makes "Worker" a public field, so technically one could overwrite it. builder-next: reenable runc executor Currently, without special CNI config the builder would only create host network containers that is a security issue. Using runc directly instead of shim is faster as well as builder doesn’t need anything from shim. The overhead of setting up network sandbox is much slower of course. builder/builder-next: simplify options handling Trying to simplify the logic; - Use an early return if multiple outputs are provided - Only construct the list of tags if we're using an image (or moby) exporter - Combine some logic for snapshotter and non-snapshotter handling Create a constant for the moby exporter Pass a context when creating a router The context has a 10 seconds timeout which should be more than enough to get the answer from containerd. Signed-off-by: Djordje Lukic <djordje.lukic@docker.com> Co-authored-by: Sebastiaan van Stijn <github@gone.nl> Co-authored-by: Tonis Tiigi <tonistiigi@gmail.com> Co-authored-by: Nicolas De Loof <nicolas.deloof@gmail.com> Co-authored-by: Paweł Gronowski <pawel.gronowski@docker.com> Signed-off-by: Paweł Gronowski <pawel.gronowski@docker.com>
* builder/exporter: Remove commented unused constPaweł Gronowski2023-03-031-4/+0
| | | | Signed-off-by: Paweł Gronowski <pawel.gronowski@docker.com>
* builder: Remove buildkit's build informationPaweł Gronowski2023-03-022-49/+5
| | | | | | | Buildkit deprecated build information in v0.11 and will remove it in v0.12. It's suggested to use provenance attestations instead. Signed-off-by: Paweł Gronowski <pawel.gronowski@docker.com>
* builder: define GetRemotes for the workerTonis Tiigi2023-02-071-5/+12
| | | | | | The function signature has changed since v0.10. Signed-off-by: Tonis Tiigi <tonistiigi@gmail.com>
* vendor: update buildkit to v0.11.2Tonis Tiigi2023-02-014-24/+76
| | | | Signed-off-by: Tonis Tiigi <tonistiigi@gmail.com>
* Merge pull request #44818 from vvoland/c8d-commit-ctx-upstreamSebastiaan van Stijn2023-01-184-7/+7
|\ | | | | images: Pass context to commit related operations
| * images: Pass context to commit related operationsNicolas De Loof2023-01-184-7/+7
| | | | | | | | Signed-off-by: Paweł Gronowski <pawel.gronowski@docker.com>
* | libnetwork: return concrete-typed *EndpointCory Snider2023-01-131-1/+1
| | | | | | | | | | | | | | | | libnetwork.Endpoint is an interface with a single implementation. https://github.com/golang/go/wiki/CodeReviewComments#interfaces Signed-off-by: Cory Snider <csnider@mirantis.com>
* | libnetwork: return concrete-typed *SandboxCory Snider2023-01-131-1/+1
| | | | | | | | | | | | | | | | | | | | Basically every exported method which takes a libnetwork.Sandbox argument asserts that the value's concrete type is *sandbox. Passing any other implementation of the interface is a runtime error! This interface is a footgun, and clearly not necessary. Export and use the concrete type instead. Signed-off-by: Cory Snider <csnider@mirantis.com>
* | libnetwork: return concrete-typed *ControllerCory Snider2023-01-133-8/+8
|/ | | | | | | | | libnetwork.NetworkController is an interface with a single implementation. https://github.com/golang/go/wiki/CodeReviewComments#interfaces Signed-off-by: Cory Snider <csnider@mirantis.com>
* builder/dockerfile: use example.com for testsSebastiaan van Stijn2023-01-101-1/+1
| | | | | | | | Trying to remove the "docker.io" domain from locations where it's not relevant. In these cases, this domain was used as a "random" domain for testing or example purposes. Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
* builder/dockerfile: use strings.Cut()Sebastiaan van Stijn2022-12-211-5/+4
| | | | Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
* builder/remotecontext/git: use strings.Cut()Sebastiaan van Stijn2022-12-211-15/+6
| | | | Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
* pkg/ioutils: TempDir: move to pkg/longpathSebastiaan van Stijn2022-12-203-6/+6
| | | | | | | | | | | | | | | This utility wasn't very related to all other utilities in pkg/ioutils. Moving it to longpath to also make it more clear what it does. It looks like there's only a single (public) external consumer of this utility, and only used in a test, and it's not 100% clear if it was intentional to use our package, of if it was a case of "I actually meant `io/ioutil.MkdirTemp`" so we could consider skipping the alias. While moving the package, I also renamed `TempDir` to `MkdirTemp`, which is the signature it matches in "os" from stdlib. Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
* Merge pull request #44275 from thaJeztah/move_pkg_system_funcsSebastiaan van Stijn2022-12-162-3/+6
|\ | | | | pkg/system: move some functions to a new home
| * pkg/system: deprecate DefaultPathEnv, move to ociSebastiaan van Stijn2022-11-292-3/+6
| | | | | | | | | | | | | | | | | | | | This patch: - Deprecates pkg/system.DefaultPathEnv - Moves the implementation inside oci - Adds TODOs to align the default in the Builder with the one used elsewhere Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
* | builder: handle host-gateway with extra hostsCrazyMax2022-12-021-6/+19
|/ | | | Signed-off-by: CrazyMax <crazy-max@users.noreply.github.com>
* Merge pull request #44432 from thaJeztah/no_execabsSebastiaan van Stijn2022-11-111-1/+1
|\ | | | | switch back from golang.org/x/sys/execabs to os/exec
| * builder/remotecontext/gitutils: switch back to os/execSebastiaan van Stijn2022-11-091-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This is a partial revert of 7ca0cb7ffafc5339ac5fa575ce3f8b479c3643bf, which switched from os/exec to the golang.org/x/sys/execabs package to mitigate security issues (mainly on Windows) with lookups resolving to binaries in the current directory. from the go1.19 release notes https://go.dev/doc/go1.19#os-exec-path > ## PATH lookups > > Command and LookPath no longer allow results from a PATH search to be found > relative to the current directory. This removes a common source of security > problems but may also break existing programs that depend on using, say, > exec.Command("prog") to run a binary named prog (or, on Windows, prog.exe) in > the current directory. See the os/exec package documentation for information > about how best to update such programs. > > On Windows, Command and LookPath now respect the NoDefaultCurrentDirectoryInExePath > environment variable, making it possible to disable the default implicit search > of “.” in PATH lookups on Windows systems. Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
* | Remove uses of deprecated go-digest.NewDigestFromHex, go-digest.Digest.HexSebastiaan van Stijn2022-11-081-1/+1
|/ | | | | | | | | | Both of these were deprecated in https://github.com/opencontainers/go-digest/commit/55f675811a1b915549933c64571fd86b2676ba76, but the format of the GoDoc comments didn't follow the correct format, which caused them not being picked up by tools as "deprecated". This patch updates uses in the codebase to use the alternatives. Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
* builder: Don't store context in structPaweł Gronowski2022-11-037-27/+27
| | | | Signed-off-by: Paweł Gronowski <pawel.gronowski@docker.com>
* imageservice: Add context to various methodsNicolas De Loof2022-11-0313-165/+208
| | | | | Co-authored-by: Paweł Gronowski <pawel.gronowski@docker.com> Signed-off-by: Paweł Gronowski <pawel.gronowski@docker.com>
* builder/remotecontext/git: allow building on go1.18Sebastiaan van Stijn2022-10-211-1/+1
| | | | | | | | | cmd.Environ() is new in go1.19, and not needed for this specific case. Without this, trying to use this package in code that uses go1.18 will fail; builder/remotecontext/git/gitutils.go:216:23: cmd.Environ undefined (type *exec.Cmd has no field or method Environ) Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
* Merge pull request #44273 from thaJeztah/use_walkdirSebastiaan van Stijn2022-10-213-4/+4
|\ | | | | use filepath.WalkDir instead of filepath.Walk
| * builder: use filepath.WalkDir instead of filepath.WalkSebastiaan van Stijn2022-10-093-4/+4
| | | | | | | | | | | | | | WalkDir is more performant as it doesn't perform an os.Lstat on every visited file or directory. Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
* | builder: add missing doc commentCory Snider2022-10-201-0/+1
| | | | | | | | Signed-off-by: Cory Snider <csnider@mirantis.com>
* | builder: fix running git commands on WindowsCory Snider2022-10-201-1/+1
| | | | | | | | | | | | | | | | | | | | | | Setting cmd.Env overrides the default of passing through the parent process' environment, which works out fine most of the time, except when it doesn't. For whatever reason, leaving out all the environment causes git-for-windows sh.exe subprocesses to enter an infinite loop of access violations during Cygwin initialization in certain environments (specifically, our very own dev container image). Signed-off-by: Cory Snider <csnider@mirantis.com>
* | builder: make git config isolation opt-inCory Snider2022-10-203-40/+61
| | | | | | | | | | | | | | | | While it is undesirable for the system or user git config to be used when the daemon clones a Git repo, it could break workflows if it was unconditionally applied to docker/cli as well. Signed-off-by: Cory Snider <csnider@mirantis.com>
* | builder: isolate git from local systemCory Snider2022-10-202-2/+55
| | | | | | | | | | | | | | Prevent git commands we run from reading the user or system configuration, or cloning submodules from the local filesystem. Signed-off-by: Cory Snider <csnider@mirantis.com>
* | builder: explicitly set CWD for all git commandsCory Snider2022-10-202-14/+7
| | | | | | | | | | | | | | | | Keep It Simple! Set the working directory for git commands by...setting the git process's working directory. Git commands can be run in the parent process's working directory by passing the empty string. Signed-off-by: Cory Snider <csnider@mirantis.com>
* | builder: modernize TestCheckoutGitCory Snider2022-10-201-87/+56
|/ | | | | | | Make the test more debuggable by logging all git command output and running each table-driven test case as a subtest. Signed-off-by: Cory Snider <csnider@mirantis.com>