Commit Graph
57 Commits
Author SHA1 Message Date
Tonis Tiigi 5c3551beeb policy: add GitHub attestation verification
Add github_attestation and github_release_attestation policy support.
Fetch GitHub attestation bundles (including bundle_url .json.sn decode)
and verify against input.http.checksum.

Wire source metadata resolver progress through resolver options and add
ResolveState support for policy HTTP attestation fetches.

Signed-off-by: Tonis Tiigi <tonistiigi@gmail.com>
2026-02-20 08:56:40 -08:00
Tonis Tiigi 048ebea483 policy: mark policy progress vertex on DENY build failures
Track denied source identifiers during policy evaluation and flag the policy
progress vertex as failed when BuildKit returns a matching DENY error pattern.

This improves the progress output of policy error and shows last
policy logs with the build error.

Signed-off-by: Tonis Tiigi <tonistiigi@gmail.com>
2026-02-18 17:19:54 -08:00
Tõnis TiigiandGitHub 7940a9650d Merge pull request #3646 from crazy-max/urlutil
history: don't import build package
2026-02-11 10:59:05 -08:00
CrazyMax 7899695fa6 history: don't import build package
Signed-off-by: CrazyMax <1951866+crazy-max@users.noreply.github.com>
2026-02-11 10:29:47 +01:00
CrazyMaxandGitHub 9bfd2a4b5c Merge pull request #3462 from crazy-max/bake-input-context
bake: set input:context for remote builds
2026-02-11 09:41:30 +01:00
CrazyMax f60c7c9069 bake: set input:context for remote builds
Signed-off-by: CrazyMax <1951866+crazy-max@users.noreply.github.com>
2026-02-09 13:50:19 +01:00
Tonis Tiigi c01e50342b build: send individual shared keys for local build contexts
Allows avoiding the case where two separate builds using
same context name would use the same destination directory
for upload.

Requires updated frontend to handle these new keys.

Signed-off-by: Tonis Tiigi <tonistiigi@gmail.com>
2026-01-20 19:08:05 -08:00
Tonis Tiigi 73f5b1f9c7 policy: update policy progress logic
Fix the policy logger being open for the whole build.

In new logic logger is opened on-demand if there are logs,
remains open until timeout and is restarted if new logs
come after.

Signed-off-by: Tonis Tiigi <tonistiigi@gmail.com>
2026-01-16 11:48:55 -08:00
Tonis Tiigi 20405112c2 policy: allow image source without set platform
Signed-off-by: Tonis Tiigi <tonistiigi@gmail.com>
2026-01-16 11:48:55 -08:00
Tonis Tiigi be42b48462 policy: implement policy logging via progress printer
Signed-off-by: Tonis Tiigi <tonistiigi@gmail.com>
2026-01-14 09:10:34 -08:00
Tonis Tiigi 5ad09ce3eb commands: implement policy eval command
Signed-off-by: Tonis Tiigi <tonistiigi@gmail.com>
2026-01-14 09:10:33 -08:00
Tonis Tiigi 61843e0031 policy: add strict policy config support
Strict policy will fail if remote daemon doesn't support policy
verification.

Signed-off-by: Tonis Tiigi <tonistiigi@gmail.com>
2026-01-14 09:09:10 -08:00
Tonis Tiigi 0e1036bef5 policy: add multiple policy support
Signed-off-by: Tonis Tiigi <tonistiigi@gmail.com>
2026-01-14 09:09:10 -08:00
Tonis Tiigi 87d4189039 policy: image signature verification support
Signed-off-by: Tonis Tiigi <tonistiigi@gmail.com>
2026-01-14 09:03:42 -08:00
Tonis Tiigi 70da643c58 policy: add helper modules loading
Signed-off-by: Tonis Tiigi <tonistiigi@gmail.com>
2026-01-14 09:03:42 -08:00
Tonis Tiigi 7247c1e38e policy: print debug helper
Signed-off-by: Tonis Tiigi <tonistiigi@gmail.com>
2026-01-14 09:03:42 -08:00
Tonis Tiigi 93341aaeee add rego integration to source policies
Signed-off-by: Tonis Tiigi <tonistiigi@gmail.com>
2026-01-14 09:03:40 -08:00
Paweł Gronowski 41a1782b35 build: Don't unpack by default when pushing
Automatically set `unpack=false` for registry exports unless explicitly
overridden by the user.

This applies to:

- `registry` exporter type (converted to `image` exporter with `push=true`)
- `--push` flag usage with image exporters

Users can still explicitly set `unpack=true` if they need local image
storage alongside registry push.

Signed-off-by: Paweł Gronowski <pawel.gronowski@docker.com>
2026-01-14 16:04:45 +01:00
Jonathan A. Sternberg 2e76c05592 build: handle at symbols in an oci-layout path
The buildx command line will now handle `@` symbols in the
`oci-layout://` path when used with named contexts. Instead of
assuming the `@` symbol is part of the reference digest, it will first
check that it is a valid reference digest. Otherwise, it will assume
it's part of the file path.

