Merge "Move startRBE error handling to the main goroutine" into main
This commit is contained in:
@@ -283,11 +283,16 @@ func Build(ctx Context, config Config) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
rbeCh := make(chan bool)
|
rbeCh := make(chan bool)
|
||||||
|
var rbePanic any
|
||||||
if config.StartRBE() {
|
if config.StartRBE() {
|
||||||
cleanupRBELogsDir(ctx, config)
|
cleanupRBELogsDir(ctx, config)
|
||||||
|
checkRBERequirements(ctx, config)
|
||||||
go func() {
|
go func() {
|
||||||
|
defer func() {
|
||||||
|
rbePanic = recover()
|
||||||
|
close(rbeCh)
|
||||||
|
}()
|
||||||
startRBE(ctx, config)
|
startRBE(ctx, config)
|
||||||
close(rbeCh)
|
|
||||||
}()
|
}()
|
||||||
defer DumpRBEMetrics(ctx, config, filepath.Join(config.LogsDir(), "rbe_metrics.pb"))
|
defer DumpRBEMetrics(ctx, config, filepath.Join(config.LogsDir(), "rbe_metrics.pb"))
|
||||||
} else {
|
} else {
|
||||||
@@ -345,6 +350,11 @@ func Build(ctx Context, config Config) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
<-rbeCh
|
<-rbeCh
|
||||||
|
if rbePanic != nil {
|
||||||
|
// If there was a ctx.Fatal in startRBE, rethrow it.
|
||||||
|
panic(rbePanic)
|
||||||
|
}
|
||||||
|
|
||||||
if what&RunNinja != 0 {
|
if what&RunNinja != 0 {
|
||||||
if what&RunKati != 0 {
|
if what&RunKati != 0 {
|
||||||
installCleanIfNecessary(ctx, config)
|
installCleanIfNecessary(ctx, config)
|
||||||
|
@@ -95,14 +95,10 @@ func cleanupRBELogsDir(ctx Context, config Config) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
func startRBE(ctx Context, config Config) {
|
func checkRBERequirements(ctx Context, config Config) {
|
||||||
if !config.GoogleProdCredsExist() && prodCredsAuthType(config) {
|
if !config.GoogleProdCredsExist() && prodCredsAuthType(config) {
|
||||||
ctx.Fatalf("Unable to start RBE reproxy\nFAILED: Missing LOAS credentials.")
|
ctx.Fatalf("Unable to start RBE reproxy\nFAILED: Missing LOAS credentials.")
|
||||||
}
|
}
|
||||||
ctx.BeginTrace(metrics.RunSetupTool, "rbe_bootstrap")
|
|
||||||
defer ctx.EndTrace()
|
|
||||||
|
|
||||||
ctx.Status.Status("Starting rbe...")
|
|
||||||
|
|
||||||
if u := ulimitOrFatal(ctx, config, "-u"); u < rbeLeastNProcs {
|
if u := ulimitOrFatal(ctx, config, "-u"); u < rbeLeastNProcs {
|
||||||
ctx.Fatalf("max user processes is insufficient: %d; want >= %d.\n", u, rbeLeastNProcs)
|
ctx.Fatalf("max user processes is insufficient: %d; want >= %d.\n", u, rbeLeastNProcs)
|
||||||
@@ -115,6 +111,13 @@ func startRBE(ctx Context, config Config) {
|
|||||||
ctx.Fatalf("Unable to create logs dir (%v) for RBE: %v", config.rbeProxyLogsDir, err)
|
ctx.Fatalf("Unable to create logs dir (%v) for RBE: %v", config.rbeProxyLogsDir, err)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
func startRBE(ctx Context, config Config) {
|
||||||
|
ctx.BeginTrace(metrics.RunSetupTool, "rbe_bootstrap")
|
||||||
|
defer ctx.EndTrace()
|
||||||
|
|
||||||
|
ctx.Status.Status("Starting rbe...")
|
||||||
|
|
||||||
cmd := Command(ctx, config, "startRBE bootstrap", rbeCommand(ctx, config, bootstrapCmd))
|
cmd := Command(ctx, config, "startRBE bootstrap", rbeCommand(ctx, config, bootstrapCmd))
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user