summaryrefslogtreecommitdiffhomepage
path: root/tools/github/main.go
diff options
context:
space:
mode:
authorAyush Ranjan <ayushranjan@google.com>2021-04-23 12:31:41 -0700
committergVisor bot <gvisor-bot@google.com>2021-04-23 12:33:48 -0700
commit915b8137981e5acb48b58f378a058b88938d44d4 (patch)
tree9af0c25075dfbce5c3b22c9355c67e71dfc8d82b /tools/github/main.go
parent9e4aa04ad1f6e63f4aa99f516b19e4ff2592918b (diff)
[op] Remove Build job from GitHub actions.
We already have blocking nogo tests which show all findings. This job was building all nogo targets, and posting all the findings to GitHub as a check run. Building nogo takes a while so we actually end up wasting a lot of time doing redundant work. This is aligned with our goal of moving away from GitHub actions to BuildKite only. PiperOrigin-RevId: 370134875
Diffstat (limited to 'tools/github/main.go')
-rw-r--r--tools/github/main.go35
1 files changed, 5 insertions, 30 deletions
diff --git a/tools/github/main.go b/tools/github/main.go
index 681003eef..dfb4c769d 100644
--- a/tools/github/main.go
+++ b/tools/github/main.go
@@ -22,12 +22,10 @@ import (
"io/ioutil"
"log"
"os"
- "os/exec"
"strings"
"github.com/google/go-github/github"
"golang.org/x/oauth2"
- "gvisor.dev/gvisor/tools/github/nogo"
"gvisor.dev/gvisor/tools/github/reviver"
)
@@ -53,11 +51,10 @@ func (s *stringList) Set(value string) error {
// Keep the options simple for now. Supports only a single path and repo.
func init() {
- flag.StringVar(&owner, "owner", "", "GitHub project org/owner (required, except nogo dry-run)")
- flag.StringVar(&repo, "repo", "", "GitHub repo (required, except nogo dry-run)")
+ flag.StringVar(&owner, "owner", "", "GitHub project org/owner")
+ flag.StringVar(&repo, "repo", "", "GitHub repo")
flag.StringVar(&tokenFile, "oauth-token-file", "", "file containing the GitHub token (or GITHUB_TOKEN is set)")
- flag.Var(&paths, "path", "path(s) to scan (required for revive and nogo)")
- flag.StringVar(&commit, "commit", "", "commit to associated (required for nogo, except dry-run)")
+ flag.Var(&paths, "path", "path(s) to scan (required for revive)")
flag.BoolVar(&dryRun, "dry-run", false, "just print changes to be made")
}
@@ -96,12 +93,12 @@ func main() {
// Check for mandatory parameters.
command := args[0]
- if len(owner) == 0 && (command != "nogo" || !dryRun) {
+ if len(owner) == 0 {
fmt.Fprintln(flag.CommandLine.Output(), "missing --owner option.")
flag.Usage()
os.Exit(1)
}
- if len(repo) == 0 && (command != "nogo" || !dryRun) {
+ if len(repo) == 0 {
fmt.Fprintln(flag.CommandLine.Output(), "missing --repo option.")
flag.Usage()
os.Exit(1)
@@ -155,28 +152,6 @@ func main() {
}
os.Exit(1)
}
- case "nogo":
- // Did we get a commit? Try to extract one.
- if len(commit) == 0 && !dryRun {
- cmd := exec.Command("git", "rev-parse", "HEAD")
- revBytes, err := cmd.Output()
- if err != nil {
- fmt.Fprintf(flag.CommandLine.Output(), "missing --commit option, unable to infer: %v\n", err)
- flag.Usage()
- os.Exit(1)
- }
- commit = strings.TrimSpace(string(revBytes))
- }
- // Scan all findings.
- poster := nogo.NewFindingsPoster(client, owner, repo, commit, dryRun)
- if err := poster.Walk(filteredPaths); err != nil {
- fmt.Fprintln(os.Stderr, "Error finding nogo findings:", err)
- os.Exit(1)
- }
- // Post to GitHub.
- if err := poster.Post(); err != nil {
- fmt.Fprintln(os.Stderr, "Error posting nogo findings:", err)
- }
default:
// Not a known command.
fmt.Fprintf(flag.CommandLine.Output(), "unknown command: %s\n", command)