Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Mount special filesystem in chroot runners #116

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions cmd/bb_runner/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,13 @@ func main() {
buildDirectoryPath,
commandCreator,
configuration.SetTmpdirEnvironmentVariable)
for _, mountinfo := range configuration.InputRootMounts {
EdSchouten marked this conversation as resolved.
Show resolved Hide resolved
r = runner.NewMountingRunner(
r,
buildDirectory,
mountinfo,
)
}

// Let bb_runner replace temporary directories with symbolic
// links pointing to the temporary directory set up by
Expand Down
2 changes: 1 addition & 1 deletion cmd/bb_scheduler/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,7 @@ func main() {
}
killOperationsAuthorizer, err := authorizerFactory.NewAuthorizerFromConfiguration(configuration.KillOperationsAuthorizer)
if err != nil {
return util.StatusWrap(err, "Failed to create kill operaitons authorizer")
return util.StatusWrap(err, "Failed to create kill operations authorizer")
}

platformQueueWithNoWorkersTimeout := configuration.PlatformQueueWithNoWorkersTimeout
Expand Down
157 changes: 128 additions & 29 deletions pkg/proto/configuration/bb_runner/bb_runner.pb.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

33 changes: 33 additions & 0 deletions pkg/proto/configuration/bb_runner/bb_runner.proto
Original file line number Diff line number Diff line change
Expand Up @@ -131,4 +131,37 @@ message ApplicationConfiguration {
// https://github.com/bazelbuild/bazel/blob/master/src/main/java/com/google/devtools/build/lib/exec/local/XcodeLocalEnvProvider.java
// https://www.smileykeith.com/2021/03/08/locking-xcode-in-bazel/
map<string, string> apple_xcode_developer_directories = 14;

// Mount special filesystems in the input root. This is useful when
// running with `chroot_into_input_root`. Some tools require access to
// special filesystems that are created when the operating system
// boots. An input root with a full userland implementation may need
// these.
//
// The mount point directories must exist in the input root.
//
// Typical choices are:
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is this a good place for this? The chroot connection is smeared all over this work,
but the work can also stand on its own feet, maybe a central "how-to-chroot" document is better?

  //    {"proc", "/proc", "proc"}
  //    {"sys", "/sys", "sysfs"}

//
// inputRootMounts: [
// {
// mountpoint: 'proc',
// source: '/proc',
// filesystemType: 'proc',
// },
// {
// mountpoint: 'sys',
// source: '/sys',
// filesystemType: 'sysfs',
// },
// ],
repeated InputMountOptions input_root_mounts = 15;
}

message InputMountOptions {
// Mount a filesystem in the input root, a relative path.
string mountpoint = 1;
// Source filesystem from the runner's operating system.
string source = 2;
// Type of filesystem, see the mount(8) man page.
string filesystem_type = 3;
}
4 changes: 4 additions & 0 deletions pkg/runner/BUILD.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ go_library(
"local_runner_rss_kibibytes.go",
"local_runner_unix.go",
"local_runner_windows.go",
"mounting_runner.go",
"path_existence_checking_runner.go",
"temporary_directory_installing_runner.go",
"temporary_directory_symlinking_runner.go",
Expand All @@ -19,6 +20,7 @@ go_library(
visibility = ["//visibility:public"],
deps = [
"//pkg/cleaner",
"//pkg/proto/configuration/bb_runner",
"//pkg/proto/runner",
"//pkg/proto/tmp_installer",
"@com_github_buildbarn_bb_storage//pkg/filesystem",
Expand Down Expand Up @@ -70,13 +72,15 @@ go_test(
"apple_xcode_resolving_runner_test.go",
"clean_runner_test.go",
"local_runner_test.go",
"mounting_runner_test.go",
"path_existence_checking_runner_test.go",
"temporary_directory_symlinking_runner_test.go",
],
deps = [
":runner",
"//internal/mock",
"//pkg/cleaner",
"//pkg/proto/configuration/bb_runner",
"//pkg/proto/resourceusage",
"//pkg/proto/runner",
"@com_github_buildbarn_bb_storage//pkg/filesystem",
Expand Down
Loading