Signed-off-by: Jonathan A. Sternberg <jonathan.sternberg@docker.com>
2026-01-12 11:19:51 -06:00
CrazyMax 28b6750599 build: create parent directories for tar output in lazy writer
Signed-off-by: CrazyMax <1951866+crazy-max@users.noreply.github.com>
2025-10-22 11:50:32 +02:00
Tonis Tiigi 5a3afbf839 build: set original url to attrs when replacef with input
Save original URL so it can be picked up from provenance attestation.

Signed-off-by: Tonis Tiigi <tonistiigi@gmail.com>
2025-09-09 11:08:00 -07:00
Tonis Tiigi c737e84f94 build: allow client side querystring resolution
For the cases where frontend/buildkit doesn't support new
Git Querystring format, allow resolving the URL into LLB
on client side and then build from input.

Note that this produces slightly different provenance
where context is not set as string, so added opt-in
via environment variable for now.

Signed-off-by: Tonis Tiigi <tonistiigi@gmail.com>
2025-09-08 17:40:31 -07:00
Tonis Tiigi 5e6951c571 git querystring frontend capability detection
Signed-off-by: Tonis Tiigi <tonistiigi@gmail.com>
2025-09-02 10:46:37 -07:00
Tõnis TiigiandGitHub df7c46b02d Merge pull request #3384 from crazy-max/export-annotations-check
build: fail early if trying to export index annotations with moby exporter
2025-08-27 08:44:51 -07:00
CrazyMax a8f546eea5 build: fail early if trying to export index annotations with moby exporter
Signed-off-by: CrazyMax <1951866+crazy-max@users.noreply.github.com>
2025-08-27 11:17:31 +02:00
Dan Duvall fc3ecb60fb Preserve raw BUILDKIT_SYNTAX as cmdline option
Set gateway `source` to the first part of `BUILDKIT_SYNTAX` and
`cmdline` to the entire raw value to preserve additional options.

Signed-off-by: Dan Duvall <dduvall@wikimedia.org>
2025-08-26 13:56:07 -07:00
Will NonnemakerandDan Duvall b99e799f00 Add BUILDKIT_SYNTAX option handling
This fix allows building with a remote builder where
frontend.dockerfile.v0 enabled = false in the buildkitd yaml file.

Note that this change only allows the usage of BUILDKIT_SYNTAX with
a custom frontend image, and using the #syntax directive in this case
will still fail.

Resolves: docker#3077

Signed-off-by: Will Nonnemaker <wnonnemaker@gmail.com>
2025-08-26 13:51:22 -07:00
Jonathan A. Sternberg 1d7cda1232 controller: remove remaining parts of the controller
Removes all references to the controller and moves the remaining
sections of code to other packages.

Processes has been moved to monitor where it is used and the data
structs have been removed so buildflags is used directly. The controller
build function has been moved to the commands package.

Signed-off-by: Jonathan A. Sternberg <jonathan.sternberg@docker.com>
2025-06-05 11:57:03 -05:00
CrazyMax 1383aa30c1 lint: modernize fix
Signed-off-by: CrazyMax <1951866+crazy-max@users.noreply.github.com>
2025-05-13 20:44:57 +02:00
CrazyMax b606e2f6bb update golangci-lint to v2.1.5
Signed-off-by: CrazyMax <1951866+crazy-max@users.noreply.github.com>
2025-05-13 16:54:43 +02:00
Cesar Talledo 679407862f Output correct image ID when using Docker with the containerd-snapshotter.
Prior to this change, the following command emits the wrong image ID when buildx
uses the "docker-container" driver and Docker is configured with the
containerd-snapshotter.

$ docker buildx build --load --iidfile=img.txt

$ docker run --rm "$(cat img.txt)" echo hello
docker: Error response from daemon: No such image: sha256:4ac37e81e00f242010e42f3251094e47de6100e01d25e9bd0feac6b8906976df.
See 'docker run --help'.

The problem is that buildx is outputing the incorrect image ID in this scenario
(it's outputing the container image config digest, instead of the container
image digest used by the containerd-snapshotter).

This commit fixes this. See https://github.com/moby/moby/issues/45458.

Signed-off-by: Cesar Talledo <cesar.talledo@docker.com>
2025-05-01 16:33:22 -07:00
Tõnis TiigiandCrazyMax 0c296fe857 support for device entitlement in build and bake
Allow access to CDI Devices in Buildkit v0.20.0+ for
devices that are not automatically allowed to be used by
everyone in BuildKit configuration.

