third_party/linux: build using unhermetic rule
This replaces ad-hoc genrules (for the node Linux image and the ktest
image) with a real Bazel rule with an attached transition which ensures
we end up with the same-ish configurations for all builds of an image.
This reduces rebuilds of the ktest Linux kernel, from three down to one.
Before: https://drive.google.com/file/d/1c6VmY2bqx9Pgs61TOUfgMi8Sn0WQeobu/view
After: https://drive.google.com/file/d/13eO1rLhoBCMMRUKrmJz8QnhdAR3ctIGb/view
We also drive-by fix the Kubernetes CTS test suite to run on a single-node
Cluster (instead of failing early due to that being currently reworked).
Test Plan: Build system refactor, following existing test.
X-Origin-Diff: phab/D761
GitOrigin-RevId: b5545ac5fd402fbf0340d941a90b9ea6ea0b6d43
diff --git a/third_party/linux/BUILD.bazel b/third_party/linux/BUILD.bazel
index 2a52fe3..0d1bad9 100644
--- a/third_party/linux/BUILD.bazel
+++ b/third_party/linux/BUILD.bazel
@@ -1,28 +1,8 @@
-genrule(
- name = "bzImage",
- srcs = [
- "@linux//:all",
- "linux-metropolis.config",
- ],
- outs = [
- "bzImage",
- ],
- cmd = """
- DIR=external/linux
+load("//third_party/linux:def.bzl", "linux_image")
- mkdir $$DIR/.bin
+exports_files(["linux-metropolis.config"])
- cp $(location linux-metropolis.config) $$DIR/.config
-
- (cd $$DIR && make -j $$(nproc) >/dev/null)
-
- cp $$DIR/arch/x86/boot/bzImage $(RULEDIR)
- """,
- visibility = ["//visibility:public"],
-)
-
-filegroup(
- name = "kernel-config",
- srcs = ["linux-metropolis.config"],
+linux_image(
+ name = "linux",
visibility = ["//visibility:public"],
)