Add option to use API key in upload_system_symbols
Adds a new option, `-api-key`. If passed, `symupload` is invoked with the `sym-upload-v2` protocol, the key is passed through, and the V2 API upload servers are used. Bug: 1400770 Change-Id: I81255dccc54038a57900058a050603b89e37d716 Reviewed-on: https://chromium-review.googlesource.com/c/breakpad/breakpad/+/4103749 Reviewed-by: Robert Sesek <rsesek@chromium.org>
This commit is contained in:
parent
33b8438986
commit
387a002c89
1 changed files with 27 additions and 4 deletions
|
@ -63,6 +63,7 @@ var (
|
|||
dumpOnlyPath = flag.String("dump-to", "", "Dump the symbols to the specified directory, but do not upload them.")
|
||||
systemRoot = flag.String("system-root", "", "Path to the root of the Mac OS X system whose symbols will be dumped.")
|
||||
dumpArchitecture = flag.String("arch", "", "The CPU architecture for which symbols should be dumped. If not specified, dumps all architectures.")
|
||||
apiKey = flag.String("api-key", "", "API key to use. If this is present, the `sym-upload-v2` protocol is used.\nSee https://chromium.googlesource.com/breakpad/breakpad/+/HEAD/docs/sym_upload_v2_protocol.md or\n`symupload`'s help for more information.")
|
||||
)
|
||||
|
||||
var (
|
||||
|
@ -80,11 +81,22 @@ var (
|
|||
"/Library/QuickTime",
|
||||
}
|
||||
|
||||
// uploadServers are the list of servers to which symbols should be uploaded.
|
||||
uploadServers = []string{
|
||||
// uploadServersV1 are the list of servers to which symbols should be
|
||||
// uploaded when using the V1 protocol.
|
||||
uploadServersV1 = []string{
|
||||
"https://clients2.google.com/cr/symbol",
|
||||
"https://clients2.google.com/cr/staging_symbol",
|
||||
}
|
||||
// uploadServersV2 are the list of servers to which symbols should be
|
||||
// uploaded when using the V2 protocol.
|
||||
uploadServersV2 = []string{
|
||||
"https://staging-crashsymbolcollector-pa.googleapis.com",
|
||||
"https://prod-crashsymbolcollector-pa.googleapis.com",
|
||||
}
|
||||
|
||||
// uploadServers are the list of servers that should be used, accounting
|
||||
// for whether v1 or v2 protocol is used.
|
||||
uploadServers = uploadServersV1
|
||||
|
||||
// blacklistRegexps match paths that should be excluded from dumping.
|
||||
blacklistRegexps = []*regexp.Regexp{
|
||||
|
@ -137,6 +149,10 @@ func main() {
|
|||
defer os.RemoveAll(p)
|
||||
}
|
||||
}
|
||||
// If `apiKey` is set, we're using the v2 protocol.
|
||||
if len(*apiKey) > 0 {
|
||||
uploadServers = uploadServersV2
|
||||
}
|
||||
|
||||
dq := StartDumpQueue(*systemRoot, dumpPath, uq)
|
||||
dq.Wait()
|
||||
|
@ -194,13 +210,20 @@ func (uq *UploadQueue) Done() {
|
|||
close(uq.queue)
|
||||
}
|
||||
|
||||
func (uq *UploadQueue) worker() {
|
||||
func (uq *UploadQueue) runSymUpload(symfile, server string) *exec.Cmd {
|
||||
symUpload := path.Join(*breakpadTools, "symupload")
|
||||
args := []string{symfile, server}
|
||||
if len(*apiKey) > 0 {
|
||||
args = append([]string{"-p", "sym-upload-v2", "-k", *apiKey}, args...)
|
||||
}
|
||||
return exec.Command(symUpload, args...)
|
||||
}
|
||||
|
||||
func (uq *UploadQueue) worker() {
|
||||
for symfile := range uq.queue {
|
||||
for _, server := range uploadServers {
|
||||
for i := 0; i < 3; i++ { // Give each upload 3 attempts to succeed.
|
||||
cmd := exec.Command(symUpload, symfile, server)
|
||||
cmd := uq.runSymUpload(symfile, server)
|
||||
if output, err := cmd.Output(); err == nil {
|
||||
// Success. No retry needed.
|
||||
fmt.Printf("Uploaded %s to %s\n", symfile, server)
|
||||
|
|
Loading…
Reference in a new issue