Add reasonable defaults to RBE configuration parameters.
Test: simple one action build
Change-Id: Ic66ad2b89866a67008950035bc3b559dae4e3a3e
diff --git a/ui/build/rbe.go b/ui/build/rbe.go
index fd3b7ab..99107e3 100644
--- a/ui/build/rbe.go
+++ b/ui/build/rbe.go
@@ -37,10 +37,8 @@
func rbeCommand(ctx Context, config Config, rbeCmd string) string {
var cmdPath string
- if rbeDir, ok := config.Environment().Get("RBE_DIR"); ok {
+ if rbeDir := config.rbeDir(); rbeDir != "" {
cmdPath = filepath.Join(rbeDir, rbeCmd)
- } else if home, ok := config.Environment().Get("HOME"); ok {
- cmdPath = filepath.Join(home, "rbe", rbeCmd)
} else {
ctx.Fatalf("rbe command path not found")
}
@@ -52,9 +50,18 @@
return cmdPath
}
-func getRBEVars(ctx Context, tmpDir string) map[string]string {
+func getRBEVars(ctx Context, config Config) map[string]string {
rand.Seed(time.Now().UnixNano())
- return map[string]string{"RBE_server_address": fmt.Sprintf("unix://%v/reproxy_%v.sock", tmpDir, rand.Intn(1000))}
+ vars := map[string]string{
+ "RBE_server_address": fmt.Sprintf("unix://%v/reproxy_%v.sock", absPath(ctx, config.TempDir()), rand.Intn(1000)),
+ "RBE_log_path": config.rbeLogPath(),
+ "RBE_re_proxy": config.rbeReproxy(),
+ "RBE_exec_root": config.rbeExecRoot(),
+ "RBE_output_dir": config.rbeStatsOutputDir(),
+ }
+ k, v := config.rbeAuth()
+ vars[k] = v
+ return vars
}
func startRBE(ctx Context, config Config) {
@@ -102,7 +109,7 @@
return
}
- outputDir := config.RBEStatsOutputDir()
+ outputDir := config.rbeStatsOutputDir()
if outputDir == "" {
ctx.Fatal("RBE output dir variable not defined. Aborting metrics dumping.")
}
@@ -111,6 +118,9 @@
// Stop the proxy first in order to generate the RBE metrics protobuf file.
stopRBE(ctx, config)
+ if metricsFile == filename {
+ return
+ }
if _, err := copyFile(metricsFile, filename); err != nil {
ctx.Fatalf("failed to copy %q to %q: %v\n", metricsFile, filename, err)
}