Commit Graph

31 Commits

Author SHA1 Message Date
Marat Radchenko
0a5a80cfec Remove pre-Go 1.17 build tags
Signed-off-by: Marat Radchenko <marat@slonopotamus.org>
2024-11-21 10:58:27 +03:00
Tonis Tiigi
c9a25c4d8a pb: regenerate protobuf
Signed-off-by: Tonis Tiigi <tonistiigi@gmail.com>
2024-10-28 12:56:03 -07:00
Jonathan A. Sternberg
41a0a0c37d protobuf: add vtproto as a supplemental marshaler
vtproto is an extra protobuf compiler that generates special methods
suffixed with `VT` that create typed and unrolled marshal and unmarshal
functions similar to gogo that can be used for performance sensitive
code. These extensions are optional for code to use but buildkit uses
them.

A codec is also included to utilize vtproto for grpc code. If the
package `github.com/moby/buildkit/util/grpcutil/encoding/proto` is
imported then vtproto will be used if it exists and otherwise it will
use the standard marshaling and unmarshaling methods.

This codec has an important difference from the default codec. The
default codec will always reset messages before unmarshaling. In most
cases, this is unnecessary and is only relevant for `RecvMsg` on
streams. In most cases, if we are passing in an existing message to this
method, we want to reuse the buffers. This codec will always merge the
message when unmarshaling instead of resetting the input message.

Signed-off-by: Jonathan A. Sternberg <jonathan.sternberg@docker.com>
2024-10-04 12:52:15 -05:00
Jonathan A. Sternberg
ffd8ff490e protobuf: normalize how protobuf files are generated
The relative paths option for protoc generators doesn't work well when
it comes to dependencies. This simplifies the code generation to avoid
using `go generate` and to use one global command for protoc generation.

This is similar to https://github.com/docker/buildx/pull/2713 since the
same problems with code generation occur here too.

Signed-off-by: Jonathan A. Sternberg <jonathan.sternberg@docker.com>
2024-10-03 17:40:53 -05: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
guoguangwu
b94bdb0bbc fix: close files in the toAgentSource func
Signed-off-by: guoguangwu <guoguangwug@gmail.com>
2024-04-26 09:50:24 +08:00
Tonis Tiigi
1f9988911f lint: unusedparams fixes
Signed-off-by: Tonis Tiigi <tonistiigi@gmail.com>
2024-04-09 07:23:16 -07: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
Erik Sipsma
30ea41976d ssh: add fallback to ensure conn is closed in all cases.
Signed-off-by: Erik Sipsma <erik@sipsma.dev>
2023-05-07 15:09:06 -07:00
Aaron Lehmann
8c978cf909 Propagate sshforward send side connection close
PR #3431 caused connections closed on the remote side of a sshforward
session to not always result in the local side reading an EOF from the
connection. This change restores that behavior by closing the write side
of the forwarded connection after reading an EOF from the stream. Since
only the write side is being closed, it doesn't prevent the remote side
from continuing to read from the connection.

Signed-off-by: Aaron Lehmann <alehmann@netflix.com>
2023-01-13 21:39:15 -08:00
Erik Sipsma
eb9e2c974c sshforward: skip conn close on stream CloseSend.
The GRPC docs on RecvMsg say:
> RecvMsg blocks until it receives a message into m or the stream is
> done. It returns io.EOF when the client has performed a CloseSend.
> On any non-EOF error, the stream is aborted and the error contains
> the RPC status.

So if EOF is received that just means the client won't be sending
anymore data. But it may still be expecting to read data, so we
shouldn't close the conn yet.

This was encountered in real life when forwarding a docker socket to a
container, where it appears that the docker CLI closes its write side of
the connection when requesting the stdout/stderr but then expects to
read data after that.

