Skip to content

Commit

Permalink
netmeta-in-a-box
Browse files Browse the repository at this point in the history
Change-Id: I4d26a445fc53184fd0d127cd32bf888019982011
  • Loading branch information
fionera committed Jan 5, 2025
1 parent 43e3ce3 commit 4977445
Show file tree
Hide file tree
Showing 29 changed files with 2,234 additions and 104 deletions.
27 changes: 24 additions & 3 deletions MODULE.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ bazel_dep(name = "aspect_bazel_lib", version = "2.9.0")
bazel_dep(name = "hermetic_cc_toolchain", version = "3.1.0")
bazel_dep(name = "toolchains_protoc", version = "0.3.3")
bazel_dep(name = "rules_multirun", version = "0.9.0")
bazel_dep(name = "protobuf", version = "29.2")

toolchains = use_extension("@hermetic_cc_toolchain//toolchain:ext.bzl", "toolchains")
use_repo(toolchains, "zig_sdk")
Expand All @@ -54,13 +55,12 @@ use_repo(
"com_github_gopacket_gopacket",
"com_github_huandu_go_sqlbuilder",
"com_github_netsampler_goflow2",
"com_github_netsampler_goflow2_v2",
"com_github_osrg_gobgp",
"com_github_pressly_goose_v3",
"com_github_sirupsen_logrus",
"com_github_vishvananda_netlink",
"io_k8s_klog_v2",
"org_cuelang_go",
"org_golang_google_protobuf",
)

oci = use_extension("@rules_oci//oci:extensions.bzl", "oci")
Expand Down Expand Up @@ -111,5 +111,26 @@ grafana_plugin(
grafana_plugin(
name = "grafana-clickhouse-datasource",
plugin_name = "grafana-clickhouse-datasource",
version = "4.5.0",
version = "4.5.1",
)

grafana = use_repo_rule("//third_party/grafana:defs.bzl", "grafana")

grafana(
name = "grafana_bin",
)

clickhouse = use_repo_rule("//third_party/clickhouse:defs.bzl", "clickhouse")

clickhouse(
name = "clickhouse_bin",
)

#http_file = use_repo_rule("@bazel_tools//tools/build_defs/repo:http.bzl", "http_file")

#http_file(
# name = "clickhouse",
# downloaded_file_path = "clickhouse",
# executable = True,
# url = "https://builds.clickhouse.com/master/macos-aarch64/clickhouse",
#)
769 changes: 752 additions & 17 deletions MODULE.bazel.lock

Large diffs are not rendered by default.

6 changes: 3 additions & 3 deletions build/cue/def.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,8 @@ def _cue_export(ctx):
for arg in ctx.attr.args:
arguments.add(ctx.expand_location(arg))

output = ctx.actions.declare_file(ctx.attr.outfile)
arguments.add_all(["--outfile", output])
output = ctx.actions.declare_file(ctx.attr.output)
arguments.add_all(["--output", output])

ctx.actions.run(
outputs = [output],
Expand All @@ -38,7 +38,7 @@ cue_export = rule(
"args": attr.string_list(),
"srcs": attr.label_list(
),
"outfile": attr.string(
"output": attr.string(
mandatory = True,
),
"_cue": attr.label(
Expand Down
62 changes: 62 additions & 0 deletions cmd/pcap/BUILD.bazel
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
load("@rules_go//go:def.bzl", "go_binary", "go_library")

go_library(
name = "pcap_lib",
srcs = [
"bla.go",
"frame.go",
"main.go",
"quote.go",
"visitor.go",
],
data = [
":google_protos",
"//cmd/risinfo",
"//deploy:all_files",
"@clickhouse_bin//:clickhouse",
"@grafana-clickhouse-datasource//:files",
"@grafana_bin//:bin/grafana-server",
"@netsage-sankey-panel//:files",
],
importpath = "github.com/monogon-dev/netmeta/cmd/pcap",
visibility = ["//visibility:private"],
x_defs = {
"xClickhousePath": "$(rlocationpath @clickhouse_bin//:clickhouse)",
"xGrafanaPath": "$(rlocationpath @grafana_bin//:bin/grafana-server)",
"xProtobufPaths": "$(rlocationpaths :google_protos)",
"xRisInfoPath": "$(rlocationpath //cmd/risinfo)",
"xNetsageSankeyPanel": "$(rlocationpaths @netsage-sankey-panel//:files)",
"xGrafanaClickhouseDatasource": "$(rlocationpaths @grafana-clickhouse-datasource//:files)",
},
deps = [
"@com_github_clickhouse_clickhouse_go_v2//:clickhouse-go",
"@com_github_clickhouse_clickhouse_go_v2//lib/driver",
"@com_github_emicklei_proto//:proto",
"@com_github_gopacket_gopacket//:gopacket",
"@com_github_gopacket_gopacket//layers",
"@com_github_gopacket_gopacket//pcapgo",
"@com_github_huandu_go_sqlbuilder//:go-sqlbuilder",
"@com_github_netsampler_goflow2//pb",
"@org_cuelang_go//cue",
"@org_cuelang_go//cue/cuecontext",
"@org_cuelang_go//cue/errors",
"@org_cuelang_go//cue/interpreter/embed",
"@org_cuelang_go//cue/load",
"@org_golang_google_protobuf//encoding/protodelim",
"@rules_go//go/runfiles",
],
)

filegroup(
name = "google_protos",
srcs = [
"@protobuf//:descriptor_proto_srcs",
"@protobuf//:well_known_type_protos",
],
)

go_binary(
name = "pcap",
embed = [":pcap_lib"],
visibility = ["//visibility:public"],
)
Loading

0 comments on commit 4977445

Please sign in to comment.