bazel: limit concurrency of mkosi_image rule

The mkosi_image rule uses a lot of memory.
In order to allow higher levels of concurrency,
such as `bazel build --jobs 128`, we need to more accurately model the
amount of CPU and memory required.
This commit is contained in:
Malte Poll 2024-05-22 13:24:42 +02:00
parent 1b3b3041d7
commit 6533351dd9

View File

@ -2,6 +2,9 @@
load("@bazel_skylib//lib:paths.bzl", "paths") load("@bazel_skylib//lib:paths.bzl", "paths")
def _resource_set(_os, _num_inputs):
return {"cpu": 4, "memory": 4096}
def _mkosi_image_impl(ctx): def _mkosi_image_impl(ctx):
args = ctx.actions.args() args = ctx.actions.args()
inputs = [] inputs = []
@ -99,6 +102,7 @@ def _mkosi_image_impl(ctx):
execution_requirements = {"no-remote": "1", "no-sandbox": "1"}, execution_requirements = {"no-remote": "1", "no-sandbox": "1"},
progress_message = "Building mkosi image " + ctx.label.name, progress_message = "Building mkosi image " + ctx.label.name,
env = env, env = env,
resource_set = _resource_set,
) )
return DefaultInfo(files = depset(outputs), runfiles = ctx.runfiles(outputs)) return DefaultInfo(files = depset(outputs), runfiles = ctx.runfiles(outputs))