Commit Graph

203 Commits (master)

Author SHA1 Message Date
CrazyMax 9f821dabeb
Merge pull request #1548 from crazy-max/git-ls-remote
build: set remote origin url
2 years ago
Kohei Tokunaga a27b8395b1 Enable to run build and invoke in background
Signed-off-by: Kohei Tokunaga <ktokunaga.mail@gmail.com>
2 years ago
Tõnis Tiigi b1b4e64c97
Merge pull request #1504 from jedevc/fix-1497
Refactor BuildWithResultHandler to simplify concurrency usage
2 years ago
CrazyMax c1058c17aa
build: set remote origin url
Signed-off-by: CrazyMax <crazy-max@users.noreply.github.com>
2 years ago
Tonis Tiigi be55b41427
build: mark capabilities request as internal
So it doesn't show up in the History API.

Signed-off-by: Tonis Tiigi <tonistiigi@gmail.com>
2 years ago
Justin Chadwell 43a748fd15 build: error when using docker exporter and attestations
Signed-off-by: Justin Chadwell <me@jedevc.com>
2 years ago
Justin Chadwell 15a80b56b5 build: avoid compatability error when attestations disabled
We should avoid erroring with attestations support compatability errors
when a user has specified --provenance=false.

A user may wish to enable --provenance=false that works across buildkit
versions, but currently it will fail on old versions - this patch fixes
this, to silently ignore the provenance flag for this check if it's set
to disabled.

Signed-off-by: Justin Chadwell <me@jedevc.com>
2 years ago
Justin Chadwell 8b7aa1a168 build: create error group per opt
Using the syncronization primitive, we can avoid needing to create a
separate wait group.

This allows us to sidestep the issue where the wait group could be
completed, but the build invocation functions had not terminated - if
one of the functions was to terminate with an error, then it was
possible to encounter a race condition, where the result handling code
would begin executing, despite an error.

The refactor to use a separate error group which more elegantly handles
the concept of function returns and errors, ensures that we can't
encounter this issue.

Signed-off-by: Justin Chadwell <me@jedevc.com>
2 years ago
Justin Chadwell 1180d919f5 build: reorder error group funcs
Signed-off-by: Justin Chadwell <me@jedevc.com>
2 years ago
Justin Chadwell 347417ee12 build: use copy for BuildWithResultHandler loop vars
Signed-off-by: Justin Chadwell <me@jedevc.com>
2 years ago
Justin Chadwell 60c9cf74ce
vendor: update buildkit to v0.11.0-rc4
Signed-off-by: Tonis Tiigi <tonistiigi@gmail.com>
Signed-off-by: Justin Chadwell <me@jedevc.com>
2 years ago
Tõnis Tiigi ff6754eb04
Merge pull request #1456 from jedevc/oci-layout-reference-parsing
build: refactor reference parsing for oci image layouts
2 years ago
Akihiro Suda 0e6f5a155e
Propagate SOURCE_DATE_EPOCH from the client env
Signed-off-by: Akihiro Suda <akihiro.suda.cz@hco.ntt.co.jp>
2 years ago
Justin Chadwell e584c6e1a7 build: check error from toSolveOpt before adding FrontendAttrs
Signed-off-by: Justin Chadwell <me@jedevc.com>
2 years ago
Tõnis Tiigi 64e4c19971
Merge pull request #1477 from crazy-max/git-wsl
build: lookup the right git binary on WSL
2 years ago
Tonis Tiigi 551b8f6785
git: do not show warnings if project does not use git
Signed-off-by: Tonis Tiigi <tonistiigi@gmail.com>
2 years ago
CrazyMax 0d1fea8134
build: warn if git operation fails
Signed-off-by: CrazyMax <crazy-max@users.noreply.github.com>
2 years ago
CrazyMax 19417e76e7
build: lookup the right git binary on WSL
Signed-off-by: CrazyMax <crazy-max@users.noreply.github.com>
2 years ago
Justin Chadwell a8f689c223 build: forward all build opts everywhere
All build options should be passed everywhere - the frontend and the
backend of buildkit should both be able to see all attestations, as well
as all other opts: e.g. epoch settings, and no-cache.

