in util/gcs/read.go [438:477]
func (build Build) Suites(ctx context.Context, opener Opener, artifacts <-chan string, suites chan<- SuitesMeta, max int) error {
for {
var art string
var more bool
select {
case <-ctx.Done():
return ctx.Err()
case art, more = <-artifacts:
if !more {
return nil
}
}
meta := parseSuitesMeta(art)
if meta == nil {
continue // not a junit file ignore it, ignore it
}
if art != "" && art[0] != '/' {
art = "/" + art
}
path, err := build.Path.ResolveReference(&url.URL{Path: art})
if err != nil {
return fmt.Errorf("resolve %q: %v", art, err)
}
out := SuitesMeta{
Metadata: meta,
Path: path.String(),
}
out.Suites, err = readSuites(ctx, opener, *path)
if err != nil {
out.Err = err
} else {
out.Suites.Truncate(max)
}
select {
case <-ctx.Done():
return ctx.Err()
case suites <- out:
}
}
}