From d8418d2832fb39c3c477e3a34037d9125ecfa0b8 Mon Sep 17 00:00:00 2001 From: Michael Payne Date: Sat, 22 Aug 2020 14:03:00 -0700 Subject: [PATCH 1/3] Dependencies: build updates. Signed-off-by: Michael Payne --- bazel/dependency_imports.bzl | 2 +- bazel/envoy_library.bzl | 2 +- bazel/repository_locations.bzl | 36 +++++++++---------- ci/verify_examples.sh | 2 +- source/extensions/extensions_build_config.bzl | 8 +++-- tools/code_format/check_format.py | 22 ++++++------ 6 files changed, 37 insertions(+), 35 deletions(-) diff --git a/bazel/dependency_imports.bzl b/bazel/dependency_imports.bzl index 56aa348f4be00..e7ef365fb03f6 100644 --- a/bazel/dependency_imports.bzl +++ b/bazel/dependency_imports.bzl @@ -10,7 +10,7 @@ load("@protodoc_pip3//:requirements.bzl", protodoc_pip_install = "pip_install") load("@rules_antlr//antlr:deps.bzl", "antlr_dependencies") # go version for rules_go -GO_VERSION = "1.14.7" +GO_VERSION = "1.15" def envoy_dependency_imports(go_version = GO_VERSION): rules_foreign_cc_dependencies() diff --git a/bazel/envoy_library.bzl b/bazel/envoy_library.bzl index 25b4c6ba17d75..038efb29e2257 100644 --- a/bazel/envoy_library.bzl +++ b/bazel/envoy_library.bzl @@ -21,7 +21,7 @@ def tcmalloc_external_deps(repository): # Envoy C++ library targets that need no transformations or additional dependencies before being # passed to cc_library should be specified with this function. Note: this exists to ensure that -# all envoy targets pass through an envoy-declared starlark function where they can be modified +# all envoy targets pass through an envoy-declared Starlark function where they can be modified # before being passed to a native bazel function. def envoy_basic_cc_library(name, deps = [], external_deps = [], **kargs): cc_library( diff --git a/bazel/repository_locations.bzl b/bazel/repository_locations.bzl index 8f6d636ee0aad..a465088c54b09 100644 --- a/bazel/repository_locations.bzl +++ b/bazel/repository_locations.bzl @@ -21,24 +21,24 @@ DEPENDENCY_ANNOTATIONS = [ # NOTE: If a dependency use case is either dataplane or controlplane, the other uses are not needed # to be declared. USE_CATEGORIES = [ - # This dependency is used in build process. - "build", - # This dependency is used for unit tests. - "test", # This dependency is used in API protos. "api", - # This dependency is used in processing downstream or upstream requests. - "dataplane", + # This dependency is used in build process. + "build", # This dependency is used to process xDS requests. "controlplane", + # This dependency is used in processing downstream or upstream requests. + "dataplane", # This dependecy is used for logging, metrics or tracing. It may process unstrusted input. "observability", # This dependency does not handle untrusted data and is used for various utility purposes. "other", + # This dependency is used for unit tests. + "test", ] # Components with these use categories are not required to specify the 'cpe' annotation. -USE_CATEGORIES_WITH_CPE_OPTIONAL = ["build", "test", "other"] +USE_CATEGORIES_WITH_CPE_OPTIONAL = ["build", "other", "test"] DEPENDENCY_REPOSITORIES_SPEC = dict( bazel_compdb = dict( @@ -53,16 +53,16 @@ DEPENDENCY_REPOSITORIES_SPEC = dict( bazel_gazelle = dict( project_name = "Gazelle", project_url = "https://github.com/bazelbuild/bazel-gazelle", - version = "0.19.1", - sha256 = "86c6d481b3f7aedc1d60c1c211c6f76da282ae197c3b3160f54bd3a8f847896f", + version = "0.21.1", + sha256 = "cdb02a887a7187ea4d5a27452311a75ed8637379a1287d8eeb952138ea485f7d", urls = ["https://github.com/bazelbuild/bazel-gazelle/releases/download/v{version}/bazel-gazelle-v{version}.tar.gz"], use_category = ["build"], ), bazel_toolchains = dict( project_name = "bazel-toolchains", project_url = "https://github.com/bazelbuild/bazel-toolchains", - version = "3.4.0", - sha256 = "882fecfc88d3dc528f5c5681d95d730e213e39099abff2e637688a91a9619395", + version = "3.4.1", + sha256 = "7ebb200ed3ca3d1f7505659c7dfed01c4b5cb04c3a6f34140726fe22f5d35e86", strip_prefix = "bazel-toolchains-{version}", urls = [ "https://github.com/bazelbuild/bazel-toolchains/releases/download/{version}/bazel-toolchains-{version}.tar.gz", @@ -398,8 +398,8 @@ DEPENDENCY_REPOSITORIES_SPEC = dict( com_github_pallets_markupsafe = dict( project_name = "MarkupSafe", project_url = "https://github.com/pallets/markupsafe", - version = "1.1.1", - sha256 = "222a10e3237d92a9cd45ed5ea882626bc72bc5e0264d3ed0f2c9129fa69fc167", + version = "2.0.0a1", + sha256 = "2b0c5c2a067d9268813d55523bc513a12181cffb23b2f3d5618eb5d93776bad8", strip_prefix = "markupsafe-{version}/src", urls = ["https://github.com/pallets/markupsafe/archive/{version}.tar.gz"], use_category = ["build"], @@ -478,8 +478,8 @@ DEPENDENCY_REPOSITORIES_SPEC = dict( io_bazel_rules_go = dict( project_name = "Go rules for Bazel", project_url = "https://github.com/bazelbuild/rules_go", - version = "0.23.7", - sha256 = "0310e837aed522875791750de44408ec91046c630374990edd51827cb169f616", + version = "0.23.8", + sha256 = "2697f6bc7c529ee5e6a2d9799870b9ec9eaeb3ee7d70ed50b87a2c2c97e13d9e", urls = ["https://github.com/bazelbuild/rules_go/releases/download/v{version}/rules_go-v{version}.tar.gz"], use_category = ["build"], ), @@ -497,9 +497,9 @@ DEPENDENCY_REPOSITORIES_SPEC = dict( rules_foreign_cc = dict( project_name = "Rules for using foreign build systems in Bazel", project_url = "https://github.com/bazelbuild/rules_foreign_cc", - # 2020-06-09 - version = "f54b7ae56dcf1b81bcafed3a08d58fc08ac095a7", - sha256 = "7ca49ac5b0bc8f5a2c9a7e87b7f86aca604bda197259c9b96f8b7f0a4f38b57b", + # 2020-08-21 + version = "594bf4d7731e606a705f3ad787dd0a70c5a28b30", + sha256 = "2b1cf88de0b6e0195f6571cfde3a5bd406d11b42117d6adef2395c9525a1902e", strip_prefix = "rules_foreign_cc-{version}", urls = ["https://github.com/bazelbuild/rules_foreign_cc/archive/{version}.tar.gz"], use_category = ["build"], diff --git a/ci/verify_examples.sh b/ci/verify_examples.sh index 711ceb5f25a30..51f1b97b5c9a2 100755 --- a/ci/verify_examples.sh +++ b/ci/verify_examples.sh @@ -23,7 +23,7 @@ cd ../ # Test grpc bridge example # install go -GO_VERSION="1.14.7" +GO_VERSION="1.15" curl -O https://storage.googleapis.com/golang/go$GO_VERSION.linux-amd64.tar.gz tar -xf go$GO_VERSION.linux-amd64.tar.gz sudo mv go /usr/local diff --git a/source/extensions/extensions_build_config.bzl b/source/extensions/extensions_build_config.bzl index c95f3b031ae16..e0dd5e66bf95b 100644 --- a/source/extensions/extensions_build_config.bzl +++ b/source/extensions/extensions_build_config.bzl @@ -193,10 +193,12 @@ EXTENSIONS = { "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", + # + "envoy.upstreams.http.http": "//source/extensions/upstreams/http/http:config", + "envoy.upstreams.http.tcp": "//source/extensions/upstreams/http/tcp:config", } @@ -204,4 +206,4 @@ EXTENSIONS = { # (//:extension_config and //:extension_library in //BUILD) # if downstream Envoy builds need to directly reference envoy extensions. ADDITIONAL_VISIBILITY = [ - ] +] diff --git a/tools/code_format/check_format.py b/tools/code_format/check_format.py index 7e0fccd15a255..1beb5298172a4 100755 --- a/tools/code_format/check_format.py +++ b/tools/code_format/check_format.py @@ -401,7 +401,7 @@ def isExternalBuildFile(file_path): file_path.startswith("./tools/clang_tools")) -def isSkylarkFile(file_path): +def isStarlarkFile(file_path): return file_path.endswith(".bzl") @@ -774,20 +774,20 @@ def checkSourceLine(line, file_path, reportError): def checkBuildLine(line, file_path, reportError): - if "@bazel_tools" in line and not (isSkylarkFile(file_path) or file_path.startswith("./bazel/") or - "python/runfiles" in line): + if "@bazel_tools" in line and not (isStarlarkFile(file_path) or + file_path.startswith("./bazel/") or "python/runfiles" in line): reportError("unexpected @bazel_tools reference, please indirect via a definition in //bazel") if not allowlistedForProtobufDeps(file_path) and '"protobuf"' in line: reportError("unexpected direct external dependency on protobuf, use " "//source/common/protobuf instead.") - if (envoy_build_rule_check and not isSkylarkFile(file_path) and not isWorkspaceFile(file_path) and - not isExternalBuildFile(file_path) and "@envoy//" in line): + if (envoy_build_rule_check and not isStarlarkFile(file_path) and + not isWorkspaceFile(file_path) and not isExternalBuildFile(file_path) and "@envoy//" in line): reportError("Superfluous '@envoy//' prefix") def fixBuildLine(file_path, line, line_number): - if (envoy_build_rule_check and not isSkylarkFile(file_path) and not isWorkspaceFile(file_path) and - not isExternalBuildFile(file_path)): + if (envoy_build_rule_check and not isStarlarkFile(file_path) and + not isWorkspaceFile(file_path) and not isExternalBuildFile(file_path)): line = line.replace("@envoy//", "//") return line @@ -798,7 +798,7 @@ def fixBuildPath(file_path): error_messages = [] # TODO(htuch): Add API specific BUILD fixer script. - if not isBuildFixerExcludedFile(file_path) and not isApiFile(file_path) and not isSkylarkFile( + if not isBuildFixerExcludedFile(file_path) and not isApiFile(file_path) and not isStarlarkFile( file_path) and not isWorkspaceFile(file_path): if os.system("%s %s %s" % (ENVOY_BUILD_FIXER_PATH, file_path, file_path)) != 0: error_messages += ["envoy_build_fixer rewrite failed for file: %s" % file_path] @@ -811,7 +811,7 @@ def fixBuildPath(file_path): def checkBuildPath(file_path): error_messages = [] - if not isBuildFixerExcludedFile(file_path) and not isApiFile(file_path) and not isSkylarkFile( + if not isBuildFixerExcludedFile(file_path) and not isApiFile(file_path) and not isStarlarkFile( file_path) and not isWorkspaceFile(file_path): command = "%s %s | diff %s -" % (ENVOY_BUILD_FIXER_PATH, file_path, file_path) error_messages += executeCommand(command, "envoy_build_fixer check failed", file_path) @@ -917,7 +917,7 @@ def checkFormat(file_path): # Apply fixes first, if asked, and then run checks. If we wind up attempting to fix # an issue, but there's still an error, that's a problem. try_to_fix = operation_type == "fix" - if isBuildFile(file_path) or isSkylarkFile(file_path) or isWorkspaceFile(file_path): + if isBuildFile(file_path) or isStarlarkFile(file_path) or isWorkspaceFile(file_path): if try_to_fix: error_messages += fixBuildPath(file_path) error_messages += checkBuildPath(file_path) @@ -999,7 +999,7 @@ def checkFormatVisitor(arg, dir_name, names): checkOwners(dir_name[len(source_prefix):], owned_directories, error_messages) for file_name in names: - if dir_name.startswith("./api") and isSkylarkFile(file_name): + if dir_name.startswith("./api") and isStarlarkFile(file_name): result = pool.apply_async(checkApiShadowStarlarkFiles, args=(api_shadow_root, dir_name + "/" + file_name, error_messages)) result_list.append(result) From d2da6511efdf9378d3afb7906d92c0ef018bf417 Mon Sep 17 00:00:00 2001 From: Michael Payne Date: Sat, 22 Aug 2020 14:35:59 -0700 Subject: [PATCH 2/3] Formatting despite passing checks locally. Signed-off-by: Michael Payne --- tools/code_format/check_format.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/tools/code_format/check_format.py b/tools/code_format/check_format.py index 1beb5298172a4..18c9e092ce0a1 100755 --- a/tools/code_format/check_format.py +++ b/tools/code_format/check_format.py @@ -775,19 +775,19 @@ def checkSourceLine(line, file_path, reportError): def checkBuildLine(line, file_path, reportError): if "@bazel_tools" in line and not (isStarlarkFile(file_path) or - file_path.startswith("./bazel/") or "python/runfiles" in line): + file_path.startswith("./bazel/") or "python/runfiles" in line): reportError("unexpected @bazel_tools reference, please indirect via a definition in //bazel") if not allowlistedForProtobufDeps(file_path) and '"protobuf"' in line: reportError("unexpected direct external dependency on protobuf, use " "//source/common/protobuf instead.") if (envoy_build_rule_check and not isStarlarkFile(file_path) and - not isWorkspaceFile(file_path) and not isExternalBuildFile(file_path) and "@envoy//" in line): + not isWorkspaceFile(file_path) and not isExternalBuildFile(file_path) and "@envoy//" in line): reportError("Superfluous '@envoy//' prefix") def fixBuildLine(file_path, line, line_number): if (envoy_build_rule_check and not isStarlarkFile(file_path) and - not isWorkspaceFile(file_path) and not isExternalBuildFile(file_path)): + not isWorkspaceFile(file_path) and not isExternalBuildFile(file_path)): line = line.replace("@envoy//", "//") return line From 71c475be6ffe12031e770add05515e838ddba3b4 Mon Sep 17 00:00:00 2001 From: Michael Payne Date: Sat, 22 Aug 2020 15:32:50 -0700 Subject: [PATCH 3/3] Rollback Go version and rules_go causing issues in api CI. Signed-off-by: Michael Payne --- bazel/dependency_imports.bzl | 2 +- bazel/repository_locations.bzl | 4 ++-- ci/verify_examples.sh | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/bazel/dependency_imports.bzl b/bazel/dependency_imports.bzl index e7ef365fb03f6..56aa348f4be00 100644 --- a/bazel/dependency_imports.bzl +++ b/bazel/dependency_imports.bzl @@ -10,7 +10,7 @@ load("@protodoc_pip3//:requirements.bzl", protodoc_pip_install = "pip_install") load("@rules_antlr//antlr:deps.bzl", "antlr_dependencies") # go version for rules_go -GO_VERSION = "1.15" +GO_VERSION = "1.14.7" def envoy_dependency_imports(go_version = GO_VERSION): rules_foreign_cc_dependencies() diff --git a/bazel/repository_locations.bzl b/bazel/repository_locations.bzl index a465088c54b09..a63f134361276 100644 --- a/bazel/repository_locations.bzl +++ b/bazel/repository_locations.bzl @@ -478,8 +478,8 @@ DEPENDENCY_REPOSITORIES_SPEC = dict( io_bazel_rules_go = dict( project_name = "Go rules for Bazel", project_url = "https://github.com/bazelbuild/rules_go", - version = "0.23.8", - sha256 = "2697f6bc7c529ee5e6a2d9799870b9ec9eaeb3ee7d70ed50b87a2c2c97e13d9e", + version = "0.23.7", + sha256 = "0310e837aed522875791750de44408ec91046c630374990edd51827cb169f616", urls = ["https://github.com/bazelbuild/rules_go/releases/download/v{version}/rules_go-v{version}.tar.gz"], use_category = ["build"], ), diff --git a/ci/verify_examples.sh b/ci/verify_examples.sh index 51f1b97b5c9a2..711ceb5f25a30 100755 --- a/ci/verify_examples.sh +++ b/ci/verify_examples.sh @@ -23,7 +23,7 @@ cd ../ # Test grpc bridge example # install go -GO_VERSION="1.15" +GO_VERSION="1.14.7" curl -O https://storage.googleapis.com/golang/go$GO_VERSION.linux-amd64.tar.gz tar -xf go$GO_VERSION.linux-amd64.tar.gz sudo mv go /usr/local