func main() { flag.Parse() if len(*userWhitelist) == 0 { glog.Fatalf("--user-whitelist is required.") } if len(*jenkinsHost) == 0 { glog.Fatalf("--jenkins-host is required.") } client := github.MakeClient(*token) users, err := loadWhitelist(*userWhitelist) if err != nil { glog.Fatalf("error loading user whitelist: %v", err) } requiredContexts := strings.Split(*requiredContexts, ",") config := &github.FilterConfig{ MinPRNumber: *minPRNumber, UserWhitelist: users, RequiredStatusContexts: requiredContexts, WhitelistOverride: *whitelistOverride, } for !*oneOff { if err := github.ForEachCandidatePRDo(client, org, project, runE2ETests, *oneOff, config); err != nil { glog.Fatalf("Error getting candidate PRs: %v", err) } } }
func main() { flag.Parse() if len(*jenkinsHost) == 0 { glog.Fatalf("--jenkins-host is required.") } tokenData := *token if len(tokenData) == 0 && len(*tokenFile) != 0 { data, err := ioutil.ReadFile(*tokenFile) if err != nil { glog.Fatalf("error reading token file: %v", err) } tokenData = string(data) } client := github.MakeClient(tokenData) users, err := loadWhitelist(*userWhitelist) if err != nil { glog.Fatalf("error loading user whitelist: %v", err) } requiredContexts := strings.Split(*requiredContexts, ",") config := &github.FilterConfig{ MinPRNumber: *minPRNumber, AdditionalUserWhitelist: users, RequiredStatusContexts: requiredContexts, WhitelistOverride: *whitelistOverride, DryRun: *dryrun, DontRequireE2ELabel: *dontRequireE2E, E2EStatusContext: *e2eStatusContext, } e2e := &e2eTester{} if len(*address) > 0 { go http.ListenAndServe(*address, e2e) } for !*oneOff { if err := github.ForEachCandidatePRDo(client, org, project, e2e.runE2ETests, *oneOff, config); err != nil { glog.Errorf("Error getting candidate PRs: %v", err) } time.Sleep(*pollPeriod) } }
func main() { flag.Parse() tokenData := *token if len(tokenData) == 0 && len(*tokenFile) != 0 { data, err := ioutil.ReadFile(*tokenFile) if err != nil { glog.Fatalf("error reading token file: %v", err) } tokenData = string(data) } client := github.MakeClient(tokenData) if *genCommitters { doGenCommitters(client) } if len(*jenkinsHost) == 0 { glog.Fatalf("--jenkins-host is required.") } users, err := loadWhitelist(*userWhitelist) if err != nil { glog.Fatalf("error loading user whitelist: %v", err) } committerList, err := loadWhitelist(*committers) if err != nil { glog.Fatalf("error loading committers whitelist: %v", err) } requiredContexts := strings.Split(*requiredContexts, ",") config := &github.FilterConfig{ MinPRNumber: *minPRNumber, AdditionalUserWhitelist: users, Committers: committerList, RequiredStatusContexts: requiredContexts, WhitelistOverride: *whitelistOverride, DryRun: *dryrun, DontRequireE2ELabel: *dontRequireE2E, E2EStatusContext: *e2eStatusContext, } e2e := &e2eTester{ BuildStatus: map[string]string{}, Config: config, state: &ExternalState{}, } if len(*address) > 0 { if len(*www) > 0 { http.Handle("/", http.FileServer(http.Dir(*www))) } http.Handle("/api", e2e) go http.ListenAndServe(*address, nil) } for !*oneOff { e2e.msg("Beginning PR scan...") wl := config.RefreshWhitelist(client, org, project) e2e.locked(func() { e2e.state.Whitelist = wl.List() }) if err := github.ForEachCandidatePRDo(client, org, project, e2e.runE2ETests, *oneOff, config); err != nil { glog.Errorf("Error getting candidate PRs: %v", err) } time.Sleep(*pollPeriod) } }