46 Commits

Author SHA1 Message Date
Tonis Tiigi
9fcedf9807 update gopls to go1.24 compatible version
Signed-off-by: Tonis Tiigi <tonistiigi@gmail.com>
2025-05-07 18:23:20 -07:00
Marat Radchenko
5be7edb69c Upgrade to containerd 2
Co-authored-by: Derek McGowan <derek@mcg.dev>
Signed-off-by: Marat Radchenko <marat@slonopotamus.org>
2025-01-13 16:42:48 -08:00
Jonathan A. Sternberg
1a3fc0aa15 protobuf: remove gogoproto
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>
2024-09-26 12:57:45 -05:00
Jonathan A. Sternberg
c3105e49d9 otel: update usage of otelgrpc interceptors to use stat handlers
The otelgrpc interceptors were deprecated. This updates the areas where
these were used to use the stat handlers instead of the interceptors.
This helps with creating a single method for both unary and stream rpcs
and also ensures we aren't using a deprecated function for the future.

Signed-off-by: Jonathan A. Sternberg <jonathan.sternberg@docker.com>
2024-03-29 16:39:25 -05:00
Höhl, Lukas
cda45ada82 fix: use default dialer for client
Uses the default grpc dialer to allow [proxy configuration](https://github.com/grpc/grpc-go/blob/v1.57.0/Documentation/proxy.md)

Signed-off-by: Höhl, Lukas <lukas.hoehl@accso.de>
2024-03-18 16:01:58 +01:00
Sebastiaan van Stijn
841e397d54 vendor: OTEL v0.46.1 / v1.21.0
Temporarily adding some "nolint" tags, and a TODO for replacing some
deprecated features;

    client/client.go:105:43: SA1019: otelgrpc.UnaryClientInterceptor is deprecated: Use [NewClientHandler] instead. (staticcheck)
            unary = append(unary, filterInterceptor(otelgrpc.UnaryClientInterceptor(otelgrpc.WithTracerProvider(tracerProvider), otelgrpc.WithPropagators(propagators))))
                                                    ^
    client/client.go:106:27: SA1019: otelgrpc.StreamClientInterceptor is deprecated: Use [NewClientHandler] instead. (staticcheck)
            stream = append(stream, otelgrpc.StreamClientInterceptor(otelgrpc.WithTracerProvider(tracerProvider), otelgrpc.WithPropagators(propagators)))
                                    ^
    solver/jobs.go:515:13: SA1019: trace.NewNoopTracerProvider is deprecated: Use [go.opentelemetry.io/otel/trace/noop.NewTracerProvider] instead. (staticcheck)
        _, span := trace.NewNoopTracerProvider().Tracer("").Start(ctx, "")
                   ^
    util/tracing/detect/detect.go:108:7: SA1019: trace.NewNoopTracerProvider is deprecated: Use [go.opentelemetry.io/otel/trace/noop.NewTracerProvider] instead. (staticcheck)
        tp = trace.NewNoopTracerProvider()
             ^
    cmd/buildkitd/main.go:273:19: SA1019: otelgrpc.StreamServerInterceptor is deprecated: Use [NewServerHandler] instead. (staticcheck)
            streamTracer := otelgrpc.StreamServerInterceptor(
                            ^
    cmd/buildkitd/main.go:664:15: SA1019: otelgrpc.UnaryServerInterceptor is deprecated: Use [NewServerHandler] instead. (staticcheck)
        withTrace := otelgrpc.UnaryServerInterceptor(
                     ^

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2024-02-22 18:46:05 +01:00
Justin Chadwell
e31fc48a54 chore: remove WithFailFast option
WithFailFast was not actually causing any change in behavior, so we can
remove the option completely.

The option set FailOnNonTempDialError(true) on the gRPC connection.
However, the help text for this method option declares that it "does not
do anything useful unless you are also using WithBlock()" - which we do
not do. I've verified that the only client-side code path that actually
handles this option is under a check for if WithBlock() was also used.

We can remove this option instead of fixing it, since the need for this
functionality has been replaced by the more buildkit-native client.Wait
function - this function also correctly waits for the buildkit server to
begin running, and to start serving requests (which is generally the
desired behaviour).

If users actually desire this option (which was not fully working
previously), they can use the WithGRPCDialOption, and pass
FailOnNonTempDialError(true) directly, alongside WithBlock.

Signed-off-by: Justin Chadwell <me@jedevc.com>
2023-12-13 17:43:38 +00:00
Tonis Tiigi
8a2a3e83ec replace context.WithCancel with WithCancelCause
Keep stack traces for cancellation errors where possible.

Signed-off-by: Tonis Tiigi <tonistiigi@gmail.com>
2023-12-06 22:15:06 -08:00
Justin Chadwell
f1d7f2e410 client: manually implement Wait backoffs
When calling client.Wait, we want to avoid the default backoff behavior,
because we want to achieve a quick response back once the server becomes
active.

To do this, without modifying the entire client's exponential backoff
configuration, we can use conn.ResetConnectBackoff, while attempting to
reconnect every second.

Here are some common scenarios:
- Server is listening: the call to Info succeeds quickly, and we return.
- Server is listening, but is behind several proxies and so latency is
  high: the call to Info succeeds slowly (up to minConnectTimeout=20s),
  and we return.
- Server is not listening and gets "connection refused": the
  call to Info fails quickly, and we wait a second before retrying.
- Server is not listening and does not respond (e.g. firewall dropping
  packets): the call to Info fails slowly (by default after
  minConnectTimeout=20s). After the call fails, we wait a second before
  retrying.

Signed-off-by: Justin Chadwell <me@jedevc.com>
2023-09-06 22:56:32 +01:00
Dan Duvall
ef61bbe583 buildctl: Provide --wait option
Added `--wait` to buildctl's global options. See below for behavior.

Implemented a `Wait` client method that blocks until a successful
request has been made to the remote buildkit. This behavior is identical
as in buildx, and only makes additional ListWorker calls *if the user
has requested them*.

The timeout as requested using the `--timeout` option is additionally
applied here.

Co-authored-by: Justin Chadwell <me@jedevc.com>
Signed-off-by: Justin Chadwell <me@jedevc.com>
2023-06-29 10:54:58 +01:00
Justin Chadwell
8f66706b7a client: add client opts to enable system certificates
Additionally, this splits out WithCredentials into separate methods:

- WithCredentials configures the client credentials presented to the
  server
- WithServerConfig configures the name and ca certificate to check the
  server's certificate against
- WithServerConfigSystem configures the name to check the server's
  certificate against - the ca certificate is automatically pulled from
  the system store.

Signed-off-by: Justin Chadwell <me@jedevc.com>
2023-03-30 10:00:51 +01:00
Brian Goff
eae50a4bd7 Make ClientOpts type safe
This provides some compile-time safety around options passed when
creating a buildkit client.
Before this change since a ClientOpt is an empty interface anything and
everything could be passed in.

This is a breaking change since before consumers could pass in a raw
grpc.DialOption, this now needs to be wrapped with
`client.WithGRPCDialOption(grpcOpt)`
Consumers could also pass in something tat was not a client opt at all
and it was completely ignored.

Signed-off-by: Brian Goff <cpuguy83@gmail.com>
2023-03-29 17:55:17 +00:00
Justin Chadwell
17df8847d9 client: allow grpc dial option passthrough
This allows consumers of buildkit's client API to manually specify grpc
options, such as underlying transport details, or creating interceptors
for requests. All custom options are appended *after* the internal
options, to allow for more specific overrides if desired.

Additionally, to prevent accidentally overwriding the internal
interceptors, we switch the client to using
`WithChain{Unary,Stream}Interceptor` instead of the singular form, which
will overwrite if multiple are specified.

Signed-off-by: Justin Chadwell <me@jedevc.com>
2023-03-27 11:02:24 +01:00
Tonis Tiigi
8a2addb899 history api: tracing storage support
Signed-off-by: Tonis Tiigi <tonistiigi@gmail.com>
2022-12-12 22:15:40 -08:00
Tonis Tiigi
dbee61670d add build history APIs
Signed-off-by: Tonis Tiigi <tonistiigi@gmail.com>
2022-11-22 23:59:33 -08:00
Pranav Pandit
4ebb56e0fe Remove deprecated function call to fix lint error
Signed-off-by: Pranav Pandit <pranavp@microsoft.com>
2022-08-11 16:44:56 -07:00
Sebastiaan van Stijn
21e9e9641e Remove uses of deprecated io/ioutil
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2022-03-10 00:57:07 +01:00
CrazyMax
39f6b4e739 Bump github.com/containerd/containerd to v1.6.0-rc.1
Signed-off-by: CrazyMax <crazy-max@users.noreply.github.com>
2022-01-28 10:18:59 +01:00
Shingo Omura
ccbf7f3386 Setting just servername to :authority pseudo header in client when using tls.
HTTP/2(RFC7540) defines :authority pseudo header includes the authority portion
of target URI but it must not include userinfo part (i.e. url.Host).

However, when TLS certificate specified, grpc-go requires it must match
with its servername specified for certificate validation.

Signed-off-by: Shingo Omura <everpeace@gmail.com>
2021-12-10 21:13:25 +09:00
Tonis Tiigi
1c51e87e16 client: allow setting custom dialer for session endpoint
Signed-off-by: Tonis Tiigi <tonistiigi@gmail.com>
2021-10-17 20:21:28 -07:00
Tonis Tiigi
14d606c289 client: pass delegated exporter as parameter
Avoid client package having dependency on global detect package.

Signed-off-by: Tonis Tiigi <tonistiigi@gmail.com>
2021-06-20 21:57:41 -07:00
Tonis Tiigi
d512920c24 support collecting traces from llb.Exec
Signed-off-by: Tonis Tiigi <tonistiigi@gmail.com>
2021-06-20 21:57:35 -07:00
Tonis Tiigi
d8fc4e15f9 enable collecting traces via control api
Signed-off-by: Tonis Tiigi <tonistiigi@gmail.com>
2021-06-20 21:57:35 -07:00
Tonis Tiigi
7489cc8be0 vendor: update opentelemetry to 1.0.0-rc
Signed-off-by: Tonis Tiigi <tonistiigi@gmail.com>
2021-06-19 10:02:26 -07:00
Tonis Tiigi
8f50bae3f1 replace opentracing with opentelemetry tracers
Signed-off-by: Tonis Tiigi <tonistiigi@gmail.com>
2021-06-15 21:11:27 -07:00
Tonis Tiigi
51decbe06d client: use containerd grpc message size defaults
Same defaults already used on buildkitd side

Signed-off-by: Tonis Tiigi <tonistiigi@gmail.com>
2020-10-26 14:51:47 -07:00
Shingo Omura
804aa5d21a setting host part of address as :authority pseudo header.
grpc-go uses a slightly different naming scheme(https://github.com/grpc/grpc/blob/master/doc/naming.md)
This will end up setting rfc non-complient :authority header to address string (e.g. tcp://127.0.0.1:1234).
So, this commit changes to sets right authority header via WithAuthority DialOption.

Signed-off-by: Shingo Omura <everpeace@gmail.com>
2020-07-31 21:10:45 +09:00
Tonis Tiigi
dc40e5708c client: update dialer to contextDialer
Signed-off-by: Tonis Tiigi <tonistiigi@gmail.com>
2020-07-19 09:28:36 -07:00
Tonis Tiigi
725f5e1207 grpc interceptors for errors
Signed-off-by: Tonis Tiigi <tonistiigi@gmail.com>
2020-04-22 18:31:32 -07:00
Tonis Tiigi
2fc9aee26f Revert "grpc: add error handling wrappers to client/server"
This reverts commit 3f77f0495b.

Signed-off-by: Tonis Tiigi <tonistiigi@gmail.com>
2020-04-22 18:31:27 -07:00
Tonis Tiigi
3f77f0495b grpc: add error handling wrappers to client/server
Signed-off-by: Tonis Tiigi <tonistiigi@gmail.com>
2020-04-21 23:46:11 -07:00
Edgar Lee
423f5f8a97 Allow sessions to hijack the connection outside of a solve
Signed-off-by: Edgar Lee <edgarl@netflix.com>
2020-04-08 12:13:42 -07:00
Tonis Tiigi
6081335ee5 client: allow setting custom dialer
Signed-off-by: Tonis Tiigi <tonistiigi@gmail.com>
2019-03-26 11:33:56 -07:00
Akihiro Suda
2f007a47a9 client: add docker:// connhelper
Signed-off-by: Akihiro Suda <suda.akihiro@lab.ntt.co.jp>
2019-03-26 21:25:01 +09:00
Tonis Tiigi
653fb12ecf buildctl: replace withblock with dial error check
Signed-off-by: Tonis Tiigi <tonistiigi@gmail.com>
2018-09-13 17:29:01 -07:00
Ian Campbell
97ffd6cce8 client: take a context.Context to New().
This allows two things:

- The caller to set a shorter timeout than previously hardcoded 30s. In
  `buildctl` reduce the timeout to 5s. Since the existing timeout has gone
  callers will need to arrange to pass one themselves.
- The caller can arrange for the context to be cancelled for other reasons, use
  this in `buildctl` to plumb through the Ctrl-C handling, meaning that
  `buildctl` now exits almost immediately on Ctrl-C instead of after several
  seconds.

Signed-off-by: Ian Campbell <ijc@docker.com>
2018-06-11 14:28:08 +01:00
Nao YONASHIRO
28fc483de0 client: use grpc.DialContext and context.WithTimeout instead of grpc.WithTimeout
Currently, grpc.WithTimeout is deprecated.
2018-06-05 17:34:49 +09:00
Tonis Tiigi
6b98dedaef Add grpc opentracing support to the binaries
Signed-off-by: Tonis Tiigi <tonistiigi@gmail.com>
2018-01-08 17:49:34 -08:00
Tino Rusch
03f717bd32 transport: add possibility to use TLS secured transport layer on server- and clientside; 2017-12-20 13:30:46 +01:00
Akihiro Suda
2f2b72989c *: buildd -> buildkitd
Signed-off-by: Akihiro Suda <suda.akihiro@lab.ntt.co.jp>
2017-12-19 13:23:27 +09:00
Tonis Tiigi
90d728e194 client: add http source integration test
Signed-off-by: Tonis Tiigi <tonistiigi@gmail.com>
2017-12-02 19:52:15 -08:00
Vincent Demeester
5986fa9947 Allow to use TCP for buildkit daemon and client communication
The next step is to allow TLS configuration.

Signed-off-by: Vincent Demeester <vincent@sbr.pm>
2017-10-07 22:02:15 +02:00
Akihiro Suda
c5ba23d886 client: allow empty address for the system-default value
Signed-off-by: Akihiro Suda <suda.akihiro@lab.ntt.co.jp>
2017-08-08 08:07:51 +00:00
Tonis Tiigi
b573060eea project: remove poc label
Signed-off-by: Tonis Tiigi <tonistiigi@gmail.com>
2017-06-23 09:37:36 -07:00
Tonis Tiigi
5244a14bc2 client: add integration tests
Signed-off-by: Tonis Tiigi <tonistiigi@gmail.com>
2017-06-19 14:35:57 -07:00
Tonis Tiigi
ad25e5e54c client: implement diskusage
Signed-off-by: Tonis Tiigi <tonistiigi@gmail.com>
2017-06-09 14:49:01 -07:00