Commit Graph
228 Commits
Author SHA1 Message Date
Tonis Tiigi 25db0fb050 tests: verify exec traffic is policy-checked in caps proxy test
Extend testBuildPolicyCapsProxy so that instead of only checking that
the network proxy was enabled, the build runs a command that makes an
HTTP request to a local test server. The policy denies that URL as an
HTTP source, so the test now verifies that exec traffic actually flows
through the proxy and is subject to source policy, including the deny
message and DENY decision in the build output.

Signed-off-by: Tonis Tiigi <tonistiigi@gmail.com>
2026-06-10 08:58:48 -07:00
Tonis TiigiandCrazyMax 4da04e3bf4 policy: enable proxy network from source policy caps
Evaluate source policy caps before solve requests so policies can enable
BuildKit proxy networking. Policy can return caps {"exec.proxy": true}
during the caps request to enable proxy network
support for the solve.

Signed-off-by: Tonis Tiigi <tonistiigi@gmail.com>
2026-06-10 15:04:23 +02:00
CrazyMax 8191e19d94 build: handle buildkit defaulting to oci mediatypes
Signed-off-by: CrazyMax <1951866+crazy-max@users.noreply.github.com>
2026-06-09 19:43:48 +02:00
CrazyMax da8fa45c1c bake: global policy evaluation options
Signed-off-by: CrazyMax <1951866+crazy-max@users.noreply.github.com>
2026-05-07 11:11:59 +02:00
CrazyMaxandMateusz Gozdek 9de08b24ff tests: cover debug build missing mount result IDs
Signed-off-by: CrazyMax <1951866+crazy-max@users.noreply.github.com>
2026-05-04 15:49:46 +02:00
CrazyMax dcf533e756 build: fix oci-layout named context serialization
Signed-off-by: CrazyMax <1951866+crazy-max@users.noreply.github.com>
2026-04-23 12:26:02 +02:00
CrazyMax 720f91fdd4 gitutil: migrate to BuildKit GitCLI API
Signed-off-by: CrazyMax <1951866+crazy-max@users.noreply.github.com>
2026-04-09 14:57:38 +02:00
Tõnis TiigiandGitHub b1c10489eb Merge pull request #3734 from crazy-max/build-fix-empty-syntax
build: reject empty BUILDKIT_SYNTAX overrides
2026-03-24 17:34:54 -07:00
Tõnis TiigiandGitHub 7ac8168016 Merge pull request #3738 from tonistiigi/policy-eval-upt
Updated for policy eval
2026-03-24 17:08:04 -07:00
CrazyMax 7c44ec11ec build: reject empty BUILDKIT_SYNTAX overrides
Signed-off-by: CrazyMax <1951866+crazy-max@users.noreply.github.com>
2026-03-24 15:35:08 +01:00
Tonis Tiigi 64cd4136d9 policy: support reading policy from stdin via --file -
Allow passing policy content through stdin by specifying
"--file -" in the eval command. This enables piping policy
data without requiring a file on disk.

Signed-off-by: Tonis Tiigi <tonistiigi@gmail.com>
2026-03-23 11:13:46 -07:00
Jonathan A. Sternberg a8d359a9ca dap: make dap generally available
Removes the experimental flags and bits for dap and deletes some dead
code that somehow made its way this far without anyone noticing.

Signed-off-by: Jonathan A. Sternberg <jonathan.sternberg@docker.com>
2026-03-23 10:43:27 -05:00
Jonathan A. Sternberg 180cfd9e41 dap: pass exit code through exited event
Pass the exit code through the exited event back to the client and
ensure that the printed text is printed completely.

Previously, the exited event just had a big todo and the printer would
sometimes fail to send messages to the connected client. This moves the
printer wait to before the debug adapter is closed to ensure that all
messages get sent through the connection to the editor. While there, I
also plumbed in the exit code to exited. It's not necessarily the real
exit code but it will produce a zero on build success and a non-zero
code on build failure so that should be good enough.

