| Lorenz Brun | de57e6f | 2025-01-08 16:34:08 +0000 | [diff] [blame^] | 1 | load("@aspect_bazel_lib//lib:transitions.bzl", "platform_transition_binary") |
| 2 | load("@io_bazel_rules_go//go:def.bzl", "go_binary", "go_library") |
| 3 | load("@rules_oci//oci:defs.bzl", "oci_image") |
| 4 | load("@rules_pkg//pkg:tar.bzl", "pkg_tar") |
| 5 | |
| 6 | go_library( |
| 7 | name = "agent_lib", |
| 8 | srcs = ["main.go"], |
| 9 | importpath = "source.monogon.dev/metropolis/test/e2e/connectivity/agent", |
| 10 | visibility = ["//visibility:private"], |
| 11 | deps = [ |
| 12 | "//metropolis/test/e2e/connectivity/spec", |
| 13 | "@org_golang_google_protobuf//encoding/protodelim", |
| 14 | ], |
| 15 | ) |
| 16 | |
| 17 | go_binary( |
| 18 | name = "agent", |
| 19 | embed = [":agent_lib"], |
| 20 | visibility = ["//visibility:private"], |
| 21 | ) |
| 22 | |
| 23 | platform_transition_binary( |
| 24 | name = "agent_transitioned", |
| 25 | binary = ":agent", |
| 26 | target_platform = "//build/platforms:linux_amd64_static", |
| 27 | visibility = ["//visibility:private"], |
| 28 | ) |
| 29 | |
| 30 | pkg_tar( |
| 31 | name = "agent_layer", |
| 32 | srcs = [":agent_transitioned"], |
| 33 | visibility = ["//visibility:private"], |
| 34 | ) |
| 35 | |
| 36 | oci_image( |
| 37 | name = "agent_image", |
| 38 | base = "@distroless_base", |
| 39 | entrypoint = ["/agent"], |
| 40 | tars = [":agent_layer"], |
| 41 | visibility = ["//metropolis/test/e2e:__pkg__"], |
| 42 | workdir = "/app", |
| 43 | ) |