forked from buildbarn/bb-deployments
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Reproduce the /proc error in chroot runners.
This works fine for regular runners that uses the docker image user-space. But the next commit enables chroot runners and it starts to fail. bazel build \ --remote_executor=grpc://localhost:8980 \ --remote_instance_name=fuse \ --remote_default_exec_properties OSFamily=linux \ --remote_default_exec_properties container-image="docker://ghcr.io/catthehacker/ubuntu:act-22.04@sha256:5f9c35c25db1d51a8ddaae5c0ba8d3c163c5e9a4a6cc97acd409ac7eae239448" \ @//:introspection This is step one of three to verify the solution to: buildbarn/bb-remote-execution#115
- Loading branch information
1 parent
bd5c7fe
commit 4bd72af
Showing
8 changed files
with
65 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,8 +1,30 @@ | ||
load("@aspect_bazel_lib//lib:run_binary.bzl", "run_binary") | ||
load("@bazel_gazelle//:def.bzl", "gazelle") | ||
load("@com_github_bazelbuild_buildtools//buildifier:def.bzl", "buildifier") | ||
|
||
# gazelle:prefix github.com/buildbarn/bb-deployments | ||
# gazelle:exclude dummy_for_dependencies.go | ||
gazelle( | ||
name = "gazelle", | ||
) | ||
|
||
# $ bazel build //cmd/ls-proc | ||
# $ cp -f bazel-bin/cmd/ls-proc/ls-proc_/ls-proc ls-proc | ||
run_binary( | ||
name = "introspection", | ||
outs = ["out"], | ||
args = ["$(location out)"], | ||
execution_requirements = { | ||
"no-cache": "1", | ||
}, | ||
tool = ":ls-proc", | ||
srcs = [ | ||
# env is required in path resolution for chroot actions. | ||
"usr/bin/env", | ||
# Not strictly needed, but symmetric with sys and proc. | ||
"dev/dummy", | ||
# Send a directory for /sys and /proc | ||
# Bazel wants a file for it to send the directory. | ||
"sys/dummy", | ||
"proc/dummy", | ||
], | ||
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
load("@io_bazel_rules_go//go:def.bzl", "go_binary", "go_library") | ||
|
||
go_library( | ||
name = "go_default_library", | ||
srcs = ["main.go"], | ||
importpath = "github.com/buildbarn/bb-deployments/cmd/ls-proc", | ||
visibility = ["//visibility:private"], | ||
) | ||
|
||
go_binary( | ||
name = "ls-proc", | ||
embed = [":go_default_library"], | ||
visibility = ["//visibility:public"], | ||
pure = "on", | ||
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
package main | ||
|
||
import ( | ||
"fmt" | ||
"os" | ||
"log" | ||
) | ||
|
||
func main() { | ||
entries, err := os.ReadDir("/proc/self") | ||
if err != nil { | ||
log.Fatal("Reading /proc/self:", err) | ||
} | ||
if len(os.Args) == 1 { | ||
log.Fatal("Usage: ls-proc <output file>") | ||
} | ||
|
||
max := 10 | ||
for i, e := range entries { | ||
if i > max { | ||
break | ||
} | ||
fmt.Println(e.Name()) | ||
} | ||
|
||
os.Create(os.Args[1]) | ||
} |
Empty file.
Binary file not shown.