Signed-off-by: Jonathan A. Sternberg <jonathan.sternberg@docker.com>
2026-03-20 14:02:21 -05:00
Tõnis TiigiandGitHub ba04f8f7b4 Merge pull request #3687 from jsternberg/dap-filter-inputs
dap: defer inputs for a step to prevent overeager evaluation
2026-03-20 10:57:30 -07:00
Jonathan A. Sternberg c79061526f dap: defer inputs for a step to prevent overeager evaluation
When the debug thread was updated to always solve inputs from the
operation that it was tied to it became a bit overeager to evaluate
them. The intention of the steps is to have a single direct parent and
then potentially multiple "function calls" that can be evaluated with
step into and step out to leave.

With the change, that logic stayed in, but the inputs were always being
evaluated before they were stepped into or over. Now, when we construct
the steps, we also attach a list of inputs that we should defer
evaluation on to ensure we don't execute inputs that haven't been
executed yet.

It will then wrap the reference with a version that causes `Evaluate` to
do nothing. This prevents the overeager evaluation but allows the
reference to be evaluated if we need to read the filesystem.

Signed-off-by: Jonathan A. Sternberg <jonathan.sternberg@docker.com>
2026-03-20 09:26:32 -05:00
CrazyMax 5245d50a5b tests: history finalize on multi-node
Signed-off-by: CrazyMax <1951866+crazy-max@users.noreply.github.com>
2026-03-17 11:08:18 +01:00
Tõnis TiigiandGitHub 19258b1d84 Merge pull request #3691 from jsternberg/dap-entrypoint-breakpoint
dap: fix skipped breakpoint when the breakpoint and the entrypoint were the same
2026-03-16 17:58:47 -07:00
Tonis Tiigi 6eb48d9c8c imagetools: fix oci-layout index update when blob exists
When pushing to an OCI layout where the top-level descriptor
blob already existed, pushOCILayout returned early without
updating index.json or writing pending referrers. Restructure
the control flow so the blob-exists case skips only the write
but still updates the index and flushes referrers.

Signed-off-by: Tonis Tiigi <tonistiigi@gmail.com>
2026-03-12 22:54:35 -07:00
Tonis Tiigi 3e5c05cb1f imagetools: support oci-layout referrers
Handle OCI layout referrers via subject-annotated index entries and add
integration coverage for copying signed attestations through oci-layout.

Signed-off-by: Tonis Tiigi <tonistiigi@gmail.com>
2026-03-12 22:45:01 -07:00
Tonis Tiigi 9894189361 imagetools: support oci-layout refs
Add oci-layout:// source and target support to imagetools create and
inspect while keeping merge, filter, and referrer logic shared.

Signed-off-by: Tonis Tiigi <tonistiigi@gmail.com>
2026-03-12 22:45:01 -07:00
Tonis Tiigi 71edf28d8e tests: add negative checks for imagetools signature coverage
Verify imagetools copies signatures only for attestation manifests and
does not copy image-manifest signatures or unsupported referrers.

Signed-off-by: Tonis Tiigi <tonistiigi@gmail.com>
2026-03-12 22:45:01 -07:00
CrazyMax 176e497922 tests: skip remote multi-node history cases
Signed-off-by: CrazyMax <1951866+crazy-max@users.noreply.github.com>
2026-03-12 11:58:39 +01:00
CrazyMax 766592b2d1 tests: add remote multi-node worker
Signed-off-by: CrazyMax <1951866+crazy-max@users.noreply.github.com>
2026-03-12 11:37:08 +01:00
Jonathan A. Sternberg 724afbb867 dap: fix skipped breakpoint when the breakpoint and the entrypoint were the same
We erroneously skipped a breakpoint when that breakpoint was the same as
the entrypoint and we did not use stop on entry. This is because we only
started evaluating breakpoints after the first step on the entrypoint
instead of at the entrypoint.

Signed-off-by: Jonathan A. Sternberg <jonathan.sternberg@docker.com>
2026-03-11 10:52:50 -05:00
Tonis Tiigi 3281dce28c tests: cover imagetools dry-run
Add dry-run assertions to imagetools merge and platform filter
integration tests to verify emitted manifest JSON before push.

