Commit Graph

44 Commits

Author SHA1 Message Date
Tonis Tiigi
c9a25c4d8a pb: regenerate protobuf
Signed-off-by: Tonis Tiigi <tonistiigi@gmail.com>
2024-10-28 12:56:03 -07:00
Tonis Tiigi
c4a9c39e61 authprovider: add OTEL spans for loading credentials
Credential loading could take long depending on credentials storage.

Signed-off-by: Tonis Tiigi <tonistiigi@gmail.com>
2024-10-16 20:52:09 -07:00
Tonis Tiigi
a6e85c7fd0 tracing: enable OTEL on authprovider requests
Signed-off-by: Tonis Tiigi <tonistiigi@gmail.com>
2024-10-16 20:52:09 -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
x893675
50990100c5 buildctl: Add insecure config for registry-auth-tlscontext flag
Signed-off-by: x893675 <x893675@icloud.com>
2023-11-16 11:25:25 +08:00
Tõnis Tiigi
75896378d7 Merge pull request #4211 from njucjc/support-auth-tls
buildctl: Add configured TLS certificate to trust store when making calls to registry auth
2023-09-15 17:28:40 -07:00
njucjc
2bd8d76504 buildctl: Add configured TLS certificate to trust store when making calls to registry auth
Signed-off-by: njucjc <njucjc@gmail.com>
2023-09-14 14:28:38 +08:00
Aaron Lehmann
95e5f6b76f authprovider: Fix error return from Credentials when logger is nil
This would segfault if SetLogger had not been called, because
progresswriter.Wrap returns nil when its logger arg is nil, causing
Credentials to return nil, nil.

Signed-off-by: Aaron Lehmann <alehmann@netflix.com>
2023-09-11 11:16:18 -07:00
Justin Chadwell
c5402622bb lint: add protolint config
And tidy up the proto definitions to follow the new linting rules.

Signed-off-by: Justin Chadwell <me@jedevc.com>
2023-08-10 13:11:18 +01:00
Nick Santos
c5012139a5 response to comments
Signed-off-by: Nick Santos <nick.santos@docker.com>
2023-05-30 08:01:57 -04:00
Nick Santos
0fa754cde0 authprovider: fix a bug where registry-1.docker.io auth was always a cache miss
Signed-off-by: Nick Santos <nick.santos@docker.com>
2023-05-26 19:21:17 -04:00
Sascha Schwarze
8e6a2c0dd6 lint: fix various gosec findings
Signed-off-by: Sascha Schwarze <schwarzs@de.ibm.com>
2022-10-26 10:16:04 +01:00
Alex Suraci
e6d91fbeaa Docker auth: inject config instead of loading it
Signed-off-by: Alex Suraci <suraci.alex@gmail.com>
2022-06-04 11:54:26 -04:00
Dan Duvall
c99cb34971 authprovider: synchronize all authConfigCache access
Signed-off-by: Dan Duvall <dduvall@wikimedia.org>
2022-05-19 09:25:28 -07:00
Dan Duvall
ed05457d7b authprovider: Cache GetAuthConfig responses which may be expensive
Signed-off-by: Dan Duvall <dduvall@wikimedia.org>
2022-05-17 15:03:54 -07:00
Dan Duvall
b99a251f20 authprovider: support registrytoken field in docker auth config
The Docker CLI supports a field called "registrytoken" within the auth
config that may contain a previously resolved bearer token. If a
value is present, it is used verbatim and OAuth token retrieval using
username/password or identity token is skipped.

Support this same functionality in the buildkit client by checking for
this field's value prior to credential based auth in `FetchToken`. If a
value is set for `AuthConfig.RegistryToken`, short circuit and return
the token value as is.

This feature helps to support registry setups that integrate with third
party auth systems such as GitLab's JWT OmniAuth provider.

Signed-off-by: Dan Duvall <dduvall@wikimedia.org>
2022-05-17 15:03:44 -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
Tonis Tiigi
ed0408ac52 authorizer: default token expiration to 60s
When server does not return expiration time for token
default to 60s. This replaces previous solution
in error handling that broke cross-repo push.