Signed-off-by: Tonis Tiigi <tonistiigi@gmail.com>
Signed-off-by: CrazyMax <1951866+crazy-max@users.noreply.github.com>
2025-02-14 11:51:47 +01:00
Tonis Tiigi 44fa243d58 vendor: update buildkit to v0.19.0-rc1
Signed-off-by: Tonis Tiigi <tonistiigi@gmail.com>
2025-01-14 14:24:38 -08:00
CrazyMax f89f861999 config: fix file/folder ownership
Signed-off-by: CrazyMax <1951866+crazy-max@users.noreply.github.com>
2024-10-23 18:23:14 +02:00
Talon Bowler 671bd1b54d Update to pass DockerMappingSrc and Dst in with Inputs, and return Inputs through Build
Signed-off-by: Talon Bowler <talon.bowler@docker.com>
2024-09-18 20:56:31 -07:00
Talon Bowler f1b92e9e6c update Build commands to return dockerfile mapping for use in printing rule check warnings
Signed-off-by: Talon Bowler <talon.bowler@docker.com>
2024-09-06 07:34:13 -07:00
Tonis Tiigi adbcc2225e build: allow builds from stdin for multi-node builders
When building from same stream all nodes need to read
data from the same stream. In order to achive that there
is a new SyncMultiReader wrapper that sends the stream
concurrently to all readers. Readers must read at similar
speed or pauses will happen while they wait for each other.

Dockerfiles were already written to disk before sent. Now
the file written by first node is reused for others.

Signed-off-by: Tonis Tiigi <tonistiigi@gmail.com>
2024-08-14 13:13:18 +03:00
CrazyMax d03c13b947 chore: rename PrintFunc to CallFunc
Signed-off-by: CrazyMax <1951866+crazy-max@users.noreply.github.com>
2024-08-13 14:13:32 +02:00
Tõnis TiigiandGitHub 3d542f3d31 Merge pull request #2601 from tonistiigi/init-fixes
Improvements based on inittrace
2024-07-24 10:52:25 -07:00
Tonis Tiigi d8f26f79ed build: refactor setting git info to local mounts
This is a preparation to shared local sources for bake
targets and makes it possible to have equality check
between locals from different targets.

Signed-off-by: Tonis Tiigi <tonistiigi@gmail.com>
2024-07-16 21:50:06 -07:00
Tonis Tiigi b92bfb53d2 update errors handling allocations and comparison
Signed-off-by: Tonis Tiigi <tonistiigi@gmail.com>
2024-07-15 13:37:23 -07:00
CrazyMax 6fc19c4024 build: set same ref when building on multiple nodes
Signed-off-by: CrazyMax <1951866+crazy-max@users.noreply.github.com>
2024-07-03 15:06:53 +02:00
Tonis Tiigi f374f64d2f vendor: update buildkit to f7bda278b7e2
Signed-off-by: Tonis Tiigi <tonistiigi@gmail.com>
2024-07-02 22:24:55 -07:00
Tonis Tiigi b8da14166c build: fix sharedkey computation for local context
When LocalDirs were changed to LocalMounts, this broke the
sharedKey computation that was based on the context directory
path. SharedKey defines if directory is valid candidate for
incremental context transfer and if not set properly then
different directories do metadata-based transfers to same destination.

Signed-off-by: Tonis Tiigi <tonistiigi@gmail.com>
2024-06-27 17:53:22 -07:00
CrazyMax 314ca32446 fix assignment of buildinfo-attrs for exporter
Signed-off-by: CrazyMax <1951866+crazy-max@users.noreply.github.com>
2024-06-13 10:56:32 +02:00
Justin ChadwellandGitHub 9ad116aa8e Merge pull request #2478 from thaJeztah/extract_resolve_digest
build: loadInputs: extract resolving digest to a separate function
2024-05-29 11:00:54 +01:00
Tõnis TiigiandGitHub e3d5e64ec9 Merge pull request #2475 from thaJeztah/remove_urlutil
remove uses of github.com/docker/docker/builder/remotecontext package
2024-05-28 22:51:36 -07:00
Sebastiaan van Stijn 38d7d36f0a build: loadInputs: extract resolving digest to a separate function
This makes the code slightly more idiomatic, but the errors produced will
change slightly to prevent having to path NamedContext as argument.

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2024-05-27 19:31:32 +02:00
Sebastiaan van Stijn b948b07e2d remove uses of github.com/docker/docker/builder/remotecontext package
This package is part of the classic builder, and was currently only used
for the IsURL utility, which is a very rudimentary check for a string having
a "https://" or "http://" scheme.

This patch copies the code as non-exported functions where they're used to
remove the dependency.

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2024-05-26 11:06:02 +02:00
Sebastiaan van Stijn 17c0a3794b build: loadInputs: remove redundant check for hasDigest
hasDigest would always be true when reaching this code, because the function
would return with an error when failing to resolve the digest;

    if !hasDigest {
        return nil, errors.Errorf("oci-layout reference %q could not be resolved", v.Path)
    }

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2024-05-25 16:36:52 +02:00