Print executed Git commands in build logs to help diagnose source
resolution, fetch, and checkout behavior, including bundle staging.
Enable tracing with BUILDKIT_GIT_DEBUG_COMMANDS=1 or llb.GitDebugCommands().
Redact URL credentials and HTTP extra headers without changing command
execution or snapshot cache keys. Tracing is disabled by default.
Signed-off-by: CrazyMax <1951866+crazy-max@users.noreply.github.com>
Bound Dockerfile and ignore-file reads to the gateway message size.
Reject oversized files before parsing to avoid unbounded daemon memory use.
Signed-off-by: Tonis Tiigi <tonistiigi@gmail.com>
(cherry picked from commit 2508d93d8a2ac621955f0355258f9a4ec79b02b7)
(cherry picked from commit 69d8a4527d8435c50c1bcce92d7e8f0e7851706c)
Let frontend and external callers detect archives without importing image-layer compression
backends and their transitive dependencies.
Signed-off-by: CrazyMax <1951866+crazy-max@users.noreply.github.com>
- Updated multiple instances across various files to replace errors.Errorf with errors.New for error message creation.
- This change enhances consistency in error handling throughout the codebase.
Signed-off-by: Matthieu MOREL <matthieu.morel35@gmail.com>
Allow git sources to fetch a pinned commit without resolving the ref
against the remote tip, while preserving cache keys for canonical
branch refs and covering the behavior with tests.
Signed-off-by: Tonis Tiigi <tonistiigi@gmail.com>
Extend SOURCE_DATE_EPOCH resolution to accept a stage name
or named context in addition to numeric and "context" values.
A referenced stage must be FROM scratch with a single remote
ADD (HTTP or Git), from which the epoch timestamp is derived.
Refactor resolution logic from dockerui/context.go into a
dedicated epoch.go file. Remove buildContext fields that were
only needed for epoch resolution and expose GatewayClient()
on dockerui.Client for direct source metadata access.
Also align HTTP named context to use Filename("context"),
matching the existing DetectHTTPContext behavior.
Signed-off-by: Tonis Tiigi <tonistiigi@gmail.com>
Resolve SOURCE_DATE_EPOCH=context in the Dockerfile frontend from the
main build context and pass the resolved numeric epoch through normal
ARG handling and exporter metadata.
Use git commit time for git contexts, HTTP Last-Modified when present,
and newest archive entry mtime for HTTP archives. Leave local contexts
unset.
Signed-off-by: Tonis Tiigi <tonistiigi@gmail.com>
Propagate Dockerfile-defined SOURCE_DATE_EPOCH through frontend result
metadata so exporters can consume it, including per-platform export
paths and rewrite-timestamp handling.
Refactor Dockerfile2LLB to return a structured result, preserve exporter
reset semantics, and cover the exporter-facing behavior with Dockerfile
integration tests.
Signed-off-by: Tonis Tiigi <tonistiigi@gmail.com>
Add git.mtime=commit option that normalizes all file, symlink,
and directory mtimes in a git snapshot to the resolved commit
timestamp. This enables reproducible builds from git sources.
When SOURCE_DATE_EPOCH is set in the Dockerfile frontend, the
git context automatically uses commit-time mtimes. The URL
query parameter ?mtime=commit|checkout can override this.
New LLB attr (git.mtime) and capability (source.git.mtime) are
registered as experimental. Cache keys include the mtime policy
so that commit-time and checkout-time snapshots are distinct.
Signed-off-by: Tonis Tiigi <tonistiigi@gmail.com>
Avoids the case where two projects that use the
named context with same name would share the destination
directory for the upload.
Assuming the client sets a different sharedkey
for them based on local dir basename.
Signed-off-by: Tonis Tiigi <tonistiigi@gmail.com>
Currently it is not possible to update to more
recent version as modernize causes errors in generated code.
Signed-off-by: Tonis Tiigi <tonistiigi@gmail.com>
ResolveImageConfig was changed to ResolveSourceMetadata long time
ago for cross-source implementation but the worker implementation
was still using old method name with conversions.
Signed-off-by: Tonis Tiigi <tonistiigi@gmail.com>
This subrequest is similar to `buildctl debug dump-llb` but works on a
running buildkit daemon with the dockerfile frontend. The
`--call=convertllb` option can be used to dump the raw LLB along with the
metadata and anything else in the definition to a JSON format.
This is useful for debugging purposes.
Signed-off-by: Jonathan A. Sternberg <jonathan.sternberg@docker.com>
The `ParseGitRef` function was only used in `frontend/{dockerfile, dockerui}`,
expect a single occurrence in `solver/llbsolver/history.go`.
The occurrence in `solver/llbsolver/history.go` now uses
`util/gitutil/git_url.go:ParseURL()`.
Signed-off-by: Akihiro Suda <akihiro.suda.cz@hco.ntt.co.jp>
Because dockerui added osversion to original reference before
calling res.AddRef() that meant that the sbom was looked up by
wrong key in scanTargets.Load(id) .
Signed-off-by: Tonis Tiigi <tonistiigi@gmail.com>
I came across a number of calls to `platforms.DefaultSpec()`
that were not necessary. That prompted me to take a look
various other similar places.
At least on Windows, the call is a has some cost till
doing a sycall `RtlGetNtVersionNumbers()`.
Signed-off-by: Anthony Nandaa <profnandaa@gmail.com>
This allows platforms following the new `platforms.FormatAll` function,
which allows for setting the `OSVersion` field of the platform with
`<os>(<ver>)/<arch>`.
Signed-off-by: Brian Goff <cpuguy83@gmail.com>
Remove gogoproto in favor of the standard protobuf compiler. This
removes any nonstandard extensions that were part of gogoproto such as
the custom types.
Signed-off-by: Jonathan A. Sternberg <jonathan.sternberg@docker.com>
This allows frontend to associate a specific local to specific
session when it is assembling LLB. It can be used to create builds
using files from multiple sessions or multiple builds to use
the same session that is different from default session for the
build request.
Signed-off-by: Tonis Tiigi <tonistiigi@gmail.com>
Switch to use github.com/containerd/platforms module, because containerd's
platforms package has moved to a separate module. This allows updating the
platforms parsing independent of the containerd module itself.
The package in containerd is deprecated, but kept as an alias to provide
compatibility between codebases.
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>