1
0
mirror of https://github.com/moby/buildkit.git synced 2025-09-11 04:30:45 +03:00

4 Commits

Author SHA1 Message Date
Dan Duvall
e19af64fe3 http: Support additional request headers
Support additional request header fields for HTTP sources, "Accept" and
"User-Agent" as a start.

The "Accept" header is required in some cases and some servers may vary
the response body based on the header value.

The "User-Agent" header may be useful in custom frontends and
potentially other cases.

 - llb: Add `llb.Header` and `HTTPInfo.Header` to allow `client/llb`
   users to set these header fields on HTTP sources. The argument to
   `llb.Header` is a struct to effectively limit header fields to a
   subset.
 - llb: Define and flag new `source.http.header` capability when
   `llb.Header` is used.
 - solver: Define new `http.header.` source attribute prefix. Giving
   each header field its own attribute (opposed to JSON encoding the
   header struct) will allow source policy to make assertions on
   individual header fields.
 - source/http: Parse `http.header.` attributes into a sorted slice and
   include them in cache key digest.
 - source/http: Set request headers accordingly.

Signed-off-by: Dan Duvall <dduvall@wikimedia.org>
2025-02-21 10:08:59 -08:00
Dan Duvall
ab1e99e19a http: Support authentication
Support authentication for HTTP sources.

 - llb: Define general `llb.AuthOption` interface composed of
   `HTTPOption` and `GitOption`.
 - llb: Refactor `llb.AuthHeaderSecret` to return an `llb.AuthOption` so
   it may be used with both `llb.Git` and `llb.HTTP`.
 - llb: Define `HTTPInfo.AuthHeaderSecret`.
 - llb: Define and flag new `source.http.auth` capability when
   `HTTPInfo.AuthHeaderSecret` is set.
 - solver: Define new `http.auth` source attribute.
 - source/http: If an `http.auth` attribute is specified, resolve a
   secret named by its value and set the "Authorization" request header.

Signed-off-by: Dan Duvall <dduvall@wikimedia.org>
2025-02-20 12:12:55 -08:00
CrazyMax
94e2370023 provenance: move types to a dedicated package
Signed-off-by: CrazyMax <1951866+crazy-max@users.noreply.github.com>
2024-02-25 20:39:50 +01:00
Alex Suraci
6b27487fec source: make sources pluggable
Sources are a pretty neat extension point, except there are a few code
paths that hard-code against each type. This moves code around and
adjusts interfaces so that Source implementations are self-contained and
merely need to be registered with the source.Manager.

Signed-off-by: Alex Suraci <suraci.alex@gmail.com>
2023-08-16 09:57:55 +01:00