From 445c935fba78ef2558b5142fd72d8f64bd4d5175 Mon Sep 17 00:00:00 2001 From: mathetake Date: Sun, 22 Nov 2020 13:52:10 +0900 Subject: [PATCH 01/12] Clean up WORKSPACE Signed-off-by: mathetake --- BUILD | 2 +- WORKSPACE | 88 ++---------------------------- bazel/BUILD | 0 bazel/dependencies.bzl | 73 +++++++++++++++++++++++++ bazel/dependencies_extra.bzl | 10 ++++ {test/test_data => bazel}/wasm.bzl | 0 test/BUILD | 2 +- test/test_data/BUILD | 2 +- 8 files changed, 90 insertions(+), 87 deletions(-) create mode 100644 bazel/BUILD create mode 100644 bazel/dependencies.bzl create mode 100644 bazel/dependencies_extra.bzl rename {test/test_data => bazel}/wasm.bzl (100%) diff --git a/BUILD b/BUILD index e9d434b2..fb9aaa44 100644 --- a/BUILD +++ b/BUILD @@ -1,4 +1,4 @@ -load("//:bazel/variables.bzl", "COPTS", "LINKOPTS") +load("@proxy_wasm_cpp_host//bazel:variables.bzl", "COPTS", "LINKOPTS") licenses(["notice"]) # Apache 2 diff --git a/WORKSPACE b/WORKSPACE index 874d39b1..86a9b70c 100644 --- a/WORKSPACE +++ b/WORKSPACE @@ -1,89 +1,9 @@ workspace(name = "proxy_wasm_cpp_host") -load("@bazel_tools//tools/build_defs/repo:http.bzl", "http_archive") -load("@bazel_tools//tools/build_defs/repo:git.bzl", "git_repository") +load("@proxy_wasm_cpp_host//bazel:dependencies.bzl", proxy_wasm_cpp_host_dependencies = "dependencies") -git_repository( - name = "proxy_wasm_cpp_sdk", - commit = "1b5f69ce1535b0c21f88c4af4ebf0ec51d255abe", - remote = "https://github.com/proxy-wasm/proxy-wasm-cpp-sdk", -) +proxy_wasm_cpp_host_dependencies() -http_archive( - name = "com_google_absl", - sha256 = "19391fb4882601a65cb648d638c11aa301ce5f525ef02da1a9eafd22f72d7c59", - strip_prefix = "abseil-cpp-37dd2562ec830d547a1524bb306be313ac3f2556", - # 2020-01-29 - urls = ["https://github.com/abseil/abseil-cpp/archive/37dd2562ec830d547a1524bb306be313ac3f2556.tar.gz"], -) +load("@proxy_wasm_cpp_host//bazel:dependencies_extra.bzl", proxy_wasm_cpp_host_dependencies_extra = "dependencies_extra") -# required by com_google_protobuf -http_archive( - name = "bazel_skylib", - sha256 = "97e70364e9249702246c0e9444bccdc4b847bed1eb03c5a3ece4f83dfe6abc44", - urls = [ - "https://mirror.bazel.build/github.com/bazelbuild/bazel-skylib/releases/download/1.0.2/bazel-skylib-1.0.2.tar.gz", - "https://github.com/bazelbuild/bazel-skylib/releases/download/1.0.2/bazel-skylib-1.0.2.tar.gz", - ], -) - -load("@bazel_skylib//:workspace.bzl", "bazel_skylib_workspace") - -bazel_skylib_workspace() - -# rust rules -http_archive( - name = "io_bazel_rules_rust", - sha256 = "7401878bf966325bbec5224eeb4ff7e8762681070b401acaa168da68d383563a", - strip_prefix = "rules_rust-9741a32e50a8c50c504c0931111bb6048d6d6888", - url = "https://github.com/bazelbuild/rules_rust/archive/9741a32e50a8c50c504c0931111bb6048d6d6888.tar.gz", -) - -load("@io_bazel_rules_rust//rust:repositories.bzl", "rust_repositories") - -rust_repositories() - -load("@io_bazel_rules_rust//:workspace.bzl", "rust_workspace") - -rust_workspace() - -load("//bazel/cargo:crates.bzl", "proxy_wasm_cpp_host_raze__fetch_remote_crates") - -proxy_wasm_cpp_host_raze__fetch_remote_crates() - -git_repository( - name = "com_google_protobuf", - commit = "655310ca192a6e3a050e0ca0b7084a2968072260", - remote = "https://github.com/protocolbuffers/protobuf", - shallow_since = "1565024848 -0700", -) - -http_archive( - name = "boringssl", - sha256 = "bb55b0ed2f0cb548b5dce6a6b8307ce37f7f748eb9f1be6bfe2d266ff2b4d52b", - strip_prefix = "boringssl-2192bbc878822cf6ab5977d4257a1339453d9d39", - urls = ["https://github.com/google/boringssl/archive/2192bbc878822cf6ab5977d4257a1339453d9d39.tar.gz"], -) - -http_archive( - name = "com_google_googletest", - sha256 = "9dc9157a9a1551ec7a7e43daea9a694a0bb5fb8bec81235d8a1e6ef64c716dcb", - strip_prefix = "googletest-release-1.10.0", - urls = ["https://github.com/google/googletest/archive/release-1.10.0.tar.gz"], -) - -http_archive( - name = "wasmtime", - build_file = "@proxy_wasm_cpp_host//bazel/external:wasmtime.BUILD", - sha256 = "7874feb1026bbef06796bd5ab80e73f15b8e83752bde8dc93994f5bc039a4952", - strip_prefix = "wasmtime-0.21.0", - url = "https://github.com/bytecodealliance/wasmtime/archive/v0.21.0.tar.gz", -) - -http_archive( - name = "wasm_c_api", - build_file = "@proxy_wasm_cpp_host//bazel/external:wasm-c-api.BUILD", - sha256 = "aea8cd095e9937f1e14f2c93e026317b197eb2345e7a817fe3932062eb7b792c", - strip_prefix = "wasm-c-api-d9a80099d496b5cdba6f3fe8fc77586e0e505ddc", - url = "https://github.com/WebAssembly/wasm-c-api/archive/d9a80099d496b5cdba6f3fe8fc77586e0e505ddc.tar.gz", -) +proxy_wasm_cpp_host_dependencies_extra() diff --git a/bazel/BUILD b/bazel/BUILD new file mode 100644 index 00000000..e69de29b diff --git a/bazel/dependencies.bzl b/bazel/dependencies.bzl new file mode 100644 index 00000000..c75c9ffd --- /dev/null +++ b/bazel/dependencies.bzl @@ -0,0 +1,73 @@ +load("@bazel_tools//tools/build_defs/repo:http.bzl", "http_archive") + +def dependencies(): + _http_archives() + +def _http_archives(): + http_archive( + name = "proxy_wasm_cpp_sdk", + sha256 = "b97e3e716b1f38dc601487aa0bde72490bbc82b8f3ad73f1f3e69733984955df", + strip_prefix = "proxy-wasm-cpp-sdk-956f0d500c380cc1656a2d861b7ee12c2515a664", + urls = ["https://github.com/proxy-wasm/proxy-wasm-cpp-sdk/archive/956f0d500c380cc1656a2d861b7ee12c2515a664.tar.gz"], + ) + + http_archive( + name = "boringssl", + sha256 = "bb55b0ed2f0cb548b5dce6a6b8307ce37f7f748eb9f1be6bfe2d266ff2b4d52b", + strip_prefix = "boringssl-2192bbc878822cf6ab5977d4257a1339453d9d39", + urls = ["https://github.com/google/boringssl/archive/2192bbc878822cf6ab5977d4257a1339453d9d39.tar.gz"], + ) + + http_archive( + name = "com_google_googletest", + sha256 = "9dc9157a9a1551ec7a7e43daea9a694a0bb5fb8bec81235d8a1e6ef64c716dcb", + strip_prefix = "googletest-release-1.10.0", + urls = ["https://github.com/google/googletest/archive/release-1.10.0.tar.gz"], + ) + + http_archive( + name = "wasmtime", + build_file = "@proxy_wasm_cpp_host//bazel/external:wasmtime.BUILD", + sha256 = "7874feb1026bbef06796bd5ab80e73f15b8e83752bde8dc93994f5bc039a4952", + strip_prefix = "wasmtime-0.21.0", + url = "https://github.com/bytecodealliance/wasmtime/archive/v0.21.0.tar.gz", + ) + + http_archive( + name = "wasm_c_api", + build_file = "@proxy_wasm_cpp_host//bazel/external:wasm-c-api.BUILD", + sha256 = "aea8cd095e9937f1e14f2c93e026317b197eb2345e7a817fe3932062eb7b792c", + strip_prefix = "wasm-c-api-d9a80099d496b5cdba6f3fe8fc77586e0e505ddc", + url = "https://github.com/WebAssembly/wasm-c-api/archive/d9a80099d496b5cdba6f3fe8fc77586e0e505ddc.tar.gz", + ) + + http_archive( + name = "com_google_absl", + sha256 = "19391fb4882601a65cb648d638c11aa301ce5f525ef02da1a9eafd22f72d7c59", + strip_prefix = "abseil-cpp-37dd2562ec830d547a1524bb306be313ac3f2556", + # 2020-01-29 + urls = ["https://github.com/abseil/abseil-cpp/archive/37dd2562ec830d547a1524bb306be313ac3f2556.tar.gz"], + ) + + http_archive( + name = "io_bazel_rules_rust", + sha256 = "7401878bf966325bbec5224eeb4ff7e8762681070b401acaa168da68d383563a", + strip_prefix = "rules_rust-9741a32e50a8c50c504c0931111bb6048d6d6888", + url = "https://github.com/bazelbuild/rules_rust/archive/9741a32e50a8c50c504c0931111bb6048d6d6888.tar.gz", + ) + + http_archive( + name = "bazel_skylib", + sha256 = "97e70364e9249702246c0e9444bccdc4b847bed1eb03c5a3ece4f83dfe6abc44", + urls = [ + "https://mirror.bazel.build/github.com/bazelbuild/bazel-skylib/releases/download/1.0.2/bazel-skylib-1.0.2.tar.gz", + "https://github.com/bazelbuild/bazel-skylib/releases/download/1.0.2/bazel-skylib-1.0.2.tar.gz", + ], + ) + + http_archive( + name = "com_google_protobuf", + sha256 = "59621f4011a95df270748dcc0ec1cc51946473f0e140d4848a2f20c8719e43aa", + strip_prefix = "protobuf-655310ca192a6e3a050e0ca0b7084a2968072260", + url = "https://github.com/protocolbuffers/protobuf/archive/655310ca192a6e3a050e0ca0b7084a2968072260.tar.gz", + ) diff --git a/bazel/dependencies_extra.bzl b/bazel/dependencies_extra.bzl new file mode 100644 index 00000000..25aa15b3 --- /dev/null +++ b/bazel/dependencies_extra.bzl @@ -0,0 +1,10 @@ +load("@io_bazel_rules_rust//:workspace.bzl", "rust_workspace") +load("@io_bazel_rules_rust//rust:repositories.bzl", "rust_repositories") +load("@bazel_skylib//:workspace.bzl", "bazel_skylib_workspace") +load("@proxy_wasm_cpp_host//bazel/cargo:crates.bzl", "proxy_wasm_cpp_host_raze__fetch_remote_crates") + +def dependencies_extra(): + bazel_skylib_workspace() + rust_repositories() + rust_workspace() + proxy_wasm_cpp_host_raze__fetch_remote_crates() diff --git a/test/test_data/wasm.bzl b/bazel/wasm.bzl similarity index 100% rename from test/test_data/wasm.bzl rename to bazel/wasm.bzl diff --git a/test/BUILD b/test/BUILD index 803e59e9..82daf715 100644 --- a/test/BUILD +++ b/test/BUILD @@ -1,5 +1,5 @@ load("@rules_cc//cc:defs.bzl", "cc_test") -load("//:bazel/variables.bzl", "COPTS", "LINKOPTS") +load("@proxy_wasm_cpp_host//bazel:variables.bzl", "COPTS", "LINKOPTS") cc_test( name = "null_vm_test", diff --git a/test/test_data/BUILD b/test/test_data/BUILD index d6797368..051f051c 100644 --- a/test/test_data/BUILD +++ b/test/test_data/BUILD @@ -1,4 +1,4 @@ -load("//test/test_data:wasm.bzl", "wasm_rust_binary") +load("@proxy_wasm_cpp_host//bazel:wasm.bzl", "wasm_rust_binary") package(default_visibility = ["//visibility:public"]) From f0529fed32ae836b0a4c66c40593e7a6cbaf9f43 Mon Sep 17 00:00:00 2001 From: mathetake Date: Sun, 22 Nov 2020 13:57:46 +0900 Subject: [PATCH 02/12] Style: add license Signed-off-by: mathetake --- bazel/dependencies.bzl | 14 ++++++++++++++ bazel/dependencies_extra.bzl | 14 ++++++++++++++ 2 files changed, 28 insertions(+) diff --git a/bazel/dependencies.bzl b/bazel/dependencies.bzl index c75c9ffd..739ad2ba 100644 --- a/bazel/dependencies.bzl +++ b/bazel/dependencies.bzl @@ -1,3 +1,17 @@ +# Copyright 2020 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + load("@bazel_tools//tools/build_defs/repo:http.bzl", "http_archive") def dependencies(): diff --git a/bazel/dependencies_extra.bzl b/bazel/dependencies_extra.bzl index 25aa15b3..2653c1fb 100644 --- a/bazel/dependencies_extra.bzl +++ b/bazel/dependencies_extra.bzl @@ -1,3 +1,17 @@ +# Copyright 2020 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + load("@io_bazel_rules_rust//:workspace.bzl", "rust_workspace") load("@io_bazel_rules_rust//rust:repositories.bzl", "rust_repositories") load("@bazel_skylib//:workspace.bzl", "bazel_skylib_workspace") From 2e53e223509c07c406a5fcd61d396a0c392af5c0 Mon Sep 17 00:00:00 2001 From: mathetake Date: Sun, 22 Nov 2020 14:05:04 +0900 Subject: [PATCH 03/12] Style: explicit load of cc_library Signed-off-by: mathetake --- BUILD | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/BUILD b/BUILD index fb9aaa44..840ccd3a 100644 --- a/BUILD +++ b/BUILD @@ -1,4 +1,5 @@ -load("@proxy_wasm_cpp_host//bazel:variables.bzl", "COPTS", "LINKOPTS") +load("@rules_cc//cc:defs.bzl", "cc_library") +load("@proxy_wasm_cpp_host//bazel:variables.bzl", "COPTS") licenses(["notice"]) # Apache 2 From 3abc2417d51988748309f1f58123d63c5e1254b2 Mon Sep 17 00:00:00 2001 From: mathetake Date: Fri, 27 Nov 2020 18:47:23 +0900 Subject: [PATCH 04/12] Test: build against Envoy Signed-off-by: mathetake --- BUILD | 72 ++++++++ WORKSPACE | 20 +++ bazel/dependencies.bzl | 26 ++- .../envoy/extensions_build_config.bzl | 154 ++++++++++++++++++ bazel/get_workspace_status | 42 +++++ test/integration/BUILD | 12 ++ 6 files changed, 321 insertions(+), 5 deletions(-) create mode 100644 bazel/external/envoy/extensions_build_config.bzl create mode 100644 bazel/get_workspace_status create mode 100644 test/integration/BUILD diff --git a/BUILD b/BUILD index 840ccd3a..046023f7 100644 --- a/BUILD +++ b/BUILD @@ -37,3 +37,75 @@ cc_library( "@wasm_c_api//:wasmtime_lib", ], ) + +cc_library( + name = "common_lib", + srcs = glob([ + "src/*.h", + "src/*.cc", + "src/common/*.h", + "src/common/*.cc", + "src/third_party/*.h", + "src/third_party/*.cc", + ]), + deps = [ + ":include", + "//external:abseil_flat_hash_map", + "//external:abseil_optional", + "//external:abseil_strings", + "//external:protobuf", + "//external:ssl", + "//external:zlib", + "@proxy_wasm_cpp_sdk//:api_lib", + "@proxy_wasm_cpp_sdk//:common_lib", + ], +) + +cc_library( + name = "null_lib", + srcs = glob([ + "src/null/*.cc", + ]), + deps = [ + ":common_lib", + ], +) + +cc_library( + name = "v8_lib", + srcs = glob([ + "src/v8/*.cc", + ]), + deps = [ + ":common_lib", + "//external:wee8", + ], +) + +cc_library( + name = "wavm_lib", + srcs = glob([ + "src/wavm/*.cc", + ]), + copts = [ + '-DWAVM_API=""', + "-Wno-non-virtual-dtor", + "-Wno-old-style-cast", + ], + deps = [ + ":common_lib", + "@envoy//bazel/foreign_cc:wavm", + ], +) + +cc_library( + name = "wasmtime_lib", + srcs = glob([ + "src/wasmtime/*.h", + "src/wasmtime/*.cc", + ]), + deps = [ + ":common_lib", + "@com_github_wasm_c_api//:wasmtime_lib", + ], +) diff --git a/WORKSPACE b/WORKSPACE index 86a9b70c..5b08a7b4 100644 --- a/WORKSPACE +++ b/WORKSPACE @@ -7,3 +7,23 @@ proxy_wasm_cpp_host_dependencies() load("@proxy_wasm_cpp_host//bazel:dependencies_extra.bzl", proxy_wasm_cpp_host_dependencies_extra = "dependencies_extra") proxy_wasm_cpp_host_dependencies_extra() + +load("@envoy//bazel:api_binding.bzl", "envoy_api_binding") + +envoy_api_binding() + +load("@envoy//bazel:api_repositories.bzl", "envoy_api_dependencies") + +envoy_api_dependencies() + +load("@envoy//bazel:repositories.bzl", "envoy_dependencies") + +envoy_dependencies() + +load("@envoy//bazel:repositories_extra.bzl", "envoy_dependencies_extra") + +envoy_dependencies_extra() + +load("@envoy//bazel:dependency_imports.bzl", "envoy_dependency_imports") + +envoy_dependency_imports() diff --git a/bazel/dependencies.bzl b/bazel/dependencies.bzl index 739ad2ba..444dca1a 100644 --- a/bazel/dependencies.bzl +++ b/bazel/dependencies.bzl @@ -14,7 +14,8 @@ load("@bazel_tools//tools/build_defs/repo:http.bzl", "http_archive") -def dependencies(): +def dependencies(name = ""): + _envoy_deps() _http_archives() def _http_archives(): @@ -57,10 +58,9 @@ def _http_archives(): http_archive( name = "com_google_absl", - sha256 = "19391fb4882601a65cb648d638c11aa301ce5f525ef02da1a9eafd22f72d7c59", - strip_prefix = "abseil-cpp-37dd2562ec830d547a1524bb306be313ac3f2556", - # 2020-01-29 - urls = ["https://github.com/abseil/abseil-cpp/archive/37dd2562ec830d547a1524bb306be313ac3f2556.tar.gz"], + sha256 = "e3812f256dd7347a33bf9d93a950cf356c61c0596842ff07d8154cd415145d83", + strip_prefix = "abseil-cpp-5d8fc9192245f0ea67094af57399d7931d6bd53f", + urls = ["https://github.com/abseil/abseil-cpp/archive/5d8fc9192245f0ea67094af57399d7931d6bd53f.tar.gz"], ) http_archive( @@ -84,4 +84,20 @@ def _http_archives(): sha256 = "59621f4011a95df270748dcc0ec1cc51946473f0e140d4848a2f20c8719e43aa", strip_prefix = "protobuf-655310ca192a6e3a050e0ca0b7084a2968072260", url = "https://github.com/protocolbuffers/protobuf/archive/655310ca192a6e3a050e0ca0b7084a2968072260.tar.gz", + patches = ["@envoy//bazel:protobuf.patch"], + patch_args = ["-p1"], + ) + +def _envoy_deps(): + native.new_local_repository( + name = "envoy_build_config", + path = "bazel/external/envoy", + build_file_content = "", + ) + + http_archive( + name = "envoy", + sha256 = "910ef0c163a0b9ff34506a6c787de7239d8f57c558ef8db92b3c71d15fc3a281", + strip_prefix = "envoy-0f7952d1850be92620f2add304c8d95fce028f93", + url = "https://github.com/envoyproxy/envoy/archive/0f7952d1850be92620f2add304c8d95fce028f93.tar.gz", ) diff --git a/bazel/external/envoy/extensions_build_config.bzl b/bazel/external/envoy/extensions_build_config.bzl new file mode 100644 index 00000000..04a1a490 --- /dev/null +++ b/bazel/external/envoy/extensions_build_config.bzl @@ -0,0 +1,154 @@ +# See bazel/README.md for details on how this system works. +EXTENSIONS = { + # + # Access loggers + # + "envoy.access_loggers.file": "//source/extensions/access_loggers/file:config", + "envoy.access_loggers.wasm": "//source/extensions/access_loggers/wasm:config", + + # + # WASM + # + "envoy.bootstrap.wasm": "//source/extensions/bootstrap/wasm:config", + + # + # HTTP filters + # + "envoy.filters.http.router": "//source/extensions/filters/http/router:config", + "envoy.filters.http.wasm": "//source/extensions/filters/http/wasm:config", + + # + # Listener filters + # + "envoy.filters.listener.http_inspector": "//source/extensions/filters/listener/http_inspector:config", + # NOTE: The original_dst filter is implicitly loaded if original_dst functionality is + # configured on the listener. Do not remove it in that case or configs will fail to load. + "envoy.filters.listener.original_dst": "//source/extensions/filters/listener/original_dst:config", + "envoy.filters.listener.original_src": "//source/extensions/filters/listener/original_src:config", + # NOTE: The proxy_protocol filter is implicitly loaded if proxy_protocol functionality is + # configured on the listener. Do not remove it in that case or configs will fail to load. + "envoy.filters.listener.proxy_protocol": "//source/extensions/filters/listener/proxy_protocol:config", + "envoy.filters.listener.tls_inspector": "//source/extensions/filters/listener/tls_inspector:config", + + # + # Network filters + # + "envoy.filters.network.client_ssl_auth": "//source/extensions/filters/network/client_ssl_auth:config", + "envoy.filters.network.direct_response": "//source/extensions/filters/network/direct_response:config", + "envoy.filters.network.dubbo_proxy": "//source/extensions/filters/network/dubbo_proxy:config", + "envoy.filters.network.echo": "//source/extensions/filters/network/echo:config", + "envoy.filters.network.ext_authz": "//source/extensions/filters/network/ext_authz:config", + "envoy.filters.network.http_connection_manager": "//source/extensions/filters/network/http_connection_manager:config", + # WiP + "envoy.filters.network.kafka_broker": "//source/extensions/filters/network/kafka:kafka_broker_config_lib", + "envoy.filters.network.local_ratelimit": "//source/extensions/filters/network/local_ratelimit:config", + "envoy.filters.network.mongo_proxy": "//source/extensions/filters/network/mongo_proxy:config", + "envoy.filters.network.mysql_proxy": "//source/extensions/filters/network/mysql_proxy:config", + "envoy.filters.network.postgres_proxy": "//source/extensions/filters/network/postgres_proxy:config", + "envoy.filters.network.ratelimit": "//source/extensions/filters/network/ratelimit:config", + "envoy.filters.network.rbac": "//source/extensions/filters/network/rbac:config", + "envoy.filters.network.redis_proxy": "//source/extensions/filters/network/redis_proxy:config", + "envoy.filters.network.rocketmq_proxy": "//source/extensions/filters/network/rocketmq_proxy:config", + "envoy.filters.network.tcp_proxy": "//source/extensions/filters/network/tcp_proxy:config", + "envoy.filters.network.thrift_proxy": "//source/extensions/filters/network/thrift_proxy:config", + "envoy.filters.network.sni_cluster": "//source/extensions/filters/network/sni_cluster:config", + "envoy.filters.network.sni_dynamic_forward_proxy": "//source/extensions/filters/network/sni_dynamic_forward_proxy:config", + "envoy.filters.network.wasm": "//source/extensions/filters/network/wasm:config", + "envoy.filters.network.zookeeper_proxy": "//source/extensions/filters/network/zookeeper_proxy:config", + + # + # UDP filters + # + "envoy.filters.udp_listener.dns_filter": "//source/extensions/filters/udp/dns_filter:config", + "envoy.filters.udp_listener.udp_proxy": "//source/extensions/filters/udp/udp_proxy:config", + + # + # Resource monitors + # + "envoy.resource_monitors.fixed_heap": "//source/extensions/resource_monitors/fixed_heap:config", + "envoy.resource_monitors.injected_resource": "//source/extensions/resource_monitors/injected_resource:config", + + # + # Stat sinks + # + "envoy.stat_sinks.dog_statsd": "//source/extensions/stat_sinks/dog_statsd:config", + "envoy.stat_sinks.hystrix": "//source/extensions/stat_sinks/hystrix:config", + "envoy.stat_sinks.metrics_service": "//source/extensions/stat_sinks/metrics_service:config", + "envoy.stat_sinks.statsd": "//source/extensions/stat_sinks/statsd:config", + "envoy.stat_sinks.wasm": "//source/extensions/stat_sinks/wasm:config", + + # + # Thrift filters + # + "envoy.filters.thrift.router": "//source/extensions/filters/network/thrift_proxy/router:config", + "envoy.filters.thrift.ratelimit": "//source/extensions/filters/network/thrift_proxy/filters/ratelimit:config", + + # + # Tracers + # + "envoy.tracers.dynamic_ot": "//source/extensions/tracers/dynamic_ot:config", + "envoy.tracers.lightstep": "//source/extensions/tracers/lightstep:config", + "envoy.tracers.datadog": "//source/extensions/tracers/datadog:config", + "envoy.tracers.zipkin": "//source/extensions/tracers/zipkin:config", + "envoy.tracers.opencensus": "//source/extensions/tracers/opencensus:config", + # WiP + "envoy.tracers.xray": "//source/extensions/tracers/xray:config", + "envoy.tracers.skywalking": "//source/extensions/tracers/skywalking:config", + + # + # Transport sockets + # + "envoy.transport_sockets.alts": "//source/extensions/transport_sockets/alts:config", + "envoy.transport_sockets.upstream_proxy_protocol": "//source/extensions/transport_sockets/proxy_protocol:upstream_config", + "envoy.transport_sockets.raw_buffer": "//source/extensions/transport_sockets/raw_buffer:config", + "envoy.transport_sockets.tap": "//source/extensions/transport_sockets/tap:config", + "envoy.transport_sockets.quic": "//source/extensions/quic_listeners/quiche:quic_factory_lib", + + # + # Retry host predicates + # + "envoy.retry_host_predicates.previous_hosts": "//source/extensions/retry/host/previous_hosts:config", + "envoy.retry_host_predicates.omit_canary_hosts": "//source/extensions/retry/host/omit_canary_hosts:config", + "envoy.retry_host_predicates.omit_host_metadata": "//source/extensions/retry/host/omit_host_metadata:config", + + # + # Retry priorities + # + "envoy.retry_priorities.previous_priorities": "//source/extensions/retry/priority/previous_priorities:config", + + # + # CacheFilter plugins + # + "envoy.filters.http.cache.simple_http_cache": "//source/extensions/filters/http/cache/simple_http_cache:simple_http_cache_lib", + + # + # Internal redirect predicates + # + "envoy.internal_redirect_predicates.allow_listed_routes": "//source/extensions/internal_redirect/allow_listed_routes:config", + "envoy.internal_redirect_predicates.previous_routes": "//source/extensions/internal_redirect/previous_routes:config", + "envoy.internal_redirect_predicates.safe_cross_scheme": "//source/extensions/internal_redirect/safe_cross_scheme:config", + + # + # Http Upstreams (excepting envoy.upstreams.http.generic which is hard-coded into the build so not registered here) + # + "envoy.upstreams.http.http": "//source/extensions/upstreams/http/http:config", + "envoy.upstreams.http.tcp": "//source/extensions/upstreams/http/tcp:config", + + # + # Watchdog actions + # + "envoy.watchdog.profile_action": "//source/extensions/watchdog/profile_action:config", + + # + # WebAssembly runtimes + # + "envoy.wasm.runtime.null": "//source/extensions/wasm_runtime/null:config", + "envoy.wasm.runtime.v8": "//source/extensions/wasm_runtime/v8:config", + "envoy.wasm.runtime.wavm": "//source/extensions/wasm_runtime/wavm:config", + "envoy.wasm.runtime.wasmtime": "//source/extensions/wasm_runtime/wasmtime:config", +} + +# These can be changed to ["//visibility:public"], for downstream builds which +# need to directly reference Envoy extensions. +EXTENSION_CONFIG_VISIBILITY = ["//:extension_config"] +EXTENSION_PACKAGE_VISIBILITY = ["//:extension_library"] diff --git a/bazel/get_workspace_status b/bazel/get_workspace_status new file mode 100644 index 00000000..4cfce22f --- /dev/null +++ b/bazel/get_workspace_status @@ -0,0 +1,42 @@ +#!/bin/bash + +# This file was imported from https://github.com/bazelbuild/bazel at d6fec93. + +# This script will be run bazel when building process starts to +# generate key-value information that represents the status of the +# workspace. The output should be like +# +# KEY1 VALUE1 +# KEY2 VALUE2 +# +# If the script exits with non-zero code, it's considered as a failure +# and the output will be discarded. + +# For Envoy in particular, we want to force binaries to relink when the Git +# SHA changes (https://github.com/envoyproxy/envoy/issues/2551). This can be +# done by prefixing keys with "STABLE_". To avoid breaking compatibility with +# other status scripts, this one still echos the non-stable ("volatile") names. + +# If this SOURCE_VERSION file exists then it must have been placed here by a +# distribution doing a non-git, source build. +# Distributions would be expected to echo the commit/tag as BUILD_SCM_REVISION +if [ -f SOURCE_VERSION ] +then + echo "BUILD_SCM_REVISION $(cat SOURCE_VERSION)" + echo "STABLE_BUILD_SCM_REVISION $(cat SOURCE_VERSION)" + echo "BUILD_SCM_STATUS Distribution" + exit 0 +fi + +# The code below presents an implementation that works for git repository +git_rev=$(git rev-parse HEAD) || exit 1 +echo "BUILD_SCM_REVISION ${git_rev}" +echo "STABLE_BUILD_SCM_REVISION ${git_rev}" + +# Check whether there are any uncommitted changes +tree_status="Clean" +git diff-index --quiet HEAD -- || { + tree_status="Modified" +} +echo "BUILD_SCM_STATUS ${tree_status}" +echo "STABLE_BUILD_SCM_STATUS ${tree_status}" diff --git a/test/integration/BUILD b/test/integration/BUILD new file mode 100644 index 00000000..2d878699 --- /dev/null +++ b/test/integration/BUILD @@ -0,0 +1,12 @@ +load( + "@envoy//bazel:envoy_build_system.bzl", + "envoy_cc_binary", +) + +envoy_cc_binary( + name = "envoy", + repository = "@envoy", + deps = [ + "@envoy//source/exe:envoy_main_entry_lib", + ], +) From a810305ae1886a1eb2a3ee5aa7bb958de9209221 Mon Sep 17 00:00:00 2001 From: mathetake Date: Fri, 27 Nov 2020 19:16:47 +0900 Subject: [PATCH 05/12] Clean up extensions in Envoy Signed-off-by: mathetake --- .bazelversion | 1 + .github/workflows/cpp.yml | 11 ++ bazel/dependencies.bzl | 13 ++- .../envoy/extensions_build_config.bzl | 103 ------------------ test/integration/BUILD | 12 -- 5 files changed, 22 insertions(+), 118 deletions(-) create mode 100644 .bazelversion delete mode 100644 test/integration/BUILD diff --git a/.bazelversion b/.bazelversion new file mode 100644 index 00000000..084e244c --- /dev/null +++ b/.bazelversion @@ -0,0 +1 @@ +3.6.0 \ No newline at end of file diff --git a/.github/workflows/cpp.yml b/.github/workflows/cpp.yml index 59713c0a..3af79bb1 100644 --- a/.github/workflows/cpp.yml +++ b/.github/workflows/cpp.yml @@ -75,3 +75,14 @@ jobs: - name: Test run: | "${GITHUB_WORKSPACE}/bin/bazel" test //... + + integration: # TODO: add setup.sh + runs-on: ubuntu-latest + container: + image: gcr.io/envoy-ci/envoy-build:19a268cfe3d12625380e7c61d2467c8779b58b56 + steps: + - uses: actions/checkout@v2 + + - name: Test + run: | + "bazel" test //integration_test/... diff --git a/bazel/dependencies.bzl b/bazel/dependencies.bzl index 444dca1a..2a79cab3 100644 --- a/bazel/dependencies.bzl +++ b/bazel/dependencies.bzl @@ -19,6 +19,13 @@ def dependencies(name = ""): _http_archives() def _http_archives(): + http_archive( + name = "rules_cc", + sha256 = "9d48151ea71b3e225adfb6867e6d2c7d0dce46cbdc8710d9a9a628574dfd40a0", + strip_prefix = "rules_cc-818289e5613731ae410efb54218a4077fb9dbb03", + urls = ["https://github.com/bazelbuild/rules_cc/archive/818289e5613731ae410efb54218a4077fb9dbb03.tar.gz"], + ) + http_archive( name = "proxy_wasm_cpp_sdk", sha256 = "b97e3e716b1f38dc601487aa0bde72490bbc82b8f3ad73f1f3e69733984955df", @@ -81,9 +88,9 @@ def _http_archives(): http_archive( name = "com_google_protobuf", - sha256 = "59621f4011a95df270748dcc0ec1cc51946473f0e140d4848a2f20c8719e43aa", - strip_prefix = "protobuf-655310ca192a6e3a050e0ca0b7084a2968072260", - url = "https://github.com/protocolbuffers/protobuf/archive/655310ca192a6e3a050e0ca0b7084a2968072260.tar.gz", + sha256 = "465fd9367992a9b9c4fba34a549773735da200903678b81b25f367982e8df376", + strip_prefix = "protobuf-3.13.0", + url = "https://github.com/protocolbuffers/protobuf/releases/download/v3.13.0/protobuf-all-3.13.0.tar.gz", patches = ["@envoy//bazel:protobuf.patch"], patch_args = ["-p1"], ) diff --git a/bazel/external/envoy/extensions_build_config.bzl b/bazel/external/envoy/extensions_build_config.bzl index 04a1a490..92987452 100644 --- a/bazel/external/envoy/extensions_build_config.bzl +++ b/bazel/external/envoy/extensions_build_config.bzl @@ -17,128 +17,25 @@ EXTENSIONS = { "envoy.filters.http.router": "//source/extensions/filters/http/router:config", "envoy.filters.http.wasm": "//source/extensions/filters/http/wasm:config", - # - # Listener filters - # - "envoy.filters.listener.http_inspector": "//source/extensions/filters/listener/http_inspector:config", - # NOTE: The original_dst filter is implicitly loaded if original_dst functionality is - # configured on the listener. Do not remove it in that case or configs will fail to load. - "envoy.filters.listener.original_dst": "//source/extensions/filters/listener/original_dst:config", - "envoy.filters.listener.original_src": "//source/extensions/filters/listener/original_src:config", - # NOTE: The proxy_protocol filter is implicitly loaded if proxy_protocol functionality is - # configured on the listener. Do not remove it in that case or configs will fail to load. - "envoy.filters.listener.proxy_protocol": "//source/extensions/filters/listener/proxy_protocol:config", - "envoy.filters.listener.tls_inspector": "//source/extensions/filters/listener/tls_inspector:config", - # # Network filters # - "envoy.filters.network.client_ssl_auth": "//source/extensions/filters/network/client_ssl_auth:config", - "envoy.filters.network.direct_response": "//source/extensions/filters/network/direct_response:config", - "envoy.filters.network.dubbo_proxy": "//source/extensions/filters/network/dubbo_proxy:config", "envoy.filters.network.echo": "//source/extensions/filters/network/echo:config", - "envoy.filters.network.ext_authz": "//source/extensions/filters/network/ext_authz:config", "envoy.filters.network.http_connection_manager": "//source/extensions/filters/network/http_connection_manager:config", - # WiP - "envoy.filters.network.kafka_broker": "//source/extensions/filters/network/kafka:kafka_broker_config_lib", - "envoy.filters.network.local_ratelimit": "//source/extensions/filters/network/local_ratelimit:config", - "envoy.filters.network.mongo_proxy": "//source/extensions/filters/network/mongo_proxy:config", - "envoy.filters.network.mysql_proxy": "//source/extensions/filters/network/mysql_proxy:config", - "envoy.filters.network.postgres_proxy": "//source/extensions/filters/network/postgres_proxy:config", - "envoy.filters.network.ratelimit": "//source/extensions/filters/network/ratelimit:config", - "envoy.filters.network.rbac": "//source/extensions/filters/network/rbac:config", - "envoy.filters.network.redis_proxy": "//source/extensions/filters/network/redis_proxy:config", - "envoy.filters.network.rocketmq_proxy": "//source/extensions/filters/network/rocketmq_proxy:config", "envoy.filters.network.tcp_proxy": "//source/extensions/filters/network/tcp_proxy:config", - "envoy.filters.network.thrift_proxy": "//source/extensions/filters/network/thrift_proxy:config", - "envoy.filters.network.sni_cluster": "//source/extensions/filters/network/sni_cluster:config", - "envoy.filters.network.sni_dynamic_forward_proxy": "//source/extensions/filters/network/sni_dynamic_forward_proxy:config", "envoy.filters.network.wasm": "//source/extensions/filters/network/wasm:config", - "envoy.filters.network.zookeeper_proxy": "//source/extensions/filters/network/zookeeper_proxy:config", - - # - # UDP filters - # - "envoy.filters.udp_listener.dns_filter": "//source/extensions/filters/udp/dns_filter:config", - "envoy.filters.udp_listener.udp_proxy": "//source/extensions/filters/udp/udp_proxy:config", - - # - # Resource monitors - # - "envoy.resource_monitors.fixed_heap": "//source/extensions/resource_monitors/fixed_heap:config", - "envoy.resource_monitors.injected_resource": "//source/extensions/resource_monitors/injected_resource:config", # # Stat sinks # - "envoy.stat_sinks.dog_statsd": "//source/extensions/stat_sinks/dog_statsd:config", - "envoy.stat_sinks.hystrix": "//source/extensions/stat_sinks/hystrix:config", - "envoy.stat_sinks.metrics_service": "//source/extensions/stat_sinks/metrics_service:config", - "envoy.stat_sinks.statsd": "//source/extensions/stat_sinks/statsd:config", "envoy.stat_sinks.wasm": "//source/extensions/stat_sinks/wasm:config", - # - # Thrift filters - # - "envoy.filters.thrift.router": "//source/extensions/filters/network/thrift_proxy/router:config", - "envoy.filters.thrift.ratelimit": "//source/extensions/filters/network/thrift_proxy/filters/ratelimit:config", - - # - # Tracers - # - "envoy.tracers.dynamic_ot": "//source/extensions/tracers/dynamic_ot:config", - "envoy.tracers.lightstep": "//source/extensions/tracers/lightstep:config", - "envoy.tracers.datadog": "//source/extensions/tracers/datadog:config", - "envoy.tracers.zipkin": "//source/extensions/tracers/zipkin:config", - "envoy.tracers.opencensus": "//source/extensions/tracers/opencensus:config", - # WiP - "envoy.tracers.xray": "//source/extensions/tracers/xray:config", - "envoy.tracers.skywalking": "//source/extensions/tracers/skywalking:config", - - # - # Transport sockets - # - "envoy.transport_sockets.alts": "//source/extensions/transport_sockets/alts:config", - "envoy.transport_sockets.upstream_proxy_protocol": "//source/extensions/transport_sockets/proxy_protocol:upstream_config", - "envoy.transport_sockets.raw_buffer": "//source/extensions/transport_sockets/raw_buffer:config", - "envoy.transport_sockets.tap": "//source/extensions/transport_sockets/tap:config", - "envoy.transport_sockets.quic": "//source/extensions/quic_listeners/quiche:quic_factory_lib", - - # - # Retry host predicates - # - "envoy.retry_host_predicates.previous_hosts": "//source/extensions/retry/host/previous_hosts:config", - "envoy.retry_host_predicates.omit_canary_hosts": "//source/extensions/retry/host/omit_canary_hosts:config", - "envoy.retry_host_predicates.omit_host_metadata": "//source/extensions/retry/host/omit_host_metadata:config", - - # - # Retry priorities - # - "envoy.retry_priorities.previous_priorities": "//source/extensions/retry/priority/previous_priorities:config", - - # - # CacheFilter plugins - # - "envoy.filters.http.cache.simple_http_cache": "//source/extensions/filters/http/cache/simple_http_cache:simple_http_cache_lib", - - # - # Internal redirect predicates - # - "envoy.internal_redirect_predicates.allow_listed_routes": "//source/extensions/internal_redirect/allow_listed_routes:config", - "envoy.internal_redirect_predicates.previous_routes": "//source/extensions/internal_redirect/previous_routes:config", - "envoy.internal_redirect_predicates.safe_cross_scheme": "//source/extensions/internal_redirect/safe_cross_scheme:config", - # # Http Upstreams (excepting envoy.upstreams.http.generic which is hard-coded into the build so not registered here) # "envoy.upstreams.http.http": "//source/extensions/upstreams/http/http:config", "envoy.upstreams.http.tcp": "//source/extensions/upstreams/http/tcp:config", - # - # Watchdog actions - # - "envoy.watchdog.profile_action": "//source/extensions/watchdog/profile_action:config", - # # WebAssembly runtimes # diff --git a/test/integration/BUILD b/test/integration/BUILD deleted file mode 100644 index 2d878699..00000000 --- a/test/integration/BUILD +++ /dev/null @@ -1,12 +0,0 @@ -load( - "@envoy//bazel:envoy_build_system.bzl", - "envoy_cc_binary", -) - -envoy_cc_binary( - name = "envoy", - repository = "@envoy", - deps = [ - "@envoy//source/exe:envoy_main_entry_lib", - ], -) From 2bc1c6175e66386ad7e6173f1d376951defef094 Mon Sep 17 00:00:00 2001 From: mathetake Date: Fri, 27 Nov 2020 19:17:56 +0900 Subject: [PATCH 06/12] Fix github workflow Signed-off-by: mathetake --- .github/workflows/cpp.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/cpp.yml b/.github/workflows/cpp.yml index 3af79bb1..0df538ab 100644 --- a/.github/workflows/cpp.yml +++ b/.github/workflows/cpp.yml @@ -78,7 +78,7 @@ jobs: integration: # TODO: add setup.sh runs-on: ubuntu-latest - container: + container: image: gcr.io/envoy-ci/envoy-build:19a268cfe3d12625380e7c61d2467c8779b58b56 steps: - uses: actions/checkout@v2 From 030b46db1081a7942e25e5d4f6575e4e4941f8e2 Mon Sep 17 00:00:00 2001 From: mathetake Date: Fri, 27 Nov 2020 19:21:51 +0900 Subject: [PATCH 07/12] Add integration_test/** Signed-off-by: mathetake --- integration_test/BUILD | 23 +++++++++++++++++++++++ integration_test/tmp.cc | 0 2 files changed, 23 insertions(+) create mode 100644 integration_test/BUILD create mode 100644 integration_test/tmp.cc diff --git a/integration_test/BUILD b/integration_test/BUILD new file mode 100644 index 00000000..929e91f9 --- /dev/null +++ b/integration_test/BUILD @@ -0,0 +1,23 @@ +load("@rules_cc//cc:defs.bzl", "cc_test") +load( + "@envoy//bazel:envoy_build_system.bzl", + "envoy_cc_binary", +) + +envoy_cc_binary( + name = "envoy", + repository = "@envoy", + deps = [ + "@envoy//source/exe:envoy_main_entry_lib", + ], +) + +cc_test( + name = "tmp_test", + srcs = ["tmp.cc"], + deps = [ + ":envoy", + "@com_google_googletest//:gtest", + "@com_google_googletest//:gtest_main", + ], +) diff --git a/integration_test/tmp.cc b/integration_test/tmp.cc new file mode 100644 index 00000000..e69de29b From d2425d6c04a18f47308647a3182888fb8717d012 Mon Sep 17 00:00:00 2001 From: mathetake Date: Fri, 27 Nov 2020 19:24:45 +0900 Subject: [PATCH 08/12] Add --define wasm=wasmtime Signed-off-by: mathetake --- .github/workflows/cpp.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/cpp.yml b/.github/workflows/cpp.yml index 0df538ab..de3bd05e 100644 --- a/.github/workflows/cpp.yml +++ b/.github/workflows/cpp.yml @@ -85,4 +85,4 @@ jobs: - name: Test run: | - "bazel" test //integration_test/... + "bazel" test //integration_test/... --define wasm=wasmtime --verbose_failures From e2c1fbb0c331b07e21d2a2895cbeb8b530f859c9 Mon Sep 17 00:00:00 2001 From: mathetake Date: Fri, 27 Nov 2020 19:28:03 +0900 Subject: [PATCH 09/12] Limit test target in 'build' job Signed-off-by: mathetake --- .github/workflows/cpp.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/cpp.yml b/.github/workflows/cpp.yml index de3bd05e..46492d10 100644 --- a/.github/workflows/cpp.yml +++ b/.github/workflows/cpp.yml @@ -74,7 +74,7 @@ jobs: - name: Test run: | - "${GITHUB_WORKSPACE}/bin/bazel" test //... + "${GITHUB_WORKSPACE}/bin/bazel" test //test/... integration: # TODO: add setup.sh runs-on: ubuntu-latest From 96c1f64506579b7fbb5d01161a4d1fabc2d45fef Mon Sep 17 00:00:00 2001 From: mathetake Date: Fri, 27 Nov 2020 23:39:19 +0900 Subject: [PATCH 10/12] Add .bazelrc, and cache .cache/bazel Signed-off-by: mathetake --- .bazelrc | 5 ++++ .github/workflows/cpp.yml | 11 ++++++-- bazel/get_workspace_status | 42 ----------------------------- integration_test/{ => envoy}/BUILD | 0 integration_test/{ => envoy}/tmp.cc | 0 5 files changed, 14 insertions(+), 44 deletions(-) create mode 100644 .bazelrc delete mode 100644 bazel/get_workspace_status rename integration_test/{ => envoy}/BUILD (100%) rename integration_test/{ => envoy}/tmp.cc (100%) diff --git a/.bazelrc b/.bazelrc new file mode 100644 index 00000000..b7c51210 --- /dev/null +++ b/.bazelrc @@ -0,0 +1,5 @@ +build --copt=-fPIC +build --cxxopt=-std=c++17 +build --conlyopt=-fexceptions +build --fission=dbg,opt +build --features=per_object_debug_info diff --git a/.github/workflows/cpp.yml b/.github/workflows/cpp.yml index 46492d10..e641f22f 100644 --- a/.github/workflows/cpp.yml +++ b/.github/workflows/cpp.yml @@ -76,13 +76,20 @@ jobs: run: | "${GITHUB_WORKSPACE}/bin/bazel" test //test/... - integration: # TODO: add setup.sh + integration-test-envoy: # TODO: add setup.sh runs-on: ubuntu-latest container: image: gcr.io/envoy-ci/envoy-build:19a268cfe3d12625380e7c61d2467c8779b58b56 steps: - uses: actions/checkout@v2 + - uses: actions/cache@v2 + with: + path: ~/.cache/bazel + # TODO: find better keys + # ${ENVOY_HASH}-YYYY-MM-DD + key: 0f7952d1850be92620f2add304c8d95fce028f93-2020-11-27 + - name: Test run: | - "bazel" test //integration_test/... --define wasm=wasmtime --verbose_failures + "bazel" test //integration_test/envoy/... --define wasm=wasmtime --verbose_failures diff --git a/bazel/get_workspace_status b/bazel/get_workspace_status deleted file mode 100644 index 4cfce22f..00000000 --- a/bazel/get_workspace_status +++ /dev/null @@ -1,42 +0,0 @@ -#!/bin/bash - -# This file was imported from https://github.com/bazelbuild/bazel at d6fec93. - -# This script will be run bazel when building process starts to -# generate key-value information that represents the status of the -# workspace. The output should be like -# -# KEY1 VALUE1 -# KEY2 VALUE2 -# -# If the script exits with non-zero code, it's considered as a failure -# and the output will be discarded. - -# For Envoy in particular, we want to force binaries to relink when the Git -# SHA changes (https://github.com/envoyproxy/envoy/issues/2551). This can be -# done by prefixing keys with "STABLE_". To avoid breaking compatibility with -# other status scripts, this one still echos the non-stable ("volatile") names. - -# If this SOURCE_VERSION file exists then it must have been placed here by a -# distribution doing a non-git, source build. -# Distributions would be expected to echo the commit/tag as BUILD_SCM_REVISION -if [ -f SOURCE_VERSION ] -then - echo "BUILD_SCM_REVISION $(cat SOURCE_VERSION)" - echo "STABLE_BUILD_SCM_REVISION $(cat SOURCE_VERSION)" - echo "BUILD_SCM_STATUS Distribution" - exit 0 -fi - -# The code below presents an implementation that works for git repository -git_rev=$(git rev-parse HEAD) || exit 1 -echo "BUILD_SCM_REVISION ${git_rev}" -echo "STABLE_BUILD_SCM_REVISION ${git_rev}" - -# Check whether there are any uncommitted changes -tree_status="Clean" -git diff-index --quiet HEAD -- || { - tree_status="Modified" -} -echo "BUILD_SCM_STATUS ${tree_status}" -echo "STABLE_BUILD_SCM_STATUS ${tree_status}" diff --git a/integration_test/BUILD b/integration_test/envoy/BUILD similarity index 100% rename from integration_test/BUILD rename to integration_test/envoy/BUILD diff --git a/integration_test/tmp.cc b/integration_test/envoy/tmp.cc similarity index 100% rename from integration_test/tmp.cc rename to integration_test/envoy/tmp.cc From 3d36ce08634410684824e518f1ae9f6de8c6faff Mon Sep 17 00:00:00 2001 From: mathetake Date: Sat, 28 Nov 2020 01:11:11 +0900 Subject: [PATCH 11/12] Remove unnecessary extensions Signed-off-by: mathetake --- .bazelversion | 2 +- .github/workflows/cpp.yml | 2 +- bazel/external/envoy/extensions_build_config.bzl | 8 -------- 3 files changed, 2 insertions(+), 10 deletions(-) diff --git a/.bazelversion b/.bazelversion index 084e244c..40c341bd 100644 --- a/.bazelversion +++ b/.bazelversion @@ -1 +1 @@ -3.6.0 \ No newline at end of file +3.6.0 diff --git a/.github/workflows/cpp.yml b/.github/workflows/cpp.yml index e641f22f..f9d2ecbe 100644 --- a/.github/workflows/cpp.yml +++ b/.github/workflows/cpp.yml @@ -76,7 +76,7 @@ jobs: run: | "${GITHUB_WORKSPACE}/bin/bazel" test //test/... - integration-test-envoy: # TODO: add setup.sh + integration-test-envoy: runs-on: ubuntu-latest container: image: gcr.io/envoy-ci/envoy-build:19a268cfe3d12625380e7c61d2467c8779b58b56 diff --git a/bazel/external/envoy/extensions_build_config.bzl b/bazel/external/envoy/extensions_build_config.bzl index 92987452..b80e519c 100644 --- a/bazel/external/envoy/extensions_build_config.bzl +++ b/bazel/external/envoy/extensions_build_config.bzl @@ -3,7 +3,6 @@ EXTENSIONS = { # # Access loggers # - "envoy.access_loggers.file": "//source/extensions/access_loggers/file:config", "envoy.access_loggers.wasm": "//source/extensions/access_loggers/wasm:config", # @@ -20,7 +19,6 @@ EXTENSIONS = { # # Network filters # - "envoy.filters.network.echo": "//source/extensions/filters/network/echo:config", "envoy.filters.network.http_connection_manager": "//source/extensions/filters/network/http_connection_manager:config", "envoy.filters.network.tcp_proxy": "//source/extensions/filters/network/tcp_proxy:config", "envoy.filters.network.wasm": "//source/extensions/filters/network/wasm:config", @@ -30,12 +28,6 @@ EXTENSIONS = { # "envoy.stat_sinks.wasm": "//source/extensions/stat_sinks/wasm:config", - # - # Http Upstreams (excepting envoy.upstreams.http.generic which is hard-coded into the build so not registered here) - # - "envoy.upstreams.http.http": "//source/extensions/upstreams/http/http:config", - "envoy.upstreams.http.tcp": "//source/extensions/upstreams/http/tcp:config", - # # WebAssembly runtimes # From 47bddba8147c35b006ea95d1ef3868971fabeac7 Mon Sep 17 00:00:00 2001 From: mathetake Date: Sat, 28 Nov 2020 01:27:47 +0900 Subject: [PATCH 12/12] Add license, Clean up extensions_build_config.bzl Signed-off-by: mathetake --- BUILD | 27 ------------- .../envoy/extensions_build_config.bzl | 40 +++++++------------ integration_test/envoy/tmp.cc | 14 +++++++ 3 files changed, 28 insertions(+), 53 deletions(-) diff --git a/BUILD b/BUILD index 046023f7..d81c0d38 100644 --- a/BUILD +++ b/BUILD @@ -71,33 +71,6 @@ cc_library( ], ) -cc_library( - name = "v8_lib", - srcs = glob([ - "src/v8/*.cc", - ]), - deps = [ - ":common_lib", - "//external:wee8", - ], -) - -cc_library( - name = "wavm_lib", - srcs = glob([ - "src/wavm/*.cc", - ]), - copts = [ - '-DWAVM_API=""', - "-Wno-non-virtual-dtor", - "-Wno-old-style-cast", - ], - deps = [ - ":common_lib", - "@envoy//bazel/foreign_cc:wavm", - ], -) - cc_library( name = "wasmtime_lib", srcs = glob([ diff --git a/bazel/external/envoy/extensions_build_config.bzl b/bazel/external/envoy/extensions_build_config.bzl index b80e519c..ad5497be 100644 --- a/bazel/external/envoy/extensions_build_config.bzl +++ b/bazel/external/envoy/extensions_build_config.bzl @@ -1,39 +1,27 @@ -# See bazel/README.md for details on how this system works. +# Copyright 2020 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + EXTENSIONS = { - # - # Access loggers - # "envoy.access_loggers.wasm": "//source/extensions/access_loggers/wasm:config", - - # - # WASM - # "envoy.bootstrap.wasm": "//source/extensions/bootstrap/wasm:config", - - # - # HTTP filters - # "envoy.filters.http.router": "//source/extensions/filters/http/router:config", "envoy.filters.http.wasm": "//source/extensions/filters/http/wasm:config", - - # - # Network filters - # "envoy.filters.network.http_connection_manager": "//source/extensions/filters/network/http_connection_manager:config", "envoy.filters.network.tcp_proxy": "//source/extensions/filters/network/tcp_proxy:config", "envoy.filters.network.wasm": "//source/extensions/filters/network/wasm:config", - - # - # Stat sinks - # "envoy.stat_sinks.wasm": "//source/extensions/stat_sinks/wasm:config", - - # - # WebAssembly runtimes - # "envoy.wasm.runtime.null": "//source/extensions/wasm_runtime/null:config", - "envoy.wasm.runtime.v8": "//source/extensions/wasm_runtime/v8:config", - "envoy.wasm.runtime.wavm": "//source/extensions/wasm_runtime/wavm:config", "envoy.wasm.runtime.wasmtime": "//source/extensions/wasm_runtime/wasmtime:config", } diff --git a/integration_test/envoy/tmp.cc b/integration_test/envoy/tmp.cc index e69de29b..e4571cd5 100644 --- a/integration_test/envoy/tmp.cc +++ b/integration_test/envoy/tmp.cc @@ -0,0 +1,14 @@ +// Copyright 2016-2019 Envoy Project Authors +// Copyright 2020 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License.