Signed-off-by: Justin Chadwell <me@jedevc.com>
2 years ago
Justin Chadwell 70682b043e build: refactor reference parsing for image layouts
We allow any valid image reference format for the oci-layout, not just
limiting to name@digest, we additionally allow images of the form
name:tag@digest now.

The name of the reference is used to find the local directory to lookup
the store in, while the tag and digest are attached to a random identity
to generate the dummy reference sent to the oci-layout context.

This separation of the target to replace and the value to replace it
with ensures that any tag or digest set in the client is properly sent
across to the server. The tag is used when a digest was not specified,
and it is resolved in the context of the local directory before being
sent, using the same helpers as we use for the local cache expoter.

Signed-off-by: Justin Chadwell <me@jedevc.com>
2 years ago
CrazyMax cf8fa4a404
build: fix env vars check for vcs details
Signed-off-by: CrazyMax <crazy-max@users.noreply.github.com>
2 years ago
CrazyMax 6ad5e2fcf3
build: set provenance vcs details
Signed-off-by: CrazyMax <crazy-max@users.noreply.github.com>
2 years ago
Tõnis Tiigi abc8121aa8
Merge pull request #1457 from jedevc/add-hosts-length-check
build: don't set add-hosts option if empty
2 years ago
Justin Chadwell 98049e7eda build: don't set add-hosts option if empty
This looks like an oversight, all of the other options have similar
checks. This can interfere with generated provenance where "add-hosts"
will be marked as an argument to the build, even though it's not
actually being utilized.

Signed-off-by: Justin Chadwell <me@jedevc.com>
2 years ago
Justin Chadwell f0262dd10e build: add attestations to build options
Signed-off-by: Justin Chadwell <me@jedevc.com>
2 years ago
Justin Chadwell f8b673eccd build: pass attestation attributes to build request
Signed-off-by: Justin Chadwell <me@jedevc.com>
2 years ago
CrazyMax e7b5ee7518
mutualize builder logic
Signed-off-by: CrazyMax <crazy-max@users.noreply.github.com>
2 years ago
CrazyMax 63073b65c0
dockerutil pkg to manage docker api client and context
Signed-off-by: CrazyMax <crazy-max@users.noreply.github.com>
2 years ago
CrazyMax 49d46e71de
build: skip "host-gateway" validation with moby driver
Signed-off-by: CrazyMax <crazy-max@users.noreply.github.com>
2 years ago
Tõnis Tiigi ac85f590ba
Merge pull request #1324 from jedevc/invoke-defaults
invoke: load defaults from image config
2 years ago
CrazyMax 398da1f916
Merge pull request #1343 from dgageot/fix-1342
[1342] Fix assignment to nil map
2 years ago
David Gageot 8fd34669ed
Fix assignment to nil map
Signed-off-by: David Gageot <david.gageot@docker.com>
2 years ago
David Gageot be7e91899b
Support empty env var when it can't be unset
Signed-off-by: David Gageot <david.gageot@docker.com>
2 years ago
Justin Chadwell 966c4d4e14 invoke: load defaults from image config
If user does not specify image certain container parameters, we can load
them from the exporter metadata.

Additionally, we introduce a new "default" value for the --invoke flag,
that keeps all of the default parameters (since cobra does not have an
easy way of accepting an optional flag argument).

Signed-off-by: Justin Chadwell <me@jedevc.com>
2 years ago
CrazyMax 25ceb90678
Merge pull request #1294 from crazy-max/s3-cache
s3 cache client-side support
2 years ago
Christian Dupuis e3c91c9d29
Add git provenance labels
as per #1290

