diff options
author | buchgr <buchgr@google.com> | 2018-07-12 04:01:45 -0700 |
---|---|---|
committer | Copybara-Service <copybara-piper@google.com> | 2018-07-12 04:02:54 -0700 |
commit | b50fe8607a94579e30561a7cfb65315e71a50238 (patch) | |
tree | 1e1f7a2d28936561fc336af2d4b315d758a66e36 /src/main/java/com/google/devtools/build/lib/authandtls | |
parent | ef3fed75e478fe63d7a0b9cd61c42d3c5aee509b (diff) |
remote: add a ByteStreamBuildEventArtifactUploader
This change allows local files referenced by the BEP/BES protocol
to be uploaded to a ByteStream gRPC service.
The ByteStreamUploader is now implicitly also used by the BES
module which has a different lifecycle than the remote module.
We introduce reference counting to ensure that the channel is
closed after its no longer needed. This also fixes a bug where
we currently leak one socket per remote build until the Bazel
server is shut down.
RELNOTES: None
PiperOrigin-RevId: 204275316
Diffstat (limited to 'src/main/java/com/google/devtools/build/lib/authandtls')
-rw-r--r-- | src/main/java/com/google/devtools/build/lib/authandtls/GoogleAuthUtils.java | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/src/main/java/com/google/devtools/build/lib/authandtls/GoogleAuthUtils.java b/src/main/java/com/google/devtools/build/lib/authandtls/GoogleAuthUtils.java index 21b6588b1d..a6c51da58f 100644 --- a/src/main/java/com/google/devtools/build/lib/authandtls/GoogleAuthUtils.java +++ b/src/main/java/com/google/devtools/build/lib/authandtls/GoogleAuthUtils.java @@ -19,6 +19,7 @@ import com.google.auth.oauth2.GoogleCredentials; import com.google.common.annotations.VisibleForTesting; import com.google.common.base.Preconditions; import io.grpc.CallCredentials; +import io.grpc.ClientInterceptor; import io.grpc.ManagedChannel; import io.grpc.auth.MoreCallCredentials; import io.grpc.netty.GrpcSslContexts; @@ -42,10 +43,12 @@ public final class GoogleAuthUtils { * * @throws IOException in case the channel can't be constructed. */ - public static ManagedChannel newChannel(String target, AuthAndTLSOptions options) + public static ManagedChannel newChannel(String target, AuthAndTLSOptions options, + ClientInterceptor... interceptors) throws IOException { Preconditions.checkNotNull(target); Preconditions.checkNotNull(options); + Preconditions.checkNotNull(interceptors); final SslContext sslContext = options.tlsEnabled ? createSSlContext(options.tlsCertificate) : null; @@ -54,7 +57,8 @@ public final class GoogleAuthUtils { NettyChannelBuilder builder = NettyChannelBuilder.forTarget(target) .negotiationType(options.tlsEnabled ? NegotiationType.TLS : NegotiationType.PLAINTEXT) - .loadBalancerFactory(RoundRobinLoadBalancerFactory.getInstance()); + .loadBalancerFactory(RoundRobinLoadBalancerFactory.getInstance()) + .intercept(interceptors); if (sslContext != null) { builder.sslContext(sslContext); if (options.tlsAuthorityOverride != null) { |