Signed-off-by: Erik Sipsma <erik@sipsma.dev>
2022-12-21 11:30:11 -08:00
Sebastiaan van Stijn
d7cdc0af92 session/sshforward: remove use of obsolete golang.org/x/net/context pkg
This package is an alias for "context", which has been part of
stdlib since go1.7, so should no longer be needed.

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2022-12-08 03:05:13 +01: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
54b8ff2fc8 go fmt: add //go:build
Signed-off-by: CrazyMax <crazy-max@users.noreply.github.com>
2021-10-28 13:26:43 +02:00
Siebe Schaap
c9a5f8893f Fix regular expression to test for Windows named pipe in SSH agent path; allowed backslashes in host.
Signed-off-by: Siebe Schaap <siebe@digibites.nl>
2021-05-27 20:40:43 +02:00
Siebe Schaap
f3bdb4a784 Rename SSH agent forwarding helper parsePlatformSocketPath() to getWindowsPipeDialer().
Signed-off-by: Siebe Schaap <siebe@digibites.nl>
2021-05-27 20:40:43 +02:00
Siebe Schaap
146ea468c9 Update Windows named pipe handling for SSH forwarding to use x/sys/windows rather than syscall.
Signed-off-by: Siebe Schaap <siebe@digibites.nl>
2021-05-27 20:40:43 +02:00
Siebe Schaap
dbbe65baec Update SSH agent socket handling to support Windows OpenSSH using named pipes.
Signed-off-by: Siebe Schaap <siebe@digibites.nl>
2021-05-27 20:40:43 +02:00
Akihiro Suda
13ea18ad08 vendor containerd (requred for rootless overlayfs on kernel 5.11)
Required for rootless overlayfs on kernel 5.11
https://github.com/containerd/containerd/pull/5076

Signed-off-by: Akihiro Suda <akihiro.suda.cz@hco.ntt.co.jp>
2021-03-10 13:51:27 +09:00
Nick Santos
399dacf410 sshprovider: on Windows, ModeSocket might not be set on the ssh socket
Fixes https://github.com/moby/buildkit/issues/914

Signed-off-by: Nick Santos <nicholas.j.santos@gmail.com>
2020-09-22 19:42:38 -04:00
Tonis Tiigi
bd3354fea3 session: avoid deprecated grpc.Stream type
Signed-off-by: Tonis Tiigi <tonistiigi@gmail.com>
2020-07-19 09:28:36 -07:00
Akihiro Suda
7b579cdb98 vendor: update containerd (and various packages)
Signed-off-by: Akihiro Suda <akihiro.suda.cz@hco.ntt.co.jp>
2020-02-28 10:24:10 +09:00
Troels Liebe Bentsen
9c70fb9927 Disallow Extensions for now
Signed-off-by: Troels Liebe Bentsen <tlb@nversion.dk>
2019-11-21 21:57:04 +01:00
Troels Liebe Bentsen
4e7904f37e Inherit extended agent so we get modern sign hashes
Signed-off-by: Troels Liebe Bentsen <tlb@nversion.dk>
2019-11-20 00:15:51 +01:00
Tonis Tiigi
307bdc3c3d exec: fix mount options on userns remapping
Signed-off-by: Tonis Tiigi <tonistiigi@gmail.com>
2019-10-29 14:20:40 -07:00
Tonis Tiigi
bc3a1eefdd session: release forwarded ssh socket connection per connection
Signed-off-by: Tonis Tiigi <tonistiigi@gmail.com>
2019-08-26 15:34:55 -07:00
Tonis Tiigi
d3597181e0 session: wrap errors with debug info
Make sure to cover the grpc errors origins.

Signed-off-by: Tonis Tiigi <tonistiigi@gmail.com>
2019-06-06 21:15:21 -07:00
Tonis Tiigi
632797cef0 vendor: udpate fsutil to b4281fa
Signed-off-by: Tonis Tiigi <tonistiigi@gmail.com>
2019-03-05 17:34:01 -08:00
Tonis Tiigi
0940cdc6fe update golint comments
Signed-off-by: Tonis Tiigi <tonistiigi@gmail.com>
2018-09-18 22:06:47 -07:00
Tonis Tiigi
347420e77f sshprovider: allow keys from local files
Signed-off-by: Tonis Tiigi <tonistiigi@gmail.com>
2018-09-10 14:12:41 -07:00
Tonis Tiigi
6888956557 sshforward: implement ssh socket forwarding
Signed-off-by: Tonis Tiigi <tonistiigi@gmail.com>
2018-09-07 08:57:06 -07:00