Signed-off-by: Christian Dupuis <cd@atomist.com>
2 years ago
CrazyMax 57d22a7bd1
s3 cache client-side support
Signed-off-by: CrazyMax <crazy-max@users.noreply.github.com>
2 years ago
Tonis Tiigi 18dbde9ed6 build: update outline fallback image
Signed-off-by: Tonis Tiigi <tonistiigi@gmail.com>
2 years ago
Tõnis Tiigi da1f4b8496
Merge pull request #1100 from tonistiigi/print-outline
Build: Support for printing outline/targets of the current build
2 years ago
Tonis Tiigi c834ba1389 add formatting support to print function
Signed-off-by: Tonis Tiigi <tonistiigi@gmail.com>
2 years ago
Tonis Tiigi cab437adef build: add fallback to outline requests if not supported by frontend
Signed-off-by: Tonis Tiigi <tonistiigi@gmail.com>
2 years ago
Tonis Tiigi eefa8188e1 build: add experimental support for print flag
Print flag can be used to make additional information
requests about the build and print their results.

Currently Dockerfile supports: outline, targets, subrequests.describe

Signed-off-by: Tonis Tiigi <tonistiigi@gmail.com>
2 years ago
Tonis Tiigi 75ddc5b811 build: fix issues with leaving invoke containers running
Signed-off-by: Tonis Tiigi <tonistiigi@gmail.com>
2 years ago
Kohei Tokunaga 2f9d46ce27 invoke: add messages
Signed-off-by: Kohei Tokunaga <ktokunaga.mail@gmail.com>
2 years ago
Tõnis Tiigi 1f6612b118
Merge pull request #1137 from jedevc/imagetools-multiple-repositories
Imagetools multiple repositories
2 years ago
Justin Chadwell d3412f1039 imagetools: refactor combining repository logic
This patch modifies the existing combining code in imagetools create to
provide better support for multiple repositories down the road.
Specifically, the code should no longer rely on a single repository
being used for all sources and tags, and should resolve descriptors in
their relevant repositories.

Signed-off-by: Justin Chadwell <me@jedevc.com>
2 years ago
Tõnis Tiigi 766653f7a6
Merge pull request #994 from corhere/local-dockerfile-remote-context
build: allow external Dockerfile on remote context
2 years ago
CrazyMax b0deb8bdd7
vendor: update docker/cli to f1615fa
also needs to update docker/docker to a60b458 (22.06 branch) otherwise
build breaks since docker/cli#3512 with:

    # github.com/docker/cli/cli/flags
    vendor/github.com/docker/cli/cli/flags/common.go:40:37: undefined: client.EnvOverrideCertPath
    vendor/github.com/docker/cli/cli/flags/common.go:41:37: undefined: client.EnvTLSVerify
    vendor/github.com/docker/cli/cli/flags/common.go:89:76: undefined: client.EnvOverrideHost

needs also to update github.com/spf13/cobra to v1.5.0 otherwise
build breaks with:

    # github.com/docker/cli/cli-plugins/plugin
    vendor/github.com/docker/cli/cli-plugins/plugin/plugin.go:130:4: unknown field 'HiddenDefaultCmd' in struct literal of type cobra.CompletionOptions

Signed-off-by: CrazyMax <crazy-max@users.noreply.github.com>
3 years ago
Avi Deitcher 02bae945c3 add support for oci-layout build-context
Signed-off-by: Avi Deitcher <avi@deitcher.net>
3 years ago
Kohei Tokunaga 387e1ecca6 Add `--invoke` option to launch a container from the build result
Signed-off-by: Kohei Tokunaga <ktokunaga.mail@gmail.com>
3 years ago
CrazyMax 1cb1ee018b
build: enhance warning message when no output specified
Signed-off-by: CrazyMax <crazy-max@users.noreply.github.com>
3 years ago
Justin Chadwell 48067735fc Update golint to revive
Resolves the following message in golangci output:

> The linter 'golint' is deprecated (since v1.41.0) due to: The
repository of the linter has been archived by the owner.  Replaced by
revive.

Additionally, fix a minor linting issue discovered by revive.

Signed-off-by: Justin Chadwell <me@jedevc.com>
3 years ago
Cory Snider ca3507656d build: allow external Dockerfile on remote context
BuildKit has supported external Dockerfile on remote contexts since
v0.5.0, included in Moby v19.03.0. The client side was the only missing
piece.

