_id
stringlengths
2
7
title
stringlengths
1
118
partition
stringclasses
3 values
text
stringlengths
52
85.5k
language
stringclasses
1 value
meta_information
dict
q176100
ExpandAlias
test
func (a RepoAliases) ExpandAlias(alias string) sets.String { if a == nil { return nil } return a[github.NormLogin(alias)] }
go
{ "resource": "" }
q176101
ExpandAliases
test
func (a RepoAliases) ExpandAliases(logins sets.String) sets.String { if a == nil { return logins } // Make logins a copy of the original set to avoid modifying the original. logins = logins.Union(nil) for _, login := range logins.List() { if expanded := a.ExpandAlias(login); len(expanded) > 0 { logins.Delet...
go
{ "resource": "" }
q176102
ParseFullConfig
test
func ParseFullConfig(b []byte) (FullConfig, error) { full := new(FullConfig) err := yaml.Unmarshal(b, full) return *full, err }
go
{ "resource": "" }
q176103
ParseSimpleConfig
test
func ParseSimpleConfig(b []byte) (SimpleConfig, error) { simple := new(SimpleConfig) err := yaml.Unmarshal(b, simple) return *simple, err }
go
{ "resource": "" }
q176104
decodeOwnersMdConfig
test
func decodeOwnersMdConfig(path string, config *SimpleConfig) error { fileBytes, err := ioutil.ReadFile(path) if err != nil { return err } // Parse the yaml header from the top of the file. Will return an empty string if regex does not match. meta := mdStructuredHeaderRegex.FindString(string(fileBytes)) // Unm...
go
{ "resource": "" }
q176105
findOwnersForFile
test
func findOwnersForFile(log *logrus.Entry, path string, ownerMap map[string]map[*regexp.Regexp]sets.String) string { d := path for ; d != baseDirConvention; d = canonicalize(filepath.Dir(d)) { relative, err := filepath.Rel(d, path) if err != nil { log.WithError(err).WithField("path", path).Errorf("Unable to fi...
go
{ "resource": "" }
q176106
FindApproverOwnersForFile
test
func (o *RepoOwners) FindApproverOwnersForFile(path string) string { return findOwnersForFile(o.log, path, o.approvers) }
go
{ "resource": "" }
q176107
FindReviewersOwnersForFile
test
func (o *RepoOwners) FindReviewersOwnersForFile(path string) string { return findOwnersForFile(o.log, path, o.reviewers) }
go
{ "resource": "" }
q176108
FindLabelsForFile
test
func (o *RepoOwners) FindLabelsForFile(path string) sets.String { return o.entriesForFile(path, o.labels, false) }
go
{ "resource": "" }
q176109
IsNoParentOwners
test
func (o *RepoOwners) IsNoParentOwners(path string) bool { return o.options[path].NoParentOwners }
go
{ "resource": "" }
q176110
Ratio
test
func (c *Coverage) Ratio() float32 { if c.NumAllStmts == 0 { return 1 } return float32(c.NumCoveredStmts) / float32(c.NumAllStmts) }
go
{ "resource": "" }
q176111
FromPayload
test
func (pe *PeriodicProwJobEvent) FromPayload(data []byte) error { if err := json.Unmarshal(data, pe); err != nil { return err } return nil }
go
{ "resource": "" }
q176112
ToMessage
test
func (pe *PeriodicProwJobEvent) ToMessage() (*pubsub.Message, error) { data, err := json.Marshal(pe) if err != nil { return nil, err } message := pubsub.Message{ Data: data, Attributes: map[string]string{ prowEventType: periodicProwJobEvent, }, } return &message, nil }
go
{ "resource": "" }
q176113
UnmarshalText
test
func (p *Privacy) UnmarshalText(text []byte) error { v := Privacy(text) if _, ok := privacySettings[v]; !ok { return fmt.Errorf("bad privacy setting: %s", v) } *p = v return nil }
go
{ "resource": "" }
q176114
compileApplicableBlockades
test
func compileApplicableBlockades(org, repo string, log *logrus.Entry, blockades []plugins.Blockade) []blockade { if len(blockades) == 0 { return nil } orgRepo := fmt.Sprintf("%s/%s", org, repo) var compiled []blockade for _, raw := range blockades { // Only consider blockades that apply to this repo. if !str...
go
{ "resource": "" }
q176115
calculateBlocks
test
func calculateBlocks(changes []github.PullRequestChange, blockades []blockade) summary { sum := make(summary) for _, change := range changes { for _, b := range blockades { if b.isBlocked(change.Filename) { sum[b.explanation] = append(sum[b.explanation], change) } } } return sum }
go
{ "resource": "" }
q176116
MergeMultipleProfiles
test
func MergeMultipleProfiles(profiles [][]*cover.Profile) ([]*cover.Profile, error) { if len(profiles) < 1 { return nil, errors.New("can't merge zero profiles") } result := profiles[0] for _, profile := range profiles[1:] { var err error if result, err = MergeProfiles(result, profile); err != nil { return ni...
go
{ "resource": "" }
q176117
AddFlags
test
func (o *Options) AddFlags(fs *flag.FlagSet) { fs.StringVar(&o.ProcessLog, "process-log", "", "path to the log where stdout and stderr are streamed for the process we execute") fs.StringVar(&o.MarkerFile, "marker-file", "", "file we write the return code of the process we execute once it has finished running") fs.St...
go
{ "resource": "" }
q176118
processNextItem
test
func (c *Controller) processNextItem() bool { key, quit := c.queue.Get() if quit { return false } defer c.queue.Done(key) workItem := key.(item) prowJob, err := c.prowJobClient.GetProwJob(workItem.prowJobId) if err != nil { c.handleErr(err, workItem) return true } spec := downwardapi.NewJobSpec(prowJob...
go
{ "resource": "" }
q176119
handleErr
test
func (c *Controller) handleErr(err error, key item) { if c.queue.NumRequeues(key) < 5 { glog.Infof("Error uploading logs for container %v in pod %v: %v", key.containerName, key.podName, err) c.queue.AddRateLimited(key) return } c.queue.Forget(key) glog.Infof("Giving up on upload of logs for container %v in p...
go
{ "resource": "" }
q176120
AggregateFilter
test
func AggregateFilter(filters []Filter) Filter { return func(presubmit config.Presubmit) (bool, bool, bool) { for _, filter := range filters { if shouldRun, forced, defaults := filter(presubmit); shouldRun { return shouldRun, forced, defaults } } return false, false, false } }
go
{ "resource": "" }
q176121
FilterPresubmits
test
func FilterPresubmits(filter Filter, changes config.ChangedFilesProvider, branch string, presubmits []config.Presubmit, logger *logrus.Entry) ([]config.Presubmit, []config.Presubmit, error) { var toTrigger []config.Presubmit var toSkip []config.Presubmit for _, presubmit := range presubmits { matches, forced, def...
go
{ "resource": "" }
q176122
MakeCommand
test
func MakeCommand() *cobra.Command { flags := &flags{} cmd := &cobra.Command{ Use: "filter [file]", Short: "Filters a Go coverage file.", Long: `Filters a Go coverage file, removing entries that do not match the given flags.`, Run: func(cmd *cobra.Command, args []string) { run(flags, cmd, args) }, } ...
go
{ "resource": "" }
q176123
Push
test
func (t *EventTimeHeap) Push(x interface{}) { *t = append(*t, x.(sql.IssueEvent)) }
go
{ "resource": "" }
q176124
Pop
test
func (t *EventTimeHeap) Pop() interface{} { old := *t n := len(old) x := old[n-1] *t = old[0 : n-1] return x }
go
{ "resource": "" }
q176125
NewFakeOpenPluginWrapper
test
func NewFakeOpenPluginWrapper(plugin Plugin) *FakeOpenPluginWrapper { return &FakeOpenPluginWrapper{ plugin: plugin, alreadyOpen: map[string]bool{}, } }
go
{ "resource": "" }
q176126
ReceiveIssue
test
func (o *FakeOpenPluginWrapper) ReceiveIssue(issue sql.Issue) []Point { if _, ok := o.alreadyOpen[issue.ID]; !ok { // Create/Add fake "opened" events heap.Push(&o.openEvents, sql.IssueEvent{ Event: "opened", IssueID: issue.ID, Actor: &issue.User, EventCreatedAt: issue.IssueCrea...
go
{ "resource": "" }
q176127
Validate
test
func (o *Options) Validate() error { if o.SrcRoot == "" { return errors.New("no source root specified") } if o.Log == "" { return errors.New("no log file specified") } if len(o.GitRefs) == 0 { return errors.New("no refs specified to clone") } seen := map[string]sets.String{} for _, ref := range o.GitRe...
go
{ "resource": "" }
q176128
Complete
test
func (o *Options) Complete(args []string) { o.GitRefs = o.refs.gitRefs o.KeyFiles = o.keys.data for _, ref := range o.GitRefs { alias, err := o.clonePath.Execute(OrgRepo{Org: ref.Org, Repo: ref.Repo}) if err != nil { panic(err) } ref.PathAlias = alias alias, err = o.cloneURI.Execute(OrgRepo{Org: ref.O...
go
{ "resource": "" }
q176129
Set
test
func (a *orgRepoFormat) Set(value string) error { templ, err := template.New("format").Parse(value) if err != nil { return err } a.raw = value a.format = templ return nil }
go
{ "resource": "" }
q176130
ensure
test
func ensure(binary, install string) error { if _, err := exec.LookPath(binary); err != nil { return fmt.Errorf("%s: %s", binary, install) } return nil }
go
{ "resource": "" }
q176131
output
test
func output(args ...string) (string, error) { cmd := exec.Command(args[0], args[1:]...) cmd.Stderr = os.Stderr cmd.Stdin = os.Stdin b, err := cmd.Output() return strings.TrimSpace(string(b)), err }
go
{ "resource": "" }
q176132
projects
test
func projects(max int) ([]string, error) { out, err := output("gcloud", "projects", "list", fmt.Sprintf("--limit=%d", max), "--format=value(project_id)") if err != nil { return nil, err } return strings.Split(out, "\n"), nil }
go
{ "resource": "" }
q176133
selectProject
test
func selectProject(choice string) (string, error) { fmt.Print("Getting active GCP account...") who, err := currentAccount() if err != nil { logrus.Warn("Run gcloud auth login to initialize gcloud") return "", err } fmt.Println(who) var projs []string if choice == "" { fmt.Printf("Projects available to %s...
go
{ "resource": "" }
q176134
createCluster
test
func createCluster(proj, choice string) (*cluster, error) { const def = "prow" if choice == "" { fmt.Printf("Cluster name [%s]: ", def) fmt.Scanln(&choice) if choice == "" { choice = def } } cmd := exec.Command("gcloud", "container", "clusters", "create", choice) cmd.Stdin = os.Stdin cmd.Stdout = os.S...
go
{ "resource": "" }
q176135
createContext
test
func createContext(co contextOptions) (string, error) { proj, err := selectProject(co.project) if err != nil { logrus.Info("Run gcloud auth login to initialize gcloud") return "", fmt.Errorf("get current project: %v", err) } fmt.Printf("Existing GKE clusters in %s:", proj) fmt.Println() clusters, err := curr...
go
{ "resource": "" }
q176136
contextConfig
test
func contextConfig() (clientcmd.ClientConfigLoader, *clientcmdapi.Config, error) { if err := ensureKubectl(); err != nil { fmt.Println("Prow's tackler requires kubectl, please install:") fmt.Println(" *", err) if gerr := ensureGcloud(); gerr != nil { fmt.Println(" *", gerr) } return nil, nil, errors.New...
go
{ "resource": "" }
q176137
selectContext
test
func selectContext(co contextOptions) (string, error) { fmt.Println("Existing kubernetes contexts:") // get cluster context _, cfg, err := contextConfig() if err != nil { logrus.WithError(err).Fatal("Failed to load ~/.kube/config from any obvious location") } // list contexts and ask to user to choose a context...
go
{ "resource": "" }
q176138
applyCreate
test
func applyCreate(ctx string, args ...string) error { create := exec.Command("kubectl", append([]string{"--dry-run=true", "--output=yaml", "create"}, args...)...) create.Stderr = os.Stderr obj, err := create.StdoutPipe() if err != nil { return fmt.Errorf("rolebinding pipe: %v", err) } if err := create.Start(); ...
go
{ "resource": "" }
q176139
determineSkippedPresubmits
test
func determineSkippedPresubmits(toTrigger, toSkipSuperset []config.Presubmit, logger *logrus.Entry) []config.Presubmit { triggeredContexts := sets.NewString() for _, presubmit := range toTrigger { triggeredContexts.Insert(presubmit.Context) } var toSkip []config.Presubmit for _, presubmit := range toSkipSuperset...
go
{ "resource": "" }
q176140
Dispatch
test
func Dispatch(plugin plugins.Plugin, DB *InfluxDB, issues chan sql.Issue, eventsCommentsChannel chan interface{}) { for { var points []plugins.Point select { case issue, ok := <-issues: if !ok { return } points = plugin.ReceiveIssue(issue) case event, ok := <-eventsCommentsChannel: if !ok { ...
go
{ "resource": "" }
q176141
CreateIssue
test
func (c *Client) CreateIssue(org, repo, title, body string, labels, assignees []string) (*github.Issue, error) { glog.Infof("CreateIssue(dry=%t) Title:%q, Labels:%q, Assignees:%q\n", c.dryRun, title, labels, assignees) if c.dryRun { return nil, nil } issue := &github.IssueRequest{ Title: &title, Body: &body...
go
{ "resource": "" }
q176142
CreateStatus
test
func (c *Client) CreateStatus(owner, repo, ref string, status *github.RepoStatus) (*github.RepoStatus, error) { glog.Infof("CreateStatus(dry=%t) ref:%s: %s:%s", c.dryRun, ref, *status.Context, *status.State) if c.dryRun { return nil, nil } var result *github.RepoStatus msg := fmt.Sprintf("creating status for ref...
go
{ "resource": "" }
q176143
ForEachPR
test
func (c *Client) ForEachPR(owner, repo string, opts *github.PullRequestListOptions, continueOnError bool, mungePR PRMungeFunc) error { var lastPage int // Munge each page as we get it (or in other words, wait until we are ready to munge the next // page of issues before getting it). We use depaginate to make the cal...
go
{ "resource": "" }
q176144
GetCollaborators
test
func (c *Client) GetCollaborators(org, repo string) ([]*github.User, error) { opts := &github.ListCollaboratorsOptions{} collaborators, err := c.depaginate( fmt.Sprintf("getting collaborators for '%s/%s'", org, repo), &opts.ListOptions, func() ([]interface{}, *github.Response, error) { page, resp, err := c.r...
go
{ "resource": "" }
q176145
GetCombinedStatus
test
func (c *Client) GetCombinedStatus(owner, repo, ref string) (*github.CombinedStatus, error) { var result *github.CombinedStatus listOpts := &github.ListOptions{} statuses, err := c.depaginate( fmt.Sprintf("getting combined status for ref '%s'", ref), listOpts, func() ([]interface{}, *github.Response, error) {...
go
{ "resource": "" }
q176146
GetIssues
test
func (c *Client) GetIssues(org, repo string, opts *github.IssueListByRepoOptions) ([]*github.Issue, error) { issues, err := c.depaginate( fmt.Sprintf("getting issues from '%s/%s'", org, repo), &opts.ListOptions, func() ([]interface{}, *github.Response, error) { page, resp, err := c.issueService.ListByRepo(con...
go
{ "resource": "" }
q176147
GetRepoLabels
test
func (c *Client) GetRepoLabels(org, repo string) ([]*github.Label, error) { opts := &github.ListOptions{} labels, err := c.depaginate( fmt.Sprintf("getting valid labels for '%s/%s'", org, repo), opts, func() ([]interface{}, *github.Response, error) { page, resp, err := c.issueService.ListLabels(context.Backg...
go
{ "resource": "" }
q176148
GetUser
test
func (c *Client) GetUser(login string) (*github.User, error) { var result *github.User _, err := c.retry( fmt.Sprintf("getting user '%s'", login), func() (*github.Response, error) { var resp *github.Response var err error result, resp, err = c.userService.Get(context.Background(), login) return resp, ...
go
{ "resource": "" }
q176149
checkConfigValidity
test
func checkConfigValidity() error { glog.Info("Verifying if a valid config has been provided through the flags") if *nodeName == "" { return fmt.Errorf("Flag --node-name has its value unspecified") } if *gcsPath == "" { return fmt.Errorf("Flag --gcs-path has its value unspecified") } if _, err := os.Stat(*gclo...
go
{ "resource": "" }
q176150
createSystemdLogfile
test
func createSystemdLogfile(service string, outputMode string, outputDir string) error { // Generate the journalctl command. journalCmdArgs := []string{fmt.Sprintf("--output=%v", outputMode), "-D", *journalPath} if service == "kern" { journalCmdArgs = append(journalCmdArgs, "-k") } else { journalCmdArgs = append(...
go
{ "resource": "" }
q176151
createFullSystemdLogfile
test
func createFullSystemdLogfile(outputDir string) error { cmd := exec.Command("journalctl", "--output=short-precise", "-D", *journalPath) // Run the command and record the output to a file. output, err := cmd.Output() if err != nil { return fmt.Errorf("Journalctl command failed: %v", err) } logfile := filepath.Jo...
go
{ "resource": "" }
q176152
createSystemdLogfiles
test
func createSystemdLogfiles(outputDir string) { services := append(systemdServices, nodeSystemdServices...) for _, service := range services { if err := createSystemdLogfile(service, "cat", outputDir); err != nil { glog.Warningf("Failed to record journalctl logs: %v", err) } } // Service logs specific to VM s...
go
{ "resource": "" }
q176153
prepareLogfiles
test
func prepareLogfiles(logDir string) { glog.Info("Preparing logfiles relevant to this node") logfiles := nodeLogs[:] switch *cloudProvider { case "gce", "gke": logfiles = append(logfiles, gceLogs...) case "aws": logfiles = append(logfiles, awsLogs...) default: glog.Errorf("Unknown cloud provider '%v' provid...
go
{ "resource": "" }
q176154
writeSuccessMarkerFile
test
func writeSuccessMarkerFile() error { markerFilePath := *gcsPath + "/logexported-nodes-registry/" + *nodeName + ".txt" cmd := exec.Command("gsutil", "-q", "cp", "-a", "public-read", "-", markerFilePath) stdin, err := cmd.StdinPipe() if err != nil { return fmt.Errorf("Failed to get stdin pipe to write marker file:...
go
{ "resource": "" }
q176155
MakeCommand
test
func MakeCommand() *cobra.Command { flags := &flags{} cmd := &cobra.Command{ Use: "junit [profile]", Short: "Summarize coverage profile and produce the result in junit xml format.", Long: `Summarize coverage profile and produce the result in junit xml format. Summary done at per-file and per-package level. An...
go
{ "resource": "" }
q176156
warnDeprecated
test
func warnDeprecated(last *time.Time, freq time.Duration, msg string) { // have we warned within the last freq? warnLock.RLock() fresh := time.Now().Sub(*last) <= freq warnLock.RUnlock() if fresh { // we've warned recently return } // Warning is stale, will we win the race to warn? warnLock.Lock() defer warnL...
go
{ "resource": "" }
q176157
Describe
test
func (r RequireMatchingLabel) Describe() string { str := &strings.Builder{} fmt.Fprintf(str, "Applies the '%s' label ", r.MissingLabel) if r.MissingComment == "" { fmt.Fprint(str, "to ") } else { fmt.Fprint(str, "and comments on ") } if r.Issues { fmt.Fprint(str, "Issues ") if r.PRs { fmt.Fprint(str, ...
go
{ "resource": "" }
q176158
TriggerFor
test
func (c *Configuration) TriggerFor(org, repo string) Trigger { for _, tr := range c.Triggers { for _, r := range tr.Repos { if r == org || r == fmt.Sprintf("%s/%s", org, repo) { return tr } } } return Trigger{} }
go
{ "resource": "" }
q176159
EnabledReposForPlugin
test
func (c *Configuration) EnabledReposForPlugin(plugin string) (orgs, repos []string) { for repo, plugins := range c.Plugins { found := false for _, candidate := range plugins { if candidate == plugin { found = true break } } if found { if strings.Contains(repo, "/") { repos = append(repos, ...
go
{ "resource": "" }
q176160
EnabledReposForExternalPlugin
test
func (c *Configuration) EnabledReposForExternalPlugin(plugin string) (orgs, repos []string) { for repo, plugins := range c.ExternalPlugins { found := false for _, candidate := range plugins { if candidate.Name == plugin { found = true break } } if found { if strings.Contains(repo, "/") { r...
go
{ "resource": "" }
q176161
SetDefaults
test
func (c *ConfigUpdater) SetDefaults() { if len(c.Maps) == 0 { cf := c.ConfigFile if cf == "" { cf = "prow/config.yaml" } else { logrus.Warnf(`config_file is deprecated, please switch to "maps": {"%s": "config"} before July 2018`, cf) } pf := c.PluginFile if pf == "" { pf = "prow/plugins.yaml" } ...
go
{ "resource": "" }
q176162
validatePlugins
test
func validatePlugins(plugins map[string][]string) error { var errors []string for _, configuration := range plugins { for _, plugin := range configuration { if _, ok := pluginHelp[plugin]; !ok { errors = append(errors, fmt.Sprintf("unknown plugin: %s", plugin)) } } } for repo, repoConfig := range plug...
go
{ "resource": "" }
q176163
ShouldReport
test
func (c *Client) ShouldReport(pj *v1.ProwJob) bool { if pj.Status.State == v1.TriggeredState || pj.Status.State == v1.PendingState { // not done yet logrus.WithField("prowjob", pj.ObjectMeta.Name).Info("PJ not finished") return false } if pj.Status.State == v1.AbortedState { // aborted (new patchset) log...
go
{ "resource": "" }
q176164
Run
test
func Run(refs prowapi.Refs, dir, gitUserName, gitUserEmail, cookiePath string, env []string) Record { logrus.WithFields(logrus.Fields{"refs": refs}).Info("Cloning refs") record := Record{Refs: refs} // This function runs the provided commands in order, logging them as they run, // aborting early and returning if a...
go
{ "resource": "" }
q176165
PathForRefs
test
func PathForRefs(baseDir string, refs prowapi.Refs) string { var clonePath string if refs.PathAlias != "" { clonePath = refs.PathAlias } else { clonePath = fmt.Sprintf("github.com/%s/%s", refs.Org, refs.Repo) } return fmt.Sprintf("%s/src/%s", baseDir, clonePath) }
go
{ "resource": "" }
q176166
gitCtxForRefs
test
func gitCtxForRefs(refs prowapi.Refs, baseDir string, env []string) gitCtx { g := gitCtx{ cloneDir: PathForRefs(baseDir, refs), env: env, repositoryURI: fmt.Sprintf("https://github.com/%s/%s.git", refs.Org, refs.Repo), } if refs.CloneURI != "" { g.repositoryURI = refs.CloneURI } return g }
go
{ "resource": "" }
q176167
commandsForBaseRef
test
func (g *gitCtx) commandsForBaseRef(refs prowapi.Refs, gitUserName, gitUserEmail, cookiePath string) []cloneCommand { commands := []cloneCommand{{dir: "/", env: g.env, command: "mkdir", args: []string{"-p", g.cloneDir}}} commands = append(commands, g.gitCommand("init")) if gitUserName != "" { commands = append(co...
go
{ "resource": "" }
q176168
gitTimestampEnvs
test
func gitTimestampEnvs(timestamp int) []string { return []string{ fmt.Sprintf("GIT_AUTHOR_DATE=%d", timestamp), fmt.Sprintf("GIT_COMMITTER_DATE=%d", timestamp), } }
go
{ "resource": "" }
q176169
gitRevParse
test
func (g *gitCtx) gitRevParse() (string, error) { gitRevParseCommand := g.gitCommand("rev-parse", "HEAD") _, commit, err := gitRevParseCommand.run() if err != nil { logrus.WithError(err).Error("git rev-parse HEAD failed!") return "", err } return strings.TrimSpace(commit), nil }
go
{ "resource": "" }
q176170
commandsForPullRefs
test
func (g *gitCtx) commandsForPullRefs(refs prowapi.Refs, fakeTimestamp int) []cloneCommand { var commands []cloneCommand for _, prRef := range refs.Pulls { ref := fmt.Sprintf("pull/%d/head", prRef.Number) if prRef.Ref != "" { ref = prRef.Ref } commands = append(commands, g.gitCommand("fetch", g.repositoryUR...
go
{ "resource": "" }
q176171
ProduceCovList
test
func ProduceCovList(profiles []*cover.Profile) *CoverageList { covList := newCoverageList("summary") for _, prof := range profiles { covList.Group = append(covList.Group, summarizeBlocks(prof)) } return covList }
go
{ "resource": "" }
q176172
popRandom
test
func popRandom(set sets.String) string { list := set.List() sort.Strings(list) sel := list[rand.Intn(len(list))] set.Delete(sel) return sel }
go
{ "resource": "" }
q176173
resolve
test
func (o *ExperimentalKubernetesOptions) resolve(dryRun bool) (err error) { if o.resolved { return nil } o.dryRun = dryRun if dryRun { return nil } clusterConfigs, err := kube.LoadClusterConfigs(o.kubeconfig, o.buildCluster) if err != nil { return fmt.Errorf("load --kubeconfig=%q --build-cluster=%q config...
go
{ "resource": "" }
q176174
ProwJobClientset
test
func (o *ExperimentalKubernetesOptions) ProwJobClientset(namespace string, dryRun bool) (prowJobClientset prow.Interface, err error) { if err := o.resolve(dryRun); err != nil { return nil, err } if o.dryRun { return nil, errors.New("no dry-run prowjob clientset is supported in dry-run mode") } return o.prowJ...
go
{ "resource": "" }
q176175
ProwJobClient
test
func (o *ExperimentalKubernetesOptions) ProwJobClient(namespace string, dryRun bool) (prowJobClient prowv1.ProwJobInterface, err error) { if err := o.resolve(dryRun); err != nil { return nil, err } if o.dryRun { return kube.NewDryRunProwJobClient(o.DeckURI), nil } return o.prowJobClientset.ProwV1().ProwJobs(...
go
{ "resource": "" }
q176176
InfrastructureClusterClient
test
func (o *ExperimentalKubernetesOptions) InfrastructureClusterClient(dryRun bool) (kubernetesClient kubernetes.Interface, err error) { if err := o.resolve(dryRun); err != nil { return nil, err } if o.dryRun { return nil, errors.New("no dry-run kubernetes client is supported in dry-run mode") } return o.kubern...
go
{ "resource": "" }
q176177
BuildClusterClients
test
func (o *ExperimentalKubernetesOptions) BuildClusterClients(namespace string, dryRun bool) (buildClusterClients map[string]corev1.PodInterface, err error) { if err := o.resolve(dryRun); err != nil { return nil, err } if o.dryRun { return nil, errors.New("no dry-run pod client is supported for build clusters in ...
go
{ "resource": "" }
q176178
Age
test
func (a *ActiveState) Age(t time.Time) time.Duration { return t.Sub(a.startTime) }
go
{ "resource": "" }
q176179
ReceiveEvent
test
func (a *ActiveState) ReceiveEvent(eventName, label string, t time.Time) (State, bool) { if a.exit.Match(eventName, label) { return &InactiveState{ entry: a.exit.Opposite(), }, true } return a, false }
go
{ "resource": "" }
q176180
ReceiveEvent
test
func (i *InactiveState) ReceiveEvent(eventName, label string, t time.Time) (State, bool) { if i.entry.Match(eventName, label) { return &ActiveState{ startTime: t, exit: i.entry.Opposite(), }, true } return i, false }
go
{ "resource": "" }
q176181
Active
test
func (m *MultiState) Active() bool { for _, state := range m.states { if !state.Active() { return false } } return true }
go
{ "resource": "" }
q176182
Age
test
func (m *MultiState) Age(t time.Time) time.Duration { minAge := time.Duration(1<<63 - 1) for _, state := range m.states { stateAge := state.Age(t) if stateAge < minAge { minAge = stateAge } } return minAge }
go
{ "resource": "" }
q176183
ReceiveEvent
test
func (m *MultiState) ReceiveEvent(eventName, label string, t time.Time) (State, bool) { oneChanged := false for i := range m.states { state, changed := m.states[i].ReceiveEvent(eventName, label, t) if changed { oneChanged = true } m.states[i] = state } return m, oneChanged }
go
{ "resource": "" }
q176184
ProwJobs
test
func (v *version) ProwJobs() ProwJobInformer { return &prowJobInformer{factory: v.factory, namespace: v.namespace, tweakListOptions: v.tweakListOptions} }
go
{ "resource": "" }
q176185
ItemToResourcesConfig
test
func ItemToResourcesConfig(i Item) (ResourcesConfig, error) { conf, ok := i.(ResourcesConfig) if !ok { return ResourcesConfig{}, fmt.Errorf("cannot construct Resource from received object %v", i) } return conf, nil }
go
{ "resource": "" }
q176186
Copy
test
func (t TypeToResources) Copy() TypeToResources { n := TypeToResources{} for k, v := range t { n[k] = v } return n }
go
{ "resource": "" }
q176187
MakeCommand
test
func MakeCommand() *cobra.Command { flags := &flags{} cmd := &cobra.Command{ Use: "aggregate [files...]", Short: "Aggregates multiple Go coverage files.", Long: `Given multiple Go coverage files from identical binaries recorded in "count" or "atomic" mode, produces a new Go coverage file in the same mode that...
go
{ "resource": "" }
q176188
incrementNumPendingJobs
test
func (c *Controller) incrementNumPendingJobs(job string) { c.lock.Lock() defer c.lock.Unlock() c.pendingJobs[job]++ }
go
{ "resource": "" }
q176189
setPreviousReportState
test
func (c *Controller) setPreviousReportState(pj prowapi.ProwJob) error { // fetch latest before replace latestPJ, err := c.kc.GetProwJob(pj.ObjectMeta.Name) if err != nil { return err } if latestPJ.Status.PrevReportStates == nil { latestPJ.Status.PrevReportStates = map[string]prowapi.ProwJobState{} } latestP...
go
{ "resource": "" }
q176190
SyncMetrics
test
func (c *Controller) SyncMetrics() { c.pjLock.RLock() defer c.pjLock.RUnlock() kube.GatherProwJobMetrics(c.pjs) }
go
{ "resource": "" }
q176191
DumpProfile
test
func DumpProfile(profiles []*cover.Profile, writer io.Writer) error { if len(profiles) == 0 { return errors.New("can't write an empty profile") } if _, err := io.WriteString(writer, "mode: "+profiles[0].Mode+"\n"); err != nil { return err } for _, profile := range profiles { for _, block := range profile.Blo...
go
{ "resource": "" }
q176192
blocksEqual
test
func blocksEqual(a cover.ProfileBlock, b cover.ProfileBlock) bool { return a.StartCol == b.StartCol && a.StartLine == b.StartLine && a.EndCol == b.EndCol && a.EndLine == b.EndLine && a.NumStmt == b.NumStmt }
go
{ "resource": "" }
q176193
NewProwJobInformer
test
func NewProwJobInformer(client versioned.Interface, namespace string, resyncPeriod time.Duration, indexers cache.Indexers) cache.SharedIndexInformer { return NewFilteredProwJobInformer(client, namespace, resyncPeriod, indexers, nil) }
go
{ "resource": "" }
q176194
NewFilteredProwJobInformer
test
func NewFilteredProwJobInformer(client versioned.Interface, namespace string, resyncPeriod time.Duration, indexers cache.Indexers, tweakListOptions internalinterfaces.TweakListOptionsFunc) cache.SharedIndexInformer { return cache.NewSharedIndexInformer( &cache.ListWatch{ ListFunc: func(options metav1.ListOptions)...
go
{ "resource": "" }
q176195
New
test
func New(ja *jobs.JobAgent, cfg config.Getter, c *storage.Client, ctx context.Context) *Spyglass { return &Spyglass{ JobAgent: ja, config: cfg, PodLogArtifactFetcher: NewPodLogArtifactFetcher(ja), GCSArtifactFetcher: NewGCSArtifactFetcher(c), testgrid: &TestGrid{ conf: cfg...
go
{ "resource": "" }
q176196
Lenses
test
func (s *Spyglass) Lenses(matchCache map[string][]string) []lenses.Lens { ls := []lenses.Lens{} for lensName, matches := range matchCache { if len(matches) == 0 { continue } lens, err := lenses.GetLens(lensName) if err != nil { logrus.WithField("lensName", lens).WithError(err).Error("Could not find arti...
go
{ "resource": "" }
q176197
JobPath
test
func (s *Spyglass) JobPath(src string) (string, error) { src = strings.TrimSuffix(src, "/") keyType, key, err := splitSrc(src) if err != nil { return "", fmt.Errorf("error parsing src: %v", src) } split := strings.Split(key, "/") switch keyType { case gcsKeyType: if len(split) < 4 { return "", fmt.Errorf(...
go
{ "resource": "" }
q176198
RunPath
test
func (s *Spyglass) RunPath(src string) (string, error) { src = strings.TrimSuffix(src, "/") keyType, key, err := splitSrc(src) if err != nil { return "", fmt.Errorf("error parsing src: %v", src) } switch keyType { case gcsKeyType: return key, nil case prowKeyType: return s.prowToGCS(key) default: return...
go
{ "resource": "" }
q176199
ExtraLinks
test
func (sg *Spyglass) ExtraLinks(src string) ([]ExtraLink, error) { artifacts, err := sg.FetchArtifacts(src, "", 1000000, []string{"started.json"}) // Failing to find started.json is okay, just return nothing quietly. if err != nil || len(artifacts) == 0 { logrus.WithError(err).Debugf("Failed to find started.json wh...
go
{ "resource": "" }