_id stringlengths 2 7 | title stringlengths 1 118 | partition stringclasses 3
values | text stringlengths 52 85.5k | language stringclasses 1
value | meta_information dict |
|---|---|---|---|---|---|
q175700 | Start | test | func (ca *Agent) Start(prowConfig, jobConfig string) error {
c, err := Load(prowConfig, jobConfig)
if err != nil {
return err
}
ca.Set(c)
go func() {
var lastModTime time.Time
// Rarely, if two changes happen in the same second, mtime will
// be the same for the second change, and an mtime-based check woul... | go | {
"resource": ""
} |
q175701 | Subscribe | test | func (ca *Agent) Subscribe(subscription DeltaChan) {
ca.mut.Lock()
defer ca.mut.Unlock()
ca.subscriptions = append(ca.subscriptions, subscription)
} | go | {
"resource": ""
} |
q175702 | Config | test | func (ca *Agent) Config() *Config {
ca.mut.RLock()
defer ca.mut.RUnlock()
return ca.c
} | go | {
"resource": ""
} |
q175703 | Set | test | func (ca *Agent) Set(c *Config) {
ca.mut.Lock()
defer ca.mut.Unlock()
var oldConfig Config
if ca.c != nil {
oldConfig = *ca.c
}
delta := Delta{oldConfig, *c}
ca.c = c
for _, subscription := range ca.subscriptions {
go func(sub DeltaChan) { // wait a minute to send each event
end := time.NewTimer(time.Min... | go | {
"resource": ""
} |
q175704 | IsMember | test | func (f *FakeClient) IsMember(org, user string) (bool, error) {
for _, m := range f.OrgMembers[org] {
if m == user {
return true, nil
}
}
return false, nil
} | go | {
"resource": ""
} |
q175705 | ListIssueComments | test | func (f *FakeClient) ListIssueComments(owner, repo string, number int) ([]github.IssueComment, error) {
return append([]github.IssueComment{}, f.IssueComments[number]...), nil
} | go | {
"resource": ""
} |
q175706 | ListPullRequestComments | test | func (f *FakeClient) ListPullRequestComments(owner, repo string, number int) ([]github.ReviewComment, error) {
return append([]github.ReviewComment{}, f.PullRequestComments[number]...), nil
} | go | {
"resource": ""
} |
q175707 | ListReviews | test | func (f *FakeClient) ListReviews(owner, repo string, number int) ([]github.Review, error) {
return append([]github.Review{}, f.Reviews[number]...), nil
} | go | {
"resource": ""
} |
q175708 | ListIssueEvents | test | func (f *FakeClient) ListIssueEvents(owner, repo string, number int) ([]github.ListedIssueEvent, error) {
return append([]github.ListedIssueEvent{}, f.IssueEvents[number]...), nil
} | go | {
"resource": ""
} |
q175709 | CreateComment | test | func (f *FakeClient) CreateComment(owner, repo string, number int, comment string) error {
f.IssueCommentsAdded = append(f.IssueCommentsAdded, fmt.Sprintf("%s/%s#%d:%s", owner, repo, number, comment))
f.IssueComments[number] = append(f.IssueComments[number], github.IssueComment{
ID: f.IssueCommentID,
Body: comm... | go | {
"resource": ""
} |
q175710 | CreateReview | test | func (f *FakeClient) CreateReview(org, repo string, number int, r github.DraftReview) error {
f.Reviews[number] = append(f.Reviews[number], github.Review{
ID: f.ReviewID,
User: github.User{Login: botName},
Body: r.Body,
})
f.ReviewID++
return nil
} | go | {
"resource": ""
} |
q175711 | CreateCommentReaction | test | func (f *FakeClient) CreateCommentReaction(org, repo string, ID int, reaction string) error {
f.CommentReactionsAdded = append(f.CommentReactionsAdded, fmt.Sprintf("%s/%s#%d:%s", org, repo, ID, reaction))
return nil
} | go | {
"resource": ""
} |
q175712 | CreateIssueReaction | test | func (f *FakeClient) CreateIssueReaction(org, repo string, ID int, reaction string) error {
f.IssueReactionsAdded = append(f.IssueReactionsAdded, fmt.Sprintf("%s/%s#%d:%s", org, repo, ID, reaction))
return nil
} | go | {
"resource": ""
} |
q175713 | DeleteComment | test | func (f *FakeClient) DeleteComment(owner, repo string, ID int) error {
f.IssueCommentsDeleted = append(f.IssueCommentsDeleted, fmt.Sprintf("%s/%s#%d", owner, repo, ID))
for num, ics := range f.IssueComments {
for i, ic := range ics {
if ic.ID == ID {
f.IssueComments[num] = append(ics[:i], ics[i+1:]...)
r... | go | {
"resource": ""
} |
q175714 | DeleteStaleComments | test | func (f *FakeClient) DeleteStaleComments(org, repo string, number int, comments []github.IssueComment, isStale func(github.IssueComment) bool) error {
if comments == nil {
comments, _ = f.ListIssueComments(org, repo, number)
}
for _, comment := range comments {
if isStale(comment) {
if err := f.DeleteComment(... | go | {
"resource": ""
} |
q175715 | GetPullRequest | test | func (f *FakeClient) GetPullRequest(owner, repo string, number int) (*github.PullRequest, error) {
val, exists := f.PullRequests[number]
if !exists {
return nil, fmt.Errorf("Pull request number %d does not exit", number)
}
return val, nil
} | go | {
"resource": ""
} |
q175716 | GetPullRequestChanges | test | func (f *FakeClient) GetPullRequestChanges(org, repo string, number int) ([]github.PullRequestChange, error) {
return f.PullRequestChanges[number], nil
} | go | {
"resource": ""
} |
q175717 | GetRef | test | func (f *FakeClient) GetRef(owner, repo, ref string) (string, error) {
return TestRef, nil
} | go | {
"resource": ""
} |
q175718 | DeleteRef | test | func (f *FakeClient) DeleteRef(owner, repo, ref string) error {
f.RefsDeleted = append(f.RefsDeleted, struct{ Org, Repo, Ref string }{Org: owner, Repo: repo, Ref: ref})
return nil
} | go | {
"resource": ""
} |
q175719 | GetSingleCommit | test | func (f *FakeClient) GetSingleCommit(org, repo, SHA string) (github.SingleCommit, error) {
return f.Commits[SHA], nil
} | go | {
"resource": ""
} |
q175720 | CreateStatus | test | func (f *FakeClient) CreateStatus(owner, repo, SHA string, s github.Status) error {
if f.CreatedStatuses == nil {
f.CreatedStatuses = make(map[string][]github.Status)
}
statuses := f.CreatedStatuses[SHA]
var updated bool
for i := range statuses {
if statuses[i].Context == s.Context {
statuses[i] = s
upda... | go | {
"resource": ""
} |
q175721 | ListStatuses | test | func (f *FakeClient) ListStatuses(org, repo, ref string) ([]github.Status, error) {
return f.CreatedStatuses[ref], nil
} | go | {
"resource": ""
} |
q175722 | GetCombinedStatus | test | func (f *FakeClient) GetCombinedStatus(owner, repo, ref string) (*github.CombinedStatus, error) {
return f.CombinedStatuses[ref], nil
} | go | {
"resource": ""
} |
q175723 | GetRepoLabels | test | func (f *FakeClient) GetRepoLabels(owner, repo string) ([]github.Label, error) {
la := []github.Label{}
for _, l := range f.RepoLabelsExisting {
la = append(la, github.Label{Name: l})
}
return la, nil
} | go | {
"resource": ""
} |
q175724 | GetIssueLabels | test | func (f *FakeClient) GetIssueLabels(owner, repo string, number int) ([]github.Label, error) {
re := regexp.MustCompile(fmt.Sprintf(`^%s/%s#%d:(.*)$`, owner, repo, number))
la := []github.Label{}
allLabels := sets.NewString(f.IssueLabelsExisting...)
allLabels.Insert(f.IssueLabelsAdded...)
allLabels.Delete(f.IssueLa... | go | {
"resource": ""
} |
q175725 | AddLabel | test | func (f *FakeClient) AddLabel(owner, repo string, number int, label string) error {
labelString := fmt.Sprintf("%s/%s#%d:%s", owner, repo, number, label)
if sets.NewString(f.IssueLabelsAdded...).Has(labelString) {
return fmt.Errorf("cannot add %v to %s/%s/#%d", label, owner, repo, number)
}
if f.RepoLabelsExistin... | go | {
"resource": ""
} |
q175726 | RemoveLabel | test | func (f *FakeClient) RemoveLabel(owner, repo string, number int, label string) error {
labelString := fmt.Sprintf("%s/%s#%d:%s", owner, repo, number, label)
if !sets.NewString(f.IssueLabelsRemoved...).Has(labelString) {
f.IssueLabelsRemoved = append(f.IssueLabelsRemoved, labelString)
return nil
}
return fmt.Err... | go | {
"resource": ""
} |
q175727 | FindIssues | test | func (f *FakeClient) FindIssues(query, sort string, asc bool) ([]github.Issue, error) {
return f.Issues, nil
} | go | {
"resource": ""
} |
q175728 | AssignIssue | test | func (f *FakeClient) AssignIssue(owner, repo string, number int, assignees []string) error {
var m github.MissingUsers
for _, a := range assignees {
if a == "not-in-the-org" {
m.Users = append(m.Users, a)
continue
}
f.AssigneesAdded = append(f.AssigneesAdded, fmt.Sprintf("%s/%s#%d:%s", owner, repo, number... | go | {
"resource": ""
} |
q175729 | GetFile | test | func (f *FakeClient) GetFile(org, repo, file, commit string) ([]byte, error) {
contents, ok := f.RemoteFiles[file]
if !ok {
return nil, fmt.Errorf("could not find file %s", file)
}
if commit == "" {
if master, ok := contents["master"]; ok {
return []byte(master), nil
}
return nil, fmt.Errorf("could not ... | go | {
"resource": ""
} |
q175730 | ListTeams | test | func (f *FakeClient) ListTeams(org string) ([]github.Team, error) {
return []github.Team{
{
ID: 0,
Name: "Admins",
},
{
ID: 42,
Name: "Leads",
},
}, nil
} | go | {
"resource": ""
} |
q175731 | ListTeamMembers | test | func (f *FakeClient) ListTeamMembers(teamID int, role string) ([]github.TeamMember, error) {
if role != github.RoleAll {
return nil, fmt.Errorf("unsupported role %v (only all supported)", role)
}
teams := map[int][]github.TeamMember{
0: {{Login: "default-sig-lead"}},
42: {{Login: "sig-lead"}},
}
members, ok... | go | {
"resource": ""
} |
q175732 | IsCollaborator | test | func (f *FakeClient) IsCollaborator(org, repo, login string) (bool, error) {
normed := github.NormLogin(login)
for _, collab := range f.Collaborators {
if github.NormLogin(collab) == normed {
return true, nil
}
}
return false, nil
} | go | {
"resource": ""
} |
q175733 | ListCollaborators | test | func (f *FakeClient) ListCollaborators(org, repo string) ([]github.User, error) {
result := make([]github.User, 0, len(f.Collaborators))
for _, login := range f.Collaborators {
result = append(result, github.User{Login: login})
}
return result, nil
} | go | {
"resource": ""
} |
q175734 | ClearMilestone | test | func (f *FakeClient) ClearMilestone(org, repo string, issueNum int) error {
f.Milestone = 0
return nil
} | go | {
"resource": ""
} |
q175735 | SetMilestone | test | func (f *FakeClient) SetMilestone(org, repo string, issueNum, milestoneNum int) error {
if milestoneNum < 0 {
return fmt.Errorf("Milestone Numbers Cannot Be Negative")
}
f.Milestone = milestoneNum
return nil
} | go | {
"resource": ""
} |
q175736 | ListMilestones | test | func (f *FakeClient) ListMilestones(org, repo string) ([]github.Milestone, error) {
milestones := []github.Milestone{}
for k, v := range f.MilestoneMap {
milestones = append(milestones, github.Milestone{Title: k, Number: v})
}
return milestones, nil
} | go | {
"resource": ""
} |
q175737 | ListPRCommits | test | func (f *FakeClient) ListPRCommits(org, repo string, prNumber int) ([]github.RepositoryCommit, error) {
k := fmt.Sprintf("%s/%s#%d", org, repo, prNumber)
return f.CommitMap[k], nil
} | go | {
"resource": ""
} |
q175738 | GetRepoProjects | test | func (f *FakeClient) GetRepoProjects(owner, repo string) ([]github.Project, error) {
return f.RepoProjects[fmt.Sprintf("%s/%s", owner, repo)], nil
} | go | {
"resource": ""
} |
q175739 | GetOrgProjects | test | func (f *FakeClient) GetOrgProjects(org string) ([]github.Project, error) {
return f.RepoProjects[fmt.Sprintf("%s/*", org)], nil
} | go | {
"resource": ""
} |
q175740 | GetProjectColumns | test | func (f *FakeClient) GetProjectColumns(projectID int) ([]github.ProjectColumn, error) {
// Get project name
for _, projects := range f.RepoProjects {
for _, project := range projects {
if projectID == project.ID {
return f.ProjectColumnsMap[project.Name], nil
}
}
}
return nil, fmt.Errorf("Cannot find ... | go | {
"resource": ""
} |
q175741 | CreateProjectCard | test | func (f *FakeClient) CreateProjectCard(columnID int, projectCard github.ProjectCard) (*github.ProjectCard, error) {
if f.ColumnCardsMap == nil {
f.ColumnCardsMap = make(map[int][]github.ProjectCard)
}
for project, columnIDMap := range f.ColumnIDMap {
columnName, exists := columnIDMap[columnID]
if exists {
... | go | {
"resource": ""
} |
q175742 | DeleteProjectCard | test | func (f *FakeClient) DeleteProjectCard(projectCardID int) error {
if f.ColumnCardsMap == nil {
return fmt.Errorf("Project card doesn't exist")
}
f.Project = ""
f.Column = ""
newCards := []github.ProjectCard{}
oldColumnID := -1
for column, cards := range f.ColumnCardsMap {
removalIndex := -1
for i, existing... | go | {
"resource": ""
} |
q175743 | MoveProjectCard | test | func (f *FakeClient) MoveProjectCard(projectCardID int, newColumnID int) error {
// Remove project card from old column
newCards := []github.ProjectCard{}
oldColumnID := -1
projectCard := github.ProjectCard{}
for column, cards := range f.ColumnCardsMap {
removalIndex := -1
for i, existingCard := range cards {
... | go | {
"resource": ""
} |
q175744 | CreateDatabaseClient | test | func (config *InfluxConfig) CreateDatabaseClient() (*InfluxDB, error) {
client, err := influxdb.NewHTTPClient(influxdb.HTTPConfig{
Addr: config.Host,
Username: config.User,
Password: config.Password,
})
if err != nil {
return nil, err
}
return &InfluxDB{
client: client,
database: config.DB,
}, ... | go | {
"resource": ""
} |
q175745 | Push | test | func (i *InfluxDB) Push(measurement string, tags map[string]string, fields map[string]interface{}, date time.Time) error {
batch, err := influxdb.NewBatchPoints(influxdb.BatchPointsConfig{
Database: i.database,
Precision: "s",
})
if err != nil {
return err
}
pt, err := influxdb.NewPoint(measurement, tags, ... | go | {
"resource": ""
} |
q175746 | NewProwJobWithAnnotation | test | func NewProwJobWithAnnotation(spec prowapi.ProwJobSpec, labels, annotations map[string]string) prowapi.ProwJob {
return newProwJob(spec, labels, annotations)
} | go | {
"resource": ""
} |
q175747 | NewProwJob | test | func NewProwJob(spec prowapi.ProwJobSpec, labels map[string]string) prowapi.ProwJob {
return newProwJob(spec, labels, nil)
} | go | {
"resource": ""
} |
q175748 | NewPresubmit | test | func NewPresubmit(pr github.PullRequest, baseSHA string, job config.Presubmit, eventGUID string) prowapi.ProwJob {
refs := createRefs(pr, baseSHA)
labels := make(map[string]string)
for k, v := range job.Labels {
labels[k] = v
}
labels[github.EventGUID] = eventGUID
return NewProwJob(PresubmitSpec(job, refs), lab... | go | {
"resource": ""
} |
q175749 | PresubmitSpec | test | func PresubmitSpec(p config.Presubmit, refs prowapi.Refs) prowapi.ProwJobSpec {
pjs := specFromJobBase(p.JobBase)
pjs.Type = prowapi.PresubmitJob
pjs.Context = p.Context
pjs.Report = !p.SkipReport
pjs.RerunCommand = p.RerunCommand
if p.JenkinsSpec != nil {
pjs.JenkinsSpec = &prowapi.JenkinsSpec{
GitHubBranch... | go | {
"resource": ""
} |
q175750 | PostsubmitSpec | test | func PostsubmitSpec(p config.Postsubmit, refs prowapi.Refs) prowapi.ProwJobSpec {
pjs := specFromJobBase(p.JobBase)
pjs.Type = prowapi.PostsubmitJob
pjs.Context = p.Context
pjs.Report = !p.SkipReport
pjs.Refs = completePrimaryRefs(refs, p.JobBase)
if p.JenkinsSpec != nil {
pjs.JenkinsSpec = &prowapi.JenkinsSpec... | go | {
"resource": ""
} |
q175751 | PeriodicSpec | test | func PeriodicSpec(p config.Periodic) prowapi.ProwJobSpec {
pjs := specFromJobBase(p.JobBase)
pjs.Type = prowapi.PeriodicJob
return pjs
} | go | {
"resource": ""
} |
q175752 | BatchSpec | test | func BatchSpec(p config.Presubmit, refs prowapi.Refs) prowapi.ProwJobSpec {
pjs := specFromJobBase(p.JobBase)
pjs.Type = prowapi.BatchJob
pjs.Context = p.Context
pjs.Refs = completePrimaryRefs(refs, p.JobBase)
return pjs
} | go | {
"resource": ""
} |
q175753 | PartitionActive | test | func PartitionActive(pjs []prowapi.ProwJob) (pending, triggered chan prowapi.ProwJob) {
// Size channels correctly.
pendingCount, triggeredCount := 0, 0
for _, pj := range pjs {
switch pj.Status.State {
case prowapi.PendingState:
pendingCount++
case prowapi.TriggeredState:
triggeredCount++
}
}
pendin... | go | {
"resource": ""
} |
q175754 | ProwJobFields | test | func ProwJobFields(pj *prowapi.ProwJob) logrus.Fields {
fields := make(logrus.Fields)
fields["name"] = pj.ObjectMeta.Name
fields["job"] = pj.Spec.Job
fields["type"] = pj.Spec.Type
if len(pj.ObjectMeta.Labels[github.EventGUID]) > 0 {
fields[github.EventGUID] = pj.ObjectMeta.Labels[github.EventGUID]
}
if pj.Spec... | go | {
"resource": ""
} |
q175755 | ClusterToCtx | test | func ClusterToCtx(cluster string) string {
if cluster == kube.InClusterContext {
return kube.DefaultClusterAlias
}
return cluster
} | go | {
"resource": ""
} |
q175756 | AddCommand | test | func (pluginHelp *PluginHelp) AddCommand(command Command) {
pluginHelp.Commands = append(pluginHelp.Commands, command)
} | go | {
"resource": ""
} |
q175757 | Get | test | func (c *FakeProwJobs) Get(name string, options v1.GetOptions) (result *prowjobsv1.ProwJob, err error) {
obj, err := c.Fake.
Invokes(testing.NewGetAction(prowjobsResource, c.ns, name), &prowjobsv1.ProwJob{})
if obj == nil {
return nil, err
}
return obj.(*prowjobsv1.ProwJob), err
} | go | {
"resource": ""
} |
q175758 | Watch | test | func (c *FakeProwJobs) Watch(opts v1.ListOptions) (watch.Interface, error) {
return c.Fake.
InvokesWatch(testing.NewWatchAction(prowjobsResource, c.ns, opts))
} | go | {
"resource": ""
} |
q175759 | Delete | test | func (c *FakeProwJobs) Delete(name string, options *v1.DeleteOptions) error {
_, err := c.Fake.
Invokes(testing.NewDeleteAction(prowjobsResource, c.ns, name), &prowjobsv1.ProwJob{})
return err
} | go | {
"resource": ""
} |
q175760 | Patch | test | func (c *FakeProwJobs) Patch(name string, pt types.PatchType, data []byte, subresources ...string) (result *prowjobsv1.ProwJob, err error) {
obj, err := c.Fake.
Invokes(testing.NewPatchSubresourceAction(prowjobsResource, c.ns, name, data, subresources...), &prowjobsv1.ProwJob{})
if obj == nil {
return nil, err
... | go | {
"resource": ""
} |
q175761 | MergeMethod | test | func (t *Tide) MergeMethod(org, repo string) github.PullRequestMergeType {
name := org + "/" + repo
v, ok := t.MergeType[name]
if !ok {
if ov, found := t.MergeType[org]; found {
return ov
}
return github.MergeMerge
}
return v
} | go | {
"resource": ""
} |
q175762 | Query | test | func (tq *TideQuery) Query() string {
toks := []string{"is:pr", "state:open"}
for _, o := range tq.Orgs {
toks = append(toks, fmt.Sprintf("org:\"%s\"", o))
}
for _, r := range tq.Repos {
toks = append(toks, fmt.Sprintf("repo:\"%s\"", r))
}
for _, r := range tq.ExcludedRepos {
toks = append(toks, fmt.Sprintf... | go | {
"resource": ""
} |
q175763 | ForRepo | test | func (tq TideQuery) ForRepo(org, repo string) bool {
fullName := fmt.Sprintf("%s/%s", org, repo)
for _, queryOrg := range tq.Orgs {
if queryOrg != org {
continue
}
// Check for repos excluded from the org.
for _, excludedRepo := range tq.ExcludedRepos {
if excludedRepo == fullName {
return false
... | go | {
"resource": ""
} |
q175764 | OrgExceptionsAndRepos | test | func (tqs TideQueries) OrgExceptionsAndRepos() (map[string]sets.String, sets.String) {
orgs := make(map[string]sets.String)
for i := range tqs {
for _, org := range tqs[i].Orgs {
applicableRepos := sets.NewString(reposInOrg(org, tqs[i].ExcludedRepos)...)
if excepts, ok := orgs[org]; !ok {
// We have not s... | go | {
"resource": ""
} |
q175765 | QueryMap | test | func (tqs TideQueries) QueryMap() *QueryMap {
return &QueryMap{
queries: tqs,
cache: make(map[string]TideQueries),
}
} | go | {
"resource": ""
} |
q175766 | ForRepo | test | func (qm *QueryMap) ForRepo(org, repo string) TideQueries {
res := TideQueries(nil)
fullName := fmt.Sprintf("%s/%s", org, repo)
qm.Lock()
defer qm.Unlock()
if qs, ok := qm.cache[fullName]; ok {
return append(res, qs...) // Return a copy.
}
// Cache miss. Need to determine relevant queries.
for _, query := ... | go | {
"resource": ""
} |
q175767 | Validate | test | func (cp *TideContextPolicy) Validate() error {
if inter := sets.NewString(cp.RequiredContexts...).Intersection(sets.NewString(cp.OptionalContexts...)); inter.Len() > 0 {
return fmt.Errorf("contexts %s are defined as required and optional", strings.Join(inter.List(), ", "))
}
if inter := sets.NewString(cp.Required... | go | {
"resource": ""
} |
q175768 | GetTideContextPolicy | test | func (c Config) GetTideContextPolicy(org, repo, branch string) (*TideContextPolicy, error) {
options := parseTideContextPolicyOptions(org, repo, branch, c.Tide.ContextOptions)
// Adding required and optional contexts from options
required := sets.NewString(options.RequiredContexts...)
requiredIfPresent := sets.NewS... | go | {
"resource": ""
} |
q175769 | IsOptional | test | func (cp *TideContextPolicy) IsOptional(c string) bool {
if sets.NewString(cp.OptionalContexts...).Has(c) {
return true
}
if sets.NewString(cp.RequiredContexts...).Has(c) {
return false
}
// assume if we're asking that the context is present on the PR
if sets.NewString(cp.RequiredIfPresentContexts...).Has(c) ... | go | {
"resource": ""
} |
q175770 | MissingRequiredContexts | test | func (cp *TideContextPolicy) MissingRequiredContexts(contexts []string) []string {
if len(cp.RequiredContexts) == 0 {
return nil
}
existingContexts := sets.NewString()
for _, c := range contexts {
existingContexts.Insert(c)
}
var missingContexts []string
for c := range sets.NewString(cp.RequiredContexts...).... | go | {
"resource": ""
} |
q175771 | ValidateWebhook | test | func ValidateWebhook(w http.ResponseWriter, r *http.Request, hmacSecret []byte) (string, string, []byte, bool, int) {
defer r.Body.Close()
// Our health check uses GET, so just kick back a 200.
if r.Method == http.MethodGet {
return "", "", nil, false, http.StatusOK
}
// Header checks: It must be a POST with a... | go | {
"resource": ""
} |
q175772 | HelpProvider | test | func HelpProvider(enabledRepos []string) (*pluginhelp.PluginHelp, error) {
return &pluginhelp.PluginHelp{
Description: `The needs-rebase plugin manages the '` + labels.NeedsRebase + `' label by removing it from Pull Requests that are mergeable and adding it to those which are not.
The plugin reacts to commit change... | go | {
"resource": ""
} |
q175773 | HandleEvent | test | func HandleEvent(log *logrus.Entry, ghc githubClient, pre *github.PullRequestEvent) error {
if pre.Action != github.PullRequestActionOpened && pre.Action != github.PullRequestActionSynchronize && pre.Action != github.PullRequestActionReopened {
return nil
}
// Before checking mergeability wait a few seconds to gi... | go | {
"resource": ""
} |
q175774 | HandleAll | test | func HandleAll(log *logrus.Entry, ghc githubClient, config *plugins.Configuration) error {
log.Info("Checking all PRs.")
orgs, repos := config.EnabledReposForExternalPlugin(PluginName)
if len(orgs) == 0 && len(repos) == 0 {
log.Warnf("No repos have been configured for the %s plugin", PluginName)
return nil
}
v... | go | {
"resource": ""
} |
q175775 | NewDryRunProwJobClient | test | func NewDryRunProwJobClient(deckURL string) prowv1.ProwJobInterface {
return &dryRunProwJobClient{
deckURL: deckURL,
client: &http.Client{},
}
} | go | {
"resource": ""
} |
q175776 | Create | test | func (c *dryRunProwJobClient) Create(*prowapi.ProwJob) (*prowapi.ProwJob, error) {
return nil, nil
} | go | {
"resource": ""
} |
q175777 | Update | test | func (c *dryRunProwJobClient) Update(*prowapi.ProwJob) (*prowapi.ProwJob, error) {
return nil, nil
} | go | {
"resource": ""
} |
q175778 | UpdateStatus | test | func (c *dryRunProwJobClient) UpdateStatus(*prowapi.ProwJob) (*prowapi.ProwJob, error) {
return nil, nil
} | go | {
"resource": ""
} |
q175779 | Delete | test | func (c *dryRunProwJobClient) Delete(name string, options *metav1.DeleteOptions) error {
return nil
} | go | {
"resource": ""
} |
q175780 | DeleteCollection | test | func (c *dryRunProwJobClient) DeleteCollection(options *metav1.DeleteOptions, listOptions metav1.ListOptions) error {
return nil
} | go | {
"resource": ""
} |
q175781 | Get | test | func (c *dryRunProwJobClient) Get(name string, options metav1.GetOptions) (*prowapi.ProwJob, error) {
return nil, nil
} | go | {
"resource": ""
} |
q175782 | List | test | func (c *dryRunProwJobClient) List(opts metav1.ListOptions) (*prowapi.ProwJobList, error) {
var jl prowapi.ProwJobList
err := c.request("/prowjobs.js", map[string]string{"labelSelector": opts.LabelSelector}, &jl)
return &jl, err
} | go | {
"resource": ""
} |
q175783 | Watch | test | func (c *dryRunProwJobClient) Watch(opts metav1.ListOptions) (watch.Interface, error) {
return nil, nil
} | go | {
"resource": ""
} |
q175784 | Patch | test | func (c *dryRunProwJobClient) Patch(name string, pt types.PatchType, data []byte, subresources ...string) (result *prowapi.ProwJob, err error) {
return nil, nil
} | go | {
"resource": ""
} |
q175785 | hasSynced | test | func (c *controller) hasSynced() bool {
if !c.pjInformer.HasSynced() {
if c.wait != "prowjobs" {
c.wait = "prowjobs"
ns := c.pjNamespace()
if ns == "" {
ns = "controllers"
}
logrus.Infof("Waiting on prowjobs in %s namespace...", ns)
}
return false // still syncing prowjobs
}
if !c.prowJobsDo... | go | {
"resource": ""
} |
q175786 | Run | test | func (c *controller) Run(threads int, stop <-chan struct{}) error {
defer runtime.HandleCrash()
defer c.workqueue.ShutDown()
logrus.Info("Starting Pipeline controller")
logrus.Info("Waiting for informer caches to sync")
if ok := cache.WaitForCacheSync(stop, c.hasSynced); !ok {
return fmt.Errorf("failed to wait ... | go | {
"resource": ""
} |
q175787 | runWorker | test | func (c *controller) runWorker() {
for {
key, shutdown := c.workqueue.Get()
if shutdown {
return
}
func() {
defer c.workqueue.Done(key)
if err := reconcile(c, key.(string)); err != nil {
runtime.HandleError(fmt.Errorf("failed to reconcile %s: %v", key, err))
return // Do not forget so we retr... | go | {
"resource": ""
} |
q175788 | fromKey | test | func fromKey(key string) (string, string, string, error) {
parts := strings.Split(key, "/")
if len(parts) != 3 {
return "", "", "", fmt.Errorf("bad key: %q", key)
}
return parts[0], parts[1], parts[2], nil
} | go | {
"resource": ""
} |
q175789 | enqueueKey | test | func (c *controller) enqueueKey(ctx string, obj interface{}) {
switch o := obj.(type) {
case *prowjobv1.ProwJob:
ns := o.Spec.Namespace
if ns == "" {
ns = o.Namespace
}
c.workqueue.AddRateLimited(toKey(ctx, ns, o.Name))
case *pipelinev1alpha1.PipelineRun:
c.workqueue.AddRateLimited(toKey(ctx, o.Namespac... | go | {
"resource": ""
} |
q175790 | finalState | test | func finalState(status prowjobv1.ProwJobState) bool {
switch status {
case "", prowjobv1.PendingState, prowjobv1.TriggeredState:
return false
}
return true
} | go | {
"resource": ""
} |
q175791 | description | test | func description(cond duckv1alpha1.Condition, fallback string) string {
switch {
case cond.Message != "":
return cond.Message
case cond.Reason != "":
return cond.Reason
}
return fallback
} | go | {
"resource": ""
} |
q175792 | prowJobStatus | test | func prowJobStatus(ps pipelinev1alpha1.PipelineRunStatus) (prowjobv1.ProwJobState, string) {
started := ps.StartTime
finished := ps.CompletionTime
pcond := ps.GetCondition(duckv1alpha1.ConditionSucceeded)
if pcond == nil {
if !finished.IsZero() {
return prowjobv1.ErrorState, descMissingCondition
}
return p... | go | {
"resource": ""
} |
q175793 | pipelineMeta | test | func pipelineMeta(pj prowjobv1.ProwJob) metav1.ObjectMeta {
labels, annotations := decorate.LabelsAndAnnotationsForJob(pj)
return metav1.ObjectMeta{
Annotations: annotations,
Name: pj.Name,
Namespace: pj.Spec.Namespace,
Labels: labels,
}
} | go | {
"resource": ""
} |
q175794 | sourceURL | test | func sourceURL(pj prowjobv1.ProwJob) string {
if pj.Spec.Refs == nil {
return ""
}
sourceURL := pj.Spec.Refs.CloneURI
if sourceURL == "" {
sourceURL = fmt.Sprintf("%s.git", pj.Spec.Refs.RepoLink)
}
return sourceURL
} | go | {
"resource": ""
} |
q175795 | makePipelineGitResource | test | func makePipelineGitResource(pj prowjobv1.ProwJob) *pipelinev1alpha1.PipelineResource {
var revision string
if pj.Spec.Refs != nil {
if len(pj.Spec.Refs.Pulls) > 0 {
revision = pj.Spec.Refs.Pulls[0].SHA
} else {
revision = pj.Spec.Refs.BaseSHA
}
}
pr := pipelinev1alpha1.PipelineResource{
ObjectMeta: p... | go | {
"resource": ""
} |
q175796 | makePipelineRun | test | func makePipelineRun(pj prowjobv1.ProwJob, pr *pipelinev1alpha1.PipelineResource) (*pipelinev1alpha1.PipelineRun, error) {
if pj.Spec.PipelineRunSpec == nil {
return nil, errors.New("no PipelineSpec defined")
}
p := pipelinev1alpha1.PipelineRun{
ObjectMeta: pipelineMeta(pj),
Spec: *pj.Spec.PipelineRunSpe... | go | {
"resource": ""
} |
q175797 | matchingConfigs | test | func matchingConfigs(org, repo, branch, label string, allConfigs []plugins.RequireMatchingLabel) []plugins.RequireMatchingLabel {
var filtered []plugins.RequireMatchingLabel
for _, cfg := range allConfigs {
// Check if the config applies to this issue type.
if (branch == "" && !cfg.Issues) || (branch != "" && !cf... | go | {
"resource": ""
} |
q175798 | SuggestCodeChange | test | func SuggestCodeChange(p lint.Problem) string {
var suggestion = ""
for regex, handler := range lintHandlersMap {
matches := regex.FindStringSubmatch(p.Text)
suggestion = handler(p, matches)
if suggestion != "" && suggestion != p.LineText {
return formatSuggestion(suggestion)
}
}
return ""
} | go | {
"resource": ""
} |
q175799 | ServeExternalPluginHelp | test | func ServeExternalPluginHelp(mux *http.ServeMux, log *logrus.Entry, provider ExternalPluginHelpProvider) {
mux.HandleFunc(
"/help",
func(w http.ResponseWriter, r *http.Request) {
w.Header().Set("Cache-Control", "no-cache")
serverError := func(action string, err error) {
log.WithError(err).Errorf("Error ... | go | {
"resource": ""
} |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.