Signed-off-by: Cory Snider <csnider@mirantis.com>
3 years ago
Sebastiaan van Stijn fc7ba75fd7
Remove uses of deprecated io/ioutil
The package has been deprecated since Go 1.16: https://go.dev/doc/go1.16#ioutil

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
3 years ago
CrazyMax 19ff7cdadc
build: set remote digest when pushed with docker driver
Signed-off-by: CrazyMax <crazy-max@users.noreply.github.com>
3 years ago
Tõnis Tiigi 8079bd2841
Merge pull request #980 from crazy-max/imageid
build: return imageID when loading without docker driver
3 years ago
CrazyMax 2d5368cccc
Merge pull request #981 from tonistiigi/target-context-remove
build: remove target context if platform specific used
3 years ago
CrazyMax e7863eb664
build: return imageID when loading without docker driver
Signed-off-by: CrazyMax <crazy-max@users.noreply.github.com>
3 years ago
Tonis Tiigi 171c4375a1 build: fix multi-node builds with mixed platforms
Signed-off-by: Tonis Tiigi <tonistiigi@gmail.com>
3 years ago
Tonis Tiigi 45844805ec build: remove target context if platform specific used
Signed-off-by: Tonis Tiigi <tonistiigi@gmail.com>
3 years ago
Tonis Tiigi 280c008f81 bake: make named contexts relative to remote bake input
Signed-off-by: Tonis Tiigi <tonistiigi@gmail.com>
3 years ago
Tõnis Tiigi 10debb577e
Merge pull request #959 from tonistiigi/docker-proxy-config
set build-args from docker proxy configuration
3 years ago
CrazyMax 75cdea48e4
Merge pull request #962 from tonistiigi/bake-deps-error
build: fix deadlock on handling deps errors
3 years ago
Tõnis Tiigi e871c39f05
Merge pull request #908 from crazy-max/inline-buildattrs
build: inline buildinfo attrs
3 years ago
Tonis Tiigi 3b2aeb2d5b build: fix deadlock on handling deps errors
Signed-off-by: Tonis Tiigi <tonistiigi@gmail.com>
3 years ago
Tonis Tiigi e98a476dc8 set build-args from docker proxy configuration
For backward compatibility with docker build.

Signed-off-by: Tonis Tiigi <tonistiigi@gmail.com>
3 years ago
CrazyMax 7677052cb7
build: send buildinfo dependencies
Signed-off-by: CrazyMax <crazy-max@users.noreply.github.com>
3 years ago
Tonis Tiigi 3b47722032 build: add no-cache-filter
Signed-off-by: Tonis Tiigi <tonistiigi@gmail.com>
3 years ago
Tonis Tiigi fa04611afc bake: connect results between build targets
Build context “target:<name>” will take the contents
from another bake target.

Signed-off-by: Tonis Tiigi <tonistiigi@gmail.com>
3 years ago
CrazyMax 24db7366ba
build: inline buildinfo attrs
Signed-off-by: CrazyMax <crazy-max@users.noreply.github.com>
3 years ago
Tonis Tiigi d77e2453da commands: rename context flag to build-context
Avoid conflicts with docker context

Signed-off-by: Tonis Tiigi <tonistiigi@gmail.com>
3 years ago
Tonis Tiigi de6b04d726 build: add support for named contexts
Signed-off-by: Tonis Tiigi <tonistiigi@gmail.com>
3 years ago
Tonis Tiigi 1cca41b81a build: support insecure export option for multi-node build
Signed-off-by: Tonis Tiigi <tonistiigi@gmail.com>
3 years ago
Tonis Tiigi 88d0775692 refactor accessing registry configs via drivers
Signed-off-by: Tonis Tiigi <tonistiigi@gmail.com>
3 years ago
Tõnis Tiigi 8afc82b427
Merge pull request #817 from tonistiigi/project-sharedkey
build: set local sharedkey per project basename
3 years ago
Tonis Tiigi 02d29e0af5 build: fix setting iidfile with multi-node push
Signed-off-by: Tonis Tiigi <tonistiigi@gmail.com>
3 years ago
Tonis Tiigi aa52a5a699 build: set local sharedkey per project basename
Signed-off-by: Tonis Tiigi <tonistiigi@gmail.com>
3 years ago
CrazyMax dd15969c93
build: add cgroup-parent support
Signed-off-by: CrazyMax <crazy-max@users.noreply.github.com>
3 years ago
CrazyMax 2890209a11
refactor: lexical order for build opts
Signed-off-by: CrazyMax <crazy-max@users.noreply.github.com>
3 years ago
CrazyMax 25d2f73858
build: warning on deprecated flags
Signed-off-by: CrazyMax <crazy-max@users.noreply.github.com>
3 years ago
Brian Goff b6474d43a9 Mark span status as error when fatal error occurs.
Before this only recorded errors instead of setting the span status,
which makes it harder to dig through.
Now an error that bubbles is reflected in the span status.

