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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>