diff --git a/WORKSPACE b/WORKSPACE index 2462e8f51d0..1cb765c2849 100644 --- a/WORKSPACE +++ b/WORKSPACE @@ -183,4 +183,15 @@ bind( # The first one wins when it comes to package declaration. load("@bazel_gazelle//:deps.bzl", "gazelle_dependencies") -gazelle_dependencies() +gazelle_dependencies(go_sdk = "go_sdk") + +# Download alternative go toolchains after all other dependencies, so that they aren't used by external dependencies. +go_download_sdk( + name = "go_sdk_1_17", + version = "1.17.11", +) + +go_download_sdk( + name = "go_sdk_1_16", + version = "1.16.14", +) diff --git a/bazel/container_images.bzl b/bazel/container_images.bzl index 5d9e8efd8df..4695c7594a3 100644 --- a/bazel/container_images.bzl +++ b/bazel/container_images.bzl @@ -139,28 +139,6 @@ def base_images(): "pixie-oss/pixie-dev-public/ghcr-deps/graalvm/graalvm-ce", ) -def stirling_test_build_images(): - _gcr_io_image( - # Using golang:1.16-alpine as it is smaller than the ubuntu based image. - "golang_1_16_image", - "sha256:c3d78e9d45bc6da38b15485456380d0b669e60d075f0ed69f87ebc14231eed19", - "pixie-oss/pixie-dev-public/docker-deps/library/golang", - ) - - _gcr_io_image( - # Using golang:1.17-alpine as it is smaller than the ubuntu based image. - "golang_1_17_image", - "sha256:1dc6a836407ef26c761af27bd39eb86ec385bab0f89a6c969bb1a04b342f7074", - "pixie-oss/pixie-dev-public/docker-deps/library/golang", - ) - - _gcr_io_image( - # Using golang:1.18-alpine as it is smaller than the ubuntu based image. - "golang_1_18_image", - "sha256:e444a82360d0e4cecc2e352829e400c240b4566a5855daa6e9bd18ef6e7c50da", - "pixie-oss/pixie-dev-public/docker-deps/library/golang", - ) - def stirling_test_images(): # NGINX with OpenSSL 1.1.0, for OpenSSL tracing tests. _gcr_io_image( diff --git a/bazel/external/rules_go.patch b/bazel/external/rules_go.patch new file mode 100644 index 00000000000..807fe4a334e --- /dev/null +++ b/bazel/external/rules_go.patch @@ -0,0 +1,335 @@ +diff --git a/go/private/BUILD.sdk.bazel b/go/private/BUILD.sdk.bazel +index 50d9127d..a24956c4 100644 +--- a/go/private/BUILD.sdk.bazel ++++ b/go/private/BUILD.sdk.bazel +@@ -62,6 +62,7 @@ declare_toolchains( + builder = ":builder", + host = "{goos}_{goarch}", + sdk = ":go_sdk", ++ is_default_sdk = {is_default_sdk}, + ) + + filegroup( +diff --git a/go/private/go_toolchain.bzl b/go/private/go_toolchain.bzl +index 0b94c9ac..c82b9d3d 100644 +--- a/go/private/go_toolchain.bzl ++++ b/go/private/go_toolchain.bzl +@@ -90,13 +90,23 @@ go_toolchain = rule( + provides = [platform_common.ToolchainInfo], + ) + +-def declare_toolchains(host, sdk, builder): ++def declare_toolchains(host, sdk, builder, is_default_sdk): + """Declares go_toolchain and toolchain targets for each platform.""" + ++ native.constraint_value( ++ name = "this_sdk_version", ++ constraint_setting = "@io_bazel_rules_go//go/toolchain:sdk_version", ++ ) ++ default_sdk_constraint = "@io_bazel_rules_go//go/toolchain:default_sdk" ++ + # keep in sync with generate_toolchain_names + host_goos, _, host_goarch = host.partition("_") + for p in PLATFORMS: + if p.cgo: ++ native.platform( ++ name = "platform_{}_{}_cgo".format(p.goos, p.goarch), ++ constraint_values = [c for c in p.constraints if c != default_sdk_constraint] + [":this_sdk_version"], ++ ) + # Don't declare separate toolchains for cgo_on / cgo_off. + # This is controlled by the cgo_context_data dependency of + # go_context_data, which is configured using constraint_values. +@@ -118,6 +128,8 @@ def declare_toolchains(host, sdk, builder): + ) + constraints = [c for c in p.constraints if c not in cgo_constraints] + ++ should_print = p.goos == "linux" and p.goarch == "amd64" ++ + go_toolchain( + name = impl_name, + goos = p.goos, +@@ -129,13 +141,32 @@ def declare_toolchains(host, sdk, builder): + tags = ["manual"], + visibility = ["//visibility:public"], + ) ++ if is_default_sdk: ++ native.toolchain( ++ name = toolchain_name, ++ toolchain_type = "@io_bazel_rules_go//go:toolchain", ++ exec_compatible_with = [ ++ "@io_bazel_rules_go//go/toolchain:" + host_goos, ++ "@io_bazel_rules_go//go/toolchain:" + host_goarch, ++ ], ++ target_compatible_with = constraints, ++ toolchain = ":" + impl_name, ++ ) ++ ++ constraints_no_sdk = [c for c in constraints if c != default_sdk_constraint] + native.toolchain( +- name = toolchain_name, ++ name = toolchain_name + "_version_constrained", + toolchain_type = "@io_bazel_rules_go//go:toolchain", + exec_compatible_with = [ + "@io_bazel_rules_go//go/toolchain:" + host_goos, + "@io_bazel_rules_go//go/toolchain:" + host_goarch, + ], +- target_compatible_with = constraints, ++ target_compatible_with = constraints_no_sdk + [":this_sdk_version"], + toolchain = ":" + impl_name, + ) ++ # Add a platform for this target with this specific SDK version. ++ native.platform( ++ name = "platform_{}_{}".format(p.goos, p.goarch), ++ constraint_values = constraints_no_sdk + ["@io_bazel_rules_go//go/toolchain:cgo_off", ":this_sdk_version"], ++ ) ++ +diff --git a/go/private/platforms.bzl b/go/private/platforms.bzl +index 21a62e90..cee6c8b6 100644 +--- a/go/private/platforms.bzl ++++ b/go/private/platforms.bzl +@@ -154,6 +154,7 @@ def _generate_platforms(): + constraints = [ + GOOS_CONSTRAINTS[goos], + GOARCH_CONSTRAINTS[goarch], ++ "@io_bazel_rules_go//go/toolchain:default_sdk", + ] + platforms.append(struct( + name = goos + "_" + goarch, +@@ -180,4 +181,4 @@ PLATFORMS = _generate_platforms() + + def generate_toolchain_names(): + # keep in sync with declare_toolchains +- return ["go_" + p.name for p in PLATFORMS if not p.cgo] ++ return ["go_" + p.name for p in PLATFORMS if not p.cgo] + ["go_" + p.name + "_version_constrained" for p in PLATFORMS if not p.cgo] +diff --git a/go/private/rules/transition.bzl b/go/private/rules/transition.bzl +index 6499caec..0c235e3b 100644 +--- a/go/private/rules/transition.bzl ++++ b/go/private/rules/transition.bzl +@@ -31,6 +31,7 @@ load( + "GoArchive", + "GoLibrary", + "GoSource", ++ "GoSDK", + ) + load( + "//go/platform:crosstool.bzl", +@@ -89,7 +90,7 @@ def go_transition_wrapper(kind, transition_kind, name, **kwargs): + regular rule. This prevents targets from being rebuilt for an alternative + configuration identical to the default configuration. + """ +- transition_keys = ("goos", "goarch", "pure", "static", "msan", "race", "gotags", "linkmode") ++ transition_keys = ("goos", "goarch", "gosdk", "pure", "static", "msan", "race", "gotags", "linkmode") + need_transition = any([key in kwargs for key in transition_keys]) + if need_transition: + transition_kind(name = name, **kwargs) +@@ -108,6 +109,9 @@ def go_transition_rule(**kwargs): + default = "auto", + values = ["auto"] + {goarch: None for _, goarch in GOOS_GOARCH}.keys(), + ), ++ "gosdk": attr.string( ++ default = "auto", ++ ), + "pure": attr.string( + default = "auto", + values = ["auto", "on", "off"], +@@ -171,6 +175,7 @@ def _go_transition_impl(settings, attr): + + goos = getattr(attr, "goos", "auto") + goarch = getattr(attr, "goarch", "auto") ++ gosdk = getattr(attr, "gosdk", "auto") + crosstool_top = settings.pop("//command_line_option:crosstool_top") + cpu = settings.pop("//command_line_option:cpu") + _check_ternary("pure", pure) +@@ -183,8 +188,13 @@ def _go_transition_impl(settings, attr): + fail("invalid goos, goarch pair: {}, {}".format(goos, goarch)) + if cgo and (goos, goarch) not in CGO_GOOS_GOARCH: + fail('pure is "off" but cgo is not supported on {} {}'.format(goos, goarch)) +- platform = "@io_bazel_rules_go//go/toolchain:{}_{}{}".format(goos, goarch, "_cgo" if cgo else "") ++ if gosdk != "auto": ++ platform = str(Label(gosdk).relative("//:platform_{}_{}{}".format(goos, goarch, "_cgo" if cgo else ""))) ++ else: ++ platform = "@io_bazel_rules_go//go/toolchain:{}_{}{}".format(goos, goarch, "_cgo" if cgo else "") + settings["//command_line_option:platforms"] = platform ++ elif gosdk != "auto": ++ fail("must set goos and goarch if gosdk is set") + else: + # If not auto, try to detect the platform the inbound crosstool/cpu. + platform = platform_from_crosstool(crosstool_top, cpu) +diff --git a/go/private/sdk.bzl b/go/private/sdk.bzl +index 4189d819..460f0cc7 100644 +--- a/go/private/sdk.bzl ++++ b/go/private/sdk.bzl +@@ -30,17 +30,30 @@ MIN_SUPPORTED_VERSION = (1, 14, 0) + def _go_host_sdk_impl(ctx): + goroot = _detect_host_sdk(ctx) + platform = _detect_sdk_platform(ctx, goroot) +- _sdk_build_file(ctx, platform) ++ _sdk_build_file(ctx, platform, ctx.attr.is_default_sdk) + _local_sdk(ctx, goroot) + + _go_host_sdk = repository_rule( + implementation = _go_host_sdk_impl, + environ = ["GOROOT"], ++ attrs = { ++ "is_default_sdk": attr.bool(), ++ }, + ) + ++def _existing_sdk_rules(): ++ sdk_kinds = ("_go_download_sdk", "_go_host_sdk", "_go_local_sdk", "_go_wrap_sdk") ++ existing_rules = native.existing_rules() ++ sdk_rules = [r for r in existing_rules.values() if r["kind"] in sdk_kinds] ++ if len(sdk_rules) == 0 and "go_sdk" in existing_rules: ++ # may be local_repository in bazel_tests. ++ sdk_rules.append(existing_rules["go_sdk"]) ++ return sdk_rules ++ + def go_host_sdk(name, **kwargs): +- _go_host_sdk(name = name, **kwargs) +- _register_toolchains(name) ++ is_default_sdk = len(_existing_sdk_rules()) == 0 ++ _go_host_sdk(name = name, is_default_sdk=is_default_sdk, **kwargs) ++ _register_toolchains(name, is_default_sdk) + + def _go_download_sdk_impl(ctx): + if not ctx.attr.goos and not ctx.attr.goarch: +@@ -52,7 +65,7 @@ def _go_download_sdk_impl(ctx): + fail("goos set but goarch not set") + goos, goarch = ctx.attr.goos, ctx.attr.goarch + platform = goos + "_" + goarch +- _sdk_build_file(ctx, platform) ++ _sdk_build_file(ctx, platform, ctx.attr.is_default_sdk) + + version = ctx.attr.version + sdks = ctx.attr.sdks +@@ -122,29 +135,33 @@ _go_download_sdk = repository_rule( + "urls": attr.string_list(default = ["https://dl.google.com/go/{}"]), + "version": attr.string(), + "strip_prefix": attr.string(default = "go"), ++ "is_default_sdk": attr.bool(), + }, + ) + + def go_download_sdk(name, **kwargs): +- _go_download_sdk(name = name, **kwargs) +- _register_toolchains(name) ++ is_default_sdk = len(_existing_sdk_rules()) == 0 ++ _go_download_sdk(name = name, is_default_sdk=is_default_sdk, **kwargs) ++ _register_toolchains(name, is_default_sdk) + + def _go_local_sdk_impl(ctx): + goroot = ctx.attr.path + platform = _detect_sdk_platform(ctx, goroot) +- _sdk_build_file(ctx, platform) ++ _sdk_build_file(ctx, platform, ctx.attr.is_default_sdk) + _local_sdk(ctx, goroot) + + _go_local_sdk = repository_rule( + implementation = _go_local_sdk_impl, + attrs = { + "path": attr.string(), ++ "is_default_sdk": attr.bool(), + }, + ) + + def go_local_sdk(name, **kwargs): +- _go_local_sdk(name = name, **kwargs) +- _register_toolchains(name) ++ is_default_sdk = len(_existing_sdk_rules()) == 0 ++ _go_local_sdk(name = name, is_default_sdk=is_default_sdk, **kwargs) ++ _register_toolchains(name, is_default_sdk) + + def _go_wrap_sdk_impl(ctx): + if not ctx.attr.root_file and not ctx.attr.root_files: +@@ -161,7 +178,7 @@ def _go_wrap_sdk_impl(ctx): + root_file = Label(ctx.attr.root_files[platform]) + goroot = str(ctx.path(root_file).dirname) + platform = _detect_sdk_platform(ctx, goroot) +- _sdk_build_file(ctx, platform) ++ _sdk_build_file(ctx, platform, ctx.attr.is_default_sdk) + _local_sdk(ctx, goroot) + + _go_wrap_sdk = repository_rule( +@@ -175,17 +192,20 @@ _go_wrap_sdk = repository_rule( + mandatory = False, + doc = "A set of mappings from the host platform to a file in the SDK's root directory", + ), ++ "is_default_sdk": attr.bool(), + }, + ) + + def go_wrap_sdk(name, **kwargs): +- _go_wrap_sdk(name = name, **kwargs) +- _register_toolchains(name) ++ is_default_sdk = len(_existing_sdk_rules()) == 0 ++ _go_wrap_sdk(name = name, is_default_sdk=is_default_sdk, **kwargs) ++ _register_toolchains(name, is_default_sdk) + +-def _register_toolchains(repo): ++def _register_toolchains(repo, is_default_sdk): + labels = [ + "@{}//:{}".format(repo, name) + for name in generate_toolchain_names() ++ if is_default_sdk or "version_constrained" in name + ] + native.register_toolchains(*labels) + +@@ -222,7 +242,7 @@ def _local_sdk(ctx, path): + for entry in ["src", "pkg", "bin", "lib"]: + ctx.symlink(path + "/" + entry, entry) + +-def _sdk_build_file(ctx, platform): ++def _sdk_build_file(ctx, platform, is_default_sdk): + ctx.file("ROOT") + goos, _, goarch = platform.partition("_") + ctx.template( +@@ -234,6 +254,7 @@ def _sdk_build_file(ctx, platform): + "{goarch}": goarch, + "{exe}": ".exe" if goos == "windows" else "", + "{rules_go_repo_name}": Label("//go/private:BUILD.sdk.bazel").workspace_name, ++ "{is_default_sdk}": "True" if is_default_sdk else "False", + }, + ) + +@@ -451,12 +472,7 @@ def go_register_toolchains(version = None, nogo = None, go_version = None): + if not version: + version = go_version # old name + +- sdk_kinds = ("_go_download_sdk", "_go_host_sdk", "_go_local_sdk", "_go_wrap_sdk") +- existing_rules = native.existing_rules() +- sdk_rules = [r for r in existing_rules.values() if r["kind"] in sdk_kinds] +- if len(sdk_rules) == 0 and "go_sdk" in existing_rules: +- # may be local_repository in bazel_tests. +- sdk_rules.append(existing_rules["go_sdk"]) ++ sdk_rules = _existing_sdk_rules() + + if version and len(sdk_rules) > 0: + fail("go_register_toolchains: version set after go sdk rule declared ({})".format(", ".join([r["name"] for r in sdk_rules]))) +diff --git a/go/toolchain/toolchains.bzl b/go/toolchain/toolchains.bzl +index b4e070cf..63565b02 100644 +--- a/go/toolchain/toolchains.bzl ++++ b/go/toolchain/toolchains.bzl +@@ -61,6 +61,11 @@ def declare_constraints(): + name = "cgo_constraint", + ) + ++ native.constraint_setting( ++ name = "sdk_version", ++ default_constraint_value = ":default_sdk", ++ ) ++ + native.constraint_value( + name = "cgo_on", + constraint_setting = ":cgo_constraint", +@@ -71,6 +76,11 @@ def declare_constraints(): + constraint_setting = ":cgo_constraint", + ) + ++ native.constraint_value( ++ name = "default_sdk", ++ constraint_setting = ":sdk_version", ++ ) ++ + for p in PLATFORMS: + native.platform( + name = p.name, diff --git a/bazel/pl_workspace.bzl b/bazel/pl_workspace.bzl index 7aae1f54697..a8ecc034ba0 100644 --- a/bazel/pl_workspace.bzl +++ b/bazel/pl_workspace.bzl @@ -22,7 +22,7 @@ load("@io_bazel_rules_docker//repositories:repositories.bzl", container_reposito load("@io_bazel_rules_docker//scala:image.bzl", _scala_image_repos = "repositories") load("@io_bazel_rules_k8s//k8s:k8s.bzl", "k8s_repositories") load("@io_bazel_rules_k8s//k8s:k8s_go_deps.bzl", k8s_go_deps = "deps") -load("//bazel:container_images.bzl", "base_images", "stirling_test_build_images", "stirling_test_images") +load("//bazel:container_images.bzl", "base_images", "stirling_test_images") load("//bazel:gcs.bzl", "gcs_file") load("//bazel:linux_headers.bzl", "linux_headers") load("//bazel/external/ubuntu_packages:packages.bzl", "download_ubuntu_packages") @@ -37,7 +37,6 @@ def _container_images_setup(): _scala_image_repos() base_images() stirling_test_images() - stirling_test_build_images() # TODO(zasgar): remove this when downstream bugs relying on bazel version are removed. def _impl(repository_ctx): diff --git a/bazel/repositories.bzl b/bazel/repositories.bzl index ca8d4e6856a..8c17722a7ce 100644 --- a/bazel/repositories.bzl +++ b/bazel/repositories.bzl @@ -207,7 +207,7 @@ def _list_pl_deps(name): def _pl_deps(): _bazel_repo("bazel_skylib") _bazel_repo("bazel_gazelle") - _bazel_repo("io_bazel_rules_go") + _bazel_repo("io_bazel_rules_go", patches = ["//bazel/external:rules_go.patch"], patch_args = ["-p1"]) _bazel_repo("io_bazel_rules_scala") _bazel_repo("rules_jvm_external") _bazel_repo("rules_foreign_cc") diff --git a/src/stirling/bpf_tools/uprobe_extra_trigger_bpf_test.cc b/src/stirling/bpf_tools/uprobe_extra_trigger_bpf_test.cc index 9da23724ae9..bad96de32c8 100644 --- a/src/stirling/bpf_tools/uprobe_extra_trigger_bpf_test.cc +++ b/src/stirling/bpf_tools/uprobe_extra_trigger_bpf_test.cc @@ -68,7 +68,7 @@ TEST(BCCWrapper, UnexpectedExtraTrigger) { }; // A templated path to the server. We will replace $0 with the pid of the server instance. - const std::string kServerPath = "/proc/$0/root/go/src/grpc_tls_server/grpc_tls_server"; + const std::string kServerPath = "/proc/$0/root/golang_1_16_grpc_tls_server_binary"; // Run server 1 and attach uprobes to it. ASSERT_OK(server1.Run(std::chrono::seconds{60})); diff --git a/src/stirling/obj_tools/BUILD.bazel b/src/stirling/obj_tools/BUILD.bazel index 6c977d4f3f3..9338a908eab 100644 --- a/src/stirling/obj_tools/BUILD.bazel +++ b/src/stirling/obj_tools/BUILD.bazel @@ -74,7 +74,7 @@ pl_cc_test( data = [ "//src/stirling/obj_tools/testdata/cc:test_exe_fixture", "//src/stirling/obj_tools/testdata/go:test_binaries", - "//src/stirling/testing/demo_apps/go_grpc_tls_pl/server:grpc_tls_server", + "//src/stirling/testing/demo_apps/go_grpc_tls_pl/server:golang_1_16_grpc_tls_server_binary", ], deps = [ ":cc_library", @@ -144,7 +144,7 @@ pl_cc_binary( pl_cc_binary( name = "dwarf_reader_benchmark", srcs = ["dwarf_reader_benchmark.cc"], - data = ["//src/stirling/testing/demo_apps/go_grpc_tls_pl/server:grpc_tls_server"], + data = ["//src/stirling/testing/demo_apps/go_grpc_tls_pl/server:golang_1_16_grpc_tls_server_binary"], deps = [ ":cc_library", "//src/common/testing:cc_library", diff --git a/src/stirling/obj_tools/dwarf_reader_benchmark.cc b/src/stirling/obj_tools/dwarf_reader_benchmark.cc index 9e575a99b58..bad69c2deaf 100644 --- a/src/stirling/obj_tools/dwarf_reader_benchmark.cc +++ b/src/stirling/obj_tools/dwarf_reader_benchmark.cc @@ -26,8 +26,8 @@ using px::stirling::obj_tools::DwarfReader; using px::testing::BazelRunfilePath; constexpr std::string_view kBinary = - "src/stirling/testing/demo_apps/go_grpc_tls_pl/server/golang_1_16_grpc_tls_server_binary/go/" - "src/grpc_tls_server/grpc_tls_server"; + "src/stirling/testing/demo_apps/go_grpc_tls_pl/server/golang_1_16_grpc_tls_server_binary_/" + "golang_1_16_grpc_tls_server_binary"; struct SymAddrs { // Members of net/http.http2serverConn. diff --git a/src/stirling/obj_tools/dwarf_reader_test.cc b/src/stirling/obj_tools/dwarf_reader_test.cc index f0cfca1b8b1..a545259b1d3 100644 --- a/src/stirling/obj_tools/dwarf_reader_test.cc +++ b/src/stirling/obj_tools/dwarf_reader_test.cc @@ -22,14 +22,17 @@ #include "src/common/testing/testing.h" constexpr std::string_view kTestGo1_16Binary = - "src/stirling/obj_tools/testdata/go/test_go_1_16_binary"; + "src/stirling/obj_tools/testdata/go/test_go_1_16_binary_/" + "test_go_1_16_binary"; constexpr std::string_view kTestGo1_17Binary = - "src/stirling/obj_tools/testdata/go/test_go_1_17_binary"; + "src/stirling/obj_tools/testdata/go/test_go_1_17_binary_/" + "test_go_1_17_binary"; constexpr std::string_view kTestGo1_18Binary = - "src/stirling/obj_tools/testdata/go/test_go_1_18_binary"; + "src/stirling/obj_tools/testdata/go/test_go_1_18_binary_/" + "test_go_1_18_binary"; constexpr std::string_view kGoGRPCServer = - "src/stirling/testing/demo_apps/go_grpc_tls_pl/server/golang_1_16_grpc_tls_server_binary/go/" - "src/grpc_tls_server/grpc_tls_server"; + "src/stirling/testing/demo_apps/go_grpc_tls_pl/server/golang_1_16_grpc_tls_server_binary_/" + "golang_1_16_grpc_tls_server_binary"; constexpr std::string_view kCppBinary = "src/stirling/obj_tools/testdata/cc/test_exe"; constexpr std::string_view kGoBinaryUnconventional = "src/stirling/obj_tools/testdata/go/sockshop_payments_service"; diff --git a/src/stirling/obj_tools/elf_reader_test.cc b/src/stirling/obj_tools/elf_reader_test.cc index 6ebb2f20dfd..860337523c7 100644 --- a/src/stirling/obj_tools/elf_reader_test.cc +++ b/src/stirling/obj_tools/elf_reader_test.cc @@ -246,12 +246,12 @@ TEST(ElfReaderTest, FuncByteCode) { } TEST(ElfReaderTest, GolangAppRuntimeBuildVersion) { - const std::string kPath = - px::testing::BazelRunfilePath("src/stirling/obj_tools/testdata/go/test_go_1_16_binary"); + const std::string kPath = px::testing::BazelRunfilePath( + "src/stirling/obj_tools/testdata/go/test_go_1_16_binary_/test_go_1_16_binary"); ASSERT_OK_AND_ASSIGN(std::unique_ptr elf_reader, ElfReader::Create(kPath)); ASSERT_OK_AND_ASSIGN(ElfReader::SymbolInfo symbol, elf_reader->SearchTheOnlySymbol("runtime.buildVersion")); - EXPECT_EQ(symbol.address, 0x54AF20); + EXPECT_EQ(symbol.address, 0x549F20); EXPECT_EQ(symbol.size, 16) << "Symbol table entry size should be 16"; EXPECT_EQ(symbol.type, ELFIO::STT_OBJECT); } diff --git a/src/stirling/obj_tools/go_syms_test.cc b/src/stirling/obj_tools/go_syms_test.cc index 04f288427f7..88836d063b8 100644 --- a/src/stirling/obj_tools/go_syms_test.cc +++ b/src/stirling/obj_tools/go_syms_test.cc @@ -30,7 +30,7 @@ using ::testing::Field; using ::testing::StrEq; constexpr std::string_view kTestGoBinaryPath = - "src/stirling/obj_tools/testdata/go/test_go_1_16_binary"; + "src/stirling/obj_tools/testdata/go/test_go_1_16_binary_/test_go_1_16_binary"; TEST(ReadBuildVersionTest, WorkingOnBasicGoBinary) { const std::string kPath = px::testing::BazelRunfilePath(kTestGoBinaryPath); diff --git a/src/stirling/obj_tools/testdata/go/BUILD.bazel b/src/stirling/obj_tools/testdata/go/BUILD.bazel index f8a31ef88a0..097dd0e062d 100644 --- a/src/stirling/obj_tools/testdata/go/BUILD.bazel +++ b/src/stirling/obj_tools/testdata/go/BUILD.bazel @@ -14,44 +14,57 @@ # # SPDX-License-Identifier: Apache-2.0 -# Build of test data binaries is controlled by dockerized builds, not bazel/gazelle. -#gazelle:ignore - -load("//src/stirling/testing/bazel:containerized_build.bzl", "pl_aux_go_binary") +load("@io_bazel_rules_go//go:def.bzl", "go_binary", "go_library") package(default_visibility = ["//src/stirling:__subpackages__"]) -pl_aux_go_binary( +go_library( + name = "lib", + srcs = ["test_go_binary.go"], + importpath = "px.dev/pixie/src/stirling/obj_tools/testdata/go", +) + +go_binary( name = "test_go_1_16_binary", - base = "@golang_1_16_image//image", - build_flags = "-gcflags='-N -l'", - files = [ - "go.mod", - "go.sum", - "test_go_binary.go", - ], + embed = [":lib"], + # -N -l are set by default in debug builds, and go tool compile re-enables inlining if it sees `-l -l`. + gc_goopts = select({ + "//bazel:debug_build": [], + "//conditions:default": [ + "-N", + "-l", + ], + }), + goarch = "amd64", + goos = "linux", + gosdk = "@go_sdk_1_16//:go_sdk", ) -pl_aux_go_binary( +go_binary( name = "test_go_1_17_binary", - base = "@golang_1_17_image//image", - build_flags = "-gcflags='-N -l'", - files = [ - "go.mod", - "go.sum", - "test_go_binary.go", - ], + embed = [":lib"], + gc_goopts = select({ + "//bazel:debug_build": [], + "//conditions:default": [ + "-N", + "-l", + ], + }), + goarch = "amd64", + goos = "linux", + gosdk = "@go_sdk_1_17//:go_sdk", ) -pl_aux_go_binary( +go_binary( name = "test_go_1_18_binary", - base = "@golang_1_18_image//image", - build_flags = "-gcflags='-N -l'", - files = [ - "go.mod", - "go.sum", - "test_go_binary.go", - ], + embed = [":lib"], + gc_goopts = select({ + "//bazel:debug_build": [], + "//conditions:default": [ + "-N", + "-l", + ], + }), ) filegroup( diff --git a/src/stirling/obj_tools/testdata/go/go.mod b/src/stirling/obj_tools/testdata/go/go.mod deleted file mode 100644 index e69de29bb2d..00000000000 diff --git a/src/stirling/obj_tools/testdata/go/go.sum b/src/stirling/obj_tools/testdata/go/go.sum deleted file mode 100644 index e69de29bb2d..00000000000 diff --git a/src/stirling/source_connectors/dynamic_tracer/dynamic_trace_bpf_test.cc b/src/stirling/source_connectors/dynamic_tracer/dynamic_trace_bpf_test.cc index da28d990d7d..3e3d28e36c7 100644 --- a/src/stirling/source_connectors/dynamic_tracer/dynamic_trace_bpf_test.cc +++ b/src/stirling/source_connectors/dynamic_tracer/dynamic_trace_bpf_test.cc @@ -32,10 +32,10 @@ constexpr std::string_view kClientPath = "src/stirling/source_connectors/socket_tracer/protocols/http2/testing/go_grpc_client/" - "golang_1_16_grpc_client"; + "golang_1_16_grpc_client_/golang_1_16_grpc_client"; constexpr std::string_view kServerPath = "src/stirling/source_connectors/socket_tracer/protocols/http2/testing/go_grpc_server/" - "golang_1_16_grpc_server"; + "golang_1_16_grpc_server_/golang_1_16_grpc_server"; namespace px { namespace stirling { diff --git a/src/stirling/source_connectors/dynamic_tracer/dynamic_tracing/autogen_test.cc b/src/stirling/source_connectors/dynamic_tracer/dynamic_tracing/autogen_test.cc index 7eeba77774b..8b3690e1a6f 100644 --- a/src/stirling/source_connectors/dynamic_tracer/dynamic_tracing/autogen_test.cc +++ b/src/stirling/source_connectors/dynamic_tracer/dynamic_tracing/autogen_test.cc @@ -22,7 +22,8 @@ #include "src/common/testing/testing.h" #include "src/stirling/source_connectors/dynamic_tracer/dynamic_tracing/autogen.h" -constexpr std::string_view kBinaryPath = "src/stirling/obj_tools/testdata/go/test_go_1_16_binary"; +constexpr std::string_view kBinaryPath = + "src/stirling/obj_tools/testdata/go/test_go_1_16_binary_/test_go_1_16_binary"; namespace px { namespace stirling { diff --git a/src/stirling/source_connectors/dynamic_tracer/dynamic_tracing/code_gen_test.cc b/src/stirling/source_connectors/dynamic_tracer/dynamic_tracing/code_gen_test.cc index b32cec6ad71..4708a4c48b5 100644 --- a/src/stirling/source_connectors/dynamic_tracer/dynamic_tracing/code_gen_test.cc +++ b/src/stirling/source_connectors/dynamic_tracer/dynamic_tracing/code_gen_test.cc @@ -22,7 +22,8 @@ #include "src/common/testing/testing.h" -constexpr std::string_view kBinaryPath = "src/stirling/obj_tools/testdata/go/test_go_1_16_binary"; +constexpr std::string_view kBinaryPath = + "src/stirling/obj_tools/testdata/go/test_go_1_16_binary_/test_go_1_16_binary"; namespace px { namespace stirling { diff --git a/src/stirling/source_connectors/dynamic_tracer/dynamic_tracing/dwarvifier_test.cc b/src/stirling/source_connectors/dynamic_tracer/dynamic_tracing/dwarvifier_test.cc index 106ee482c14..f41fea12c38 100644 --- a/src/stirling/source_connectors/dynamic_tracer/dynamic_tracing/dwarvifier_test.cc +++ b/src/stirling/source_connectors/dynamic_tracer/dynamic_tracing/dwarvifier_test.cc @@ -22,7 +22,8 @@ #include "src/common/testing/testing.h" #include "src/stirling/source_connectors/dynamic_tracer/dynamic_tracing/dwarvifier.h" -constexpr std::string_view kBinaryPath = "src/stirling/obj_tools/testdata/go/test_go_1_16_binary"; +constexpr std::string_view kBinaryPath = + "src/stirling/obj_tools/testdata/go/test_go_1_16_binary_/test_go_1_16_binary"; namespace px { namespace stirling { @@ -1370,14 +1371,14 @@ probes { scalar_var { name: "main__IntStruct_sym_addr1" type: UINT64 - constant: "5104424" + constant: "5104328" } } vars { scalar_var { name: "runtime__errorString_sym_addr2" type: UINT64 - constant: "5104456" + constant: "5104360" } } vars { diff --git a/src/stirling/source_connectors/dynamic_tracer/dynamic_tracing/dynamic_tracer_test.cc b/src/stirling/source_connectors/dynamic_tracer/dynamic_tracing/dynamic_tracer_test.cc index e9e17351dce..acb4330a7bc 100644 --- a/src/stirling/source_connectors/dynamic_tracer/dynamic_tracing/dynamic_tracer_test.cc +++ b/src/stirling/source_connectors/dynamic_tracer/dynamic_tracing/dynamic_tracer_test.cc @@ -26,7 +26,8 @@ #include "src/common/testing/testing.h" #include "src/stirling/testing/common.h" -constexpr std::string_view kBinaryPath = "src/stirling/obj_tools/testdata/go/test_go_1_16_binary"; +constexpr std::string_view kBinaryPath = + "src/stirling/obj_tools/testdata/go/test_go_1_16_binary_/test_go_1_16_binary"; namespace px { namespace stirling { @@ -45,7 +46,7 @@ using ::testing::SizeIs; constexpr char kServerPath[] = "src/stirling/source_connectors/socket_tracer/protocols/http2/testing/go_grpc_server/" - "golang_1_16_grpc_server"; + "golang_1_16_grpc_server_/golang_1_16_grpc_server"; constexpr char kPod0UpdateTxt[] = R"( uid: "pod0" diff --git a/src/stirling/source_connectors/dynamic_tracer/dynamic_tracing/probe_transformer_test.cc b/src/stirling/source_connectors/dynamic_tracer/dynamic_tracing/probe_transformer_test.cc index 70caf32be31..de2d5721618 100644 --- a/src/stirling/source_connectors/dynamic_tracer/dynamic_tracing/probe_transformer_test.cc +++ b/src/stirling/source_connectors/dynamic_tracer/dynamic_tracing/probe_transformer_test.cc @@ -21,7 +21,8 @@ #include "src/common/testing/testing.h" #include "src/stirling/source_connectors/dynamic_tracer/dynamic_tracing/probe_transformer.h" -constexpr std::string_view kBinaryPath = "src/stirling/obj_tools/testdata/go/test_go_1_16_binary"; +constexpr std::string_view kBinaryPath = + "src/stirling/obj_tools/testdata/go/test_go_1_16_binary_/test_go_1_16_binary"; namespace px { namespace stirling { diff --git a/src/stirling/source_connectors/dynamic_tracer/stirling_dt_bpf_test.cc b/src/stirling/source_connectors/dynamic_tracer/stirling_dt_bpf_test.cc index f7b0487575f..74a793f8eed 100644 --- a/src/stirling/source_connectors/dynamic_tracer/stirling_dt_bpf_test.cc +++ b/src/stirling/source_connectors/dynamic_tracer/stirling_dt_bpf_test.cc @@ -273,8 +273,8 @@ TEST_F(DynamicTraceAPITest, InvalidReference) { class DynamicTraceGolangTest : public StirlingDynamicTraceBPFTest { protected: - const std::string kBinaryPath = - BazelRunfilePath("src/stirling/obj_tools/testdata/go/test_go_1_16_binary"); + const std::string kBinaryPath = BazelRunfilePath( + "src/stirling/obj_tools/testdata/go/test_go_1_16_binary_/test_go_1_16_binary"); }; TEST_F(DynamicTraceGolangTest, TraceLatencyOnly) { diff --git a/src/stirling/source_connectors/socket_tracer/BUILD.bazel b/src/stirling/source_connectors/socket_tracer/BUILD.bazel index f6a6785f948..5842be4fedd 100644 --- a/src/stirling/source_connectors/socket_tracer/BUILD.bazel +++ b/src/stirling/source_connectors/socket_tracer/BUILD.bazel @@ -69,7 +69,7 @@ pl_cc_test( name = "uprobe_symaddrs_test", srcs = ["uprobe_symaddrs_test.cc"], data = [ - "//src/stirling/testing/demo_apps/go_grpc_tls_pl/server:grpc_tls_server", + "//src/stirling/testing/demo_apps/go_grpc_tls_pl/server:golang_1_16_grpc_tls_server_binary", "//src/stirling/testing/demo_apps/node:node_debug", ], deps = [ diff --git a/src/stirling/source_connectors/socket_tracer/grpc_trace_bpf_test.cc b/src/stirling/source_connectors/socket_tracer/grpc_trace_bpf_test.cc index 7e9b9302f08..696307bfed1 100644 --- a/src/stirling/source_connectors/socket_tracer/grpc_trace_bpf_test.cc +++ b/src/stirling/source_connectors/socket_tracer/grpc_trace_bpf_test.cc @@ -45,7 +45,7 @@ class GRPCServer { public: static constexpr std::string_view kServerPath = "src/stirling/source_connectors/socket_tracer/protocols/http2/testing/go_grpc_server/" - "golang_$0_grpc_server"; + "golang_$0_grpc_server_/golang_$0_grpc_server"; GRPCServer() = default; @@ -81,7 +81,7 @@ class GRPCClient { public: static constexpr std::string_view kClientPath = "src/stirling/source_connectors/socket_tracer/protocols/http2/testing/go_grpc_client/" - "golang_$0_grpc_client"; + "golang_$0_grpc_client_/golang_$0_grpc_client"; void LaunchClient(std::string_view go_version, bool use_compression, bool use_https, int port) { std::string client_path = absl::Substitute(kClientPath, go_version); diff --git a/src/stirling/source_connectors/socket_tracer/protocols/http2/testing/go_grpc_client/BUILD.bazel b/src/stirling/source_connectors/socket_tracer/protocols/http2/testing/go_grpc_client/BUILD.bazel index 87b0e24a684..31d323a778d 100644 --- a/src/stirling/source_connectors/socket_tracer/protocols/http2/testing/go_grpc_client/BUILD.bazel +++ b/src/stirling/source_connectors/socket_tracer/protocols/http2/testing/go_grpc_client/BUILD.bazel @@ -14,48 +14,40 @@ # # SPDX-License-Identifier: Apache-2.0 -# Build of test data binaries is controlled by dockerized builds, not bazel/gazelle. -#gazelle:ignore - -load("//src/stirling/testing/bazel:containerized_build.bzl", "pl_aux_go_binary") +load("@io_bazel_rules_go//go:def.bzl", "go_binary", "go_library") package(default_visibility = ["//src/stirling:__subpackages__"]) -pl_aux_go_binary( - name = "golang_1_16_grpc_client", - base = "@golang_1_16_image//image", - extra_layers = { - "proto": ["//src/stirling/source_connectors/socket_tracer/protocols/http2/testing/proto:proto_files"], - }, - files = [ - "go.mod", - "go.sum", - "main.go", +go_library( + name = "grpc_client_lib", + srcs = ["main.go"], + importpath = "px.dev/pixie/src/stirling/source_connectors/socket_tracer/protocols/http2/testing/go_grpc_client", + deps = [ + "//src/stirling/source_connectors/socket_tracer/protocols/http2/testing/proto:greet_pl_go_proto", + "@org_golang_google_grpc//:go_default_library", + "@org_golang_google_grpc//credentials", + "@org_golang_google_grpc//credentials/insecure", + "@org_golang_google_grpc//encoding/gzip", ], ) -pl_aux_go_binary( +go_binary( + name = "golang_1_16_grpc_client", + embed = [":grpc_client_lib"], + goarch = "amd64", + goos = "linux", + gosdk = "@go_sdk_1_16//:go_sdk", +) + +go_binary( name = "golang_1_17_grpc_client", - base = "@golang_1_17_image//image", - extra_layers = { - "proto": ["//src/stirling/source_connectors/socket_tracer/protocols/http2/testing/proto:proto_files"], - }, - files = [ - "go.mod", - "go.sum", - "main.go", - ], + embed = [":grpc_client_lib"], + goarch = "amd64", + goos = "linux", + gosdk = "@go_sdk_1_17//:go_sdk", ) -pl_aux_go_binary( +go_binary( name = "golang_1_18_grpc_client", - base = "@golang_1_18_image//image", - extra_layers = { - "proto": ["//src/stirling/source_connectors/socket_tracer/protocols/http2/testing/proto:proto_files"], - }, - files = [ - "go.mod", - "go.sum", - "main.go", - ], + embed = [":grpc_client_lib"], ) diff --git a/src/stirling/source_connectors/socket_tracer/protocols/http2/testing/go_grpc_client/go.mod b/src/stirling/source_connectors/socket_tracer/protocols/http2/testing/go_grpc_client/go.mod deleted file mode 100644 index 55de3ff4dd1..00000000000 --- a/src/stirling/source_connectors/socket_tracer/protocols/http2/testing/go_grpc_client/go.mod +++ /dev/null @@ -1,4 +0,0 @@ -require ( - github.com/gogo/protobuf v1.3.2 - google.golang.org/grpc v1.44.0 -) \ No newline at end of file diff --git a/src/stirling/source_connectors/socket_tracer/protocols/http2/testing/go_grpc_client/go.sum b/src/stirling/source_connectors/socket_tracer/protocols/http2/testing/go_grpc_client/go.sum deleted file mode 100644 index e94627c986f..00000000000 --- a/src/stirling/source_connectors/socket_tracer/protocols/http2/testing/go_grpc_client/go.sum +++ /dev/null @@ -1,135 +0,0 @@ -cloud.google.com/go v0.26.0/go.mod h1:aQUYkXzVsufM+DwF1aE+0xfcU+56JwCaLick0ClmMTw= -cloud.google.com/go v0.34.0/go.mod h1:aQUYkXzVsufM+DwF1aE+0xfcU+56JwCaLick0ClmMTw= -github.com/BurntSushi/toml v0.3.1/go.mod h1:xHWCNGjB5oqiDr8zfno3MHue2Ht5sIBksp03qcyfWMU= -github.com/antihax/optional v1.0.0/go.mod h1:uupD/76wgC+ih3iEmQUL+0Ugr19nfwCT1kdvxnR2qWY= -github.com/census-instrumentation/opencensus-proto v0.2.1/go.mod h1:f6KPmirojxKA12rnyqOA5BBL4O983OfeGPqjHWSTneU= -github.com/cespare/xxhash/v2 v2.1.1/go.mod h1:VGX0DQ3Q6kWi7AoAeZDth3/j3BFtOZR5XLFGgcrjCOs= -github.com/client9/misspell v0.3.4/go.mod h1:qj6jICC3Q7zFZvVWo7KLAzC3yx5G7kyvSDkc90ppPyw= -github.com/cncf/udpa/go v0.0.0-20191209042840-269d4d468f6f/go.mod h1:M8M6+tZqaGXZJjfX53e64911xZQV5JYwmTeXPW+k8Sc= -github.com/cncf/udpa/go v0.0.0-20201120205902-5459f2c99403/go.mod h1:WmhPx2Nbnhtbo57+VJT5O0JRkEi1Wbu0z5j0R8u5Hbk= -github.com/cncf/udpa/go v0.0.0-20210930031921-04548b0d99d4/go.mod h1:6pvJx4me5XPnfI9Z40ddWsdw2W/uZgQLFXToKeRcDiI= -github.com/cncf/xds/go v0.0.0-20210805033703-aa0b78936158/go.mod h1:eXthEFrGJvWHgFFCl3hGmgk+/aYT6PnTQLykKQRLhEs= -github.com/cncf/xds/go v0.0.0-20210922020428-25de7278fc84/go.mod h1:eXthEFrGJvWHgFFCl3hGmgk+/aYT6PnTQLykKQRLhEs= -github.com/cncf/xds/go v0.0.0-20211011173535-cb28da3451f1/go.mod h1:eXthEFrGJvWHgFFCl3hGmgk+/aYT6PnTQLykKQRLhEs= -github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= -github.com/envoyproxy/go-control-plane v0.9.0/go.mod h1:YTl/9mNaCwkRvm6d1a2C3ymFceY/DCBVvsKhRF0iEA4= -github.com/envoyproxy/go-control-plane v0.9.1-0.20191026205805-5f8ba28d4473/go.mod h1:YTl/9mNaCwkRvm6d1a2C3ymFceY/DCBVvsKhRF0iEA4= -github.com/envoyproxy/go-control-plane v0.9.4/go.mod h1:6rpuAdCZL397s3pYoYcLgu1mIlRU8Am5FuJP05cCM98= -github.com/envoyproxy/go-control-plane v0.9.9-0.20201210154907-fd9021fe5dad/go.mod h1:cXg6YxExXjJnVBQHBLXeUAgxn2UodCpnH306RInaBQk= -github.com/envoyproxy/go-control-plane v0.9.10-0.20210907150352-cf90f659a021/go.mod h1:AFq3mo9L8Lqqiid3OhADV3RfLJnjiw63cSpi+fDTRC0= -github.com/envoyproxy/protoc-gen-validate v0.1.0/go.mod h1:iSmxcyjqTsJpI2R4NaDN7+kN2VEUnK/pcBlmesArF7c= -github.com/ghodss/yaml v1.0.0/go.mod h1:4dBDuWmgqj2HViK6kFavaiC9ZROes6MMH2rRYeMEF04= -github.com/gogo/protobuf v1.3.2 h1:Ov1cvc58UF3b5XjBnZv7+opcTcQFZebYjWzi34vdm4Q= -github.com/gogo/protobuf v1.3.2/go.mod h1:P1XiOD3dCwIKUDQYPy72D8LYyHL2YPYrpS2s69NZV8Q= -github.com/golang/glog v0.0.0-20160126235308-23def4e6c14b/go.mod h1:SBH7ygxi8pfUlaOkMMuAQtPIUF8ecWP5IEl/CR7VP2Q= -github.com/golang/mock v1.1.1/go.mod h1:oTYuIxOrZwtPieC+H1uAHpcLFnEyAGVDL/k47Jfbm0A= -github.com/golang/protobuf v1.2.0/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U= -github.com/golang/protobuf v1.3.2/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U= -github.com/golang/protobuf v1.3.3/go.mod h1:vzj43D7+SQXF/4pzW/hwtAqwc6iTitCiVSaWz5lYuqw= -github.com/golang/protobuf v1.4.0-rc.1/go.mod h1:ceaxUfeHdC40wWswd/P6IGgMaK3YpKi5j83Wpe3EHw8= -github.com/golang/protobuf v1.4.0-rc.1.0.20200221234624-67d41d38c208/go.mod h1:xKAWHe0F5eneWXFV3EuXVDTCmh+JuBKY0li0aMyXATA= -github.com/golang/protobuf v1.4.0-rc.2/go.mod h1:LlEzMj4AhA7rCAGe4KMBDvJI+AwstrUpVNzEA03Pprs= -github.com/golang/protobuf v1.4.0-rc.4.0.20200313231945-b860323f09d0/go.mod h1:WU3c8KckQ9AFe+yFwt9sWVRKCVIyN9cPHBJSNnbL67w= -github.com/golang/protobuf v1.4.0/go.mod h1:jodUvKwWbYaEsadDk5Fwe5c77LiNKVO9IDvqG2KuDX0= -github.com/golang/protobuf v1.4.1/go.mod h1:U8fpvMrcmy5pZrNK1lt4xCsGvpyWQ/VVv6QDs8UjoX8= -github.com/golang/protobuf v1.4.2/go.mod h1:oDoupMAO8OvCJWAcko0GGGIgR6R6ocIYbsSw735rRwI= -github.com/golang/protobuf v1.4.3 h1:JjCZWpVbqXDqFVmTfYWEVTMIYrL/NPdPSCHPJ0T/raM= -github.com/golang/protobuf v1.4.3/go.mod h1:oDoupMAO8OvCJWAcko0GGGIgR6R6ocIYbsSw735rRwI= -github.com/google/go-cmp v0.2.0/go.mod h1:oXzfMopK8JAjlY9xF4vHSVASa0yLyX7SntLO5aqRK0M= -github.com/google/go-cmp v0.3.0/go.mod h1:8QqcDgzrUqlUb/G2PQTWiueGozuR1884gddMywk6iLU= -github.com/google/go-cmp v0.3.1/go.mod h1:8QqcDgzrUqlUb/G2PQTWiueGozuR1884gddMywk6iLU= -github.com/google/go-cmp v0.4.0/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= -github.com/google/go-cmp v0.5.0/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= -github.com/google/uuid v1.1.2/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo= -github.com/grpc-ecosystem/grpc-gateway v1.16.0/go.mod h1:BDjrQk3hbvj6Nolgz8mAMFbcEtjT1g+wF4CSlocrBnw= -github.com/kisielk/errcheck v1.5.0/go.mod h1:pFxgyoBC7bSaBwPgfKdkLd5X25qrDl4LWUI2bnpBCr8= -github.com/kisielk/gotool v1.0.0/go.mod h1:XhKaO+MFFWcvkIS/tQcRk01m1F5IRFswLeQ+oQHNcck= -github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= -github.com/prometheus/client_model v0.0.0-20190812154241-14fe0d1b01d4/go.mod h1:xMI15A0UPsDsEKsMN9yxemIoYk6Tm2C1GtYGdfGttqA= -github.com/rogpeppe/fastuuid v1.2.0/go.mod h1:jVj6XXZzXRy/MSR5jhDC/2q6DgLz+nrA6LYCDYWNEvQ= -github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= -github.com/stretchr/testify v1.5.1/go.mod h1:5W2xD1RspED5o8YsWQXVCued0rvSQ+mT+I5cxcmMvtA= -github.com/stretchr/testify v1.7.0/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= -github.com/yuin/goldmark v1.1.27/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74= -github.com/yuin/goldmark v1.2.1/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74= -go.opentelemetry.io/proto/otlp v0.7.0/go.mod h1:PqfVotwruBrMGOCsRd/89rSnXhoiJIqeYNgFYFoEGnI= -golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w= -golang.org/x/crypto v0.0.0-20191011191535-87dc89f01550/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI= -golang.org/x/crypto v0.0.0-20200622213623-75b288015ac9/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto= -golang.org/x/exp v0.0.0-20190121172915-509febef88a4/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA= -golang.org/x/lint v0.0.0-20181026193005-c67002cb31c3/go.mod h1:UVdnD1Gm6xHRNCYTkRU2/jEulfH38KcIWyp/GAMgvoE= -golang.org/x/lint v0.0.0-20190227174305-5b3e6a55c961/go.mod h1:wehouNa3lNwaWXcvxsM5YxQ5yQlVC4a0KAMCusXpPoU= -golang.org/x/lint v0.0.0-20190313153728-d0100b6bd8b3/go.mod h1:6SW0HCj/g11FgYtHlgUYUwCkIfeOF89ocIRzGO/8vkc= -golang.org/x/mod v0.2.0/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA= -golang.org/x/mod v0.3.0/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA= -golang.org/x/net v0.0.0-20180724234803-3673e40ba225/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= -golang.org/x/net v0.0.0-20180826012351-8a410e7b638d/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= -golang.org/x/net v0.0.0-20190108225652-1e06a53dbb7e/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= -golang.org/x/net v0.0.0-20190213061140-3a22650c66bd/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= -golang.org/x/net v0.0.0-20190311183353-d8887717615a/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg= -golang.org/x/net v0.0.0-20190404232315-eb5bcb51f2a3/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg= -golang.org/x/net v0.0.0-20190620200207-3b0461eec859/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= -golang.org/x/net v0.0.0-20200226121028-0de0cce0169b/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= -golang.org/x/net v0.0.0-20200822124328-c89045814202/go.mod h1:/O7V0waA8r7cgGh81Ro3o1hOxt32SMVPicZroKQ2sZA= -golang.org/x/net v0.0.0-20201021035429-f5854403a974 h1:IX6qOQeG5uLjB/hjjwjedwfjND0hgjPMMyO1RoIXQNI= -golang.org/x/net v0.0.0-20201021035429-f5854403a974/go.mod h1:sp8m0HH+o8qH0wwXwYZr8TS3Oi6o0r6Gce1SSxlDquU= -golang.org/x/oauth2 v0.0.0-20180821212333-d2e6202438be/go.mod h1:N/0e6XlmueqKjAGxoOufVs8QHGRruUQn6yWY3a++T0U= -golang.org/x/oauth2 v0.0.0-20200107190931-bf48bf16ab8d/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw= -golang.org/x/sync v0.0.0-20180314180146-1d60e4601c6f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= -golang.org/x/sync v0.0.0-20181108010431-42b317875d0f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= -golang.org/x/sync v0.0.0-20181221193216-37e7f081c4d4/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= -golang.org/x/sync v0.0.0-20190423024810-112230192c58/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= -golang.org/x/sync v0.0.0-20190911185100-cd5d95a43a6e/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= -golang.org/x/sync v0.0.0-20201020160332-67f06af15bc9/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= -golang.org/x/sys v0.0.0-20180830151530-49385e6e1522/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= -golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= -golang.org/x/sys v0.0.0-20190412213103-97732733099d/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20200323222414-85ca7c5b95cd/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20200930185726-fdedc70b468f h1:+Nyd8tzPX9R7BWHguqsrbFdRx3WQ/1ib8I44HXV5yTA= -golang.org/x/sys v0.0.0-20200930185726-fdedc70b468f/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= -golang.org/x/text v0.3.3 h1:cokOdA+Jmi5PJGXLlLllQSgYigAEfHXJAERHVMaCc2k= -golang.org/x/text v0.3.3/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= -golang.org/x/tools v0.0.0-20180917221912-90fa682c2a6e/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= -golang.org/x/tools v0.0.0-20190114222345-bf090417da8b/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= -golang.org/x/tools v0.0.0-20190226205152-f727befe758c/go.mod h1:9Yl7xja0Znq3iFh3HoIrodX9oNMXvdceNzlUR8zjMvY= -golang.org/x/tools v0.0.0-20190311212946-11955173bddd/go.mod h1:LCzVGOaR6xXOjkQ3onu1FJEFr0SW1gC7cKk1uF8kGRs= -golang.org/x/tools v0.0.0-20190524140312-2c0ae7006135/go.mod h1:RgjU9mgBXZiqYHBnxXauZ1Gv1EHHAz9KjViQ78xBX0Q= -golang.org/x/tools v0.0.0-20191119224855-298f0cb1881e/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= -golang.org/x/tools v0.0.0-20200619180055-7c47624df98f/go.mod h1:EkVYQZoAsY45+roYkvgYkIh4xh/qjgUK9TdY2XT94GE= -golang.org/x/tools v0.0.0-20210106214847-113979e3529a/go.mod h1:emZCQorbCU4vsT4fOWvOPXz4eW1wZW4PmDk9uLelYpA= -golang.org/x/xerrors v0.0.0-20190717185122-a985d3407aa7/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= -golang.org/x/xerrors v0.0.0-20191011141410-1b5146add898/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= -golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= -golang.org/x/xerrors v0.0.0-20200804184101-5ec99f83aff1/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= -google.golang.org/appengine v1.1.0/go.mod h1:EbEs0AVv82hx2wNQdGPgUI5lhzA/G0D9YwlJXL52JkM= -google.golang.org/appengine v1.4.0/go.mod h1:xpcJRLb0r/rnEns0DIKYYv+WjYCduHsrkT7/EB5XEv4= -google.golang.org/genproto v0.0.0-20180817151627-c66870c02cf8/go.mod h1:JiN7NxoALGmiZfu7CAH4rXhgtRTLTxftemlI0sWmxmc= -google.golang.org/genproto v0.0.0-20190819201941-24fa4b261c55/go.mod h1:DMBHOl98Agz4BDEuKkezgsaosCRResVns1a3J2ZsMNc= -google.golang.org/genproto v0.0.0-20200513103714-09dca8ec2884/go.mod h1:55QSHmfGQM9UVYDPBsyGGes0y52j32PQ3BqQfXhyH3c= -google.golang.org/genproto v0.0.0-20200526211855-cb27e3aa2013 h1:+kGHl1aib/qcwaRi1CbqBZ1rk19r85MNUf8HaBghugY= -google.golang.org/genproto v0.0.0-20200526211855-cb27e3aa2013/go.mod h1:NbSheEEYHJ7i3ixzK3sjbqSGDJWnxyFXZblF3eUsNvo= -google.golang.org/grpc v1.19.0/go.mod h1:mqu4LbDTu4XGKhr4mRzUsmM4RtVoemTSY81AxZiDr8c= -google.golang.org/grpc v1.23.0/go.mod h1:Y5yQAOtifL1yxbo5wqy6BxZv8vAUGQwXBOALyacEbxg= -google.golang.org/grpc v1.25.1/go.mod h1:c3i+UQWmh7LiEpx4sFZnkU36qjEYZ0imhYfXVyQciAY= -google.golang.org/grpc v1.27.0/go.mod h1:qbnxyOmOxrQa7FizSgH+ReBfzJrCY1pSN7KXBS8abTk= -google.golang.org/grpc v1.33.1/go.mod h1:fr5YgcSWrqhRRxogOsw7RzIpsmvOZ6IcH4kBYTpR3n0= -google.golang.org/grpc v1.36.0/go.mod h1:qjiiYl8FncCW8feJPdyg3v6XW24KsRHe+dy9BAGRRjU= -google.golang.org/grpc v1.44.0 h1:weqSxi/TMs1SqFRMHCtBgXRs8k3X39QIDEZ0pRcttUg= -google.golang.org/grpc v1.44.0/go.mod h1:k+4IHHFw41K8+bbowsex27ge2rCb65oeWqe4jJ590SU= -google.golang.org/protobuf v0.0.0-20200109180630-ec00e32a8dfd/go.mod h1:DFci5gLYBciE7Vtevhsrf46CRTquxDuWsQurQQe4oz8= -google.golang.org/protobuf v0.0.0-20200221191635-4d8936d0db64/go.mod h1:kwYJMbMJ01Woi6D6+Kah6886xMZcty6N08ah7+eCXa0= -google.golang.org/protobuf v0.0.0-20200228230310-ab0ca4ff8a60/go.mod h1:cfTl7dwQJ+fmap5saPgwCLgHXTUD7jkjRqWcaiX5VyM= -google.golang.org/protobuf v1.20.1-0.20200309200217-e05f789c0967/go.mod h1:A+miEFZTKqfCUM6K7xSMQL9OKL/b6hQv+e19PK+JZNE= -google.golang.org/protobuf v1.21.0/go.mod h1:47Nbq4nVaFHyn7ilMalzfO3qCViNmqZ2kzikPIcrTAo= -google.golang.org/protobuf v1.22.0/go.mod h1:EGpADcykh3NcUnDUJcl1+ZksZNG86OlYog2l/sGQquU= -google.golang.org/protobuf v1.23.0/go.mod h1:EGpADcykh3NcUnDUJcl1+ZksZNG86OlYog2l/sGQquU= -google.golang.org/protobuf v1.23.1-0.20200526195155-81db48ad09cc/go.mod h1:EGpADcykh3NcUnDUJcl1+ZksZNG86OlYog2l/sGQquU= -google.golang.org/protobuf v1.25.0 h1:Ejskq+SyPohKW+1uil0JJMtmHCgJPJ/qWTxr8qp+R4c= -google.golang.org/protobuf v1.25.0/go.mod h1:9JNX74DMeImyA3h4bdi1ymwjUzf21/xIlbajtzgsN7c= -gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= -gopkg.in/yaml.v2 v2.2.2/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= -gopkg.in/yaml.v2 v2.2.3/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= -gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= -honnef.co/go/tools v0.0.0-20190102054323-c2f93a96b099/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4= -honnef.co/go/tools v0.0.0-20190523083050-ea95bdfd59fc/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4= \ No newline at end of file diff --git a/src/stirling/source_connectors/socket_tracer/protocols/http2/testing/go_grpc_client/main.go b/src/stirling/source_connectors/socket_tracer/protocols/http2/testing/go_grpc_client/main.go index 9cfd7206f63..59e4eb07054 100644 --- a/src/stirling/source_connectors/socket_tracer/protocols/http2/testing/go_grpc_client/main.go +++ b/src/stirling/source_connectors/socket_tracer/protocols/http2/testing/go_grpc_client/main.go @@ -31,9 +31,7 @@ import ( "google.golang.org/grpc/credentials/insecure" "google.golang.org/grpc/encoding/gzip" - // ___module___ will get replaced by the module name for the current binary and - // the generated .pb.go is expected to be in a sibling proto/ folder at buildtime. - pb "___module___/proto" + pb "px.dev/pixie/src/stirling/source_connectors/socket_tracer/protocols/http2/testing/proto" ) func getDialOpts(compression, https bool) []grpc.DialOption { diff --git a/src/stirling/source_connectors/socket_tracer/protocols/http2/testing/go_grpc_server/BUILD.bazel b/src/stirling/source_connectors/socket_tracer/protocols/http2/testing/go_grpc_server/BUILD.bazel index e5d10b6d750..212737dbd39 100644 --- a/src/stirling/source_connectors/socket_tracer/protocols/http2/testing/go_grpc_server/BUILD.bazel +++ b/src/stirling/source_connectors/socket_tracer/protocols/http2/testing/go_grpc_server/BUILD.bazel @@ -14,26 +14,30 @@ # # SPDX-License-Identifier: Apache-2.0 -# Build of test data binaries is controlled by dockerized builds, not bazel/gazelle. -#gazelle:ignore - -load("//src/stirling/testing/bazel:containerized_build.bzl", "pl_aux_go_binary") +load("@io_bazel_rules_go//go:def.bzl", "go_binary", "go_library") package(default_visibility = ["//src/stirling:__subpackages__"]) -pl_aux_go_binary( - name = "golang_1_16_grpc_server", - base = "@golang_1_16_image//image", - extra_layers = { - "proto": ["//src/stirling/source_connectors/socket_tracer/protocols/http2/testing/proto:proto_files"], - }, - files = [ - "go.mod", - "go.sum", - "main.go", +go_library( + name = "grpc_server_lib", + srcs = ["main.go"], + importpath = "px.dev/pixie/src/stirling/source_connectors/socket_tracer/protocols/http2/testing/go_grpc_server", + deps = [ + "//src/stirling/source_connectors/socket_tracer/protocols/http2/testing/proto:greet_pl_go_proto", + "@org_golang_google_grpc//:go_default_library", + "@org_golang_google_grpc//encoding/gzip", + "@org_golang_google_grpc//reflection", ], ) +go_binary( + name = "golang_1_16_grpc_server", + embed = [":grpc_server_lib"], + goarch = "amd64", + goos = "linux", + gosdk = "@go_sdk_1_16//:go_sdk", +) + filegroup( name = "golang_1_16_grpc_server_with_certs", srcs = [":golang_1_16_grpc_server"], @@ -44,17 +48,12 @@ filegroup( visibility = ["//src/stirling:__subpackages__"], ) -pl_aux_go_binary( +go_binary( name = "golang_1_17_grpc_server", - base = "@golang_1_17_image//image", - extra_layers = { - "proto": ["//src/stirling/source_connectors/socket_tracer/protocols/http2/testing/proto:proto_files"], - }, - files = [ - "go.mod", - "go.sum", - "main.go", - ], + embed = [":grpc_server_lib"], + goarch = "amd64", + goos = "linux", + gosdk = "@go_sdk_1_17//:go_sdk", ) filegroup( @@ -67,17 +66,9 @@ filegroup( visibility = ["//src/stirling:__subpackages__"], ) -pl_aux_go_binary( +go_binary( name = "golang_1_18_grpc_server", - base = "@golang_1_18_image//image", - extra_layers = { - "proto": ["//src/stirling/source_connectors/socket_tracer/protocols/http2/testing/proto:proto_files"], - }, - files = [ - "go.mod", - "go.sum", - "main.go", - ], + embed = [":grpc_server_lib"], ) filegroup( diff --git a/src/stirling/source_connectors/socket_tracer/protocols/http2/testing/go_grpc_server/go.mod b/src/stirling/source_connectors/socket_tracer/protocols/http2/testing/go_grpc_server/go.mod deleted file mode 100644 index 55de3ff4dd1..00000000000 --- a/src/stirling/source_connectors/socket_tracer/protocols/http2/testing/go_grpc_server/go.mod +++ /dev/null @@ -1,4 +0,0 @@ -require ( - github.com/gogo/protobuf v1.3.2 - google.golang.org/grpc v1.44.0 -) \ No newline at end of file diff --git a/src/stirling/source_connectors/socket_tracer/protocols/http2/testing/go_grpc_server/go.sum b/src/stirling/source_connectors/socket_tracer/protocols/http2/testing/go_grpc_server/go.sum deleted file mode 100644 index e94627c986f..00000000000 --- a/src/stirling/source_connectors/socket_tracer/protocols/http2/testing/go_grpc_server/go.sum +++ /dev/null @@ -1,135 +0,0 @@ -cloud.google.com/go v0.26.0/go.mod h1:aQUYkXzVsufM+DwF1aE+0xfcU+56JwCaLick0ClmMTw= -cloud.google.com/go v0.34.0/go.mod h1:aQUYkXzVsufM+DwF1aE+0xfcU+56JwCaLick0ClmMTw= -github.com/BurntSushi/toml v0.3.1/go.mod h1:xHWCNGjB5oqiDr8zfno3MHue2Ht5sIBksp03qcyfWMU= -github.com/antihax/optional v1.0.0/go.mod h1:uupD/76wgC+ih3iEmQUL+0Ugr19nfwCT1kdvxnR2qWY= -github.com/census-instrumentation/opencensus-proto v0.2.1/go.mod h1:f6KPmirojxKA12rnyqOA5BBL4O983OfeGPqjHWSTneU= -github.com/cespare/xxhash/v2 v2.1.1/go.mod h1:VGX0DQ3Q6kWi7AoAeZDth3/j3BFtOZR5XLFGgcrjCOs= -github.com/client9/misspell v0.3.4/go.mod h1:qj6jICC3Q7zFZvVWo7KLAzC3yx5G7kyvSDkc90ppPyw= -github.com/cncf/udpa/go v0.0.0-20191209042840-269d4d468f6f/go.mod h1:M8M6+tZqaGXZJjfX53e64911xZQV5JYwmTeXPW+k8Sc= -github.com/cncf/udpa/go v0.0.0-20201120205902-5459f2c99403/go.mod h1:WmhPx2Nbnhtbo57+VJT5O0JRkEi1Wbu0z5j0R8u5Hbk= -github.com/cncf/udpa/go v0.0.0-20210930031921-04548b0d99d4/go.mod h1:6pvJx4me5XPnfI9Z40ddWsdw2W/uZgQLFXToKeRcDiI= -github.com/cncf/xds/go v0.0.0-20210805033703-aa0b78936158/go.mod h1:eXthEFrGJvWHgFFCl3hGmgk+/aYT6PnTQLykKQRLhEs= -github.com/cncf/xds/go v0.0.0-20210922020428-25de7278fc84/go.mod h1:eXthEFrGJvWHgFFCl3hGmgk+/aYT6PnTQLykKQRLhEs= -github.com/cncf/xds/go v0.0.0-20211011173535-cb28da3451f1/go.mod h1:eXthEFrGJvWHgFFCl3hGmgk+/aYT6PnTQLykKQRLhEs= -github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= -github.com/envoyproxy/go-control-plane v0.9.0/go.mod h1:YTl/9mNaCwkRvm6d1a2C3ymFceY/DCBVvsKhRF0iEA4= -github.com/envoyproxy/go-control-plane v0.9.1-0.20191026205805-5f8ba28d4473/go.mod h1:YTl/9mNaCwkRvm6d1a2C3ymFceY/DCBVvsKhRF0iEA4= -github.com/envoyproxy/go-control-plane v0.9.4/go.mod h1:6rpuAdCZL397s3pYoYcLgu1mIlRU8Am5FuJP05cCM98= -github.com/envoyproxy/go-control-plane v0.9.9-0.20201210154907-fd9021fe5dad/go.mod h1:cXg6YxExXjJnVBQHBLXeUAgxn2UodCpnH306RInaBQk= -github.com/envoyproxy/go-control-plane v0.9.10-0.20210907150352-cf90f659a021/go.mod h1:AFq3mo9L8Lqqiid3OhADV3RfLJnjiw63cSpi+fDTRC0= -github.com/envoyproxy/protoc-gen-validate v0.1.0/go.mod h1:iSmxcyjqTsJpI2R4NaDN7+kN2VEUnK/pcBlmesArF7c= -github.com/ghodss/yaml v1.0.0/go.mod h1:4dBDuWmgqj2HViK6kFavaiC9ZROes6MMH2rRYeMEF04= -github.com/gogo/protobuf v1.3.2 h1:Ov1cvc58UF3b5XjBnZv7+opcTcQFZebYjWzi34vdm4Q= -github.com/gogo/protobuf v1.3.2/go.mod h1:P1XiOD3dCwIKUDQYPy72D8LYyHL2YPYrpS2s69NZV8Q= -github.com/golang/glog v0.0.0-20160126235308-23def4e6c14b/go.mod h1:SBH7ygxi8pfUlaOkMMuAQtPIUF8ecWP5IEl/CR7VP2Q= -github.com/golang/mock v1.1.1/go.mod h1:oTYuIxOrZwtPieC+H1uAHpcLFnEyAGVDL/k47Jfbm0A= -github.com/golang/protobuf v1.2.0/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U= -github.com/golang/protobuf v1.3.2/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U= -github.com/golang/protobuf v1.3.3/go.mod h1:vzj43D7+SQXF/4pzW/hwtAqwc6iTitCiVSaWz5lYuqw= -github.com/golang/protobuf v1.4.0-rc.1/go.mod h1:ceaxUfeHdC40wWswd/P6IGgMaK3YpKi5j83Wpe3EHw8= -github.com/golang/protobuf v1.4.0-rc.1.0.20200221234624-67d41d38c208/go.mod h1:xKAWHe0F5eneWXFV3EuXVDTCmh+JuBKY0li0aMyXATA= -github.com/golang/protobuf v1.4.0-rc.2/go.mod h1:LlEzMj4AhA7rCAGe4KMBDvJI+AwstrUpVNzEA03Pprs= -github.com/golang/protobuf v1.4.0-rc.4.0.20200313231945-b860323f09d0/go.mod h1:WU3c8KckQ9AFe+yFwt9sWVRKCVIyN9cPHBJSNnbL67w= -github.com/golang/protobuf v1.4.0/go.mod h1:jodUvKwWbYaEsadDk5Fwe5c77LiNKVO9IDvqG2KuDX0= -github.com/golang/protobuf v1.4.1/go.mod h1:U8fpvMrcmy5pZrNK1lt4xCsGvpyWQ/VVv6QDs8UjoX8= -github.com/golang/protobuf v1.4.2/go.mod h1:oDoupMAO8OvCJWAcko0GGGIgR6R6ocIYbsSw735rRwI= -github.com/golang/protobuf v1.4.3 h1:JjCZWpVbqXDqFVmTfYWEVTMIYrL/NPdPSCHPJ0T/raM= -github.com/golang/protobuf v1.4.3/go.mod h1:oDoupMAO8OvCJWAcko0GGGIgR6R6ocIYbsSw735rRwI= -github.com/google/go-cmp v0.2.0/go.mod h1:oXzfMopK8JAjlY9xF4vHSVASa0yLyX7SntLO5aqRK0M= -github.com/google/go-cmp v0.3.0/go.mod h1:8QqcDgzrUqlUb/G2PQTWiueGozuR1884gddMywk6iLU= -github.com/google/go-cmp v0.3.1/go.mod h1:8QqcDgzrUqlUb/G2PQTWiueGozuR1884gddMywk6iLU= -github.com/google/go-cmp v0.4.0/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= -github.com/google/go-cmp v0.5.0/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= -github.com/google/uuid v1.1.2/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo= -github.com/grpc-ecosystem/grpc-gateway v1.16.0/go.mod h1:BDjrQk3hbvj6Nolgz8mAMFbcEtjT1g+wF4CSlocrBnw= -github.com/kisielk/errcheck v1.5.0/go.mod h1:pFxgyoBC7bSaBwPgfKdkLd5X25qrDl4LWUI2bnpBCr8= -github.com/kisielk/gotool v1.0.0/go.mod h1:XhKaO+MFFWcvkIS/tQcRk01m1F5IRFswLeQ+oQHNcck= -github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= -github.com/prometheus/client_model v0.0.0-20190812154241-14fe0d1b01d4/go.mod h1:xMI15A0UPsDsEKsMN9yxemIoYk6Tm2C1GtYGdfGttqA= -github.com/rogpeppe/fastuuid v1.2.0/go.mod h1:jVj6XXZzXRy/MSR5jhDC/2q6DgLz+nrA6LYCDYWNEvQ= -github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= -github.com/stretchr/testify v1.5.1/go.mod h1:5W2xD1RspED5o8YsWQXVCued0rvSQ+mT+I5cxcmMvtA= -github.com/stretchr/testify v1.7.0/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= -github.com/yuin/goldmark v1.1.27/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74= -github.com/yuin/goldmark v1.2.1/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74= -go.opentelemetry.io/proto/otlp v0.7.0/go.mod h1:PqfVotwruBrMGOCsRd/89rSnXhoiJIqeYNgFYFoEGnI= -golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w= -golang.org/x/crypto v0.0.0-20191011191535-87dc89f01550/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI= -golang.org/x/crypto v0.0.0-20200622213623-75b288015ac9/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto= -golang.org/x/exp v0.0.0-20190121172915-509febef88a4/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA= -golang.org/x/lint v0.0.0-20181026193005-c67002cb31c3/go.mod h1:UVdnD1Gm6xHRNCYTkRU2/jEulfH38KcIWyp/GAMgvoE= -golang.org/x/lint v0.0.0-20190227174305-5b3e6a55c961/go.mod h1:wehouNa3lNwaWXcvxsM5YxQ5yQlVC4a0KAMCusXpPoU= -golang.org/x/lint v0.0.0-20190313153728-d0100b6bd8b3/go.mod h1:6SW0HCj/g11FgYtHlgUYUwCkIfeOF89ocIRzGO/8vkc= -golang.org/x/mod v0.2.0/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA= -golang.org/x/mod v0.3.0/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA= -golang.org/x/net v0.0.0-20180724234803-3673e40ba225/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= -golang.org/x/net v0.0.0-20180826012351-8a410e7b638d/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= -golang.org/x/net v0.0.0-20190108225652-1e06a53dbb7e/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= -golang.org/x/net v0.0.0-20190213061140-3a22650c66bd/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= -golang.org/x/net v0.0.0-20190311183353-d8887717615a/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg= -golang.org/x/net v0.0.0-20190404232315-eb5bcb51f2a3/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg= -golang.org/x/net v0.0.0-20190620200207-3b0461eec859/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= -golang.org/x/net v0.0.0-20200226121028-0de0cce0169b/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= -golang.org/x/net v0.0.0-20200822124328-c89045814202/go.mod h1:/O7V0waA8r7cgGh81Ro3o1hOxt32SMVPicZroKQ2sZA= -golang.org/x/net v0.0.0-20201021035429-f5854403a974 h1:IX6qOQeG5uLjB/hjjwjedwfjND0hgjPMMyO1RoIXQNI= -golang.org/x/net v0.0.0-20201021035429-f5854403a974/go.mod h1:sp8m0HH+o8qH0wwXwYZr8TS3Oi6o0r6Gce1SSxlDquU= -golang.org/x/oauth2 v0.0.0-20180821212333-d2e6202438be/go.mod h1:N/0e6XlmueqKjAGxoOufVs8QHGRruUQn6yWY3a++T0U= -golang.org/x/oauth2 v0.0.0-20200107190931-bf48bf16ab8d/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw= -golang.org/x/sync v0.0.0-20180314180146-1d60e4601c6f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= -golang.org/x/sync v0.0.0-20181108010431-42b317875d0f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= -golang.org/x/sync v0.0.0-20181221193216-37e7f081c4d4/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= -golang.org/x/sync v0.0.0-20190423024810-112230192c58/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= -golang.org/x/sync v0.0.0-20190911185100-cd5d95a43a6e/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= -golang.org/x/sync v0.0.0-20201020160332-67f06af15bc9/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= -golang.org/x/sys v0.0.0-20180830151530-49385e6e1522/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= -golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= -golang.org/x/sys v0.0.0-20190412213103-97732733099d/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20200323222414-85ca7c5b95cd/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20200930185726-fdedc70b468f h1:+Nyd8tzPX9R7BWHguqsrbFdRx3WQ/1ib8I44HXV5yTA= -golang.org/x/sys v0.0.0-20200930185726-fdedc70b468f/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= -golang.org/x/text v0.3.3 h1:cokOdA+Jmi5PJGXLlLllQSgYigAEfHXJAERHVMaCc2k= -golang.org/x/text v0.3.3/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= -golang.org/x/tools v0.0.0-20180917221912-90fa682c2a6e/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= -golang.org/x/tools v0.0.0-20190114222345-bf090417da8b/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= -golang.org/x/tools v0.0.0-20190226205152-f727befe758c/go.mod h1:9Yl7xja0Znq3iFh3HoIrodX9oNMXvdceNzlUR8zjMvY= -golang.org/x/tools v0.0.0-20190311212946-11955173bddd/go.mod h1:LCzVGOaR6xXOjkQ3onu1FJEFr0SW1gC7cKk1uF8kGRs= -golang.org/x/tools v0.0.0-20190524140312-2c0ae7006135/go.mod h1:RgjU9mgBXZiqYHBnxXauZ1Gv1EHHAz9KjViQ78xBX0Q= -golang.org/x/tools v0.0.0-20191119224855-298f0cb1881e/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= -golang.org/x/tools v0.0.0-20200619180055-7c47624df98f/go.mod h1:EkVYQZoAsY45+roYkvgYkIh4xh/qjgUK9TdY2XT94GE= -golang.org/x/tools v0.0.0-20210106214847-113979e3529a/go.mod h1:emZCQorbCU4vsT4fOWvOPXz4eW1wZW4PmDk9uLelYpA= -golang.org/x/xerrors v0.0.0-20190717185122-a985d3407aa7/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= -golang.org/x/xerrors v0.0.0-20191011141410-1b5146add898/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= -golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= -golang.org/x/xerrors v0.0.0-20200804184101-5ec99f83aff1/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= -google.golang.org/appengine v1.1.0/go.mod h1:EbEs0AVv82hx2wNQdGPgUI5lhzA/G0D9YwlJXL52JkM= -google.golang.org/appengine v1.4.0/go.mod h1:xpcJRLb0r/rnEns0DIKYYv+WjYCduHsrkT7/EB5XEv4= -google.golang.org/genproto v0.0.0-20180817151627-c66870c02cf8/go.mod h1:JiN7NxoALGmiZfu7CAH4rXhgtRTLTxftemlI0sWmxmc= -google.golang.org/genproto v0.0.0-20190819201941-24fa4b261c55/go.mod h1:DMBHOl98Agz4BDEuKkezgsaosCRResVns1a3J2ZsMNc= -google.golang.org/genproto v0.0.0-20200513103714-09dca8ec2884/go.mod h1:55QSHmfGQM9UVYDPBsyGGes0y52j32PQ3BqQfXhyH3c= -google.golang.org/genproto v0.0.0-20200526211855-cb27e3aa2013 h1:+kGHl1aib/qcwaRi1CbqBZ1rk19r85MNUf8HaBghugY= -google.golang.org/genproto v0.0.0-20200526211855-cb27e3aa2013/go.mod h1:NbSheEEYHJ7i3ixzK3sjbqSGDJWnxyFXZblF3eUsNvo= -google.golang.org/grpc v1.19.0/go.mod h1:mqu4LbDTu4XGKhr4mRzUsmM4RtVoemTSY81AxZiDr8c= -google.golang.org/grpc v1.23.0/go.mod h1:Y5yQAOtifL1yxbo5wqy6BxZv8vAUGQwXBOALyacEbxg= -google.golang.org/grpc v1.25.1/go.mod h1:c3i+UQWmh7LiEpx4sFZnkU36qjEYZ0imhYfXVyQciAY= -google.golang.org/grpc v1.27.0/go.mod h1:qbnxyOmOxrQa7FizSgH+ReBfzJrCY1pSN7KXBS8abTk= -google.golang.org/grpc v1.33.1/go.mod h1:fr5YgcSWrqhRRxogOsw7RzIpsmvOZ6IcH4kBYTpR3n0= -google.golang.org/grpc v1.36.0/go.mod h1:qjiiYl8FncCW8feJPdyg3v6XW24KsRHe+dy9BAGRRjU= -google.golang.org/grpc v1.44.0 h1:weqSxi/TMs1SqFRMHCtBgXRs8k3X39QIDEZ0pRcttUg= -google.golang.org/grpc v1.44.0/go.mod h1:k+4IHHFw41K8+bbowsex27ge2rCb65oeWqe4jJ590SU= -google.golang.org/protobuf v0.0.0-20200109180630-ec00e32a8dfd/go.mod h1:DFci5gLYBciE7Vtevhsrf46CRTquxDuWsQurQQe4oz8= -google.golang.org/protobuf v0.0.0-20200221191635-4d8936d0db64/go.mod h1:kwYJMbMJ01Woi6D6+Kah6886xMZcty6N08ah7+eCXa0= -google.golang.org/protobuf v0.0.0-20200228230310-ab0ca4ff8a60/go.mod h1:cfTl7dwQJ+fmap5saPgwCLgHXTUD7jkjRqWcaiX5VyM= -google.golang.org/protobuf v1.20.1-0.20200309200217-e05f789c0967/go.mod h1:A+miEFZTKqfCUM6K7xSMQL9OKL/b6hQv+e19PK+JZNE= -google.golang.org/protobuf v1.21.0/go.mod h1:47Nbq4nVaFHyn7ilMalzfO3qCViNmqZ2kzikPIcrTAo= -google.golang.org/protobuf v1.22.0/go.mod h1:EGpADcykh3NcUnDUJcl1+ZksZNG86OlYog2l/sGQquU= -google.golang.org/protobuf v1.23.0/go.mod h1:EGpADcykh3NcUnDUJcl1+ZksZNG86OlYog2l/sGQquU= -google.golang.org/protobuf v1.23.1-0.20200526195155-81db48ad09cc/go.mod h1:EGpADcykh3NcUnDUJcl1+ZksZNG86OlYog2l/sGQquU= -google.golang.org/protobuf v1.25.0 h1:Ejskq+SyPohKW+1uil0JJMtmHCgJPJ/qWTxr8qp+R4c= -google.golang.org/protobuf v1.25.0/go.mod h1:9JNX74DMeImyA3h4bdi1ymwjUzf21/xIlbajtzgsN7c= -gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= -gopkg.in/yaml.v2 v2.2.2/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= -gopkg.in/yaml.v2 v2.2.3/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= -gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= -honnef.co/go/tools v0.0.0-20190102054323-c2f93a96b099/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4= -honnef.co/go/tools v0.0.0-20190523083050-ea95bdfd59fc/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4= \ No newline at end of file diff --git a/src/stirling/source_connectors/socket_tracer/protocols/http2/testing/go_grpc_server/main.go b/src/stirling/source_connectors/socket_tracer/protocols/http2/testing/go_grpc_server/main.go index 48fd4883328..e8d0767b258 100644 --- a/src/stirling/source_connectors/socket_tracer/protocols/http2/testing/go_grpc_server/main.go +++ b/src/stirling/source_connectors/socket_tracer/protocols/http2/testing/go_grpc_server/main.go @@ -33,9 +33,7 @@ import ( _ "google.golang.org/grpc/encoding/gzip" "google.golang.org/grpc/reflection" - // ___module___ will get replaced by the module name for the current binary and - // the generated .pb.go is expected to be in a sibling proto/ folder at buildtime. - pb "___module___/proto" + pb "px.dev/pixie/src/stirling/source_connectors/socket_tracer/protocols/http2/testing/proto" ) // server is used to implement helloworld.GreeterServer. diff --git a/src/stirling/source_connectors/socket_tracer/uprobe_symaddrs_test.cc b/src/stirling/source_connectors/socket_tracer/uprobe_symaddrs_test.cc index 825df4da322..82e419dca20 100644 --- a/src/stirling/source_connectors/socket_tracer/uprobe_symaddrs_test.cc +++ b/src/stirling/source_connectors/socket_tracer/uprobe_symaddrs_test.cc @@ -42,8 +42,8 @@ class UprobeSymaddrsTest : public ::testing::Test { } static inline constexpr std::string_view kGoGRPCServer = - "src/stirling/testing/demo_apps/go_grpc_tls_pl/server/golang_1_16_grpc_tls_server_binary/go/" - "src/grpc_tls_server/grpc_tls_server"; + "src/stirling/testing/demo_apps/go_grpc_tls_pl/server/golang_1_16_grpc_tls_server_binary_/" + "golang_1_16_grpc_tls_server_binary"; std::unique_ptr dwarf_reader_; std::unique_ptr elf_reader_; diff --git a/src/stirling/testing/bazel/BUILD.bazel b/src/stirling/testing/bazel/BUILD.bazel deleted file mode 100644 index 45046b38c1c..00000000000 --- a/src/stirling/testing/bazel/BUILD.bazel +++ /dev/null @@ -1,17 +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 - -package(default_visibility = ["//src/stirling:__subpackages__"]) diff --git a/src/stirling/testing/bazel/README.md b/src/stirling/testing/bazel/README.md deleted file mode 100644 index 413f150675e..00000000000 --- a/src/stirling/testing/bazel/README.md +++ /dev/null @@ -1,14 +0,0 @@ -# Containerized Build Rules for auxilary binaries - -## pl_aux_go_binary - -A rule for building auxiliary go binaries used in tests. -These builds are performed in a container, decoupling them from our go toolchain. -This lets us control the go version with which to build the auxiliary test binaries, so we can ensure Stirling works on different versions of Go. -It also provides more determinism in our tests (e.g. less churn on go toolchain upgrades). - -### Usage notes - -The rule will setup a alpine based golang container (see `base` param) and copy over all the files listed in the `files` arg into the source folder. If any more files in a specific directory structure are needed, the `extra_layers` arg can be used to specify a dict of `subfolder_name: subfolder_files` mapping. The rule will create extra container layers to nest these files into the subfolder as needed. This is particularly useful for including generated proto files which are in a separate package and hence must be in a separate folder. - -The rule expects the files copied over to also include the `go.mod` and `go.sum` for any dependencies your program might need. The easiest way to generate these is to copy the build files into a temp dir on your machine and run `go mod init` and `go get`. Be careful to remove the module name and go version from the `go.mod` file since both of those are dependent on the target name which is usually dependent on the version of golang being used. The same steps are necessary when updating any imports in any of the source files. diff --git a/src/stirling/testing/bazel/containerized_build.bzl b/src/stirling/testing/bazel/containerized_build.bzl deleted file mode 100644 index 16393769387..00000000000 --- a/src/stirling/testing/bazel/containerized_build.bzl +++ /dev/null @@ -1,75 +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("@io_bazel_rules_docker//container:container.bzl", "container_image", "container_layer") -load("@io_bazel_rules_docker//docker/util:run.bzl", "container_run_and_commit", "container_run_and_extract") - -# A rule for building auxiliary go binaries used in tests. -# These builds are performed in a container, decoupling them from our go toolchain. -# This lets us control the go version with which to build the auxiliary test binaries, -# so we can ensure Stirling works on different versions of Go. -# It also provides more determinism in our tests (e.g. less churn on go toolchain upgrades). -# Main outputs: -# : The stand-alone binary -# _image_with_binary_commit.tar: A container with the built binary in the CWD. -def pl_aux_go_binary(name, files, base, extra_layers = {}, build_flags = ""): - # Build path within the binary where the sources will be placed and built. - container_build_dir = "/go/src/" + name - outfile = container_build_dir + "/" + name - - layers = [] - for layer_name, layer_targets in extra_layers.items(): - target = "{}_{}".format(name, layer_name) - container_layer( - name = target, - directory = container_build_dir + "/" + layer_name, - files = layer_targets, - ) - layers.append(target) - - container_image( - name = "{}_image_with_source".format(name), - base = base, - directory = container_build_dir, - files = files, - layers = layers, - ) - - container_run_and_commit( - name = "{}_image_with_binary".format(name), - commands = [ - "sed -i s/___module___/{}/g *.go".format(name), - "go mod edit -module={}".format(name), - "go get", - "CGO_ENABLED=0 go build -a -v {}".format(build_flags), - ], - docker_run_flags = ["-w {}".format(container_build_dir)], - image = ":{}_image_with_source.tar".format(name), - ) - - container_run_and_extract( - name = "{}_extractor".format(name), - commands = ["echo"], - extract_file = outfile, - image = ":" + name + "_image_with_binary_commit.tar", - ) - - native.genrule( - name = "{}_gen".format(name), - outs = [name], - srcs = [":{}_extractor{}".format(name, outfile)], - cmd = "cp $< $@", - ) diff --git a/src/stirling/testing/demo_apps/go_grpc_tls_pl/README.md b/src/stirling/testing/demo_apps/go_grpc_tls_pl/README.md index e54a08b0d65..82e3a2e8ad9 100644 --- a/src/stirling/testing/demo_apps/go_grpc_tls_pl/README.md +++ b/src/stirling/testing/demo_apps/go_grpc_tls_pl/README.md @@ -2,23 +2,16 @@ To run, first build everything: ``` -bazel build //src/stirling/testing/demo_apps/go_grpc_tls_pl/... +bazel run //src/stirling/testing/demo_apps/go_grpc_tls_pl/server:golang_1_16_grpc_tls_server -- --norun +bazel run //src/stirling/testing/demo_apps/go_grpc_tls_pl/client:golang_1_16_grpc_tls_client -- --norun ``` Then execute the following commands in two separate terminals: ``` -${PIXIE_ROOT}/bazel-bin/src/stirling/testing/demo_apps/go_grpc_tls_pl/server/server_/server \ - --server_tls_cert=${PIXIE_ROOT}/bazel-bin/src/stirling/testing/demo_apps/go_grpc_tls_pl/certs/server.crt \ - --server_tls_key=${PIXIE_ROOT}/bazel-bin/src/stirling/testing/demo_apps/go_grpc_tls_pl/certs/server.key \ - --tls_ca_cert=${PIXIE_ROOT}/bazel-bin/src/stirling/testing/demo_apps/go_grpc_tls_pl/certs/ca.crt +docker run --name=grpc_tls_server bazel/src/stirling/testing/demo_apps/go_grpc_tls_pl/server:golang_1_16_grpc_tls_server ``` ``` -${PIXIE_ROOT}/bazel-bin/src/stirling/testing/demo_apps/go_grpc_tls_pl/client/client_/client \ - --count 10 \ - --client_tls_cert=${PIXIE_ROOT}/bazel-bin/src/stirling/testing/demo_apps/go_grpc_tls_pl/certs/client.crt \ - --client_tls_key=${PIXIE_ROOT}/bazel-bin/src/stirling/testing/demo_apps/go_grpc_tls_pl/certs/client.key \ - --tls_ca_cert=${PIXIE_ROOT}/bazel-bin/src/stirling/testing/demo_apps/go_grpc_tls_pl/certs/ca.crt +docker run --name=grpc_tls_client --network=container:grpc_tls_server bazel/src/stirling/testing/demo_apps/go_grpc_tls_pl/client:golang_1_16_grpc_tls_client ``` -\ diff --git a/src/stirling/testing/demo_apps/go_grpc_tls_pl/client/BUILD.bazel b/src/stirling/testing/demo_apps/go_grpc_tls_pl/client/BUILD.bazel index 96645d1507d..160b3877cb9 100644 --- a/src/stirling/testing/demo_apps/go_grpc_tls_pl/client/BUILD.bazel +++ b/src/stirling/testing/demo_apps/go_grpc_tls_pl/client/BUILD.bazel @@ -14,11 +14,8 @@ # # SPDX-License-Identifier: Apache-2.0 -# Build of test data binaries is controlled by dockerized builds, not bazel/gazelle. -#gazelle:ignore - load("@io_bazel_rules_docker//container:container.bzl", "container_image", "container_layer") -load("@io_bazel_rules_docker//docker/util:run.bzl", "container_run_and_commit", "container_run_and_extract") +load("@io_bazel_rules_go//go:def.bzl", "go_binary", "go_library") package(default_visibility = ["//src/stirling:__subpackages__"]) @@ -28,121 +25,85 @@ container_layer( files = ["//src/stirling/testing/demo_apps/go_grpc_tls_pl/certs:client_certs"], ) -container_image( - name = "golang_1_16_grpc_tls_client_source", - base = "@golang_1_16_image//image", - directory = "/go/src/grpc_tls_client", - files = ["client.go"], -) - -container_run_and_commit( - name = "golang_1_16_grpc_tls_client_build", - commands = [ - "go mod init", - "go get", - "go build -v", +go_library( + name = "client_lib", + srcs = ["client.go"], + importpath = "px.dev/pixie/src/stirling/testing/demo_apps/go_grpc_tls_pl/client", + deps = [ + "//src/stirling/testing/demo_apps/go_grpc_tls_pl/server/greetpb:service_pl_go_proto", + "@com_github_sirupsen_logrus//:logrus", + "@com_github_spf13_pflag//:pflag", + "@com_github_spf13_viper//:viper", + "@org_golang_google_grpc//:go_default_library", + "@org_golang_google_grpc//credentials", ], - docker_run_flags = ["-w /go/src/grpc_tls_client"], - image = ":golang_1_16_grpc_tls_client_source.tar", ) -container_run_and_extract( +go_binary( name = "golang_1_16_grpc_tls_client_binary", - commands = ["echo"], - extract_file = "/go/src/grpc_tls_client/grpc_tls_client", - image = ":golang_1_16_grpc_tls_client_build_commit.tar", -) - -filegroup( - name = "grpc_tls_client", - srcs = [":golang_1_16_grpc_tls_client_binary/go/src/grpc_tls_client/grpc_tls_client"], + embed = [":client_lib"], + goarch = "amd64", + goos = "linux", + gosdk = "@go_sdk_1_16//:go_sdk", ) container_image( name = "golang_1_16_grpc_tls_client", - base = ":golang_1_16_grpc_tls_client_build_commit.tar", + base = "//:pl_go_base_image", entrypoint = [ - "./grpc_tls_client", + "./golang_1_16_grpc_tls_client_binary", "--client_tls_cert=/certs/client.crt", "--client_tls_key=/certs/client.key", "--tls_ca_cert=/certs/ca.crt", "--count=1", ], - layers = [":certs_layer"], -) - -container_image( - name = "golang_1_17_grpc_tls_client_source", - base = "@golang_1_17_image//image", - directory = "/go/src/grpc_tls_client", - files = ["client.go"], -) - -container_run_and_commit( - name = "golang_1_17_grpc_tls_client_build", - commands = [ - "go mod init", - "go get", - "go build -v", + files = [ + ":golang_1_16_grpc_tls_client_binary", ], - docker_run_flags = ["-w /go/src/grpc_tls_client"], - image = ":golang_1_17_grpc_tls_client_source.tar", + layers = [":certs_layer"], ) -container_run_and_extract( +go_binary( name = "golang_1_17_grpc_tls_client_binary", - commands = ["echo"], - extract_file = "/go/src/grpc_tls_client/grpc_tls_client", - image = ":golang_1_17_grpc_tls_client_build_commit.tar", + embed = [":client_lib"], + goarch = "amd64", + goos = "linux", + gosdk = "@go_sdk_1_17//:go_sdk", ) container_image( name = "golang_1_17_grpc_tls_client", - base = ":golang_1_17_grpc_tls_client_build_commit.tar", + base = "//:pl_go_base_image", entrypoint = [ - "./grpc_tls_client", + "./golang_1_17_grpc_tls_client_binary", "--client_tls_cert=/certs/client.crt", "--client_tls_key=/certs/client.key", "--tls_ca_cert=/certs/ca.crt", "--count=1", ], - layers = [":certs_layer"], -) - -container_image( - name = "golang_1_18_grpc_tls_client_source", - base = "@golang_1_18_image//image", - directory = "/go/src/grpc_tls_client", - files = ["client.go"], -) - -container_run_and_commit( - name = "golang_1_18_grpc_tls_client_build", - commands = [ - "go mod init", - "go get", - "go build -v", + files = [ + ":golang_1_17_grpc_tls_client_binary", ], - docker_run_flags = ["-w /go/src/grpc_tls_client"], - image = ":golang_1_18_grpc_tls_client_source.tar", + layers = [":certs_layer"], ) -container_run_and_extract( +go_binary( name = "golang_1_18_grpc_tls_client_binary", - commands = ["echo"], - extract_file = "/go/src/grpc_tls_client/grpc_tls_client", - image = ":golang_1_18_grpc_tls_client_build_commit.tar", + embed = [":client_lib"], ) container_image( name = "golang_1_18_grpc_tls_client", - base = ":golang_1_18_grpc_tls_client_build_commit.tar", + base = "//:pl_go_base_image", entrypoint = [ - "./grpc_tls_client", + "./golang_1_18_grpc_tls_client_binary", "--client_tls_cert=/certs/client.crt", "--client_tls_key=/certs/client.key", "--tls_ca_cert=/certs/ca.crt", "--count=1", ], + files = [ + ":golang_1_18_grpc_tls_client_binary", + ], layers = [":certs_layer"], ) diff --git a/src/stirling/testing/demo_apps/go_grpc_tls_pl/server/BUILD.bazel b/src/stirling/testing/demo_apps/go_grpc_tls_pl/server/BUILD.bazel index 6565ece5dba..26a8719c252 100644 --- a/src/stirling/testing/demo_apps/go_grpc_tls_pl/server/BUILD.bazel +++ b/src/stirling/testing/demo_apps/go_grpc_tls_pl/server/BUILD.bazel @@ -14,11 +14,8 @@ # # SPDX-License-Identifier: Apache-2.0 -# Build of test data binaries is controlled by dockerized builds, not bazel/gazelle. -#gazelle:ignore - load("@io_bazel_rules_docker//container:container.bzl", "container_image", "container_layer") -load("@io_bazel_rules_docker//docker/util:run.bzl", "container_run_and_commit", "container_run_and_extract") +load("@io_bazel_rules_go//go:def.bzl", "go_binary", "go_library") package(default_visibility = ["//src/stirling:__subpackages__"]) @@ -28,118 +25,83 @@ container_layer( files = ["//src/stirling/testing/demo_apps/go_grpc_tls_pl/certs:server_certs"], ) -container_image( - name = "golang_1_16_grpc_tls_server_source", - base = "@golang_1_16_image//image", - directory = "/go/src/grpc_tls_server", - files = ["server.go"], -) - -container_run_and_commit( - name = "golang_1_16_grpc_tls_server_build", - commands = [ - "go mod init", - "go get", - "go build -v", +go_library( + name = "server_lib", + srcs = ["server.go"], + importpath = "px.dev/pixie/src/stirling/testing/demo_apps/go_grpc_tls_pl/server", + deps = [ + "//src/stirling/testing/demo_apps/go_grpc_tls_pl/server/greetpb:service_pl_go_proto", + "@com_github_sirupsen_logrus//:logrus", + "@com_github_spf13_pflag//:pflag", + "@com_github_spf13_viper//:viper", + "@org_golang_google_grpc//:go_default_library", + "@org_golang_x_net//http2", + "@org_golang_x_net//http2/h2c", ], - docker_run_flags = ["-w /go/src/grpc_tls_server"], - image = ":golang_1_16_grpc_tls_server_source.tar", ) -container_run_and_extract( +go_binary( name = "golang_1_16_grpc_tls_server_binary", - commands = ["echo"], - extract_file = "/go/src/grpc_tls_server/grpc_tls_server", - image = ":golang_1_16_grpc_tls_server_build_commit.tar", -) - -filegroup( - name = "grpc_tls_server", - srcs = [":golang_1_16_grpc_tls_server_binary/go/src/grpc_tls_server/grpc_tls_server"], + embed = [":server_lib"], + goarch = "amd64", + goos = "linux", + gosdk = "@go_sdk_1_16//:go_sdk", ) container_image( name = "golang_1_16_grpc_tls_server", - base = ":golang_1_16_grpc_tls_server_build_commit.tar", + base = "//:pl_go_base_image", entrypoint = [ - "./grpc_tls_server", + "./golang_1_16_grpc_tls_server_binary", "--server_tls_cert=/certs/server.crt", "--server_tls_key=/certs/server.key", "--tls_ca_cert=/certs/ca.crt", ], - layers = [":certs_layer"], -) - -container_image( - name = "golang_1_17_grpc_tls_server_source", - base = "@golang_1_17_image//image", - directory = "/go/src/grpc_tls_server", - files = ["server.go"], -) - -container_run_and_commit( - name = "golang_1_17_grpc_tls_server_build", - commands = [ - "go mod init", - "go get", - "go build -v", + files = [ + ":golang_1_16_grpc_tls_server_binary", ], - docker_run_flags = ["-w /go/src/grpc_tls_server"], - image = ":golang_1_17_grpc_tls_server_source.tar", + layers = [":certs_layer"], ) -container_run_and_extract( +go_binary( name = "golang_1_17_grpc_tls_server_binary", - commands = ["echo"], - extract_file = "/go/src/grpc_tls_server/grpc_tls_server", - image = ":golang_1_17_grpc_tls_server_build_commit.tar", + embed = [":server_lib"], + goarch = "amd64", + goos = "linux", + gosdk = "@go_sdk_1_17//:go_sdk", ) container_image( name = "golang_1_17_grpc_tls_server", - base = ":golang_1_17_grpc_tls_server_build_commit.tar", + base = "//:pl_go_base_image", entrypoint = [ - "./grpc_tls_server", + "./golang_1_17_grpc_tls_server_binary", "--server_tls_cert=/certs/server.crt", "--server_tls_key=/certs/server.key", "--tls_ca_cert=/certs/ca.crt", ], - layers = [":certs_layer"], -) - -container_image( - name = "golang_1_18_grpc_tls_server_source", - base = "@golang_1_18_image//image", - directory = "/go/src/grpc_tls_server", - files = ["server.go"], -) - -container_run_and_commit( - name = "golang_1_18_grpc_tls_server_build", - commands = [ - "go mod init", - "go get", - "go build -v", + files = [ + ":golang_1_17_grpc_tls_server_binary", ], - docker_run_flags = ["-w /go/src/grpc_tls_server"], - image = ":golang_1_18_grpc_tls_server_source.tar", + layers = [":certs_layer"], ) -container_run_and_extract( +go_binary( name = "golang_1_18_grpc_tls_server_binary", - commands = ["echo"], - extract_file = "/go/src/grpc_tls_server/grpc_tls_server", - image = ":golang_1_18_grpc_tls_server_build_commit.tar", + embed = [":server_lib"], ) container_image( name = "golang_1_18_grpc_tls_server", - base = ":golang_1_18_grpc_tls_server_build_commit.tar", + base = "//:pl_go_base_image", entrypoint = [ - "./grpc_tls_server", + "./golang_1_18_grpc_tls_server_binary", "--server_tls_cert=/certs/server.crt", "--server_tls_key=/certs/server.key", "--tls_ca_cert=/certs/ca.crt", ], + files = [ + ":golang_1_18_grpc_tls_server_binary", + ], layers = [":certs_layer"], ) diff --git a/src/stirling/testing/demo_apps/go_https/README.md b/src/stirling/testing/demo_apps/go_https/README.md index b2c9e08cb6d..02715ce107e 100644 --- a/src/stirling/testing/demo_apps/go_https/README.md +++ b/src/stirling/testing/demo_apps/go_https/README.md @@ -1,9 +1,9 @@ # HTTP server -To run, first build everything: +To run ``` -bazel run //src/stirling/testing/demo_apps/go_https/server:golang_1_16_https_server -bazel run //src/stirling/testing/demo_apps/go_https/client:golang_1_16_https_client +bazel run //src/stirling/testing/demo_apps/go_https/server:golang_1_16_https_server -- --norun +bazel run //src/stirling/testing/demo_apps/go_https/client:golang_1_16_https_client -- --norun ``` Then execute the following commands in two separate terminals: diff --git a/src/stirling/testing/demo_apps/go_https/client/BUILD.bazel b/src/stirling/testing/demo_apps/go_https/client/BUILD.bazel index d1f0a15e4af..c7aa82450c6 100644 --- a/src/stirling/testing/demo_apps/go_https/client/BUILD.bazel +++ b/src/stirling/testing/demo_apps/go_https/client/BUILD.bazel @@ -14,88 +14,44 @@ # # SPDX-License-Identifier: Apache-2.0 -# Build of test data binaries is controlled by dockerized builds, not bazel/gazelle. -#gazelle:ignore - -load("@io_bazel_rules_docker//container:container.bzl", "container_image") -load("@io_bazel_rules_docker//docker/util:run.bzl", "container_run_and_commit") +load("@io_bazel_rules_go//go:def.bzl", "go_binary", "go_library") +load("//bazel:go_image_alias.bzl", "go_image") package(default_visibility = ["//src/stirling:__subpackages__"]) -container_image( - name = "golang_1_16_https_client_source", - base = "@golang_1_16_image//image", - directory = "/go/src/https_client", - files = ["https_client.go"], -) - -container_run_and_commit( - name = "golang_1_16_https_client_build", - commands = [ - "go mod init", - "go get", - "go build -v", +go_library( + name = "client_lib", + srcs = ["https_client.go"], + importpath = "px.dev/pixie/src/stirling/testing/demo_apps/go_https/client", + deps = [ + "@com_github_spf13_pflag//:pflag", + "@com_github_spf13_viper//:viper", + "@org_golang_x_net//http2", ], - docker_run_flags = ["-w /go/src/https_client"], - image = ":golang_1_16_https_client_source.tar", ) -container_image( +go_image( name = "golang_1_16_https_client", - base = ":golang_1_16_https_client_build_commit.tar", - entrypoint = [ - "./https_client", - ], -) - -container_image( - name = "golang_1_17_https_client_source", - base = "@golang_1_17_image//image", - directory = "/go/src/https_client", - files = ["https_client.go"], -) - -container_run_and_commit( - name = "golang_1_17_https_client_build", - commands = [ - "go mod init", - "go get", - "go build -v", - ], - docker_run_flags = ["-w /go/src/https_client"], - image = ":golang_1_17_https_client_source.tar", + embed = [":client_lib"], + goarch = "amd64", + goos = "linux", + gosdk = "@go_sdk_1_16//:go_sdk", ) -container_image( +go_image( name = "golang_1_17_https_client", - base = ":golang_1_17_https_client_build_commit.tar", - entrypoint = [ - "./https_client", - ], + embed = [":client_lib"], + goarch = "amd64", + goos = "linux", + gosdk = "@go_sdk_1_17//:go_sdk", ) -container_image( - name = "golang_1_18_https_client_source", - base = "@golang_1_18_image//image", - directory = "/go/src/https_client", - files = ["https_client.go"], +go_binary( + name = "client", + embed = [":client_lib"], ) -container_run_and_commit( - name = "golang_1_18_https_client_build", - commands = [ - "go mod init", - "go get", - "go build -v", - ], - docker_run_flags = ["-w /go/src/https_client"], - image = ":golang_1_18_https_client_source.tar", -) - -container_image( +go_image( name = "golang_1_18_https_client", - base = ":golang_1_18_https_client_build_commit.tar", - entrypoint = [ - "./https_client", - ], + binary = ":client", ) diff --git a/src/stirling/testing/demo_apps/go_https/server/BUILD.bazel b/src/stirling/testing/demo_apps/go_https/server/BUILD.bazel index 839556bb1ce..49fab78b011 100644 --- a/src/stirling/testing/demo_apps/go_https/server/BUILD.bazel +++ b/src/stirling/testing/demo_apps/go_https/server/BUILD.bazel @@ -14,14 +14,21 @@ # # SPDX-License-Identifier: Apache-2.0 -# Build of test data binaries is controlled by dockerized builds, not bazel/gazelle. -#gazelle:ignore - load("@io_bazel_rules_docker//container:container.bzl", "container_image") -load("@io_bazel_rules_docker//docker/util:run.bzl", "container_run_and_commit") +load("@io_bazel_rules_go//go:def.bzl", "go_binary", "go_library") package(default_visibility = ["//src/stirling:__subpackages__"]) +go_library( + name = "server_lib", + srcs = ["https_server.go"], + importpath = "px.dev/pixie/src/stirling/testing/demo_apps/go_https/server", + deps = [ + "@com_github_spf13_pflag//:pflag", + "@com_github_spf13_viper//:viper", + ], +) + genrule( name = "certs", outs = [ @@ -42,92 +49,65 @@ filegroup( ], ) -container_image( - name = "golang_1_16_https_server_source", - base = "@golang_1_16_image//image", - directory = "/go/src/https_server", - files = ["https_server.go"], -) - -container_run_and_commit( - name = "golang_1_16_https_server_build", - commands = [ - "go mod init", - "go get", - "go build -v", - ], - docker_run_flags = ["-w /go/src/https_server"], - image = ":golang_1_16_https_server_source.tar", +go_binary( + name = "golang_1_16_server_binary", + embed = [":server_lib"], + goarch = "amd64", + goos = "linux", + gosdk = "@go_sdk_1_16//:go_sdk", ) container_image( name = "golang_1_16_https_server", - base = ":golang_1_16_https_server_build_commit.tar", - directory = "/certs", + base = "//:pl_go_base_image", entrypoint = [ - "./https_server", - "--cert=/certs/server.crt", - "--key=/certs/server.key", + "./golang_1_16_server_binary", + "--cert=server.crt", + "--key=server.key", + ], + files = [ + ":golang_1_16_server_binary", + ":server_certs", ], - files = [":server_certs"], -) - -container_image( - name = "golang_1_17_https_server_source", - base = "@golang_1_17_image//image", - directory = "/go/src/https_server", - files = ["https_server.go"], ) -container_run_and_commit( - name = "golang_1_17_https_server_build", - commands = [ - "go mod init", - "go get", - "go build -v", - ], - docker_run_flags = ["-w /go/src/https_server"], - image = ":golang_1_17_https_server_source.tar", +go_binary( + name = "golang_1_17_server_binary", + embed = [":server_lib"], + goarch = "amd64", + goos = "linux", + gosdk = "@go_sdk_1_17//:go_sdk", ) container_image( name = "golang_1_17_https_server", - base = ":golang_1_17_https_server_build_commit.tar", - directory = "/certs", + base = "//:pl_go_base_image", entrypoint = [ - "./https_server", - "--cert=/certs/server.crt", - "--key=/certs/server.key", + "./golang_1_17_server_binary", + "--cert=server.crt", + "--key=server.key", + ], + files = [ + ":golang_1_17_server_binary", + ":server_certs", ], - files = [":server_certs"], -) - -container_image( - name = "golang_1_18_https_server_source", - base = "@golang_1_18_image//image", - directory = "/go/src/https_server", - files = ["https_server.go"], ) -container_run_and_commit( - name = "golang_1_18_https_server_build", - commands = [ - "go mod init", - "go get", - "go build -v", - ], - docker_run_flags = ["-w /go/src/https_server"], - image = ":golang_1_18_https_server_source.tar", +go_binary( + name = "golang_1_18_server_binary", + embed = [":server_lib"], ) container_image( name = "golang_1_18_https_server", - base = ":golang_1_18_https_server_build_commit.tar", - directory = "/certs", + base = "//:pl_go_base_image", entrypoint = [ - "./https_server", - "--cert=/certs/server.crt", - "--key=/certs/server.key", + "./golang_1_18_server_binary", + "--cert=server.crt", + "--key=server.key", + ], + files = [ + ":golang_1_18_server_binary", + ":server_certs", ], - files = [":server_certs"], )