Skip to content

Commit

Permalink
Step 6: Add clang cl pipeline for Windows (#14668)
Browse files Browse the repository at this point in the history
Now that we have regenerated envoy build tools to update bazel and llvm, and picked up the llvm 11 tooling for windows on envoyproxy/master, finally introduce a clang-cl pipeline based on clang-cl

Risk Level: low (new facility)
Testing: local
Docs Changes: TBD
Release Notes: TBD
Platform Specific Features: Windows clang-cl compilation
Replaces #14135
Fixes #11974

Signed-off-by: William A Rowe Jr <wrowe@vmware.com>
Co-authored-by: Sunjay Bhatia <sunjayb@vmware.com>
  • Loading branch information
wrowe and sunjayBhatia authored Jan 29, 2021
1 parent 4dbcb63 commit bad818c
Show file tree
Hide file tree
Showing 8 changed files with 69 additions and 13 deletions.
37 changes: 36 additions & 1 deletion .azure-pipelines/pipelines.yml
Original file line number Diff line number Diff line change
Expand Up @@ -391,7 +391,7 @@ stages:
path: $(Build.StagingDirectory)/repository_cache
continueOnError: true
- bash: ci/run_envoy_docker.sh ci/windows_ci_steps.sh
displayName: "Run Windows CI"
displayName: "Run Windows msvc-cl CI"
env:
CI_TARGET: "windows"
ENVOY_DOCKER_BUILD_DIR: "$(Build.StagingDirectory)"
Expand All @@ -415,6 +415,41 @@ stages:
artifactName: windows.release
condition: always()

- job: clang_cl
timeoutInMinutes: 120
pool:
vmImage: "windows-latest"
steps:
- task: Cache@2
inputs:
key: '"windows.release" | ./WORKSPACE | **/*.bzl'
path: $(Build.StagingDirectory)/repository_cache
continueOnError: true
- bash: ci/run_envoy_docker.sh ci/windows_ci_steps.sh
displayName: "Run Windows clang-cl CI"
env:
CI_TARGET: "windows"
ENVOY_DOCKER_BUILD_DIR: "$(Build.StagingDirectory)"
SLACK_TOKEN: $(SLACK_TOKEN)
REPO_URI: $(Build.Repository.Uri)
BUILD_URI: $(Build.BuildUri)
ENVOY_RBE: "true"
BAZEL_BUILD_EXTRA_OPTIONS: "--config=remote-ci --config=remote-clang-cl --jobs=$(RbeJobs) --flaky_test_attempts=2"
BAZEL_REMOTE_CACHE: grpcs://remotebuildexecution.googleapis.com
BAZEL_REMOTE_INSTANCE: projects/envoy-ci/instances/default_instance
GCP_SERVICE_ACCOUNT_KEY: $(GcpServiceAccountKey)
- task: PublishTestResults@2
inputs:
testResultsFiles: "**/bazel-out/**/testlogs/**/test.xml"
testRunTitle: "clang-cl"
searchFolder: $(Build.StagingDirectory)/tmp
condition: always()
- task: PublishBuildArtifacts@1
inputs:
pathtoPublish: "$(Build.StagingDirectory)/envoy"
artifactName: windows.clang-cl
condition: always()

- job: docker
dependsOn: ["release"]
timeoutInMinutes: 120
Expand Down
6 changes: 4 additions & 2 deletions bazel/envoy_internal.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -69,8 +69,10 @@ def envoy_copts(repository, test = False):
],
repository + "//bazel:gcc_build": ["-Wno-maybe-uninitialized"],
# Allow 'nodiscard' function results values to be discarded for test code only
# TODO(envoyproxy/windows-dev): Replace with /Zc:preprocessor for cl.exe versions >= 16.5
repository + "//bazel:windows_x86_64": ["-wd4834", "-experimental:preprocessor", "-Wv:19.4"] if test else ["-experimental:preprocessor", "-Wv:19.4"],
# TODO(envoyproxy/windows-dev): Replace /Zc:preprocessor with /experimental:preprocessor
# for msvc versions between 15.8 through 16.4.x. see
# https://docs.microsoft.com/en-us/cpp/build/reference/zc-preprocessor
repository + "//bazel:windows_x86_64": ["-wd4834", "-Zc:preprocessor", "-Wv:19.4"] if test else ["-Zc:preprocessor", "-Wv:19.4"],
repository + "//bazel:clang_cl_build": ["-Wno-unused-result"] if test else [],
"//conditions:default": [],
}) + select({
Expand Down
17 changes: 10 additions & 7 deletions ci/windows_ci_steps.sh
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,11 @@ mkdir -p "${ENVOY_BUILD_DIR}"
ENVOY_DELIVERY_DIR="${ENVOY_BUILD_DIR}"/source/exe
mkdir -p "${ENVOY_DELIVERY_DIR}"

FAIL_GROUP=windows
if [[ "${BAZEL_BUILD_EXTRA_OPTIONS[*]}" =~ "clang-cl" ]]; then
FAIL_GROUP=clang_cl
fi

# Test to validate updates of all dependency libraries in bazel/external and bazel/foreign_cc
# bazel "${BAZEL_STARTUP_OPTIONS[@]}" build "${BAZEL_BUILD_OPTIONS[@]}" //bazel/... --build_tag_filters=-skip_on_windows

Expand All @@ -75,15 +80,13 @@ cp -f bazel-bin/source/exe/envoy-static.exe "${ENVOY_DELIVERY_DIR}/envoy.exe"
tar czf "${ENVOY_BUILD_DIR}"/envoy_binary.tar.gz -C "${ENVOY_DELIVERY_DIR}" envoy.exe

# 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,-flaky_on_windows --build_tests_only
bazel "${BAZEL_STARTUP_OPTIONS[@]}" test "${BAZEL_BUILD_OPTIONS[@]}" //test/... --test_tag_filters=-skip_on_windows,-fails_on_${FAIL_GROUP} --build_tests_only

echo "running flaky test reporting script"
"${ENVOY_SRCDIR}"/ci/flaky_test/run_process_xml.sh "$CI_TARGET"

# Build tests that are known-flaky or known-failing to ensure no compilation regressions
bazel "${BAZEL_STARTUP_OPTIONS[@]}" build "${BAZEL_BUILD_OPTIONS[@]}" //test/... --test_tag_filters=-skip_on_windows,fails_on_windows,flaky_on_windows --build_tests_only
# Build tests that are known flaky or failing to ensure no compilation regressions
bazel "${BAZEL_STARTUP_OPTIONS[@]}" build "${BAZEL_BUILD_OPTIONS[@]}" //test/... --test_tag_filters=-skip_on_windows,fails_on_${FAIL_GROUP} --build_tests_only

# Summarize tests bypasssed to monitor the progress of porting to Windows
echo "Tests bypassed as skip_on_windows: $(bazel "${BAZEL_STARTUP_OPTIONS[@]}" query 'kind(".*test rule", attr("tags", "skip_on_windows", //test/...))' 2>/dev/null | sort | wc -l) known unbuildable or inapplicable tests"
echo "Tests bypassed as fails_on_windows: $(bazel "${BAZEL_STARTUP_OPTIONS[@]}" query 'kind(".*test rule", attr("tags", "fails_on_windows", //test/...))' 2>/dev/null | sort | wc -l) known incompatible tests"
echo "Tests bypassed as flaky_on_windows: $(bazel "${BAZEL_STARTUP_OPTIONS[@]}" query 'kind(".*test rule", attr("tags", "flaky_on_windows", //test/...))' 2>/dev/null | sort | wc -l) known unstable tests"
# Summarize known unbuildable or inapplicable tests (example)
# bazel "${BAZEL_STARTUP_OPTIONS[@]}" query 'kind(".*test rule", attr("tags", "skip_on_windows", //test/...))' 2>/dev/null | sort
4 changes: 4 additions & 0 deletions test/common/network/BUILD
Original file line number Diff line number Diff line change
Expand Up @@ -135,6 +135,10 @@ envoy_cc_test(
# Used in createDnsResolver to force creation of DnsResolverImpl when running test on macOS.
"--runtime-feature-disable-for-tests=envoy.restart_features.use_apple_api_for_dns_lookups",
],
# TODO(envoyproxy/windows-dev): Under winsock2 this is behaving unusually for windows, even as
# 127.0.0.1 and ::1 are explicitly added to `c:\windows\system32\drivers\etc\hosts` ... see:
# https://gist.github.com/wrowe/24fe5b93b58bb444bce7ecc134905395
tags = ["fails_on_clang_cl"],
deps = [
"//include/envoy/event:dispatcher_interface",
"//include/envoy/network:address_interface",
Expand Down
3 changes: 3 additions & 0 deletions test/extensions/filters/http/dynamic_forward_proxy/BUILD
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,9 @@ envoy_extension_cc_test(
"//test/config/integration/certs",
],
extension_name = "envoy.filters.http.dynamic_forward_proxy",
# TODO(envoyproxy/windows-dev): Diagnose failure shown on clang-cl build, see:
# https://gist.github.com/wrowe/a152cb1d12c2f751916122aed39d8517
tags = ["fails_on_clang_cl"],
deps = [
"//source/extensions/clusters/dynamic_forward_proxy:cluster",
"//source/extensions/filters/http/dynamic_forward_proxy:config",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,9 @@ envoy_extension_cc_test(
"//test/config/integration/certs",
],
extension_name = "envoy.filters.network.sni_dynamic_forward_proxy",
# TODO(envoyproxy/windows-dev): Diagnose failure shown only on clang-cl build, see:
# https://gist.github.com/wrowe/12b0b7579791c541c789c98563999a2e
tags = ["fails_on_clang_cl"],
deps = [
"//source/extensions/clusters/dynamic_forward_proxy:cluster",
"//source/extensions/filters/listener/tls_inspector:config",
Expand Down
7 changes: 5 additions & 2 deletions test/extensions/quic_listeners/quiche/integration/BUILD
Original file line number Diff line number Diff line change
Expand Up @@ -13,13 +13,16 @@ envoy_cc_test(
size = "medium",
srcs = ["quic_http_integration_test.cc"],
data = ["//test/config/integration/certs"],
# TODO(envoyproxy/windows-dev): Diagnose why opt build test under Windows GCP RBE
# TODO(envoyproxy/windows-dev): Diagnose failure shown only on clang-cl build, see:
# https://gist.github.com/wrowe/a152cb1d12c2f751916122aed39d8517
# TODO(envoyproxy/windows-dev): Diagnose timeout, why opt build test under Windows GCP RBE
# takes 10x as long as on linux (>300s vs ~30s). Shards = 2 solves for windows, see:
# https://github.com/envoyproxy/envoy/pull/13713/files#r512160087
# Each of these tests exceeds 20s;
# QuicHttpIntegrationTests/QuicHttpIntegrationTest.MultipleQuicConnections[With|No]BPF*
tags = [
"flaky_on_windows",
"fails_on_clang_cl",
"fails_on_windows",
"nofips",
],
deps = [
Expand Down
5 changes: 4 additions & 1 deletion test/integration/BUILD
Original file line number Diff line number Diff line change
Expand Up @@ -1129,7 +1129,10 @@ envoy_cc_test(
# TODO(envoyproxy/windows-dev): The key rotation in SdsDynamicKeyRotationIntegrationTest via
# TestEnvironment::renameFile() fails on Windows. The renameFile() implementation does not
# correctly handle symlinks.
tags = ["fails_on_windows"],
tags = [
"fails_on_clang_cl",
"fails_on_windows",
],
deps = [
":http_integration_lib",
"//source/common/config:api_version_lib",
Expand Down

0 comments on commit bad818c

Please sign in to comment.