Signed-off-by: Tonis Tiigi <tonistiigi@gmail.com>
2026-03-10 21:11:08 -07:00
Tonis Tiigi d84544176d tests: cover imagetools file input
Add integration coverage for imagetools create --file and verify a
descriptor read from disk resolves to the expected copied manifest.

Signed-off-by: Tonis Tiigi <tonistiigi@gmail.com>
2026-03-10 21:05:57 -07:00
Tonis Tiigi b90d59a2e9 tests: cover imagetools append
Add integration coverage for imagetools create --append and verify the
target is rewritten as a two-platform manifest list.

Signed-off-by: Tonis Tiigi <tonistiigi@gmail.com>
2026-03-10 21:01:48 -07:00
Tonis Tiigi 0d82d2b115 tests: cover imagetools platform filtering
Add integration coverage for imagetools create --platform on an attested
multi-platform image and verify only the matching attestation remains.

Signed-off-by: Tonis Tiigi <tonistiigi@gmail.com>
2026-03-10 20:53:04 -07:00
Tonis Tiigi 0a5fccb7be tests: cover imagetools signature referrers
Add integration coverage for copying attestation referrers with fake
sigstore signature manifests on a multi-platform source image.

Signed-off-by: Tonis Tiigi <tonistiigi@gmail.com>
2026-03-10 20:43:35 -07:00
Tonis Tiigi 5b2a4ccd2d tests: add single arch attestation fallback case to test
Signed-off-by: Tonis Tiigi <tonistiigi@gmail.com>
2026-03-10 20:29:22 -07:00
Tonis Tiigi b43520b4ca tests: add imagetools test for merged create
With and without attestations.

Signed-off-by: Tonis Tiigi <tonistiigi@gmail.com>
2026-03-10 20:25:57 -07:00
Tonis Tiigi 2682d345fa tests: tighten imagetools copy assertions
Verify copied index content keeps the same digest and descriptor metadata.
Add function comments to clarify each imagetools integration test case.

Signed-off-by: Tonis Tiigi <tonistiigi@gmail.com>
2026-03-10 19:24:59 -07:00
Tõnis TiigiandGitHub b046c3934c Merge pull request #3712 from jsternberg/dap-skip-context-without-source
dap: skip the load build context step when it doesn't have an associated source line
2026-03-10 18:39:57 -07:00
Tõnis TiigiandGitHub 1e2b0688db Merge pull request #3709 from jsternberg/dap-loaded-source-path
dap: properly map source paths to client side paths
2026-03-10 18:08:19 -07:00
Jonathan A. Sternberg 3e4bd229ab dap: skip the load build context step when it doesn't have an associated source line
Skip the load build context step when it doesn't have an associated
source line. This caused an extra branch to be created in an otherwise
pretty straightforward dockerfile where stepping in on a copy
instruction that used the context would stay on the same line because it
"stepped into" the context loading rather than being treated the same as
step next.

This resulted in some bad and confusing ergonomics with the cursor
position that were a bit confusing and unexpected.

There might be more areas to try and prune but the most common one, a
single branch instruction that doesn't have a location, now gets skipped
which is the exact thing that was generated for loading the context.

Signed-off-by: Jonathan A. Sternberg <jonathan.sternberg@docker.com>
2026-03-10 12:35:13 -05:00
Jonathan A. Sternberg 4f3de79c13 dap: properly map source paths to client side paths
Properly map the source paths from the metadata in the solve to the
client side paths. The source path returns is relative to the context
that gets uploaded which is usually a subdirectory. The original code
noticed this when mapping the paths but made the invalid assumption that
the dockerfile would always be in the context path so it combined the
dockerfile name with the context path.

It is possible for the dockerfile to be in a subdirectory of the
context. In which case, we computed the paths incorrectly.

This modifies DAP to instead use the `DockerfileMappingDst` and
`DockerfileMappingSrc` which are special included variables to the
inputs that get filled in during the build for the purpose of mapping
the source path to the client side path.

