From 7eef4856890f658b5c8c67df9b30fba6dca38265 Mon Sep 17 00:00:00 2001 From: Dom Del Nano Date: Thu, 15 Jun 2023 11:16:05 -0700 Subject: [PATCH] Remove handcrafted maven dependency resolution for installing netty-tcnative (netty tls tracing deps) (#1507) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Summary: Remove handcrafted maven dependency resolution for installing netty-tcnative (netty tls tracing deps) See #1506 for the background on this issue. Relevant Issues: N/A Type of change: /kind cleanup Test Plan: Verified the following: - [x] `netty_tls_trace_bpf_test` passes -- indicating the thriftmux container is buildable - [x] Building thriftmux container fails with circular dependency when rules_jvm_external is at 4.2 (prior to the 4.3 fix).
thriftmux container build issue ``` # Verify rules_jvm_external is reverted to 4.2 (prior to circular dependency fix) ddelnano@vigenere:~/code/pixie (ddelnano/remove-netty-maven-install-workaround) $ git diff --cached -- diff --git a/bazel/repository_locations.bzl b/bazel/repository_locations.bzl index e11b40b9ac..26e33ef3a0 100644 --- a/bazel/repository_locations.bzl +++ b/bazel/repository_locations.bzl @@ -418,9 +418,9 @@ REPOSITORY_LOCATIONS = dict( urls = ["https://github.com/bazelbuild/rules_python/archive/refs/tags/0.8.1.tar.gz"], ), rules_jvm_external = dict( - urls = ["https://github.com/bazelbuild/rules_jvm_external/archive/refs/tags/5.2.tar.gz"], - sha256 = "c9ae901381ae7f7eca08aed96caeb542f96c5449052db9c9d27274a8dc154cdf", - strip_prefix = "rules_jvm_external-5.2", + urls = ["https://github.com/bazelbuild/rules_jvm_external/archive/refs/tags/4.2.tar.gz"], + sha256 = "2cd77de091e5376afaf9cc391c15f093ebd0105192373b334f0a855d89092ad5", + strip_prefix = "rules_jvm_external-4.2", ), rules_pkg = dict( sha256 = "eea0f59c28a9241156a47d7a8e32db9122f3d50b505fae0f33de6ce4d9b61834",     ddelnano@vigenere:~/code/pixie (ddelnano/remove-netty-maven-install-workaround) $ bazel run src/stirling/source_connectors/socket_tracer/testing/containers/thriftmux:server_image INFO: Invocation ID: a6c3bf29-5004-409a-a615-526d5db012e0 INFO: Streaming build results to: https://bb.corp.pixielabs.ai/invocation/a6c3bf29-5004-409a-a615-526d5db012e0 ERROR: /home/ddelnano/.cache/bazel/_bazel_ddelnano/b2e8b093089e374aa7d44dfed4f9953b/external/thrift_deps/BUILD:1223:11: in jvm_import rule @thrift_deps//:io_netty_netty_tcnative_boringssl_static_osx_aarch_64: cycle in dependency graph: //src/stirling/source_connectors/socket_tracer/testing/containers/thriftmux:server_image (4c3c8778e0b5d648c5156237069c088d21305dfbecc1b717ff16b9dd87d7eefb) //src/stirling/source_connectors/socket_tracer/testing/containers/thriftmux:thriftmux_scrooge (4c3c8778e0b5d648c5156237069c088d21305dfbecc1b717ff16b9dd87d7eefb) //src/stirling/source_connectors/socket_tracer/testing/containers/thriftmux:thrift_library with aspect @io_bazel_rules_scala//twitter_scrooge:twitter_scrooge.bzl%scrooge_scala_aspect @io_bazel_rules_scala//twitter_scrooge:scrooge_toolchain_impl (4c3c8778e0b5d648c5156237069c088d21305dfbecc1b717ff16b9dd87d7eefb) @io_bazel_rules_scala//twitter_scrooge:scrooge_generator_classpath_provider (4c3c8778e0b5d648c5156237069c088d21305dfbecc1b717ff16b9dd87d7eefb) //external:io_bazel_rules_scala/dependency/thrift/scrooge_generator (4c3c8778e0b5d648c5156237069c088d21305dfbecc1b717ff16b9dd87d7eefb) //src/stirling/source_connectors/socket_tracer/testing/containers/thriftmux:scrooge_jars (4c3c8778e0b5d648c5156237069c088d21305dfbecc1b717ff16b9dd87d7eefb) @thrift_deps//:com_twitter_finagle_http_2_13 (4c3c8778e0b5d648c5156237069c088d21305dfbecc1b717ff16b9dd87d7eefb) @thrift_deps//:io_netty_netty_tcnative_boringssl_static (4c3c8778e0b5d648c5156237069c088d21305dfbecc1b717ff16b9dd87d7eefb) .-> @thrift_deps//:io_netty_netty_tcnative_boringssl_static_osx_aarch_64 (4c3c8778e0b5d648c5156237069c088d21305dfbecc1b717ff16b9dd87d7eefb) \| @thrift_deps//:io_netty_netty_tcnative_boringssl_static_osx_x86_64 (4c3c8778e0b5d648c5156237069c088d21305dfbecc1b717ff16b9dd87d7eefb) `-- @thrift_deps//:io_netty_netty_tcnative_boringssl_static_osx_aarch_64 (4c3c8778e0b5d648c5156237069c088d21305dfbecc1b717ff16b9dd87d7eefb) ERROR: Analysis of target '//src/stirling/source_connectors/socket_tracer/testing/containers/thriftmux:server_image' failed; build aborted INFO: Elapsed time: 13.246s INFO: 0 processes. ERROR: Build failed. Not running target INFO: Streaming build results to: https://bb.corp.pixielabs.ai/invocation/a6c3bf29-5004-409a-a615-526d5db012e0 FAILED: Build did NOT complete successfully (34 packages loaded, 2231 targets configured) ```
Signed-off-by: Dom Del Nano --- WORKSPACE | 10 ---- bazel/netty.bzl | 36 -------------- bazel/thrift.bzl | 5 -- .../thriftmux/netty_deps/BUILD.bazel | 48 ------------------- 4 files changed, 99 deletions(-) delete mode 100644 bazel/netty.bzl delete mode 100644 src/stirling/source_connectors/socket_tracer/testing/containers/thriftmux/netty_deps/BUILD.bazel diff --git a/WORKSPACE b/WORKSPACE index b176b8732e4..111f5ca7eb4 100644 --- a/WORKSPACE +++ b/WORKSPACE @@ -168,18 +168,8 @@ load("@pxapi_python_doc_deps//:requirements.bzl", pxapi_py_doc_install_deps = "i pxapi_py_doc_install_deps() # Setup thrift: used for building Stirling tracing targets. -load("//bazel:netty.bzl", "fetch_netty_tcnative_jars") load("//bazel:thrift.bzl", "thrift_deps") -# TODO(ddelnano): Remove once rules_jvm_external is no longer impacted. -# Recent netty-tcnative releases cause rules_jvm_external to fail with a -# cyclic dependency issue due to its use of multi-classifiers. This is fixed -# by installing the netty jars manually and then overriding maven to use them. See -# https://github.com/bazelbuild/rules_jvm_external/issues/704 for more details. -netty_tcnative_version = "2.0.53.Final" - -fetch_netty_tcnative_jars(netty_tcnative_version) - thrift_deps(scala_version = scala_version) load("@thrift_deps//:defs.bzl", thrift_pinned_maven_install = "pinned_maven_install") diff --git a/bazel/netty.bzl b/bazel/netty.bzl deleted file mode 100644 index 900b16c9f9e..00000000000 --- a/bazel/netty.bzl +++ /dev/null @@ -1,36 +0,0 @@ -# Copyright 2018- The Pixie Authors. -# -# 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. -# -# SPDX-License-Identifier: Apache-2.0 - -load("@bazel_tools//tools/build_defs/repo:http.bzl", "http_jar") - -def fetch_netty_tcnative_jars(version): - http_jar( - name = "netty_tcnative_boringssl_static", - url = "https://repo1.maven.org/maven2/io/netty/netty-tcnative-boringssl-static/%s/netty-tcnative-boringssl-static-%s.jar" % (version, version), - sha256 = "0d8d16adadb19e065a5ac05738f0c2503c685cf3edafba14f7a1c246aafa09ef", - ) - - http_jar( - name = "netty_tcnative_boringssl_static_linux_x86_64", - url = "https://repo1.maven.org/maven2/io/netty/netty-tcnative-boringssl-static/%s/netty-tcnative-boringssl-static-%s-linux-x86_64.jar" % (version, version), - sha256 = "83e3357da5567a93cb5ff6cb807d70573359d7ef9676fa8169405121bae05723", - ) - - http_jar( - name = "netty_tcnative_boringssl_static_linux_aarch_64", - url = "https://repo1.maven.org/maven2/io/netty/netty-tcnative-boringssl-static/%s/netty-tcnative-boringssl-static-%s-linux-aarch_64.jar" % (version, version), - sha256 = "ce3d12e3ae2ad0b9225df347b55715b0ad24342d0195bb238f5e3f60b3f6b868", - ) diff --git a/bazel/thrift.bzl b/bazel/thrift.bzl index 5b0fa9c5329..3b535d8a078 100644 --- a/bazel/thrift.bzl +++ b/bazel/thrift.bzl @@ -38,9 +38,4 @@ def thrift_deps(scala_version): "ch.qos.logback:logback-classic:1.2.10", ], repositories = ["https://repo1.maven.org/maven2"], - override_targets = { - "io.netty:netty-tcnative-boringssl-static": "@//src/stirling/source_connectors/socket_tracer/testing/containers/thriftmux/netty_deps:io_netty_netty_tcnative_boringssl_static", - "io.netty:netty-tcnative-boringssl-static:linux-aarch_64": "@//src/stirling/source_connectors/socket_tracer/testing/containers/thriftmux/netty_deps:io_netty_netty_tcnative_boringssl_static_linux_aarch_64", - "io.netty:netty-tcnative-boringssl-static:linux-x86_64": "@//src/stirling/source_connectors/socket_tracer/testing/containers/thriftmux/netty_deps:io_netty_netty_tcnative_boringssl_static_linux_x86_64", - }, ) diff --git a/src/stirling/source_connectors/socket_tracer/testing/containers/thriftmux/netty_deps/BUILD.bazel b/src/stirling/source_connectors/socket_tracer/testing/containers/thriftmux/netty_deps/BUILD.bazel deleted file mode 100644 index 1c20d7d3942..00000000000 --- a/src/stirling/source_connectors/socket_tracer/testing/containers/thriftmux/netty_deps/BUILD.bazel +++ /dev/null @@ -1,48 +0,0 @@ -# Copyright 2018- The Pixie Authors. -# -# 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. -# -# SPDX-License-Identifier: Apache-2.0 - -load("@rules_java//java:defs.bzl", "java_import") - -java_import( - name = "io_netty_netty_tcnative_boringssl_static_linux_x86_64", - jars = ["@netty_tcnative_boringssl_static_linux_x86_64//jar:downloaded.jar"], - tags = ["maven_coordinates=io.netty:netty-tcnative-boringssl-static:jar:linux-x86_64:2.0.53.Final"], - visibility = ["//visibility:public"], -) - -java_import( - name = "io_netty_netty_tcnative_boringssl_static_linux_aarch_64", - jars = ["@netty_tcnative_boringssl_static_linux_aarch_64//jar:downloaded.jar"], - tags = ["maven_coordinates=io.netty:netty-tcnative-boringssl-static:jar:linux-aarch_64:2.0.53.Final"], - visibility = ["//visibility:public"], -) - -java_import( - name = "io_netty_netty_tcnative_boringssl_static", - jars = [ - "@netty_tcnative_boringssl_static//jar:downloaded.jar", - ], - tags = [ - "maven_coordinates=io.netty:netty-tcnative-boringssl-static:2.0.53.Final", - "maven_url=https://repo1.maven.org/maven2/io/netty/netty-tcnative-boringssl-static/2.0.53.Final/netty-tcnative-boringssl-static-2.0.53.Final.jar", - ], - visibility = ["//visibility:public"], - deps = [ - ":io_netty_netty_tcnative_boringssl_static_linux_aarch_64", - ":io_netty_netty_tcnative_boringssl_static_linux_x86_64", - "@thrift_deps//:io_netty_netty_tcnative_classes", - ], -)