-
Notifications
You must be signed in to change notification settings - Fork 22
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
greplogs: set more flag defaults when --triage is set
Also omit builders with known issues when --triage is set. For golang/go#52653.
- Loading branch information
Bryan C. Mills
committed
May 26, 2022
1 parent
f32396e
commit 8f16efb
Showing
3 changed files
with
132 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
// Copyright 2022 The Go Authors. All rights reserved. | ||
// Use of this source code is governed by a BSD-style | ||
// license that can be found in the LICENSE file. | ||
|
||
// Command broken lists the current Go builders with known issues. | ||
// | ||
// To test this program, cd to its directory and run: | ||
// go mod init | ||
// go get golang.org/x/build/dashboard@HEAD | ||
// go run . | ||
// rm go.mod go.sum | ||
package main | ||
|
||
import ( | ||
"fmt" | ||
|
||
"golang.org/x/build/dashboard" | ||
) | ||
|
||
func main() { | ||
for _, b := range dashboard.Builders { | ||
if len(b.KnownIssues) > 0 { | ||
fmt.Println(b.Name) | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,76 @@ | ||
// Copyright 2022 The Go Authors. All rights reserved. | ||
// Use of this source code is governed by a BSD-style | ||
// license that can be found in the LICENSE file. | ||
|
||
package main | ||
|
||
import ( | ||
_ "embed" | ||
"fmt" | ||
"os" | ||
"os/exec" | ||
"path/filepath" | ||
"sort" | ||
"strings" | ||
) | ||
|
||
//go:embed _embed/broken.go | ||
var brokenScript []byte | ||
|
||
// listBrokenBuilders returns the builders that are marked | ||
// as broken in golang.org/x/build/dashboard at HEAD. | ||
func listBrokenBuilders() (broken []string, err error) { | ||
defer func() { | ||
if err != nil { | ||
err = fmt.Errorf("identifying broken builders: %v", err) | ||
} | ||
}() | ||
|
||
modDir, err := os.MkdirTemp("", "greplogs") | ||
if err != nil { | ||
return nil, err | ||
} | ||
defer func() { | ||
removeErr := os.RemoveAll(modDir) | ||
if err == nil { | ||
err = removeErr | ||
} | ||
}() | ||
|
||
runCommand := func(name string, args ...string) ([]byte, error) { | ||
cmd := exec.Command(name, args...) | ||
cmd.Dir = modDir | ||
cmd.Env = append(os.Environ(), "GO111MODULE=on", "PWD="+modDir) | ||
cmd.Stderr = new(strings.Builder) | ||
|
||
out, err := cmd.Output() | ||
if err != nil { | ||
return out, fmt.Errorf("%s: %w\nstderr:\n%s", strings.Join(cmd.Args, " "), err, cmd.Stderr) | ||
} | ||
return out, nil | ||
} | ||
|
||
_, err = runCommand("go", "mod", "init", "github.com/aclements/go-misc/greplogs/_embed") | ||
if err != nil { | ||
return nil, err | ||
} | ||
|
||
_, err = runCommand("go", "get", "golang.org/x/build/dashboard@HEAD") | ||
if err != nil { | ||
return nil, err | ||
} | ||
|
||
err = os.WriteFile(filepath.Join(modDir, "broken.go"), brokenScript, 0644) | ||
if err != nil { | ||
return nil, err | ||
} | ||
|
||
out, err := runCommand("go", "run", "broken.go") | ||
if err != nil { | ||
return nil, err | ||
} | ||
|
||
broken = strings.Split(strings.TrimSpace(string(out)), "\n") | ||
sort.Strings(broken) | ||
return broken, nil | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters