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

Windows build: Enable RBE build in Windows CI #11107

Merged
merged 30 commits into from
Jun 27, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
30 commits
Select commit Hold shift + click to select a range
b4fd043
Demonstrate working RBE+Windows build
sunjayBhatia Apr 16, 2020
4569cd7
Merge remote-tracking branch 'origin/master' into windows-rbe
sunjayBhatia May 27, 2020
6f9e6f4
Bump envoy-build-tools and bazel-toolchains
sunjayBhatia May 28, 2020
b6dcd43
Fix format for clang10
sunjayBhatia May 28, 2020
7c28955
See if build failure is a persistent issue to look in to
sunjayBhatia May 28, 2020
e86fb37
Update to current bazelbuild, envoy-build-tools
wrowe Jun 4, 2020
68c65b3
Merge remote-tracking branch 'origin/master' into windows-rbe
sunjayBhatia Jun 4, 2020
d34894a
Undo changes for clang10 and update image/comment for Windows
sunjayBhatia Jun 5, 2020
9f42c0a
Fix const override specifier in mock
sunjayBhatia Jun 4, 2020
2d0dfb9
Windows: Tag additional failing tests
sunjayBhatia Jun 4, 2020
acfaa9a
Exclude three more tests on windows caused by cr/lf
sunjayBhatia Jun 5, 2020
fe15be6
Ensure tests that are failing are still compiled to avoid regressions
wrowe Jun 5, 2020
63b0974
Add -skip_on_windows to failing test build
sunjayBhatia Jun 5, 2020
bb25bd5
Merge remote-tracking branch 'origin/master' into windows-rbe
wrowe Jun 5, 2020
8fea89f
Use --test_tag_filters instead of --build_tag_filters
wrowe Jun 5, 2020
ff87bf9
Merge remote-tracking branch 'origin/master' into windows-rbe
sunjayBhatia Jun 5, 2020
5d868d2
Merge remote-tracking branch 'origin/master' into windows-rbe
wrowe Jun 10, 2020
52bab69
Run tests first before compiling failing tests
wrowe Jun 10, 2020
432b532
Merge remote-tracking branch 'origin/master' into windows-rbe
sunjayBhatia Jun 16, 2020
6f0201e
Kick CI
sunjayBhatia Jun 16, 2020
a66171c
Merge remote-tracking branch 'origin/master' into windows-rbe
sunjayBhatia Jun 18, 2020
acaf0cb
Bump build image to latest from envoy-build-tools
sunjayBhatia Jun 18, 2020
54215ba
Add rules_go patch to address RBE issue
wrowe Jun 19, 2020
430677b
Merge remote-tracking branch 'origin/master' into windows-rbe
sunjayBhatia Jun 19, 2020
0abc0a4
Do not skip test, compilation fixed by #11719
wrowe Jun 23, 2020
b6b5ef8
Merge remote-tracking branch 'origin/master' into windows-rbe
sunjayBhatia Jun 23, 2020
dadd99a
Revert "Exclude three more tests on windows caused by cr/lf"
wrowe Jun 23, 2020
50474ef
Merge remote-tracking branch 'origin/master' into windows-rbe
wrowe Jun 25, 2020
3483ec3
Tag failing tests from CI
sunjayBhatia Jun 25, 2020
0d514fb
Merge remote-tracking branch 'origin/master' into windows-rbe
sunjayBhatia Jun 26, 2020
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
2 changes: 2 additions & 0 deletions .azure-pipelines/pipelines.yml
Original file line number Diff line number Diff line change
Expand Up @@ -168,6 +168,8 @@ jobs:
- bash: ci/run_envoy_docker_windows.sh ci/windows_ci_steps.sh
displayName: "Run Windows CI"
env:
ENVOY_RBE: "true"
BAZEL_BUILD_EXTRA_OPTIONS: "--config=remote-ci --config=remote-msvc-cl --jobs=$(RbeJobs)"
BAZEL_REMOTE_CACHE: grpcs://remotebuildexecution.googleapis.com
BAZEL_REMOTE_INSTANCE: projects/envoy-ci/instances/default_instance
GCP_SERVICE_ACCOUNT_KEY: $(GcpServiceAccountKey)
19 changes: 18 additions & 1 deletion .bazelrc
Original file line number Diff line number Diff line change
Expand Up @@ -160,6 +160,11 @@ build:rbe-toolchain-gcc --config=rbe-toolchain
build:rbe-toolchain-gcc --crosstool_top=@rbe_ubuntu_gcc//cc:toolchain
build:rbe-toolchain-gcc --extra_toolchains=@rbe_ubuntu_gcc//config:cc-toolchain

build:rbe-toolchain-msvc-cl --host_platform=@rbe_windows_msvc_cl//config:platform
build:rbe-toolchain-msvc-cl --platforms=@rbe_windows_msvc_cl//config:platform
build:rbe-toolchain-msvc-cl --crosstool_top=@rbe_windows_msvc_cl//cc:toolchain
build:rbe-toolchain-msvc-cl --extra_toolchains=@rbe_windows_msvc_cl//config:cc-toolchain

build:remote --spawn_strategy=remote,sandboxed,local
build:remote --strategy=Javac=remote,sandboxed,local
build:remote --strategy=Closure=remote,sandboxed,local
Expand All @@ -168,6 +173,15 @@ build:remote --remote_timeout=7200
build:remote --auth_enabled=true
build:remote --remote_download_toplevel

# Windows bazel does not allow sandboxed as a spawn strategy
build:remote-windows --spawn_strategy=remote,local
build:remote-windows --strategy=Javac=remote,local
build:remote-windows --strategy=Closure=remote,local
build:remote-windows --strategy=Genrule=remote,local
build:remote-windows --remote_timeout=7200
build:remote-windows --auth_enabled=true
build:remote-windows --remote_download_toplevel

build:remote-clang --config=remote
build:remote-clang --config=rbe-toolchain-clang

Expand All @@ -181,9 +195,12 @@ build:remote-msan --config=remote
build:remote-msan --config=rbe-toolchain-clang-libc++
build:remote-msan --config=rbe-toolchain-msan

build:remote-msvc-cl --config=remote-windows
build:remote-msvc-cl --config=rbe-toolchain-msvc-cl

# Docker sandbox
# NOTE: Update this from https://github.com/envoyproxy/envoy-build-tools/blob/master/toolchains/rbe_toolchains_config.bzl#L8
build:docker-sandbox --experimental_docker_image=envoyproxy/envoy-build-ubuntu:12b3d2c2ffa582507e5d6dd34632b2b990f1b195
build:docker-sandbox --experimental_docker_image=envoyproxy/envoy-build-ubuntu:f21773ab398a879f976936f72c78c9dd3718ca1e
build:docker-sandbox --spawn_strategy=docker
build:docker-sandbox --strategy=Javac=docker
build:docker-sandbox --strategy=Closure=docker
Expand Down
2 changes: 1 addition & 1 deletion .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ executors:
description: "A regular build executor based on ubuntu image"
docker:
# NOTE: Update this from https://github.com/envoyproxy/envoy-build-tools/blob/master/toolchains/rbe_toolchains_config.bzl#L8
- image: envoyproxy/envoy-build-ubuntu:12b3d2c2ffa582507e5d6dd34632b2b990f1b195
- image: envoyproxy/envoy-build-ubuntu:f21773ab398a879f976936f72c78c9dd3718ca1e
resource_class: xlarge
working_directory: /source

Expand Down
2 changes: 1 addition & 1 deletion .devcontainer/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
FROM gcr.io/envoy-ci/envoy-build:12b3d2c2ffa582507e5d6dd34632b2b990f1b195
FROM gcr.io/envoy-ci/envoy-build:f21773ab398a879f976936f72c78c9dd3718ca1e

ARG USERNAME=vscode
ARG USER_UID=501
Expand Down
7 changes: 6 additions & 1 deletion bazel/repositories.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -125,7 +125,12 @@ def _go_deps(skip_targets):
# Keep the skip_targets check around until Istio Proxy has stopped using
# it to exclude the Go rules.
if "io_bazel_rules_go" not in skip_targets:
_repository_impl("io_bazel_rules_go")
_repository_impl(
name = "io_bazel_rules_go",
# TODO(wrowe, sunjayBhatia): remove when Windows RBE supports batch file invocation
patch_args = ["-p1"],
patches = ["@envoy//bazel:rules_go.patch"],
)
_repository_impl("bazel_gazelle")

