blob: c0f30cadd162efd61e34d975014cc0d8cf4ef61b [file] [log] [blame]
// Copyright 2021 The Fuchsia Authors.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
// The autocorrelator tool is a collection of heuristics to find correlations
// between failures in Fuchsia CI/CQ.
package main
import (
"log"
"os"
"github.com/maruel/subcommands"
"go.chromium.org/luci/auth"
"go.chromium.org/luci/auth/client/authcli"
"go.chromium.org/luci/client/versioncli"
"go.chromium.org/luci/common/api/gitiles"
"go.chromium.org/luci/hardcoded/chromeinfra"
)
// Version must be updated on functional change (behavior, arguments, supported commands).
const version = "0.0.1"
func getApplication(defaultAuthOpts auth.Options) *subcommands.DefaultApplication {
defaultAuthOpts.Scopes = []string{auth.OAuthScopeEmail, gitiles.OAuthScope}
return &subcommands.DefaultApplication{
Name: "autocorrelator",
Title: "Tool to detect correlated failures.",
Commands: []*subcommands.Command{
cmdCheckCI(defaultAuthOpts),
cmdCheckTry(defaultAuthOpts),
authcli.SubcommandInfo(defaultAuthOpts, "whoami", false),
authcli.SubcommandLogin(defaultAuthOpts, "login", false),
authcli.SubcommandLogout(defaultAuthOpts, "logout", false),
versioncli.CmdVersion(version),
subcommands.CmdHelp,
},
}
}
func main() {
log.SetFlags(log.Lmicroseconds)
app := getApplication(chromeinfra.DefaultAuthOptions())
os.Exit(subcommands.Run(app, nil))
}