Signed-off-by: Tonis Tiigi <tonistiigi@gmail.com>
2022-02-13 21:51:15 -08:00
Shiwei Zhang
9ae05d8e1d refine auth logic
Signed-off-by: Shiwei Zhang <shizh@microsoft.com>
2022-01-14 10:07:37 +08:00
Tonis Tiigi
3233c5275a authprovider: handle eaccess on storing token seeds
Signed-off-by: Tonis Tiigi <tonistiigi@gmail.com>
2021-07-08 21:37:03 -07:00
Yamazaki Masashi
8a4efe4de7 Remove meaningless encode
Signed-off-by: Yamazaki Masashi <masi19bw@gmail.com>
2021-07-08 00:01:42 +09:00
Tonis Tiigi
53e7116197 session: make sure all token request keep correct context
Signed-off-by: Tonis Tiigi <tonistiigi@gmail.com>
2021-06-08 21:17:35 -07:00
Tonis Tiigi
6157418c76 authprovider: allow errors on seed unmarshal
Signed-off-by: Tonis Tiigi <tonistiigi@gmail.com>
2021-03-29 22:14:41 -07: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
Tonis Tiigi
b7510f7487 authprovider: allow readonly config dir
Signed-off-by: Tonis Tiigi <tonistiigi@gmail.com>
2020-10-21 22:12:51 -07:00
Tonis Tiigi
1f94445456 auth: fetch tokens from client side
Signed-off-by: Tonis Tiigi <tonistiigi@gmail.com>
2020-09-15 13:40:30 -07:00
Tonis Tiigi
f1cd79bf65 resolver: add better pooling and custom authenticator
Signed-off-by: Tonis Tiigi <tonistiigi@gmail.com>
2020-08-13 17:27:11 -07:00
Tonis Tiigi
2e9987ad16 session: track sessions with a group construct
Avoid hidden session passing and allow one session to drop when
multiple builds share a vertex.

Signed-off-by: Tonis Tiigi <tonistiigi@gmail.com>
2020-07-05 00:15:25 -07:00
Tonis Tiigi
c78e875977 remove last instances of errors cause
Signed-off-by: Tonis Tiigi <tonistiigi@gmail.com>
2020-04-24 11:25:53 -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
Tonis Tiigi
0f1c7d0412 session: use errors cause
Signed-off-by: Tonis Tiigi <tonistiigi@gmail.com>
2019-06-06 21:15:21 -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
Akihiro Suda
073aa092e7 authprovider: set stderr
Fix #997

Signed-off-by: Akihiro Suda <akihiro.suda.cz@hco.ntt.co.jp>
2019-05-10 15:45:05 +09:00
Tibor Vass
f467c292da session: add lock to fix hang
Signed-off-by: Tibor Vass <tibor@docker.com>
2019-05-07 21:20:04 +00: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
Akihiro Suda
72c08b5cb9 update containerd (binary: v1.1.0, library: May 11, 2018)
Signed-off-by: Akihiro Suda <suda.akihiro@lab.ntt.co.jp>
2018-05-11 15:46:15 +09:00
Tonis Tiigi
e24e194078 remove net/context references
Signed-off-by: Tonis Tiigi <tonistiigi@gmail.com>
2018-04-30 18:10:54 -07:00
Tonis Tiigi
7ac9599c8f session: separate authprovider to package
Signed-off-by: Tonis Tiigi <tonistiigi@gmail.com>
2018-04-17 20:36:23 -07:00
Ian Campbell
d9b64588cb Regenerate protobuf go file with gogoproto v0.5
This matches the version in vendor.conf, the previous version was `v0.5~25`
according to `git describe`.

Signed-off-by: Ian Campbell <ijc@docker.com>
2018-04-03 13:45:50 +01:00
Ian Campbell
17069fe7e4 Validation and (controlled) generation for go generate'd files.
Modelled after the vendor support provide a validator and an updator for files
produced by `go generate` (which today just means `*.pb.go`).

Main difference from the vendor support is that we are no longer simply nuking
and replacing a single directory, so I ended up hardcoding `*.pb.go` in a bunch
of places which I don't like but cannot see a way around which doesn't risk
nuking people's other local changes.

The generated files are placed in an unpacked form in a `FROM scratch`
container for update. Use a subdirectory and `tar --strip-components` (portable
to MacOS and Linux according to `tar(1)`) since trying to do a `docker export`
of just the root ends up adding `.dockerenv`, `sys`, `proc` and `dev` to the
source tree.

The validate container is not `FROM scratch` because we want `cat`.

The run in `frontend/gateway/pb/generate.go` was missing an include so fix
that.

The versions of `protoc` and the gogo plugins were chosen to regenerate the
existing code as closely as possible. The updates to `*.pg.go` here are all the
result of regenerating with go1.9 which fixed
https://github.com/golang/go/issues/17663 and replaced an invalid timestamp in
the gzip header of the data encoded in `fileDescriptor*`, and adopted a new
standard for marking generated files.

Finally, I noticed that my `docker run`s were missing an `--rm` which I
inherited from `validate-vendor`, so fix all those.

Closes: #322

Signed-off-by: Ian Campbell <ijc@docker.com>
2018-03-28 10:52:16 +01:00
Tonis Tiigi
6e40e83d35 Remove net/context dependencies
Signed-off-by: Tonis Tiigi <tonistiigi@gmail.com>
2018-01-17 09:11:22 -08:00
Tonis Tiigi
51d1c4166f session: expose image auth
Signed-off-by: Tonis Tiigi <tonistiigi@gmail.com>
2017-10-20 12:56:06 +02:00