def envoy_dependencies(skip_targets = []):
Expand Down
16 changes: 8 additions & 8 deletions bazel/repository_locations.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -53,11 +53,11 @@ DEPENDENCY_REPOSITORIES = dict(
use_category = ["build"],
),
bazel_toolchains = dict(
sha256 = "144290c4166bd67e76a54f96cd504ed86416ca3ca82030282760f0823c10be48",
strip_prefix = "bazel-toolchains-3.1.1",
sha256 = "db48eed61552e25d36fe051a65d2a329cc0fb08442627e8f13960c5ab087a44e",
strip_prefix = "bazel-toolchains-3.2.0",
urls = [
"https://github.com/bazelbuild/bazel-toolchains/releases/download/3.1.1/bazel-toolchains-3.1.1.tar.gz",
"https://mirror.bazel.build/github.com/bazelbuild/bazel-toolchains/archive/3.1.1.tar.gz",
"https://github.com/bazelbuild/bazel-toolchains/releases/download/3.2.0/bazel-toolchains-3.2.0.tar.gz",
"https://mirror.bazel.build/github.com/bazelbuild/bazel-toolchains/archive/3.2.0.tar.gz",
],
use_category = ["build"],
),
Expand All @@ -67,10 +67,10 @@ DEPENDENCY_REPOSITORIES = dict(
use_category = ["build"],
),
envoy_build_tools = dict(
sha256 = "b0efe70a1d122fffb89570771f4ec3b912aa0a8a0ce56218223918d7737d01e2",
strip_prefix = "envoy-build-tools-3cbc1d66b9e9ead42daf69e01597cacf4fb52151",
# 2020-05-15
urls = ["https://github.com/envoyproxy/envoy-build-tools/archive/3cbc1d66b9e9ead42daf69e01597cacf4fb52151.tar.gz"],
sha256 = "c4d27c0a5db918e861b7164d69cdffe920daafbe3f597ffdda5a1d10c1abc992",
strip_prefix = "envoy-build-tools-557ee9b44a3d08cf38d9ce6f08adb872c385d6a5",
# 2020-06-16
urls = ["https://github.com/envoyproxy/envoy-build-tools/archive/557ee9b44a3d08cf38d9ce6f08adb872c385d6a5.tar.gz"],
use_category = ["build"],
),
boringssl = dict(
Expand Down
30 changes: 30 additions & 0 deletions bazel/rules_go.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
#
# Bazel RBE on Windows GCP workers currently will not invoke cmd.exe batch files correctly
#
# Symptom is program not found 'bazel-out', because of the way that the CreateProcess command
# is constructed by bazel with actions.run with forward slashes, e.g. the command
# cmd.exe /c "bazel-out/host/bin/external/go_sdk/builder.exe.bat"
# where cmd.exe on GCP is treating 'bazel-out' as the target, and /host as a command line switch.
# This problem was not observed on Azure CI pipelines or locally by the developers. The eventual
# fix is not specific to rules_go; this patch simply addresses immediate breakage and can be removed
# once the underlying issue within Bazel/RBE is fixed.
# See:
# - https://github.com/bazelbuild/rules_go/pull/2542
# - https://github.com/envoyproxy/envoy/issues/11657
#
diff --git a/go/private/rules/binary.bzl b/go/private/rules/binary.bzl
index b88dfd96..e68b5ece 100644
--- a/go/private/rules/binary.bzl
+++ b/go/private/rules/binary.bzl
@@ -128,8 +128,9 @@ def _go_tool_binary_impl(ctx):
content = cmd,
)
ctx.actions.run(
- executable = bat,
- inputs = sdk.libs + sdk.headers + sdk.tools + ctx.files.srcs + [sdk.go],
+ executable = "cmd.exe",
+ arguments = ["/S", "/C", bat.path.replace("/", "\\")],
+ inputs = sdk.libs + sdk.headers + sdk.tools + ctx.files.srcs + [sdk.go, bat],
outputs = [cout],
env = {"GOROOT": sdk.root_file.dirname}, # NOTE(#2005): avoid realpath in sandbox
mnemonic = "GoToolchainBinaryCompile",
5 changes: 2 additions & 3 deletions ci/run_envoy_docker_windows.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,8 @@

set -e

# TODO(sunjayBhatia, wrowe): update this note once we have an RBE toolchain generated for Windows
# NOTE: Update this from the latest pushed image here: https://hub.docker.com/r/envoyproxy/envoy-build-windows2019/tags
ENVOY_BUILD_SHA="9b7dc527351b9888805377a05e5975d6ef8d6ae1"
# The image tag for the Windows image is the same as the Linux one so we use the same mechanism to find it
. $(dirname $0)/envoy_build_sha.sh

[[ -z "${IMAGE_NAME}" ]] && IMAGE_NAME="envoyproxy/envoy-build-windows2019"
# The IMAGE_ID defaults to the CI hash but can be set to an arbitrary image ID (found with 'docker
Expand Down
14 changes: 4 additions & 10 deletions ci/windows_ci_steps.sh
Original file line number Diff line number Diff line change
Expand Up @@ -26,18 +26,12 @@ fi

BAZEL_STARTUP_OPTIONS="--output_base=c:/_eb"
BAZEL_BUILD_OPTIONS="-c opt --config=msvc-cl --show_task_finish --verbose_failures \
--test_output=all ${BAZEL_BUILD_EXTRA_OPTIONS} ${BAZEL_EXTRA_TEST_OPTIONS}"

# With all envoy-static and //test/ tree building, no need to test compile externals
# bazel ${BAZEL_STARTUP_OPTIONS} build ${BAZEL_BUILD_OPTIONS} //bazel/... --build_tag_filters=-skip_on_windows
--test_output=errors ${BAZEL_BUILD_EXTRA_OPTIONS} ${BAZEL_EXTRA_TEST_OPTIONS}"

bazel ${BAZEL_STARTUP_OPTIONS} build ${BAZEL_BUILD_OPTIONS} //source/exe:envoy-static --build_tag_filters=-skip_on_windows

# TODO(sunjayBhatia, wrowe): We are disabling building/running tests for now as the AZP pipelines
# workers do not provide enough resources for us to produce fast enough or reliable enough builds.
# Test compilation of known MSVC-compatible test sources
# bazel ${BAZEL_STARTUP_OPTIONS} build ${BAZEL_BUILD_OPTIONS} //test/... --test_tag_filters=-skip_on_windows --build_tests_only

# Test invocations of known-working tests on Windows
# bazel ${BAZEL_STARTUP_OPTIONS} test ${BAZEL_BUILD_OPTIONS} //test/... --test_tag_filters=-skip_on_windows,-fails_on_windows --build_tests_only --test_summary=terse --test_output=errors
bazel ${BAZEL_STARTUP_OPTIONS} test ${BAZEL_BUILD_OPTIONS} //test/... --test_tag_filters=-skip_on_windows,-fails_on_windows --build_tests_only

# Build tests that are failing to ensure no regressions
bazel ${BAZEL_STARTUP_OPTIONS} build ${BAZEL_BUILD_OPTIONS} //test/... --test_tag_filters=-skip_on_windows,fails_on_windows --build_tests_only
1 change: 1 addition & 0 deletions test/common/event/BUILD
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ envoy_package()
envoy_cc_test(
name = "dispatcher_impl_test",
srcs = ["dispatcher_impl_test.cc"],
tags = ["fails_on_windows"],
deps = [
"//source/common/api:api_lib",
"//source/common/event:deferred_task",
Expand Down
2 changes: 2 additions & 0 deletions test/common/network/utility_test.cc
Original file line number Diff line number Diff line change
Expand Up @@ -171,7 +171,9 @@ TEST_P(NetworkUtilityGetLocalAddress, GetLocalAddress) {

TEST(NetworkUtility, GetOriginalDst) {
testing::NiceMock<Network::MockConnectionSocket> socket;
#ifdef SOL_IP
EXPECT_CALL(socket, ipVersion()).WillOnce(testing::Return(absl::nullopt));
#endif
EXPECT_EQ(nullptr, Utility::getOriginalDst(socket));
}

Expand Down
1 change: 1 addition & 0 deletions test/extensions/filters/http/admission_control/BUILD
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,7 @@ envoy_extension_cc_test(
name = "admission_control_integration_test",
srcs = ["admission_control_integration_test.cc"],
extension_name = "envoy.filters.http.admission_control",
tags = ["fails_on_windows"],
deps = [
"//source/extensions/filters/http/admission_control:config",
"//test/integration:http_integration_lib",
Expand Down
1 change: 1 addition & 0 deletions test/extensions/filters/udp/dns_filter/BUILD
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ envoy_extension_cc_test(
name = "dns_filter_test",
srcs = ["dns_filter_test.cc"],
extension_name = "envoy.filters.udp_listener.dns_filter",
tags = ["fails_on_windows"],
deps = [
":dns_filter_test_lib",
"//source/extensions/filters/udp/dns_filter:dns_filter_lib",
Expand Down
2 changes: 2 additions & 0 deletions test/integration/BUILD
Original file line number Diff line number Diff line change
Expand Up @@ -237,6 +237,7 @@ envoy_cc_test(
srcs = [
"drain_close_integration_test.cc",
],
tags = ["fails_on_windows"],
deps = [
":http_protocol_integration_lib",
"//source/extensions/filters/http/health_check:config",
Expand Down Expand Up @@ -293,6 +294,7 @@ envoy_cc_test(
data = [
"//test/config/integration/certs",
],
tags = ["fails_on_windows"],
deps = [
":http_integration_lib",
"//test/test_common:utility_lib",
Expand Down