Add a warning message about missing gcert at the end of the build
Now that we are ready to rollout gcert, adding a warning that builds will fail if gcert doesn't exist. Doing this only for builds with ANDROID_BUILD_ENVIRONMENT_CONFIG=googler. Test: Ran a build without gcert and USE_RBE=true and it printed the warning. Bug: b/229743321 Change-Id: I616a4a534ab277873ac7e19baecb78620f07854c
This commit is contained in:
parent
2d6e6a1338
commit
b018b83664
2 changed files with 25 additions and 0 deletions
|
@ -1205,6 +1205,21 @@ func (c *configImpl) rbeAuth() (string, string) {
|
|||
return "RBE_use_application_default_credentials", "true"
|
||||
}
|
||||
|
||||
func (c *configImpl) IsGooglerEnvironment() bool {
|
||||
cf := "ANDROID_BUILD_ENVIRONMENT_CONFIG"
|
||||
if v, ok := c.environ.Get(cf); ok {
|
||||
return v == "googler"
|
||||
}
|
||||
return false
|
||||
}
|
||||
|
||||
func (c *configImpl) GoogleProdCredsExist() bool {
|
||||
if _, err := exec.Command("/usr/bin/prodcertstatus", "--simple_output", "--nocheck_loas").Output(); err != nil {
|
||||
return false
|
||||
}
|
||||
return true
|
||||
}
|
||||
|
||||
func (c *configImpl) UseRemoteBuild() bool {
|
||||
return c.UseGoma() || c.UseRBE()
|
||||
}
|
||||
|
|
|
@ -119,6 +119,7 @@ func startRBE(ctx Context, config Config) {
|
|||
}
|
||||
|
||||
func stopRBE(ctx Context, config Config) {
|
||||
defer checkProdCreds(ctx, config)
|
||||
cmd := Command(ctx, config, "stopRBE bootstrap", rbeCommand(ctx, config, bootstrapCmd), "-shutdown")
|
||||
output, err := cmd.CombinedOutput()
|
||||
if err != nil {
|
||||
|
@ -131,6 +132,15 @@ func stopRBE(ctx Context, config Config) {
|
|||
}
|
||||
}
|
||||
|
||||
func checkProdCreds(ctx Context, config Config) {
|
||||
if !config.IsGooglerEnvironment() || config.GoogleProdCredsExist() {
|
||||
return
|
||||
}
|
||||
fmt.Fprintln(ctx.Writer, "")
|
||||
fmt.Fprintln(ctx.Writer, "\033[33mWARNING: Missing LOAS credentials, please run `gcert`. This will result in failing RBE builds in the future, see go/build-fast#authentication.\033[0m")
|
||||
fmt.Fprintln(ctx.Writer, "")
|
||||
}
|
||||
|
||||
// DumpRBEMetrics creates a metrics protobuf file containing RBE related metrics.
|
||||
// The protobuf file is created if RBE is enabled and the proxy service has
|
||||
// started. The proxy service is shutdown in order to dump the RBE metrics to the
|
||||
|
|
Loading…
Reference in a new issue