commit | 7fbf10455fd61b4c34182be5cdb3a53fd9897d4b | [log] [tgz] |
---|---|---|
author | Leopold <leo@monogon.tech> | Fri Jan 06 19:57:37 2023 +0100 |
committer | Leopold Schabel <leo@monogon.tech> | Thu Jan 19 19:07:21 2023 +0000 |
tree | 02ead12ee79b10abfdd624071802acc771f6bb3e | |
parent | bffdda85d7750c9a9a34289a79281edeae1d73ef [diff] |
*: bring our own sandbox root This change removes the build container and replaces it with a Bazel-built Fedora 37 sysroot which is bind-mounted into the Bazel sandbox using --sandbox_add_mount_pair. The tools/bazel wrapper script automatically (re-)generates the sysroot when needed. Both Bazelisk and Bazel's native wrapper automatically run the tools/bazel script, which means that our build should now work without extra steps on any machine with a working Bazelisk setup and unpriv ns. This fixes all kinds of weirdness caused by the previous podman setup ("bazel run"/container pushes, log access, weird podman bugs, breaking the IDE plugin for any non-Monogon workspaces...). Using the sandbox hash as an action var also ensures that the cache is invalidated whenever the ambient environment changes. Previously, Bazel did not invalidate build steps when any host dependency changed. To my knowledge, this was the only remaining cause for stale builds. It also means we cannot depend on the host toolchain since it won't be accessible in the sandbox, and anything that inspects the host during analysis stage will fail. This currently means that running on a non-Fedora host won't work - we fix this next. All RPMs are pinned and the sysroot is fully reproducible. Once we upgrade to Bazel 5.x, we can take it further by enabling --experimental_use_hermetic_linux_sandbox and fully remove the remaining host paths from the sandbox for full hermeticity. In a follow-up, we can clean up the CI image to only contain the minimum dependencies needed for Bazelisk and the agent. Existing IntelliJ users need to remove the -Dbazel.bep.path flag from their VM options. Handbook/Rust rules are disabled temporarily to keep CI green (requires a more recent rules_rust version). Change-Id: I1f17d57d985ff9d749bf3359f259d8ef52247c18 Reviewed-on: https://review.monogon.dev/c/monogon/+/1033 Tested-by: Jenkins CI Reviewed-by: Lorenz Brun <lorenz@monogon.tech>
This is the main repository containing the source code for the Monogon Platform.
This is pre-release software - take a look, and check back later!
Our build environment is self-contained and requires only minimal host dependencies:
/dev/kvm
(if you want to run tests).Our docs assume that Bazelisk is available as bazel
on your PATH.
This repository is compatible with the IntelliJ Bazel plugin out of the box, which enables full autocompletion for external dependencies and generated code.
The following steps are necessary:
Install Google's Bazel plugin in IntelliJ.
Make sure that Bazel "Bazel Binary Location" in Other Settings → Bazel Settings points to Bazelisk.
Use File → Import Bazel project... and select your monorepo checkout.
After running the first sync, everything should now resolve in the IDE, including generated code.
Launch the node:
bazel run //:launch -c dbg
Run a kubectl command:
bazel run //metropolis/cli/dbg -c dbg -- kubectl describe node
Run full test suite:
bazel test -c dbg //...