Tests have also been added for this functionality to ensure it doesn't
break again. This should work with both absolute and relative paths
although absolute paths should probably be preferred for usage just
because they're less likely to result in weird things happening.

The sources are also normalized to always convert the source filenames
to absolute paths and DAP itself will accept relative paths but will
only ever communicate in absolute paths. When you set a breakpoint, it
will convert it to an absolute path and reference it in that way rather
than a relative path.

Signed-off-by: Jonathan A. Sternberg <jonathan.sternberg@docker.com>
2026-03-10 09:17:42 -05:00
Jonathan A. Sternberg b521a083ba dap: detect breakpoints for files when the case differs
Case insensitive filesystems can cause breakpoints to not be seen or
verified. This is particularly true on Windows where the drive letter
can also participate in the filepath.

Change the detection logic for a breakpoint to be case insensitive. At
the same time, report the name of the source as part of the breakpoint
so that the editor can be told which casing we're expecting to be used.

Signed-off-by: Jonathan A. Sternberg <jonathan.sternberg@docker.com>
2026-03-06 14:01:32 -06:00
Tonis Tiigi 5478703490 tests: test updates after compose update
Signed-off-by: Tonis Tiigi <tonistiigi@gmail.com>
2026-03-05 17:58:56 -08:00
CrazyMax 2ed4ece865 build: reuse build session for policy source resolution
Signed-off-by: CrazyMax <1951866+crazy-max@users.noreply.github.com>
2026-03-04 17:21:20 +01:00
CrazyMax 50fa13d859 bake: preserve git subdir in remote bake context paths
Signed-off-by: CrazyMax <1951866+crazy-max@users.noreply.github.com>
2026-03-03 17:47:07 +01:00
Tonis Tiigi d39a81e456 bake: fix remote named context subdir handling
Fix using CopyDirContentsOnly when projecting remote named contexts so
subdir contexts keep the same root semantics as local bake runs.

Signed-off-by: Tonis Tiigi <tonistiigi@gmail.com>
2026-02-27 17:06:32 -08:00
Tonis Tiigi b62fc30524 build: resolve policy files from context state and unified FS
Support remote context policy files via resolved context state and cwd:// override.

Signed-off-by: Tonis Tiigi <tonistiigi@gmail.com>
2026-02-23 16:22:19 -08:00
Tonis Tiigi 9f59d5b789 policy: add progress vertex error integration test
Refactor policy error unit tests to table-driven subtests with slug names.
Add rawjson integration coverage to verify policy vertex captures DENY build
errors in progress output.

Signed-off-by: Tonis Tiigi <tonistiigi@gmail.com>
2026-02-19 18:13:58 -08:00
Tonis Tiigi 499261eed5 build: avoid empty line when -q used with --call
Signed-off-by: Tonis Tiigi <tonistiigi@gmail.com>
2026-02-13 17:11:35 -08:00
Tonis Tiigi 8d605dcd87 policy: add image.provenance input type
Signed-off-by: Tonis Tiigi <tonistiigi@gmail.com>
2026-02-12 11:59:06 -08:00
CrazyMaxandGitHub 53882aec96 Merge pull request #3649 from tonistiigi/update-buildkit-dev
vendor: update buildkit to v0.28-dev-9836771d0c5b
2026-02-12 10:06:45 +01:00
Tonis Tiigi a5b712b275 confutil: fix toml rewriting in new package
Seems marshalling the typed struct causes empty fields
e.g. gcpolicy = [] that (old versions of?) BuildKit do no allow.

Signed-off-by: Tonis Tiigi <tonistiigi@gmail.com>
2026-02-11 21:47:11 -08:00
Tõnis TiigiandGitHub bcb8583078 Merge pull request #3638 from crazy-max/imagetools-create-digest
imagetools: metadata-file flag
2026-02-11 10:59:38 -08:00
CrazyMax a2f3c6a1b8 imagetools: metadata-file flag
Signed-off-by: CrazyMax <1951866+crazy-max@users.noreply.github.com>
2026-02-10 13:52:00 +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