Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

remote: grpcs (grpc+tls) is used by default for remote URLs #8456

Closed
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -91,6 +91,11 @@ private static boolean isTlsEnabled(String target, AuthAndTLSOptions options) {
if (options.incompatibleTlsEnabledRemoved && options.tlsEnabled) {
throw new IllegalArgumentException("flag --tls_enabled was not found");
}
if (options.incompatibleTlsEnabledRemoved) {
// 'grpcs://' or empty prefix => TLS-enabled
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe expand the comment on empty prefix a bit?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

done

// when no schema prefix is provided in URL, bazel will treat it as a gRPC request with TLS enabled
return !target.startsWith("grpc://");
}
return target.startsWith("grpcs") || options.tlsEnabled;
}

Expand Down
4 changes: 2 additions & 2 deletions src/test/py/bazel/windows_remote_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,8 +31,8 @@ def _RunRemoteBazel(self, args, env_remove=None, env_add=None):
'--strategy=Closure=remote',
'--genrule_strategy=remote',
'--define=EXECUTOR=remote',
'--remote_executor=localhost:' + str(self._worker_port),
'--remote_cache=localhost:' + str(self._worker_port),
'--remote_executor=grpc://localhost:' + str(self._worker_port),
'--remote_cache=grpc://localhost:' + str(self._worker_port),
'--remote_timeout=3600',
'--auth_enabled=false',
'--remote_accept_cached=false',
Expand Down
8 changes: 4 additions & 4 deletions src/test/shell/bazel/remote/remote_execution_http_test.sh
Original file line number Diff line number Diff line change
Expand Up @@ -260,15 +260,15 @@ function test_directory_artifact_skylark() {

bazel build \
--spawn_strategy=remote \
--remote_executor=localhost:${worker_port} \
--remote_executor=grpc://localhost:${worker_port} \
//a:test >& $TEST_log \
|| fail "Failed to build //a:test with remote execution"
diff bazel-genfiles/a/qux/out.txt a/test_expected \
|| fail "Remote execution generated different result"
bazel clean
bazel build \
--spawn_strategy=remote \
--remote_executor=localhost:${worker_port} \
--remote_executor=grpc://localhost:${worker_port} \
//a:test >& $TEST_log \
|| fail "Failed to build //a:test with remote execution"
expect_log "remote cache hit"
Expand All @@ -280,14 +280,14 @@ function test_directory_artifact_skylark_grpc_cache() {
set_directory_artifact_skylark_testfixtures

bazel build \
--remote_cache=localhost:${worker_port} \
--remote_cache=grpc://localhost:${worker_port} \
//a:test >& $TEST_log \
|| fail "Failed to build //a:test with remote gRPC cache"
diff bazel-genfiles/a/qux/out.txt a/test_expected \
|| fail "Remote cache miss generated different result"
bazel clean
bazel build \
--remote_cache=localhost:${worker_port} \
--remote_cache=grpc://localhost:${worker_port} \
//a:test >& $TEST_log \
|| fail "Failed to build //a:test with remote gRPC cache"
expect_log "remote cache hit"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -85,17 +85,17 @@ function tear_down() {
function test_genrule() {
bazel build \
--spawn_strategy=remote \
--remote_executor=localhost:${worker_port} \
--remote_cache=localhost:${worker_port} \
--remote_executor=grpc://localhost:${worker_port} \
--remote_cache=grpc://localhost:${worker_port} \
examples/genrule:simple &> $TEST_log \
|| fail "Hermetic genrule failed: examples/genrule:simple"
}

function test_genrule_can_write_to_path() {
bazel build \
--spawn_strategy=remote \
--remote_executor=localhost:${worker_port} \
--remote_cache=localhost:${worker_port} \
--remote_executor=grpc://localhost:${worker_port} \
--remote_cache=grpc://localhost:${worker_port} \
examples/genrule:writes_to_writable_path &> $TEST_log \
|| fail "Hermetic genrule failed: examples/genrule:writes_to_writable_path"
[ -f "$(cat examples/genrule/writable_path.txt)/out.txt" ] \
Expand All @@ -105,8 +105,8 @@ function test_genrule_can_write_to_path() {
function test_genrule_cannot_write_to_other_path() {
bazel build \
--spawn_strategy=remote \
--remote_executor=localhost:${worker_port} \
--remote_cache=localhost:${worker_port} \
--remote_executor=grpc://localhost:${worker_port} \
--remote_cache=grpc://localhost:${worker_port} \
examples/genrule:writes_to_readonly_path &> $TEST_log \
&& fail "Non-hermetic genrule succeeded: examples/genrule:writes_to_readonly_path" || true
[ -f "$(cat examples/genrule/readonly_path.txt)/out.txt" ] \
Expand Down
Loading