Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 24de5f24 authored by Kevin Dagostino's avatar Kevin Dagostino Committed by Gerrit Code Review
Browse files

Merge "Cache GoogleProdCredsExist() to save ~800ms during builds."

parents cd7db257 096ab2f5
Loading
Loading
Loading
Loading
+6 −1
Original line number Diff line number Diff line
@@ -46,6 +46,7 @@ const (

var (
	rbeRandPrefix             int
	googleProdCredsExistCache bool
)

func init() {
@@ -1347,9 +1348,13 @@ func (c *configImpl) IsGooglerEnvironment() bool {
// GoogleProdCredsExist determine whether credentials exist on the
// Googler machine to use remote execution.
func (c *configImpl) GoogleProdCredsExist() bool {
	if googleProdCredsExistCache {
		return googleProdCredsExistCache
	}
	if _, err := exec.Command("/usr/bin/prodcertstatus", "--simple_output", "--nocheck_loas").Output(); err != nil {
		return false
	}
	googleProdCredsExistCache = true
	return true
}