id
stringlengths
2
7
text
stringlengths
17
51.2k
title
stringclasses
1 value
c175700
logrus.WithField("jobConfig", jobConfig).WithError(err).Error("Error loading job configs.") continue } if jobConfigStat.ModTime().After(recentModTime) { recentModTime = jobConfigStat.ModTime() } } if !recentModTime.After(lastModTime) { skips++ continue // file hasn't been...
c175701
ca.subscriptions = append(ca.subscriptions, subscription) }
c175702
ca.mut.RLock() defer ca.mut.RUnlock() return ca.c }
c175703
ca.subscriptions { go func(sub DeltaChan) { // wait a minute to send each event end := time.NewTimer(time.Minute) select { case sub <- delta: case <-end.C: } if !end.Stop() { // prevent new events <-end.C // drain the pending event } }(subscription) } }
c175704
m == user { return true, nil } } return false, nil }
c175705
append([]github.IssueComment{}, f.IssueComments[number]...), nil }
c175706
return append([]github.ReviewComment{}, f.PullRequestComments[number]...), nil }
c175707
return append([]github.Review{}, f.Reviews[number]...), nil }
c175708
append([]github.ListedIssueEvent{}, f.IssueEvents[number]...), nil }
c175709
owner, repo, number, comment)) f.IssueComments[number] = append(f.IssueComments[number], github.IssueComment{ ID: f.IssueCommentID, Body: comment, User: github.User{Login: botName}, }) f.IssueCommentID++ return nil }
c175710
User: github.User{Login: botName}, Body: r.Body, }) f.ReviewID++ return nil }
c175711
append(f.CommentReactionsAdded, fmt.Sprintf("%s/%s#%d:%s", org, repo, ID, reaction)) return nil }
c175712
append(f.IssueReactionsAdded, fmt.Sprintf("%s/%s#%d:%s", org, repo, ID, reaction)) return nil }
c175713
if ic.ID == ID { f.IssueComments[num] = append(ics[:i], ics[i+1:]...) return nil } } } return fmt.Errorf("could not find issue comment %d", ID) }
c175714
{ if err := f.DeleteComment(org, repo, comment.ID); err != nil { return fmt.Errorf("failed to delete stale comment with ID '%d'", comment.ID) } } } return nil }
c175715
return nil, fmt.Errorf("Pull request number %d does not exit", number) } return val, nil }
c175716
error) { return f.PullRequestChanges[number], nil }
c175717
ref string) (string, error) { return TestRef, nil }
c175718
Repo, Ref string }{Org: owner, Repo: repo, Ref: ref}) return nil }
c175719
error) { return f.Commits[SHA], nil }
c175720
s.Context { statuses[i] = s updated = true } } if !updated { statuses = append(statuses, s) } f.CreatedStatuses[SHA] = statuses return nil }
c175721
return f.CreatedStatuses[ref], nil }
c175722
string) (*github.CombinedStatus, error) { return f.CombinedStatuses[ref], nil }
c175723
{ la = append(la, github.Label{Name: l}) } return la, nil }
c175724
l := range allLabels.List() { groups := re.FindStringSubmatch(l) if groups != nil { la = append(la, github.Label{Name: groups[1]}) } } return la, nil }
c175725
owner, repo, number) } if f.RepoLabelsExisting == nil { f.IssueLabelsAdded = append(f.IssueLabelsAdded, labelString) return nil } for _, l := range f.RepoLabelsExisting { if label == l { f.IssueLabelsAdded = append(f.IssueLabelsAdded, labelString) return nil } } return fmt.Errorf("cannot add %v to ...
c175726
if !sets.NewString(f.IssueLabelsRemoved...).Has(labelString) { f.IssueLabelsRemoved = append(f.IssueLabelsRemoved, labelString) return nil } return fmt.Errorf("cannot remove %v from %s/%s/#%d", label, owner, repo, number) }
c175727
([]github.Issue, error) { return f.Issues, nil }
c175728
} f.AssigneesAdded = append(f.AssigneesAdded, fmt.Sprintf("%s/%s#%d:%s", owner, repo, number, a)) } if m.Users == nil { return nil } return m }
c175729
if master, ok := contents["master"]; ok { return []byte(master), nil } return nil, fmt.Errorf("could not find file %s in master", file) } if content, ok := contents[commit]; ok { return []byte(content), nil } return nil, fmt.Errorf("could not find file %s with ref %s", file, commit) }
c175730
{ ID: 0, Name: "Admins", }, { ID: 42, Name: "Leads", }, }, nil }
c175731
42: {{Login: "sig-lead"}}, } members, ok := teams[teamID] if !ok { return []github.TeamMember{}, nil } return members, nil }
c175732
if github.NormLogin(collab) == normed { return true, nil } } return false, nil }
c175733
{ result = append(result, github.User{Login: login}) } return result, nil }
c175734
{ f.Milestone = 0 return nil }
c175735
fmt.Errorf("Milestone Numbers Cannot Be Negative") } f.Milestone = milestoneNum return nil }
c175736
milestones = append(milestones, github.Milestone{Title: k, Number: v}) } return milestones, nil }
c175737
:= fmt.Sprintf("%s/%s#%d", org, repo, prNumber) return f.CommitMap[k], nil }
c175738
f.RepoProjects[fmt.Sprintf("%s/%s", owner, repo)], nil }
c175739
f.RepoProjects[fmt.Sprintf("%s/*", org)], nil }
c175740
{ return f.ProjectColumnsMap[project.Name], nil } } } return nil, fmt.Errorf("Cannot find project ID") }
c175741
f.Column = columnName f.Project = project return &projectCard, nil } } return nil, fmt.Errorf("Provided column %d does not exist, ColumnIDMap is %v", columnID, f.ColumnIDMap) }
c175742
break } } if removalIndex != -1 { newCards = cards newCards[removalIndex] = newCards[len(newCards)-1] newCards = newCards[:len(newCards)-1] break } } // Update the old column's list of project cards if oldColumnID != -1 { f.ColumnCardsMap[oldColumnID] = newCards } return nil }
c175743
break } } if removalIndex != -1 { newCards = cards newCards[removalIndex] = newCards[len(newCards)-1] newCards = newCards[:len(newCards)-1] } } if oldColumnID != -1 { // Update the old column's list of project cards f.ColumnCardsMap[oldColumnID] = newCards } for project, columnIDMap := ran...
c175744
if err != nil { return nil, err } return &InfluxDB{ client: client, database: config.DB, }, nil }
c175745
batch.AddPoint(pt) err = i.client.Write(batch) if err != nil { return err } glog.Infof("Sent to influx: %s %+v %+v %s", measurement, tags, fields, date) return nil }
c175746
map[string]string) prowapi.ProwJob { return newProwJob(spec, labels, annotations) }
c175747
prowapi.ProwJob { return newProwJob(spec, labels, nil) }
c175748
labels := make(map[string]string) for k, v := range job.Labels { labels[k] = v } labels[github.EventGUID] = eventGUID return NewProwJob(PresubmitSpec(job, refs), labels) }
c175749
GitHubBranchSourceJob: p.JenkinsSpec.GitHubBranchSourceJob, } } pjs.Refs = completePrimaryRefs(refs, p.JobBase) return pjs }
c175750
pjs.JenkinsSpec = &prowapi.JenkinsSpec{ GitHubBranchSourceJob: p.JenkinsSpec.GitHubBranchSourceJob, } } return pjs }
c175751
specFromJobBase(p.JobBase) pjs.Type = prowapi.PeriodicJob return pjs }
c175752
pjs.Type = prowapi.BatchJob pjs.Context = p.Context pjs.Refs = completePrimaryRefs(refs, p.JobBase) return pjs }
c175753
triggeredCount++ } } pending = make(chan prowapi.ProwJob, pendingCount) triggered = make(chan prowapi.ProwJob, triggeredCount) // Partition the jobs into the two separate channels. for _, pj := range pjs { switch pj.Status.State { case prowapi.PendingState: pending <- pj case prowapi.TriggeredState: ...
c175754
pj.Spec.Refs.Pulls[0].Number fields[github.RepoLogField] = pj.Spec.Refs.Repo fields[github.OrgLogField] = pj.Spec.Refs.Org } if pj.Spec.JenkinsSpec != nil { fields["github_based_job"] = pj.Spec.JenkinsSpec.GitHubBranchSourceJob } return fields }
c175755
return kube.DefaultClusterAlias } return cluster }
c175756
= append(pluginHelp.Commands, command) }
c175757
c.ns, name), &prowjobsv1.ProwJob{}) if obj == nil { return nil, err } return obj.(*prowjobsv1.ProwJob), err }
c175758
error) { return c.Fake. InvokesWatch(testing.NewWatchAction(prowjobsResource, c.ns, opts)) }
c175759
Invokes(testing.NewDeleteAction(prowjobsResource, c.ns, name), &prowjobsv1.ProwJob{}) return err }
c175760
subresources...), &prowjobsv1.ProwJob{}) if obj == nil { return nil, err } return obj.(*prowjobsv1.ProwJob), err }
c175761
v, ok := t.MergeType[name] if !ok { if ov, found := t.MergeType[org]; found { return ov } return github.MergeMerge } return v }
c175762
toks = append(toks, fmt.Sprintf("label:\"%s\"", l)) } for _, l := range tq.MissingLabels { toks = append(toks, fmt.Sprintf("-label:\"%s\"", l)) } if tq.Milestone != "" { toks = append(toks, fmt.Sprintf("milestone:\"%s\"", tq.Milestone)) } if tq.ReviewApprovedRequired { toks = append(toks, "review:approved...
c175763
if excludedRepo == fullName { return false } } return true } for _, queryRepo := range tq.Repos { if queryRepo == fullName { return true } } return false }
c175764
// members of 'excludedRepos' intersected with existing exceptions. orgs[org] = excepts.Intersection(applicableRepos) } } } repos := sets.NewString() for i := range tqs { repos.Insert(tqs[i].Repos...) } // Remove any org exceptions that are explicitly included in a different query. reposList := repos....
c175765
&QueryMap{ queries: tqs, cache: make(map[string]TideQueries), } }
c175766
to determine relevant queries. for _, query := range qm.queries { if query.ForRepo(org, repo) { res = append(res, query) } } qm.cache[fullName] = res return res }
c175767
", ")) } if inter := sets.NewString(cp.OptionalContexts...).Intersection(sets.NewString(cp.RequiredIfPresentContexts...)); inter.Len() > 0 { return fmt.Errorf("contexts %s are defined as optional and required if present", strings.Join(inter.List(), ", ")) } return nil }
c175768
logrus.WithError(err).Warningf("Error getting branch protection for %s/%s+%s", org, repo, branch) } else if bp != nil && bp.Protect != nil && *bp.Protect && bp.RequiredStatusChecks != nil { required.Insert(bp.RequiredStatusChecks.Contexts...) } } t := &TideContextPolicy{ RequiredContexts: requi...
c175769
on the PR if sets.NewString(cp.RequiredIfPresentContexts...).Has(c) { return false } if cp.SkipUnknownContexts != nil && *cp.SkipUnknownContexts { return true } return false }
c175770
for c := range sets.NewString(cp.RequiredContexts...).Difference(existingContexts) { missingContexts = append(missingContexts, c) } return missingContexts }
c175771
- please reconfigure this hook on GitHub") return "", "", nil, false, http.StatusBadRequest } payload, err := ioutil.ReadAll(r.Body) if err != nil { responseHTTPError(w, http.StatusInternalServerError, "500 Internal Server Error: Failed to read request body") return "", "", nil, false, http.StatusInternalServ...
c175772
plugin reacts to commit changes on PRs in addition to periodically scanning all open PRs for any changes to mergeability that could have resulted from changes in other PRs.`, }, nil }
c175773
:= ghc.IsMergeable(org, repo, number, sha) if err != nil { return err } issueLabels, err := ghc.GetIssueLabels(org, repo, number) if err != nil { return err } hasLabel := github.HasLabel(labels.NeedsRebase, issueLabels) return takeAction(log, ghc, org, repo, number, pre.PullRequest.User.Login, hasLabel, me...
c175774
l := log.WithFields(logrus.Fields{ "org": org, "repo": repo, "pr": num, }) hasLabel := false for _, label := range pr.Labels.Nodes { if label.Name == labels.NeedsRebase { hasLabel = true break } } err := takeAction( l, ghc, org, repo, num, string(pr.Author.Login)...
c175775
deckURL: deckURL, client: &http.Client{}, } }
c175776
(*prowapi.ProwJob, error) { return nil, nil }
c175777
(*prowapi.ProwJob, error) { return nil, nil }
c175778
(*prowapi.ProwJob, error) { return nil, nil }
c175779
*metav1.DeleteOptions) error { return nil }
c175780
metav1.ListOptions) error { return nil }
c175781
metav1.GetOptions) (*prowapi.ProwJob, error) { return nil, nil }
c175782
:= c.request("/prowjobs.js", map[string]string{"labelSelector": opts.LabelSelector}, &jl) return &jl, err }
c175783
(watch.Interface, error) { return nil, nil }
c175784
(result *prowapi.ProwJob, err error) { return nil, nil }
c175785
if c.wait != n { c.wait = n logrus.Infof("Waiting on %s pipelines...", n) } return false // still syncing pipelines in at least one cluster } else if !c.pipelinesDone[n] { c.pipelinesDone[n] = true logrus.Infof("Synced %s pipelines", n) } } return true // Everyone is synced }
c175786
} logrus.Info("Starting workers") for i := 0; i < threads; i++ { go wait.Until(c.runWorker, time.Second, stop) } logrus.Info("Started workers") <-stop logrus.Info("Shutting down workers") return nil }
c175787
to reconcile %s: %v", key, err)) return // Do not forget so we retry later. } c.workqueue.Forget(key) }() } }
c175788
return "", "", "", fmt.Errorf("bad key: %q", key) } return parts[0], parts[1], parts[2], nil }
c175789
case *pipelinev1alpha1.PipelineRun: c.workqueue.AddRateLimited(toKey(ctx, o.Namespace, o.Name)) default: logrus.Warnf("cannot enqueue unknown type %T: %v", o, obj) return } }
c175790
prowjobv1.PendingState, prowjobv1.TriggeredState: return false } return true }
c175791
cond.Message case cond.Reason != "": return cond.Reason } return fallback }
c175792
description(cond, descFailed) case started.IsZero(): return prowjobv1.TriggeredState, description(cond, descInitializing) case cond.Status == untypedcorev1.ConditionUnknown, finished.IsZero(): return prowjobv1.PendingState, description(cond, descRunning) } logrus.Warnf("Unknown condition %#v", cond) return p...
c175793
Name: pj.Name, Namespace: pj.Spec.Namespace, Labels: labels, } }
c175794
sourceURL = fmt.Sprintf("%s.git", pj.Spec.Refs.RepoLink) } return sourceURL }
c175795
Type: pipelinev1alpha1.PipelineResourceTypeGit, Params: []pipelinev1alpha1.Param{ { Name: "url", Value: sourceURL(pj), }, { Name: "revision", Value: revision, }, }, }, } return &pr }
c175796
}) rb := pipelinev1alpha1.PipelineResourceBinding{ Name: pr.Name, ResourceRef: pipelinev1alpha1.PipelineResourceRef{ Name: pr.Name, APIVersion: pr.APIVersion, }, } p.Spec.Resources = append(p.Spec.Resources, rb) return &p, nil }
c175797
!= "" && cfg.Repo != repo) || (cfg.Branch != "" && branch != "" && cfg.Branch != branch) { continue } // If we are reacting to a label event, see if it is relevant. if label != "" && !cfg.Re.MatchString(label) { continue } filtered = append(filtered, cfg) } return filtered }
c175798
if suggestion != "" && suggestion != p.LineText { return formatSuggestion(suggestion) } } return "" }
c175799
serverError("unmarshaling request body", err) return } if provider == nil { serverError("generating plugin help", errors.New("help provider is nil")) return } help, err := provider(enabledRepos) if err != nil { serverError("generating plugin help", err) return } b, err = js...