treewide: clean up test static binary targets
This removes some intermediate targets only used for transitions by
consolidating them into a single one.
Change-Id: I46dcbcb731038edd2b67259de1811018f5ba43da
Reviewed-on: https://review.monogon.dev/c/monogon/+/3753
Reviewed-by: Leopold Schabel <leo@monogon.tech>
Tested-by: Jenkins CI
Vouch-Run-CI: Tim Windelschmidt <tim@monogon.tech>
diff --git a/cloud/agent/takeover/BUILD.bazel b/cloud/agent/takeover/BUILD.bazel
index 63747a9..2b28464 100644
--- a/cloud/agent/takeover/BUILD.bazel
+++ b/cloud/agent/takeover/BUILD.bazel
@@ -1,3 +1,4 @@
+load("@aspect_bazel_lib//lib:transitions.bzl", "platform_transition_binary")
load("@io_bazel_rules_go//go:def.bzl", "go_binary", "go_library")
load("//build/static_binary_tarball:def.bzl", "static_binary_tarball")
load("//osbase/build:def.bzl", "node_initramfs")
@@ -26,6 +27,27 @@
],
)
+go_binary(
+ name = "takeover_bin",
+ embed = [":takeover_lib"],
+ visibility = ["//visibility:private"],
+)
+
+# Used by e2e tests, forces a static build
+platform_transition_binary(
+ name = "takeover",
+ binary = ":takeover_bin",
+ target_platform = "//build/platforms:linux_amd64_static",
+ visibility = ["//visibility:public"],
+)
+
+# Used by container_images, forces a static build
+static_binary_tarball(
+ name = "takeover_layer",
+ executable = ":takeover_bin",
+ visibility = ["//visibility:public"],
+)
+
node_initramfs(
name = "initramfs",
files = {
@@ -39,16 +61,3 @@
],
visibility = ["//cloud/agent:__subpackages__"],
)
-
-go_binary(
- name = "takeover",
- embed = [":takeover_lib"],
- visibility = ["//visibility:public"],
-)
-
-# Used by container_images, forces a static build of the test_agent.
-static_binary_tarball(
- name = "takeover_layer",
- executable = ":takeover",
- visibility = ["//visibility:public"],
-)