Signed-off-by: Brian Goff <cpuguy83@gmail.com>
3 years ago
CrazyMax 8e5595b7c7
build: add shm-size support
Signed-off-by: CrazyMax <crazy-max@users.noreply.github.com>
3 years ago
CrazyMax b89e2f35df
build: add ulimit support
Signed-off-by: CrazyMax <crazy-max@users.noreply.github.com>
3 years ago
Tõnis Tiigi b05c313204
Merge pull request #740 from bossmc/support-quiet
Implement `--quiet` support
3 years ago
Andy Caldwell ef3e46fd62
Move printing to stdout up to the command itself
Signed-off-by: Andy Caldwell <andrew.caldwell@metaswitch.com>
3 years ago
Andy Caldwell c19c018a4c
Implement `--quiet` support
Signed-off-by: Andy Caldwell <andrew.caldwell@metaswitch.com>
3 years ago
Tonis Tiigi 422ba60b04 use long-running context for client initialization
Signed-off-by: Tonis Tiigi <tonistiigi@gmail.com>
3 years ago
Morlay 3768ab268b fix: should ignore nil client
Signed-off-by: Morlay <morlay.null@gmail.com>
4 years ago
Tonis Tiigi 9d88450118 enable opentelemetry support
Signed-off-by: Tonis Tiigi <tonistiigi@gmail.com>
4 years ago
Djordje Lukic a1d899d400 Fail fast on multi platform build with load
Signed-off-by: Djordje Lukic <djordje.lukic@docker.com>
4 years ago
Akihiro Suda 399df854ea
build: split buildflags package
Planned to be imported by nerdctl in future.

Signed-off-by: Akihiro Suda <akihiro.suda.cz@hco.ntt.co.jp>
4 years ago
Tõnis Tiigi 5ca0cbff8e
Merge pull request #535 from tonistiigi/github-actions-cache
allow exporting to github cache backend
4 years ago
Alex Couture-Beil eec843a325 include default ssh socket when given an ssh-based git url
Signed-off-by: Alex Couture-Beil <alex@earthly.dev>
4 years ago
Tonis Tiigi d7964be29c gha cache caps detection
Signed-off-by: Tonis Tiigi <tonistiigi@gmail.com>
4 years ago
Tonis Tiigi 3fef64f584 allow exporting to github cache backend
Signed-off-by: Tonis Tiigi <tonistiigi@gmail.com>
4 years ago
Tonis Tiigi 0f09e2ecfe don't require entitlement for network none
Signed-off-by: Tonis Tiigi <tonistiigi@gmail.com>
4 years ago
CrazyMax f6d83c97bb
Allow secrets with env
Signed-off-by: CrazyMax <crazy-max@users.noreply.github.com>
4 years ago
Tõnis Tiigi 33e3ca524e
Merge pull request #442 from tonistiigi/moby-push
build: add push support to docker driver
4 years ago
Tõnis Tiigi ea1a71dc07
Merge pull request #467 from cpuguy83/deterministic_output
Get multi-platform buildkit frontend opt from args
4 years ago
Tonis Tiigi f68f42cb11 build: add push support to docker driver
Signed-off-by: Tonis Tiigi <tonistiigi@gmail.com>
4 years ago