repo
stringlengths
5
67
path
stringlengths
4
218
func_name
stringlengths
0
151
original_string
stringlengths
52
373k
language
stringclasses
6 values
code
stringlengths
52
373k
code_tokens
listlengths
10
512
docstring
stringlengths
3
47.2k
docstring_tokens
listlengths
3
234
sha
stringlengths
40
40
url
stringlengths
85
339
partition
stringclasses
3 values
kubernetes/test-infra
prow/github/fakegithub/fakegithub.go
DeleteComment
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
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...
[ "func", "(", "f", "*", "FakeClient", ")", "DeleteComment", "(", "owner", ",", "repo", "string", ",", "ID", "int", ")", "error", "{", "f", ".", "IssueCommentsDeleted", "=", "append", "(", "f", ".", "IssueCommentsDeleted", ",", "fmt", ".", "Sprintf", "(", ...
// DeleteComment deletes a comment.
[ "DeleteComment", "deletes", "a", "comment", "." ]
8125fbda10178887be5dff9e901d6a0a519b67bc
https://github.com/kubernetes/test-infra/blob/8125fbda10178887be5dff9e901d6a0a519b67bc/prow/github/fakegithub/fakegithub.go#L175-L186
test
kubernetes/test-infra
prow/github/fakegithub/fakegithub.go
DeleteStaleComments
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
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(...
[ "func", "(", "f", "*", "FakeClient", ")", "DeleteStaleComments", "(", "org", ",", "repo", "string", ",", "number", "int", ",", "comments", "[", "]", "github", ".", "IssueComment", ",", "isStale", "func", "(", "github", ".", "IssueComment", ")", "bool", "...
// DeleteStaleComments deletes comments flagged by isStale.
[ "DeleteStaleComments", "deletes", "comments", "flagged", "by", "isStale", "." ]
8125fbda10178887be5dff9e901d6a0a519b67bc
https://github.com/kubernetes/test-infra/blob/8125fbda10178887be5dff9e901d6a0a519b67bc/prow/github/fakegithub/fakegithub.go#L189-L201
test
kubernetes/test-infra
prow/github/fakegithub/fakegithub.go
GetPullRequest
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
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 }
[ "func", "(", "f", "*", "FakeClient", ")", "GetPullRequest", "(", "owner", ",", "repo", "string", ",", "number", "int", ")", "(", "*", "github", ".", "PullRequest", ",", "error", ")", "{", "val", ",", "exists", ":=", "f", ".", "PullRequests", "[", "nu...
// GetPullRequest returns details about the PR.
[ "GetPullRequest", "returns", "details", "about", "the", "PR", "." ]
8125fbda10178887be5dff9e901d6a0a519b67bc
https://github.com/kubernetes/test-infra/blob/8125fbda10178887be5dff9e901d6a0a519b67bc/prow/github/fakegithub/fakegithub.go#L204-L210
test
kubernetes/test-infra
prow/github/fakegithub/fakegithub.go
GetPullRequestChanges
func (f *FakeClient) GetPullRequestChanges(org, repo string, number int) ([]github.PullRequestChange, error) { return f.PullRequestChanges[number], nil }
go
func (f *FakeClient) GetPullRequestChanges(org, repo string, number int) ([]github.PullRequestChange, error) { return f.PullRequestChanges[number], nil }
[ "func", "(", "f", "*", "FakeClient", ")", "GetPullRequestChanges", "(", "org", ",", "repo", "string", ",", "number", "int", ")", "(", "[", "]", "github", ".", "PullRequestChange", ",", "error", ")", "{", "return", "f", ".", "PullRequestChanges", "[", "nu...
// GetPullRequestChanges returns the file modifications in a PR.
[ "GetPullRequestChanges", "returns", "the", "file", "modifications", "in", "a", "PR", "." ]
8125fbda10178887be5dff9e901d6a0a519b67bc
https://github.com/kubernetes/test-infra/blob/8125fbda10178887be5dff9e901d6a0a519b67bc/prow/github/fakegithub/fakegithub.go#L213-L215
test
kubernetes/test-infra
prow/github/fakegithub/fakegithub.go
GetRef
func (f *FakeClient) GetRef(owner, repo, ref string) (string, error) { return TestRef, nil }
go
func (f *FakeClient) GetRef(owner, repo, ref string) (string, error) { return TestRef, nil }
[ "func", "(", "f", "*", "FakeClient", ")", "GetRef", "(", "owner", ",", "repo", ",", "ref", "string", ")", "(", "string", ",", "error", ")", "{", "return", "TestRef", ",", "nil", "\n", "}" ]
// GetRef returns the hash of a ref.
[ "GetRef", "returns", "the", "hash", "of", "a", "ref", "." ]
8125fbda10178887be5dff9e901d6a0a519b67bc
https://github.com/kubernetes/test-infra/blob/8125fbda10178887be5dff9e901d6a0a519b67bc/prow/github/fakegithub/fakegithub.go#L218-L220
test
kubernetes/test-infra
prow/github/fakegithub/fakegithub.go
DeleteRef
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
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 }
[ "func", "(", "f", "*", "FakeClient", ")", "DeleteRef", "(", "owner", ",", "repo", ",", "ref", "string", ")", "error", "{", "f", ".", "RefsDeleted", "=", "append", "(", "f", ".", "RefsDeleted", ",", "struct", "{", "Org", ",", "Repo", ",", "Ref", "st...
// DeleteRef returns an error indicating if deletion of the given ref was successful
[ "DeleteRef", "returns", "an", "error", "indicating", "if", "deletion", "of", "the", "given", "ref", "was", "successful" ]
8125fbda10178887be5dff9e901d6a0a519b67bc
https://github.com/kubernetes/test-infra/blob/8125fbda10178887be5dff9e901d6a0a519b67bc/prow/github/fakegithub/fakegithub.go#L223-L226
test
kubernetes/test-infra
prow/github/fakegithub/fakegithub.go
GetSingleCommit
func (f *FakeClient) GetSingleCommit(org, repo, SHA string) (github.SingleCommit, error) { return f.Commits[SHA], nil }
go
func (f *FakeClient) GetSingleCommit(org, repo, SHA string) (github.SingleCommit, error) { return f.Commits[SHA], nil }
[ "func", "(", "f", "*", "FakeClient", ")", "GetSingleCommit", "(", "org", ",", "repo", ",", "SHA", "string", ")", "(", "github", ".", "SingleCommit", ",", "error", ")", "{", "return", "f", ".", "Commits", "[", "SHA", "]", ",", "nil", "\n", "}" ]
// GetSingleCommit returns a single commit.
[ "GetSingleCommit", "returns", "a", "single", "commit", "." ]
8125fbda10178887be5dff9e901d6a0a519b67bc
https://github.com/kubernetes/test-infra/blob/8125fbda10178887be5dff9e901d6a0a519b67bc/prow/github/fakegithub/fakegithub.go#L229-L231
test
kubernetes/test-infra
prow/github/fakegithub/fakegithub.go
CreateStatus
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
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...
[ "func", "(", "f", "*", "FakeClient", ")", "CreateStatus", "(", "owner", ",", "repo", ",", "SHA", "string", ",", "s", "github", ".", "Status", ")", "error", "{", "if", "f", ".", "CreatedStatuses", "==", "nil", "{", "f", ".", "CreatedStatuses", "=", "m...
// CreateStatus adds a status context to a commit.
[ "CreateStatus", "adds", "a", "status", "context", "to", "a", "commit", "." ]
8125fbda10178887be5dff9e901d6a0a519b67bc
https://github.com/kubernetes/test-infra/blob/8125fbda10178887be5dff9e901d6a0a519b67bc/prow/github/fakegithub/fakegithub.go#L234-L251
test
kubernetes/test-infra
prow/github/fakegithub/fakegithub.go
ListStatuses
func (f *FakeClient) ListStatuses(org, repo, ref string) ([]github.Status, error) { return f.CreatedStatuses[ref], nil }
go
func (f *FakeClient) ListStatuses(org, repo, ref string) ([]github.Status, error) { return f.CreatedStatuses[ref], nil }
[ "func", "(", "f", "*", "FakeClient", ")", "ListStatuses", "(", "org", ",", "repo", ",", "ref", "string", ")", "(", "[", "]", "github", ".", "Status", ",", "error", ")", "{", "return", "f", ".", "CreatedStatuses", "[", "ref", "]", ",", "nil", "\n", ...
// ListStatuses returns individual status contexts on a commit.
[ "ListStatuses", "returns", "individual", "status", "contexts", "on", "a", "commit", "." ]
8125fbda10178887be5dff9e901d6a0a519b67bc
https://github.com/kubernetes/test-infra/blob/8125fbda10178887be5dff9e901d6a0a519b67bc/prow/github/fakegithub/fakegithub.go#L254-L256
test
kubernetes/test-infra
prow/github/fakegithub/fakegithub.go
GetCombinedStatus
func (f *FakeClient) GetCombinedStatus(owner, repo, ref string) (*github.CombinedStatus, error) { return f.CombinedStatuses[ref], nil }
go
func (f *FakeClient) GetCombinedStatus(owner, repo, ref string) (*github.CombinedStatus, error) { return f.CombinedStatuses[ref], nil }
[ "func", "(", "f", "*", "FakeClient", ")", "GetCombinedStatus", "(", "owner", ",", "repo", ",", "ref", "string", ")", "(", "*", "github", ".", "CombinedStatus", ",", "error", ")", "{", "return", "f", ".", "CombinedStatuses", "[", "ref", "]", ",", "nil",...
// GetCombinedStatus returns the overall status for a commit.
[ "GetCombinedStatus", "returns", "the", "overall", "status", "for", "a", "commit", "." ]
8125fbda10178887be5dff9e901d6a0a519b67bc
https://github.com/kubernetes/test-infra/blob/8125fbda10178887be5dff9e901d6a0a519b67bc/prow/github/fakegithub/fakegithub.go#L259-L261
test
kubernetes/test-infra
prow/github/fakegithub/fakegithub.go
GetRepoLabels
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
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 }
[ "func", "(", "f", "*", "FakeClient", ")", "GetRepoLabels", "(", "owner", ",", "repo", "string", ")", "(", "[", "]", "github", ".", "Label", ",", "error", ")", "{", "la", ":=", "[", "]", "github", ".", "Label", "{", "}", "\n", "for", "_", ",", "...
// GetRepoLabels gets labels in a repo.
[ "GetRepoLabels", "gets", "labels", "in", "a", "repo", "." ]
8125fbda10178887be5dff9e901d6a0a519b67bc
https://github.com/kubernetes/test-infra/blob/8125fbda10178887be5dff9e901d6a0a519b67bc/prow/github/fakegithub/fakegithub.go#L264-L270
test
kubernetes/test-infra
prow/github/fakegithub/fakegithub.go
GetIssueLabels
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
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...
[ "func", "(", "f", "*", "FakeClient", ")", "GetIssueLabels", "(", "owner", ",", "repo", "string", ",", "number", "int", ")", "(", "[", "]", "github", ".", "Label", ",", "error", ")", "{", "re", ":=", "regexp", ".", "MustCompile", "(", "fmt", ".", "S...
// GetIssueLabels gets labels on an issue
[ "GetIssueLabels", "gets", "labels", "on", "an", "issue" ]
8125fbda10178887be5dff9e901d6a0a519b67bc
https://github.com/kubernetes/test-infra/blob/8125fbda10178887be5dff9e901d6a0a519b67bc/prow/github/fakegithub/fakegithub.go#L273-L286
test
kubernetes/test-infra
prow/github/fakegithub/fakegithub.go
AddLabel
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
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...
[ "func", "(", "f", "*", "FakeClient", ")", "AddLabel", "(", "owner", ",", "repo", "string", ",", "number", "int", ",", "label", "string", ")", "error", "{", "labelString", ":=", "fmt", ".", "Sprintf", "(", "\"%s/%s#%d:%s\"", ",", "owner", ",", "repo", "...
// AddLabel adds a label
[ "AddLabel", "adds", "a", "label" ]
8125fbda10178887be5dff9e901d6a0a519b67bc
https://github.com/kubernetes/test-infra/blob/8125fbda10178887be5dff9e901d6a0a519b67bc/prow/github/fakegithub/fakegithub.go#L289-L305
test
kubernetes/test-infra
prow/github/fakegithub/fakegithub.go
RemoveLabel
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
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...
[ "func", "(", "f", "*", "FakeClient", ")", "RemoveLabel", "(", "owner", ",", "repo", "string", ",", "number", "int", ",", "label", "string", ")", "error", "{", "labelString", ":=", "fmt", ".", "Sprintf", "(", "\"%s/%s#%d:%s\"", ",", "owner", ",", "repo", ...
// RemoveLabel removes a label
[ "RemoveLabel", "removes", "a", "label" ]
8125fbda10178887be5dff9e901d6a0a519b67bc
https://github.com/kubernetes/test-infra/blob/8125fbda10178887be5dff9e901d6a0a519b67bc/prow/github/fakegithub/fakegithub.go#L308-L315
test
kubernetes/test-infra
prow/github/fakegithub/fakegithub.go
FindIssues
func (f *FakeClient) FindIssues(query, sort string, asc bool) ([]github.Issue, error) { return f.Issues, nil }
go
func (f *FakeClient) FindIssues(query, sort string, asc bool) ([]github.Issue, error) { return f.Issues, nil }
[ "func", "(", "f", "*", "FakeClient", ")", "FindIssues", "(", "query", ",", "sort", "string", ",", "asc", "bool", ")", "(", "[", "]", "github", ".", "Issue", ",", "error", ")", "{", "return", "f", ".", "Issues", ",", "nil", "\n", "}" ]
// FindIssues returns f.Issues
[ "FindIssues", "returns", "f", ".", "Issues" ]
8125fbda10178887be5dff9e901d6a0a519b67bc
https://github.com/kubernetes/test-infra/blob/8125fbda10178887be5dff9e901d6a0a519b67bc/prow/github/fakegithub/fakegithub.go#L318-L320
test
kubernetes/test-infra
prow/github/fakegithub/fakegithub.go
AssignIssue
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
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...
[ "func", "(", "f", "*", "FakeClient", ")", "AssignIssue", "(", "owner", ",", "repo", "string", ",", "number", "int", ",", "assignees", "[", "]", "string", ")", "error", "{", "var", "m", "github", ".", "MissingUsers", "\n", "for", "_", ",", "a", ":=", ...
// AssignIssue adds assignees.
[ "AssignIssue", "adds", "assignees", "." ]
8125fbda10178887be5dff9e901d6a0a519b67bc
https://github.com/kubernetes/test-infra/blob/8125fbda10178887be5dff9e901d6a0a519b67bc/prow/github/fakegithub/fakegithub.go#L323-L336
test
kubernetes/test-infra
prow/github/fakegithub/fakegithub.go
GetFile
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
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 ...
[ "func", "(", "f", "*", "FakeClient", ")", "GetFile", "(", "org", ",", "repo", ",", "file", ",", "commit", "string", ")", "(", "[", "]", "byte", ",", "error", ")", "{", "contents", ",", "ok", ":=", "f", ".", "RemoteFiles", "[", "file", "]", "\n", ...
// GetFile returns the bytes of the file.
[ "GetFile", "returns", "the", "bytes", "of", "the", "file", "." ]
8125fbda10178887be5dff9e901d6a0a519b67bc
https://github.com/kubernetes/test-infra/blob/8125fbda10178887be5dff9e901d6a0a519b67bc/prow/github/fakegithub/fakegithub.go#L339-L357
test
kubernetes/test-infra
prow/github/fakegithub/fakegithub.go
ListTeams
func (f *FakeClient) ListTeams(org string) ([]github.Team, error) { return []github.Team{ { ID: 0, Name: "Admins", }, { ID: 42, Name: "Leads", }, }, nil }
go
func (f *FakeClient) ListTeams(org string) ([]github.Team, error) { return []github.Team{ { ID: 0, Name: "Admins", }, { ID: 42, Name: "Leads", }, }, nil }
[ "func", "(", "f", "*", "FakeClient", ")", "ListTeams", "(", "org", "string", ")", "(", "[", "]", "github", ".", "Team", ",", "error", ")", "{", "return", "[", "]", "github", ".", "Team", "{", "{", "ID", ":", "0", ",", "Name", ":", "\"Admins\"", ...
// ListTeams return a list of fake teams that correspond to the fake team members returned by ListTeamMembers
[ "ListTeams", "return", "a", "list", "of", "fake", "teams", "that", "correspond", "to", "the", "fake", "team", "members", "returned", "by", "ListTeamMembers" ]
8125fbda10178887be5dff9e901d6a0a519b67bc
https://github.com/kubernetes/test-infra/blob/8125fbda10178887be5dff9e901d6a0a519b67bc/prow/github/fakegithub/fakegithub.go#L360-L371
test
kubernetes/test-infra
prow/github/fakegithub/fakegithub.go
ListTeamMembers
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
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...
[ "func", "(", "f", "*", "FakeClient", ")", "ListTeamMembers", "(", "teamID", "int", ",", "role", "string", ")", "(", "[", "]", "github", ".", "TeamMember", ",", "error", ")", "{", "if", "role", "!=", "github", ".", "RoleAll", "{", "return", "nil", ","...
// ListTeamMembers return a fake team with a single "sig-lead" GitHub teammember
[ "ListTeamMembers", "return", "a", "fake", "team", "with", "a", "single", "sig", "-", "lead", "GitHub", "teammember" ]
8125fbda10178887be5dff9e901d6a0a519b67bc
https://github.com/kubernetes/test-infra/blob/8125fbda10178887be5dff9e901d6a0a519b67bc/prow/github/fakegithub/fakegithub.go#L374-L387
test
kubernetes/test-infra
prow/github/fakegithub/fakegithub.go
IsCollaborator
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
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 }
[ "func", "(", "f", "*", "FakeClient", ")", "IsCollaborator", "(", "org", ",", "repo", ",", "login", "string", ")", "(", "bool", ",", "error", ")", "{", "normed", ":=", "github", ".", "NormLogin", "(", "login", ")", "\n", "for", "_", ",", "collab", "...
// IsCollaborator returns true if the user is a collaborator of the repo.
[ "IsCollaborator", "returns", "true", "if", "the", "user", "is", "a", "collaborator", "of", "the", "repo", "." ]
8125fbda10178887be5dff9e901d6a0a519b67bc
https://github.com/kubernetes/test-infra/blob/8125fbda10178887be5dff9e901d6a0a519b67bc/prow/github/fakegithub/fakegithub.go#L390-L398
test
kubernetes/test-infra
prow/github/fakegithub/fakegithub.go
ListCollaborators
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
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 }
[ "func", "(", "f", "*", "FakeClient", ")", "ListCollaborators", "(", "org", ",", "repo", "string", ")", "(", "[", "]", "github", ".", "User", ",", "error", ")", "{", "result", ":=", "make", "(", "[", "]", "github", ".", "User", ",", "0", ",", "len...
// ListCollaborators lists the collaborators.
[ "ListCollaborators", "lists", "the", "collaborators", "." ]
8125fbda10178887be5dff9e901d6a0a519b67bc
https://github.com/kubernetes/test-infra/blob/8125fbda10178887be5dff9e901d6a0a519b67bc/prow/github/fakegithub/fakegithub.go#L401-L407
test
kubernetes/test-infra
prow/github/fakegithub/fakegithub.go
ClearMilestone
func (f *FakeClient) ClearMilestone(org, repo string, issueNum int) error { f.Milestone = 0 return nil }
go
func (f *FakeClient) ClearMilestone(org, repo string, issueNum int) error { f.Milestone = 0 return nil }
[ "func", "(", "f", "*", "FakeClient", ")", "ClearMilestone", "(", "org", ",", "repo", "string", ",", "issueNum", "int", ")", "error", "{", "f", ".", "Milestone", "=", "0", "\n", "return", "nil", "\n", "}" ]
// ClearMilestone removes the milestone
[ "ClearMilestone", "removes", "the", "milestone" ]
8125fbda10178887be5dff9e901d6a0a519b67bc
https://github.com/kubernetes/test-infra/blob/8125fbda10178887be5dff9e901d6a0a519b67bc/prow/github/fakegithub/fakegithub.go#L410-L413
test
kubernetes/test-infra
prow/github/fakegithub/fakegithub.go
SetMilestone
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
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 }
[ "func", "(", "f", "*", "FakeClient", ")", "SetMilestone", "(", "org", ",", "repo", "string", ",", "issueNum", ",", "milestoneNum", "int", ")", "error", "{", "if", "milestoneNum", "<", "0", "{", "return", "fmt", ".", "Errorf", "(", "\"Milestone Numbers Cann...
// SetMilestone sets the milestone.
[ "SetMilestone", "sets", "the", "milestone", "." ]
8125fbda10178887be5dff9e901d6a0a519b67bc
https://github.com/kubernetes/test-infra/blob/8125fbda10178887be5dff9e901d6a0a519b67bc/prow/github/fakegithub/fakegithub.go#L416-L422
test
kubernetes/test-infra
prow/github/fakegithub/fakegithub.go
ListMilestones
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
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 }
[ "func", "(", "f", "*", "FakeClient", ")", "ListMilestones", "(", "org", ",", "repo", "string", ")", "(", "[", "]", "github", ".", "Milestone", ",", "error", ")", "{", "milestones", ":=", "[", "]", "github", ".", "Milestone", "{", "}", "\n", "for", ...
// ListMilestones lists milestones.
[ "ListMilestones", "lists", "milestones", "." ]
8125fbda10178887be5dff9e901d6a0a519b67bc
https://github.com/kubernetes/test-infra/blob/8125fbda10178887be5dff9e901d6a0a519b67bc/prow/github/fakegithub/fakegithub.go#L425-L431
test
kubernetes/test-infra
prow/github/fakegithub/fakegithub.go
ListPRCommits
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
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 }
[ "func", "(", "f", "*", "FakeClient", ")", "ListPRCommits", "(", "org", ",", "repo", "string", ",", "prNumber", "int", ")", "(", "[", "]", "github", ".", "RepositoryCommit", ",", "error", ")", "{", "k", ":=", "fmt", ".", "Sprintf", "(", "\"%s/%s#%d\"", ...
// ListPRCommits lists commits for a given PR.
[ "ListPRCommits", "lists", "commits", "for", "a", "given", "PR", "." ]
8125fbda10178887be5dff9e901d6a0a519b67bc
https://github.com/kubernetes/test-infra/blob/8125fbda10178887be5dff9e901d6a0a519b67bc/prow/github/fakegithub/fakegithub.go#L434-L437
test
kubernetes/test-infra
prow/github/fakegithub/fakegithub.go
GetRepoProjects
func (f *FakeClient) GetRepoProjects(owner, repo string) ([]github.Project, error) { return f.RepoProjects[fmt.Sprintf("%s/%s", owner, repo)], nil }
go
func (f *FakeClient) GetRepoProjects(owner, repo string) ([]github.Project, error) { return f.RepoProjects[fmt.Sprintf("%s/%s", owner, repo)], nil }
[ "func", "(", "f", "*", "FakeClient", ")", "GetRepoProjects", "(", "owner", ",", "repo", "string", ")", "(", "[", "]", "github", ".", "Project", ",", "error", ")", "{", "return", "f", ".", "RepoProjects", "[", "fmt", ".", "Sprintf", "(", "\"%s/%s\"", ...
// GetRepoProjects returns the list of projects under a repo.
[ "GetRepoProjects", "returns", "the", "list", "of", "projects", "under", "a", "repo", "." ]
8125fbda10178887be5dff9e901d6a0a519b67bc
https://github.com/kubernetes/test-infra/blob/8125fbda10178887be5dff9e901d6a0a519b67bc/prow/github/fakegithub/fakegithub.go#L440-L442
test
kubernetes/test-infra
prow/github/fakegithub/fakegithub.go
GetOrgProjects
func (f *FakeClient) GetOrgProjects(org string) ([]github.Project, error) { return f.RepoProjects[fmt.Sprintf("%s/*", org)], nil }
go
func (f *FakeClient) GetOrgProjects(org string) ([]github.Project, error) { return f.RepoProjects[fmt.Sprintf("%s/*", org)], nil }
[ "func", "(", "f", "*", "FakeClient", ")", "GetOrgProjects", "(", "org", "string", ")", "(", "[", "]", "github", ".", "Project", ",", "error", ")", "{", "return", "f", ".", "RepoProjects", "[", "fmt", ".", "Sprintf", "(", "\"%s/*\"", ",", "org", ")", ...
// GetOrgProjects returns the list of projects under an org
[ "GetOrgProjects", "returns", "the", "list", "of", "projects", "under", "an", "org" ]
8125fbda10178887be5dff9e901d6a0a519b67bc
https://github.com/kubernetes/test-infra/blob/8125fbda10178887be5dff9e901d6a0a519b67bc/prow/github/fakegithub/fakegithub.go#L445-L447
test
kubernetes/test-infra
prow/github/fakegithub/fakegithub.go
GetProjectColumns
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
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 ...
[ "func", "(", "f", "*", "FakeClient", ")", "GetProjectColumns", "(", "projectID", "int", ")", "(", "[", "]", "github", ".", "ProjectColumn", ",", "error", ")", "{", "for", "_", ",", "projects", ":=", "range", "f", ".", "RepoProjects", "{", "for", "_", ...
// GetProjectColumns returns the list of columns for a given project.
[ "GetProjectColumns", "returns", "the", "list", "of", "columns", "for", "a", "given", "project", "." ]
8125fbda10178887be5dff9e901d6a0a519b67bc
https://github.com/kubernetes/test-infra/blob/8125fbda10178887be5dff9e901d6a0a519b67bc/prow/github/fakegithub/fakegithub.go#L450-L460
test
kubernetes/test-infra
prow/github/fakegithub/fakegithub.go
CreateProjectCard
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
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 { ...
[ "func", "(", "f", "*", "FakeClient", ")", "CreateProjectCard", "(", "columnID", "int", ",", "projectCard", "github", ".", "ProjectCard", ")", "(", "*", "github", ".", "ProjectCard", ",", "error", ")", "{", "if", "f", ".", "ColumnCardsMap", "==", "nil", "...
// CreateProjectCard creates a project card under a given column.
[ "CreateProjectCard", "creates", "a", "project", "card", "under", "a", "given", "column", "." ]
8125fbda10178887be5dff9e901d6a0a519b67bc
https://github.com/kubernetes/test-infra/blob/8125fbda10178887be5dff9e901d6a0a519b67bc/prow/github/fakegithub/fakegithub.go#L463-L481
test
kubernetes/test-infra
prow/github/fakegithub/fakegithub.go
DeleteProjectCard
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
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...
[ "func", "(", "f", "*", "FakeClient", ")", "DeleteProjectCard", "(", "projectCardID", "int", ")", "error", "{", "if", "f", ".", "ColumnCardsMap", "==", "nil", "{", "return", "fmt", ".", "Errorf", "(", "\"Project card doesn't exist\"", ")", "\n", "}", "\n", ...
// DeleteProjectCard deletes the project card of a specific issue or PR
[ "DeleteProjectCard", "deletes", "the", "project", "card", "of", "a", "specific", "issue", "or", "PR" ]
8125fbda10178887be5dff9e901d6a0a519b67bc
https://github.com/kubernetes/test-infra/blob/8125fbda10178887be5dff9e901d6a0a519b67bc/prow/github/fakegithub/fakegithub.go#L484-L513
test
kubernetes/test-infra
prow/github/fakegithub/fakegithub.go
MoveProjectCard
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
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 { ...
[ "func", "(", "f", "*", "FakeClient", ")", "MoveProjectCard", "(", "projectCardID", "int", ",", "newColumnID", "int", ")", "error", "{", "newCards", ":=", "[", "]", "github", ".", "ProjectCard", "{", "}", "\n", "oldColumnID", ":=", "-", "1", "\n", "projec...
// MoveProjectCard moves a specific project card to a specified column in the same project
[ "MoveProjectCard", "moves", "a", "specific", "project", "card", "to", "a", "specified", "column", "in", "the", "same", "project" ]
8125fbda10178887be5dff9e901d6a0a519b67bc
https://github.com/kubernetes/test-infra/blob/8125fbda10178887be5dff9e901d6a0a519b67bc/prow/github/fakegithub/fakegithub.go#L545-L585
test
kubernetes/test-infra
velodrome/token-counter/influx.go
CreateDatabaseClient
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
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, }, ...
[ "func", "(", "config", "*", "InfluxConfig", ")", "CreateDatabaseClient", "(", ")", "(", "*", "InfluxDB", ",", "error", ")", "{", "client", ",", "err", ":=", "influxdb", ".", "NewHTTPClient", "(", "influxdb", ".", "HTTPConfig", "{", "Addr", ":", "config", ...
// CreateDatabaseClient creates and connects a new instance of an InfluxDB // It is created based on the fields set in the configuration.
[ "CreateDatabaseClient", "creates", "and", "connects", "a", "new", "instance", "of", "an", "InfluxDB", "It", "is", "created", "based", "on", "the", "fields", "set", "in", "the", "configuration", "." ]
8125fbda10178887be5dff9e901d6a0a519b67bc
https://github.com/kubernetes/test-infra/blob/8125fbda10178887be5dff9e901d6a0a519b67bc/velodrome/token-counter/influx.go#L45-L59
test
kubernetes/test-infra
velodrome/token-counter/influx.go
Push
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
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, ...
[ "func", "(", "i", "*", "InfluxDB", ")", "Push", "(", "measurement", "string", ",", "tags", "map", "[", "string", "]", "string", ",", "fields", "map", "[", "string", "]", "interface", "{", "}", ",", "date", "time", ".", "Time", ")", "error", "{", "b...
// Push a point to the database
[ "Push", "a", "point", "to", "the", "database" ]
8125fbda10178887be5dff9e901d6a0a519b67bc
https://github.com/kubernetes/test-infra/blob/8125fbda10178887be5dff9e901d6a0a519b67bc/velodrome/token-counter/influx.go#L68-L91
test
kubernetes/test-infra
prow/pjutil/pjutil.go
NewProwJobWithAnnotation
func NewProwJobWithAnnotation(spec prowapi.ProwJobSpec, labels, annotations map[string]string) prowapi.ProwJob { return newProwJob(spec, labels, annotations) }
go
func NewProwJobWithAnnotation(spec prowapi.ProwJobSpec, labels, annotations map[string]string) prowapi.ProwJob { return newProwJob(spec, labels, annotations) }
[ "func", "NewProwJobWithAnnotation", "(", "spec", "prowapi", ".", "ProwJobSpec", ",", "labels", ",", "annotations", "map", "[", "string", "]", "string", ")", "prowapi", ".", "ProwJob", "{", "return", "newProwJob", "(", "spec", ",", "labels", ",", "annotations",...
// NewProwJobWithAnnotation initializes a ProwJob out of a ProwJobSpec with annotations.
[ "NewProwJobWithAnnotation", "initializes", "a", "ProwJob", "out", "of", "a", "ProwJobSpec", "with", "annotations", "." ]
8125fbda10178887be5dff9e901d6a0a519b67bc
https://github.com/kubernetes/test-infra/blob/8125fbda10178887be5dff9e901d6a0a519b67bc/prow/pjutil/pjutil.go#L40-L42
test
kubernetes/test-infra
prow/pjutil/pjutil.go
NewProwJob
func NewProwJob(spec prowapi.ProwJobSpec, labels map[string]string) prowapi.ProwJob { return newProwJob(spec, labels, nil) }
go
func NewProwJob(spec prowapi.ProwJobSpec, labels map[string]string) prowapi.ProwJob { return newProwJob(spec, labels, nil) }
[ "func", "NewProwJob", "(", "spec", "prowapi", ".", "ProwJobSpec", ",", "labels", "map", "[", "string", "]", "string", ")", "prowapi", ".", "ProwJob", "{", "return", "newProwJob", "(", "spec", ",", "labels", ",", "nil", ")", "\n", "}" ]
// NewProwJob initializes a ProwJob out of a ProwJobSpec.
[ "NewProwJob", "initializes", "a", "ProwJob", "out", "of", "a", "ProwJobSpec", "." ]
8125fbda10178887be5dff9e901d6a0a519b67bc
https://github.com/kubernetes/test-infra/blob/8125fbda10178887be5dff9e901d6a0a519b67bc/prow/pjutil/pjutil.go#L45-L47
test
kubernetes/test-infra
prow/pjutil/pjutil.go
NewPresubmit
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
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...
[ "func", "NewPresubmit", "(", "pr", "github", ".", "PullRequest", ",", "baseSHA", "string", ",", "job", "config", ".", "Presubmit", ",", "eventGUID", "string", ")", "prowapi", ".", "ProwJob", "{", "refs", ":=", "createRefs", "(", "pr", ",", "baseSHA", ")", ...
// NewPresubmit converts a config.Presubmit into a prowapi.ProwJob. // The prowapi.Refs are configured correctly per the pr, baseSHA. // The eventGUID becomes a github.EventGUID label.
[ "NewPresubmit", "converts", "a", "config", ".", "Presubmit", "into", "a", "prowapi", ".", "ProwJob", ".", "The", "prowapi", ".", "Refs", "are", "configured", "correctly", "per", "the", "pr", "baseSHA", ".", "The", "eventGUID", "becomes", "a", "github", ".", ...
8125fbda10178887be5dff9e901d6a0a519b67bc
https://github.com/kubernetes/test-infra/blob/8125fbda10178887be5dff9e901d6a0a519b67bc/prow/pjutil/pjutil.go#L98-L106
test
kubernetes/test-infra
prow/pjutil/pjutil.go
PresubmitSpec
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
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...
[ "func", "PresubmitSpec", "(", "p", "config", ".", "Presubmit", ",", "refs", "prowapi", ".", "Refs", ")", "prowapi", ".", "ProwJobSpec", "{", "pjs", ":=", "specFromJobBase", "(", "p", ".", "JobBase", ")", "\n", "pjs", ".", "Type", "=", "prowapi", ".", "...
// PresubmitSpec initializes a ProwJobSpec for a given presubmit job.
[ "PresubmitSpec", "initializes", "a", "ProwJobSpec", "for", "a", "given", "presubmit", "job", "." ]
8125fbda10178887be5dff9e901d6a0a519b67bc
https://github.com/kubernetes/test-infra/blob/8125fbda10178887be5dff9e901d6a0a519b67bc/prow/pjutil/pjutil.go#L109-L123
test
kubernetes/test-infra
prow/pjutil/pjutil.go
PostsubmitSpec
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
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...
[ "func", "PostsubmitSpec", "(", "p", "config", ".", "Postsubmit", ",", "refs", "prowapi", ".", "Refs", ")", "prowapi", ".", "ProwJobSpec", "{", "pjs", ":=", "specFromJobBase", "(", "p", ".", "JobBase", ")", "\n", "pjs", ".", "Type", "=", "prowapi", ".", ...
// PostsubmitSpec initializes a ProwJobSpec for a given postsubmit job.
[ "PostsubmitSpec", "initializes", "a", "ProwJobSpec", "for", "a", "given", "postsubmit", "job", "." ]
8125fbda10178887be5dff9e901d6a0a519b67bc
https://github.com/kubernetes/test-infra/blob/8125fbda10178887be5dff9e901d6a0a519b67bc/prow/pjutil/pjutil.go#L126-L139
test
kubernetes/test-infra
prow/pjutil/pjutil.go
PeriodicSpec
func PeriodicSpec(p config.Periodic) prowapi.ProwJobSpec { pjs := specFromJobBase(p.JobBase) pjs.Type = prowapi.PeriodicJob return pjs }
go
func PeriodicSpec(p config.Periodic) prowapi.ProwJobSpec { pjs := specFromJobBase(p.JobBase) pjs.Type = prowapi.PeriodicJob return pjs }
[ "func", "PeriodicSpec", "(", "p", "config", ".", "Periodic", ")", "prowapi", ".", "ProwJobSpec", "{", "pjs", ":=", "specFromJobBase", "(", "p", ".", "JobBase", ")", "\n", "pjs", ".", "Type", "=", "prowapi", ".", "PeriodicJob", "\n", "return", "pjs", "\n"...
// PeriodicSpec initializes a ProwJobSpec for a given periodic job.
[ "PeriodicSpec", "initializes", "a", "ProwJobSpec", "for", "a", "given", "periodic", "job", "." ]
8125fbda10178887be5dff9e901d6a0a519b67bc
https://github.com/kubernetes/test-infra/blob/8125fbda10178887be5dff9e901d6a0a519b67bc/prow/pjutil/pjutil.go#L142-L147
test
kubernetes/test-infra
prow/pjutil/pjutil.go
BatchSpec
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
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 }
[ "func", "BatchSpec", "(", "p", "config", ".", "Presubmit", ",", "refs", "prowapi", ".", "Refs", ")", "prowapi", ".", "ProwJobSpec", "{", "pjs", ":=", "specFromJobBase", "(", "p", ".", "JobBase", ")", "\n", "pjs", ".", "Type", "=", "prowapi", ".", "Batc...
// BatchSpec initializes a ProwJobSpec for a given batch job and ref spec.
[ "BatchSpec", "initializes", "a", "ProwJobSpec", "for", "a", "given", "batch", "job", "and", "ref", "spec", "." ]
8125fbda10178887be5dff9e901d6a0a519b67bc
https://github.com/kubernetes/test-infra/blob/8125fbda10178887be5dff9e901d6a0a519b67bc/prow/pjutil/pjutil.go#L150-L157
test
kubernetes/test-infra
prow/pjutil/pjutil.go
PartitionActive
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
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...
[ "func", "PartitionActive", "(", "pjs", "[", "]", "prowapi", ".", "ProwJob", ")", "(", "pending", ",", "triggered", "chan", "prowapi", ".", "ProwJob", ")", "{", "pendingCount", ",", "triggeredCount", ":=", "0", ",", "0", "\n", "for", "_", ",", "pj", ":=...
// PartitionActive separates the provided prowjobs into pending and triggered // and returns them inside channels so that they can be consumed in parallel // by different goroutines. Complete prowjobs are filtered out. Controller // loops need to handle pending jobs first so they can conform to maximum // concurrency r...
[ "PartitionActive", "separates", "the", "provided", "prowjobs", "into", "pending", "and", "triggered", "and", "returns", "them", "inside", "channels", "so", "that", "they", "can", "be", "consumed", "in", "parallel", "by", "different", "goroutines", ".", "Complete",...
8125fbda10178887be5dff9e901d6a0a519b67bc
https://github.com/kubernetes/test-infra/blob/8125fbda10178887be5dff9e901d6a0a519b67bc/prow/pjutil/pjutil.go#L196-L222
test
kubernetes/test-infra
prow/pjutil/pjutil.go
ProwJobFields
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
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...
[ "func", "ProwJobFields", "(", "pj", "*", "prowapi", ".", "ProwJob", ")", "logrus", ".", "Fields", "{", "fields", ":=", "make", "(", "logrus", ".", "Fields", ")", "\n", "fields", "[", "\"name\"", "]", "=", "pj", ".", "ObjectMeta", ".", "Name", "\n", "...
// ProwJobFields extracts logrus fields from a prowjob useful for logging.
[ "ProwJobFields", "extracts", "logrus", "fields", "from", "a", "prowjob", "useful", "for", "logging", "." ]
8125fbda10178887be5dff9e901d6a0a519b67bc
https://github.com/kubernetes/test-infra/blob/8125fbda10178887be5dff9e901d6a0a519b67bc/prow/pjutil/pjutil.go#L241-L259
test
kubernetes/test-infra
prow/pjutil/pjutil.go
ClusterToCtx
func ClusterToCtx(cluster string) string { if cluster == kube.InClusterContext { return kube.DefaultClusterAlias } return cluster }
go
func ClusterToCtx(cluster string) string { if cluster == kube.InClusterContext { return kube.DefaultClusterAlias } return cluster }
[ "func", "ClusterToCtx", "(", "cluster", "string", ")", "string", "{", "if", "cluster", "==", "kube", ".", "InClusterContext", "{", "return", "kube", ".", "DefaultClusterAlias", "\n", "}", "\n", "return", "cluster", "\n", "}" ]
// ClusterToCtx converts the prow job's cluster to a cluster context
[ "ClusterToCtx", "converts", "the", "prow", "job", "s", "cluster", "to", "a", "cluster", "context" ]
8125fbda10178887be5dff9e901d6a0a519b67bc
https://github.com/kubernetes/test-infra/blob/8125fbda10178887be5dff9e901d6a0a519b67bc/prow/pjutil/pjutil.go#L284-L289
test
kubernetes/test-infra
prow/pluginhelp/pluginhelp.go
AddCommand
func (pluginHelp *PluginHelp) AddCommand(command Command) { pluginHelp.Commands = append(pluginHelp.Commands, command) }
go
func (pluginHelp *PluginHelp) AddCommand(command Command) { pluginHelp.Commands = append(pluginHelp.Commands, command) }
[ "func", "(", "pluginHelp", "*", "PluginHelp", ")", "AddCommand", "(", "command", "Command", ")", "{", "pluginHelp", ".", "Commands", "=", "append", "(", "pluginHelp", ".", "Commands", ",", "command", ")", "\n", "}" ]
// AddCommand registers new help text for a bot command.
[ "AddCommand", "registers", "new", "help", "text", "for", "a", "bot", "command", "." ]
8125fbda10178887be5dff9e901d6a0a519b67bc
https://github.com/kubernetes/test-infra/blob/8125fbda10178887be5dff9e901d6a0a519b67bc/prow/pluginhelp/pluginhelp.go#L71-L73
test
kubernetes/test-infra
prow/client/clientset/versioned/typed/prowjobs/v1/fake/fake_prowjob.go
Get
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
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 }
[ "func", "(", "c", "*", "FakeProwJobs", ")", "Get", "(", "name", "string", ",", "options", "v1", ".", "GetOptions", ")", "(", "result", "*", "prowjobsv1", ".", "ProwJob", ",", "err", "error", ")", "{", "obj", ",", "err", ":=", "c", ".", "Fake", ".",...
// Get takes name of the prowJob, and returns the corresponding prowJob object, and an error if there is any.
[ "Get", "takes", "name", "of", "the", "prowJob", "and", "returns", "the", "corresponding", "prowJob", "object", "and", "an", "error", "if", "there", "is", "any", "." ]
8125fbda10178887be5dff9e901d6a0a519b67bc
https://github.com/kubernetes/test-infra/blob/8125fbda10178887be5dff9e901d6a0a519b67bc/prow/client/clientset/versioned/typed/prowjobs/v1/fake/fake_prowjob.go#L42-L50
test
kubernetes/test-infra
prow/client/clientset/versioned/typed/prowjobs/v1/fake/fake_prowjob.go
Watch
func (c *FakeProwJobs) Watch(opts v1.ListOptions) (watch.Interface, error) { return c.Fake. InvokesWatch(testing.NewWatchAction(prowjobsResource, c.ns, opts)) }
go
func (c *FakeProwJobs) Watch(opts v1.ListOptions) (watch.Interface, error) { return c.Fake. InvokesWatch(testing.NewWatchAction(prowjobsResource, c.ns, opts)) }
[ "func", "(", "c", "*", "FakeProwJobs", ")", "Watch", "(", "opts", "v1", ".", "ListOptions", ")", "(", "watch", ".", "Interface", ",", "error", ")", "{", "return", "c", ".", "Fake", ".", "InvokesWatch", "(", "testing", ".", "NewWatchAction", "(", "prowj...
// Watch returns a watch.Interface that watches the requested prowJobs.
[ "Watch", "returns", "a", "watch", ".", "Interface", "that", "watches", "the", "requested", "prowJobs", "." ]
8125fbda10178887be5dff9e901d6a0a519b67bc
https://github.com/kubernetes/test-infra/blob/8125fbda10178887be5dff9e901d6a0a519b67bc/prow/client/clientset/versioned/typed/prowjobs/v1/fake/fake_prowjob.go#L75-L79
test
kubernetes/test-infra
prow/client/clientset/versioned/typed/prowjobs/v1/fake/fake_prowjob.go
Delete
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
func (c *FakeProwJobs) Delete(name string, options *v1.DeleteOptions) error { _, err := c.Fake. Invokes(testing.NewDeleteAction(prowjobsResource, c.ns, name), &prowjobsv1.ProwJob{}) return err }
[ "func", "(", "c", "*", "FakeProwJobs", ")", "Delete", "(", "name", "string", ",", "options", "*", "v1", ".", "DeleteOptions", ")", "error", "{", "_", ",", "err", ":=", "c", ".", "Fake", ".", "Invokes", "(", "testing", ".", "NewDeleteAction", "(", "pr...
// Delete takes name of the prowJob and deletes it. Returns an error if one occurs.
[ "Delete", "takes", "name", "of", "the", "prowJob", "and", "deletes", "it", ".", "Returns", "an", "error", "if", "one", "occurs", "." ]
8125fbda10178887be5dff9e901d6a0a519b67bc
https://github.com/kubernetes/test-infra/blob/8125fbda10178887be5dff9e901d6a0a519b67bc/prow/client/clientset/versioned/typed/prowjobs/v1/fake/fake_prowjob.go#L116-L121
test
kubernetes/test-infra
prow/client/clientset/versioned/typed/prowjobs/v1/fake/fake_prowjob.go
Patch
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
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 ...
[ "func", "(", "c", "*", "FakeProwJobs", ")", "Patch", "(", "name", "string", ",", "pt", "types", ".", "PatchType", ",", "data", "[", "]", "byte", ",", "subresources", "...", "string", ")", "(", "result", "*", "prowjobsv1", ".", "ProwJob", ",", "err", ...
// Patch applies the patch and returns the patched prowJob.
[ "Patch", "applies", "the", "patch", "and", "returns", "the", "patched", "prowJob", "." ]
8125fbda10178887be5dff9e901d6a0a519b67bc
https://github.com/kubernetes/test-infra/blob/8125fbda10178887be5dff9e901d6a0a519b67bc/prow/client/clientset/versioned/typed/prowjobs/v1/fake/fake_prowjob.go#L132-L140
test
kubernetes/test-infra
prow/config/tide.go
MergeMethod
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
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 }
[ "func", "(", "t", "*", "Tide", ")", "MergeMethod", "(", "org", ",", "repo", "string", ")", "github", ".", "PullRequestMergeType", "{", "name", ":=", "org", "+", "\"/\"", "+", "repo", "\n", "v", ",", "ok", ":=", "t", ".", "MergeType", "[", "name", "...
// MergeMethod returns the merge method to use for a repo. The default of merge is // returned when not overridden.
[ "MergeMethod", "returns", "the", "merge", "method", "to", "use", "for", "a", "repo", ".", "The", "default", "of", "merge", "is", "returned", "when", "not", "overridden", "." ]
8125fbda10178887be5dff9e901d6a0a519b67bc
https://github.com/kubernetes/test-infra/blob/8125fbda10178887be5dff9e901d6a0a519b67bc/prow/config/tide.go#L143-L156
test
kubernetes/test-infra
prow/config/tide.go
Query
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
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...
[ "func", "(", "tq", "*", "TideQuery", ")", "Query", "(", ")", "string", "{", "toks", ":=", "[", "]", "string", "{", "\"is:pr\"", ",", "\"state:open\"", "}", "\n", "for", "_", ",", "o", ":=", "range", "tq", ".", "Orgs", "{", "toks", "=", "append", ...
// Query returns the corresponding github search string for the tide query.
[ "Query", "returns", "the", "corresponding", "github", "search", "string", "for", "the", "tide", "query", "." ]
8125fbda10178887be5dff9e901d6a0a519b67bc
https://github.com/kubernetes/test-infra/blob/8125fbda10178887be5dff9e901d6a0a519b67bc/prow/config/tide.go#L189-L219
test
kubernetes/test-infra
prow/config/tide.go
ForRepo
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
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 ...
[ "func", "(", "tq", "TideQuery", ")", "ForRepo", "(", "org", ",", "repo", "string", ")", "bool", "{", "fullName", ":=", "fmt", ".", "Sprintf", "(", "\"%s/%s\"", ",", "org", ",", "repo", ")", "\n", "for", "_", ",", "queryOrg", ":=", "range", "tq", "....
// ForRepo indicates if the tide query applies to the specified repo.
[ "ForRepo", "indicates", "if", "the", "tide", "query", "applies", "to", "the", "specified", "repo", "." ]
8125fbda10178887be5dff9e901d6a0a519b67bc
https://github.com/kubernetes/test-infra/blob/8125fbda10178887be5dff9e901d6a0a519b67bc/prow/config/tide.go#L222-L242
test
kubernetes/test-infra
prow/config/tide.go
OrgExceptionsAndRepos
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
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...
[ "func", "(", "tqs", "TideQueries", ")", "OrgExceptionsAndRepos", "(", ")", "(", "map", "[", "string", "]", "sets", ".", "String", ",", "sets", ".", "String", ")", "{", "orgs", ":=", "make", "(", "map", "[", "string", "]", "sets", ".", "String", ")", ...
// OrgExceptionsAndRepos determines which orgs and repos a set of queries cover. // Output is returned as a mapping from 'included org'->'repos excluded in the org' // and a set of included repos.
[ "OrgExceptionsAndRepos", "determines", "which", "orgs", "and", "repos", "a", "set", "of", "queries", "cover", ".", "Output", "is", "returned", "as", "a", "mapping", "from", "included", "org", "-", ">", "repos", "excluded", "in", "the", "org", "and", "a", "...
8125fbda10178887be5dff9e901d6a0a519b67bc
https://github.com/kubernetes/test-infra/blob/8125fbda10178887be5dff9e901d6a0a519b67bc/prow/config/tide.go#L258-L284
test
kubernetes/test-infra
prow/config/tide.go
QueryMap
func (tqs TideQueries) QueryMap() *QueryMap { return &QueryMap{ queries: tqs, cache: make(map[string]TideQueries), } }
go
func (tqs TideQueries) QueryMap() *QueryMap { return &QueryMap{ queries: tqs, cache: make(map[string]TideQueries), } }
[ "func", "(", "tqs", "TideQueries", ")", "QueryMap", "(", ")", "*", "QueryMap", "{", "return", "&", "QueryMap", "{", "queries", ":", "tqs", ",", "cache", ":", "make", "(", "map", "[", "string", "]", "TideQueries", ")", ",", "}", "\n", "}" ]
// QueryMap creates a QueryMap from TideQueries
[ "QueryMap", "creates", "a", "QueryMap", "from", "TideQueries" ]
8125fbda10178887be5dff9e901d6a0a519b67bc
https://github.com/kubernetes/test-infra/blob/8125fbda10178887be5dff9e901d6a0a519b67bc/prow/config/tide.go#L296-L301
test
kubernetes/test-infra
prow/config/tide.go
ForRepo
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
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 := ...
[ "func", "(", "qm", "*", "QueryMap", ")", "ForRepo", "(", "org", ",", "repo", "string", ")", "TideQueries", "{", "res", ":=", "TideQueries", "(", "nil", ")", "\n", "fullName", ":=", "fmt", ".", "Sprintf", "(", "\"%s/%s\"", ",", "org", ",", "repo", ")"...
// ForRepo returns the tide queries that apply to a repo.
[ "ForRepo", "returns", "the", "tide", "queries", "that", "apply", "to", "a", "repo", "." ]
8125fbda10178887be5dff9e901d6a0a519b67bc
https://github.com/kubernetes/test-infra/blob/8125fbda10178887be5dff9e901d6a0a519b67bc/prow/config/tide.go#L304-L323
test
kubernetes/test-infra
prow/config/tide.go
Validate
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
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...
[ "func", "(", "cp", "*", "TideContextPolicy", ")", "Validate", "(", ")", "error", "{", "if", "inter", ":=", "sets", ".", "NewString", "(", "cp", ".", "RequiredContexts", "...", ")", ".", "Intersection", "(", "sets", ".", "NewString", "(", "cp", ".", "Op...
// Validate returns an error if any contexts are listed more than once in the config.
[ "Validate", "returns", "an", "error", "if", "any", "contexts", "are", "listed", "more", "than", "once", "in", "the", "config", "." ]
8125fbda10178887be5dff9e901d6a0a519b67bc
https://github.com/kubernetes/test-infra/blob/8125fbda10178887be5dff9e901d6a0a519b67bc/prow/config/tide.go#L419-L430
test
kubernetes/test-infra
prow/config/tide.go
GetTideContextPolicy
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
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...
[ "func", "(", "c", "Config", ")", "GetTideContextPolicy", "(", "org", ",", "repo", ",", "branch", "string", ")", "(", "*", "TideContextPolicy", ",", "error", ")", "{", "options", ":=", "parseTideContextPolicyOptions", "(", "org", ",", "repo", ",", "branch", ...
// GetTideContextPolicy parses the prow config to find context merge options. // If none are set, it will use the prow jobs configured and use the default github combined status. // Otherwise if set it will use the branch protection setting, or the listed jobs.
[ "GetTideContextPolicy", "parses", "the", "prow", "config", "to", "find", "context", "merge", "options", ".", "If", "none", "are", "set", "it", "will", "use", "the", "prow", "jobs", "configured", "and", "use", "the", "default", "github", "combined", "status", ...
8125fbda10178887be5dff9e901d6a0a519b67bc
https://github.com/kubernetes/test-infra/blob/8125fbda10178887be5dff9e901d6a0a519b67bc/prow/config/tide.go#L477-L510
test
kubernetes/test-infra
prow/config/tide.go
IsOptional
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
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) ...
[ "func", "(", "cp", "*", "TideContextPolicy", ")", "IsOptional", "(", "c", "string", ")", "bool", "{", "if", "sets", ".", "NewString", "(", "cp", ".", "OptionalContexts", "...", ")", ".", "Has", "(", "c", ")", "{", "return", "true", "\n", "}", "\n", ...
// IsOptional checks whether a context can be ignored. // Will return true if // - context is registered as optional // - required contexts are registered and the context provided is not required // Will return false otherwise. Every context is required.
[ "IsOptional", "checks", "whether", "a", "context", "can", "be", "ignored", ".", "Will", "return", "true", "if", "-", "context", "is", "registered", "as", "optional", "-", "required", "contexts", "are", "registered", "and", "the", "context", "provided", "is", ...
8125fbda10178887be5dff9e901d6a0a519b67bc
https://github.com/kubernetes/test-infra/blob/8125fbda10178887be5dff9e901d6a0a519b67bc/prow/config/tide.go#L517-L532
test
kubernetes/test-infra
prow/config/tide.go
MissingRequiredContexts
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
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...)....
[ "func", "(", "cp", "*", "TideContextPolicy", ")", "MissingRequiredContexts", "(", "contexts", "[", "]", "string", ")", "[", "]", "string", "{", "if", "len", "(", "cp", ".", "RequiredContexts", ")", "==", "0", "{", "return", "nil", "\n", "}", "\n", "exi...
// MissingRequiredContexts discard the optional contexts and only look of extra required contexts that are not provided.
[ "MissingRequiredContexts", "discard", "the", "optional", "contexts", "and", "only", "look", "of", "extra", "required", "contexts", "that", "are", "not", "provided", "." ]
8125fbda10178887be5dff9e901d6a0a519b67bc
https://github.com/kubernetes/test-infra/blob/8125fbda10178887be5dff9e901d6a0a519b67bc/prow/config/tide.go#L535-L548
test
kubernetes/test-infra
prow/github/webhooks.go
ValidateWebhook
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
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...
[ "func", "ValidateWebhook", "(", "w", "http", ".", "ResponseWriter", ",", "r", "*", "http", ".", "Request", ",", "hmacSecret", "[", "]", "byte", ")", "(", "string", ",", "string", ",", "[", "]", "byte", ",", "bool", ",", "int", ")", "{", "defer", "r...
// ValidateWebhook ensures that the provided request conforms to the // format of a GitHub webhook and the payload can be validated with // the provided hmac secret. It returns the event type, the event guid, // the payload of the request, whether the webhook is valid or not, // and finally the resultant HTTP status co...
[ "ValidateWebhook", "ensures", "that", "the", "provided", "request", "conforms", "to", "the", "format", "of", "a", "GitHub", "webhook", "and", "the", "payload", "can", "be", "validated", "with", "the", "provided", "hmac", "secret", ".", "It", "returns", "the", ...
8125fbda10178887be5dff9e901d6a0a519b67bc
https://github.com/kubernetes/test-infra/blob/8125fbda10178887be5dff9e901d6a0a519b67bc/prow/github/webhooks.go#L31-L76
test
kubernetes/test-infra
prow/external-plugins/needs-rebase/plugin/plugin.go
HelpProvider
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
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...
[ "func", "HelpProvider", "(", "enabledRepos", "[", "]", "string", ")", "(", "*", "pluginhelp", ".", "PluginHelp", ",", "error", ")", "{", "return", "&", "pluginhelp", ".", "PluginHelp", "{", "Description", ":", "`The needs-rebase plugin manages the '`", "+", "lab...
// HelpProvider constructs the PluginHelp for this plugin that takes into account enabled repositories. // HelpProvider defines the type for function that construct the PluginHelp for plugins.
[ "HelpProvider", "constructs", "the", "PluginHelp", "for", "this", "plugin", "that", "takes", "into", "account", "enabled", "repositories", ".", "HelpProvider", "defines", "the", "type", "for", "function", "that", "construct", "the", "PluginHelp", "for", "plugins", ...
8125fbda10178887be5dff9e901d6a0a519b67bc
https://github.com/kubernetes/test-infra/blob/8125fbda10178887be5dff9e901d6a0a519b67bc/prow/external-plugins/needs-rebase/plugin/plugin.go#L60-L66
test
kubernetes/test-infra
prow/external-plugins/needs-rebase/plugin/plugin.go
HandleEvent
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
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...
[ "func", "HandleEvent", "(", "log", "*", "logrus", ".", "Entry", ",", "ghc", "githubClient", ",", "pre", "*", "github", ".", "PullRequestEvent", ")", "error", "{", "if", "pre", ".", "Action", "!=", "github", ".", "PullRequestActionOpened", "&&", "pre", ".",...
// HandleEvent handles a GitHub PR event to determine if the "needs-rebase" // label needs to be added or removed. It depends on GitHub mergeability check // to decide the need for a rebase.
[ "HandleEvent", "handles", "a", "GitHub", "PR", "event", "to", "determine", "if", "the", "needs", "-", "rebase", "label", "needs", "to", "be", "added", "or", "removed", ".", "It", "depends", "on", "GitHub", "mergeability", "check", "to", "decide", "the", "n...
8125fbda10178887be5dff9e901d6a0a519b67bc
https://github.com/kubernetes/test-infra/blob/8125fbda10178887be5dff9e901d6a0a519b67bc/prow/external-plugins/needs-rebase/plugin/plugin.go#L71-L96
test
kubernetes/test-infra
prow/external-plugins/needs-rebase/plugin/plugin.go
HandleAll
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
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...
[ "func", "HandleAll", "(", "log", "*", "logrus", ".", "Entry", ",", "ghc", "githubClient", ",", "config", "*", "plugins", ".", "Configuration", ")", "error", "{", "log", ".", "Info", "(", "\"Checking all PRs.\"", ")", "\n", "orgs", ",", "repos", ":=", "co...
// HandleAll checks all orgs and repos that enabled this plugin for open PRs to // determine if the "needs-rebase" label needs to be added or removed. It // depends on GitHub's mergeability check to decide the need for a rebase.
[ "HandleAll", "checks", "all", "orgs", "and", "repos", "that", "enabled", "this", "plugin", "for", "open", "PRs", "to", "determine", "if", "the", "needs", "-", "rebase", "label", "needs", "to", "be", "added", "or", "removed", ".", "It", "depends", "on", "...
8125fbda10178887be5dff9e901d6a0a519b67bc
https://github.com/kubernetes/test-infra/blob/8125fbda10178887be5dff9e901d6a0a519b67bc/prow/external-plugins/needs-rebase/plugin/plugin.go#L101-L157
test
kubernetes/test-infra
prow/kube/dry_run_client.go
NewDryRunProwJobClient
func NewDryRunProwJobClient(deckURL string) prowv1.ProwJobInterface { return &dryRunProwJobClient{ deckURL: deckURL, client: &http.Client{}, } }
go
func NewDryRunProwJobClient(deckURL string) prowv1.ProwJobInterface { return &dryRunProwJobClient{ deckURL: deckURL, client: &http.Client{}, } }
[ "func", "NewDryRunProwJobClient", "(", "deckURL", "string", ")", "prowv1", ".", "ProwJobInterface", "{", "return", "&", "dryRunProwJobClient", "{", "deckURL", ":", "deckURL", ",", "client", ":", "&", "http", ".", "Client", "{", "}", ",", "}", "\n", "}" ]
// NewDryRunProwJobClient creates a new client that uses deck as a read-only proxy for ProwJob data
[ "NewDryRunProwJobClient", "creates", "a", "new", "client", "that", "uses", "deck", "as", "a", "read", "-", "only", "proxy", "for", "ProwJob", "data" ]
8125fbda10178887be5dff9e901d6a0a519b67bc
https://github.com/kubernetes/test-infra/blob/8125fbda10178887be5dff9e901d6a0a519b67bc/prow/kube/dry_run_client.go#L36-L41
test
kubernetes/test-infra
prow/kube/dry_run_client.go
Create
func (c *dryRunProwJobClient) Create(*prowapi.ProwJob) (*prowapi.ProwJob, error) { return nil, nil }
go
func (c *dryRunProwJobClient) Create(*prowapi.ProwJob) (*prowapi.ProwJob, error) { return nil, nil }
[ "func", "(", "c", "*", "dryRunProwJobClient", ")", "Create", "(", "*", "prowapi", ".", "ProwJob", ")", "(", "*", "prowapi", ".", "ProwJob", ",", "error", ")", "{", "return", "nil", ",", "nil", "\n", "}" ]
// Create does nothing on a dry-run client
[ "Create", "does", "nothing", "on", "a", "dry", "-", "run", "client" ]
8125fbda10178887be5dff9e901d6a0a519b67bc
https://github.com/kubernetes/test-infra/blob/8125fbda10178887be5dff9e901d6a0a519b67bc/prow/kube/dry_run_client.go#L50-L52
test
kubernetes/test-infra
prow/kube/dry_run_client.go
Update
func (c *dryRunProwJobClient) Update(*prowapi.ProwJob) (*prowapi.ProwJob, error) { return nil, nil }
go
func (c *dryRunProwJobClient) Update(*prowapi.ProwJob) (*prowapi.ProwJob, error) { return nil, nil }
[ "func", "(", "c", "*", "dryRunProwJobClient", ")", "Update", "(", "*", "prowapi", ".", "ProwJob", ")", "(", "*", "prowapi", ".", "ProwJob", ",", "error", ")", "{", "return", "nil", ",", "nil", "\n", "}" ]
// Update does nothing on a dry-run client
[ "Update", "does", "nothing", "on", "a", "dry", "-", "run", "client" ]
8125fbda10178887be5dff9e901d6a0a519b67bc
https://github.com/kubernetes/test-infra/blob/8125fbda10178887be5dff9e901d6a0a519b67bc/prow/kube/dry_run_client.go#L55-L57
test
kubernetes/test-infra
prow/kube/dry_run_client.go
UpdateStatus
func (c *dryRunProwJobClient) UpdateStatus(*prowapi.ProwJob) (*prowapi.ProwJob, error) { return nil, nil }
go
func (c *dryRunProwJobClient) UpdateStatus(*prowapi.ProwJob) (*prowapi.ProwJob, error) { return nil, nil }
[ "func", "(", "c", "*", "dryRunProwJobClient", ")", "UpdateStatus", "(", "*", "prowapi", ".", "ProwJob", ")", "(", "*", "prowapi", ".", "ProwJob", ",", "error", ")", "{", "return", "nil", ",", "nil", "\n", "}" ]
// UpdateStatus does nothing on a dry-run client
[ "UpdateStatus", "does", "nothing", "on", "a", "dry", "-", "run", "client" ]
8125fbda10178887be5dff9e901d6a0a519b67bc
https://github.com/kubernetes/test-infra/blob/8125fbda10178887be5dff9e901d6a0a519b67bc/prow/kube/dry_run_client.go#L60-L62
test
kubernetes/test-infra
prow/kube/dry_run_client.go
Delete
func (c *dryRunProwJobClient) Delete(name string, options *metav1.DeleteOptions) error { return nil }
go
func (c *dryRunProwJobClient) Delete(name string, options *metav1.DeleteOptions) error { return nil }
[ "func", "(", "c", "*", "dryRunProwJobClient", ")", "Delete", "(", "name", "string", ",", "options", "*", "metav1", ".", "DeleteOptions", ")", "error", "{", "return", "nil", "\n", "}" ]
// Delete does nothing on a dry-run client
[ "Delete", "does", "nothing", "on", "a", "dry", "-", "run", "client" ]
8125fbda10178887be5dff9e901d6a0a519b67bc
https://github.com/kubernetes/test-infra/blob/8125fbda10178887be5dff9e901d6a0a519b67bc/prow/kube/dry_run_client.go#L65-L67
test
kubernetes/test-infra
prow/kube/dry_run_client.go
DeleteCollection
func (c *dryRunProwJobClient) DeleteCollection(options *metav1.DeleteOptions, listOptions metav1.ListOptions) error { return nil }
go
func (c *dryRunProwJobClient) DeleteCollection(options *metav1.DeleteOptions, listOptions metav1.ListOptions) error { return nil }
[ "func", "(", "c", "*", "dryRunProwJobClient", ")", "DeleteCollection", "(", "options", "*", "metav1", ".", "DeleteOptions", ",", "listOptions", "metav1", ".", "ListOptions", ")", "error", "{", "return", "nil", "\n", "}" ]
// DeleteCollection does nothing on a dry-run client
[ "DeleteCollection", "does", "nothing", "on", "a", "dry", "-", "run", "client" ]
8125fbda10178887be5dff9e901d6a0a519b67bc
https://github.com/kubernetes/test-infra/blob/8125fbda10178887be5dff9e901d6a0a519b67bc/prow/kube/dry_run_client.go#L70-L72
test
kubernetes/test-infra
prow/kube/dry_run_client.go
Get
func (c *dryRunProwJobClient) Get(name string, options metav1.GetOptions) (*prowapi.ProwJob, error) { return nil, nil }
go
func (c *dryRunProwJobClient) Get(name string, options metav1.GetOptions) (*prowapi.ProwJob, error) { return nil, nil }
[ "func", "(", "c", "*", "dryRunProwJobClient", ")", "Get", "(", "name", "string", ",", "options", "metav1", ".", "GetOptions", ")", "(", "*", "prowapi", ".", "ProwJob", ",", "error", ")", "{", "return", "nil", ",", "nil", "\n", "}" ]
// Get does nothing on a dry-run client
[ "Get", "does", "nothing", "on", "a", "dry", "-", "run", "client" ]
8125fbda10178887be5dff9e901d6a0a519b67bc
https://github.com/kubernetes/test-infra/blob/8125fbda10178887be5dff9e901d6a0a519b67bc/prow/kube/dry_run_client.go#L75-L77
test
kubernetes/test-infra
prow/kube/dry_run_client.go
List
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
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 }
[ "func", "(", "c", "*", "dryRunProwJobClient", ")", "List", "(", "opts", "metav1", ".", "ListOptions", ")", "(", "*", "prowapi", ".", "ProwJobList", ",", "error", ")", "{", "var", "jl", "prowapi", ".", "ProwJobList", "\n", "err", ":=", "c", ".", "reques...
// List reaches out to `deck` to retrieve the ProwJobs on the cluster via proxy
[ "List", "reaches", "out", "to", "deck", "to", "retrieve", "the", "ProwJobs", "on", "the", "cluster", "via", "proxy" ]
8125fbda10178887be5dff9e901d6a0a519b67bc
https://github.com/kubernetes/test-infra/blob/8125fbda10178887be5dff9e901d6a0a519b67bc/prow/kube/dry_run_client.go#L80-L84
test
kubernetes/test-infra
prow/kube/dry_run_client.go
Watch
func (c *dryRunProwJobClient) Watch(opts metav1.ListOptions) (watch.Interface, error) { return nil, nil }
go
func (c *dryRunProwJobClient) Watch(opts metav1.ListOptions) (watch.Interface, error) { return nil, nil }
[ "func", "(", "c", "*", "dryRunProwJobClient", ")", "Watch", "(", "opts", "metav1", ".", "ListOptions", ")", "(", "watch", ".", "Interface", ",", "error", ")", "{", "return", "nil", ",", "nil", "\n", "}" ]
// Watch does nothing on a dry-run client
[ "Watch", "does", "nothing", "on", "a", "dry", "-", "run", "client" ]
8125fbda10178887be5dff9e901d6a0a519b67bc
https://github.com/kubernetes/test-infra/blob/8125fbda10178887be5dff9e901d6a0a519b67bc/prow/kube/dry_run_client.go#L172-L174
test
kubernetes/test-infra
prow/kube/dry_run_client.go
Patch
func (c *dryRunProwJobClient) Patch(name string, pt types.PatchType, data []byte, subresources ...string) (result *prowapi.ProwJob, err error) { return nil, nil }
go
func (c *dryRunProwJobClient) Patch(name string, pt types.PatchType, data []byte, subresources ...string) (result *prowapi.ProwJob, err error) { return nil, nil }
[ "func", "(", "c", "*", "dryRunProwJobClient", ")", "Patch", "(", "name", "string", ",", "pt", "types", ".", "PatchType", ",", "data", "[", "]", "byte", ",", "subresources", "...", "string", ")", "(", "result", "*", "prowapi", ".", "ProwJob", ",", "err"...
// Patch does nothing on a dry-run client
[ "Patch", "does", "nothing", "on", "a", "dry", "-", "run", "client" ]
8125fbda10178887be5dff9e901d6a0a519b67bc
https://github.com/kubernetes/test-infra/blob/8125fbda10178887be5dff9e901d6a0a519b67bc/prow/kube/dry_run_client.go#L177-L179
test
kubernetes/test-infra
prow/cmd/pipeline/controller.go
hasSynced
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
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...
[ "func", "(", "c", "*", "controller", ")", "hasSynced", "(", ")", "bool", "{", "if", "!", "c", ".", "pjInformer", ".", "HasSynced", "(", ")", "{", "if", "c", ".", "wait", "!=", "\"prowjobs\"", "{", "c", ".", "wait", "=", "\"prowjobs\"", "\n", "ns", ...
// hasSynced returns true when every prowjob and pipeline informer has synced.
[ "hasSynced", "returns", "true", "when", "every", "prowjob", "and", "pipeline", "informer", "has", "synced", "." ]
8125fbda10178887be5dff9e901d6a0a519b67bc
https://github.com/kubernetes/test-infra/blob/8125fbda10178887be5dff9e901d6a0a519b67bc/prow/cmd/pipeline/controller.go#L90-L122
test
kubernetes/test-infra
prow/cmd/pipeline/controller.go
Run
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
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 ...
[ "func", "(", "c", "*", "controller", ")", "Run", "(", "threads", "int", ",", "stop", "<-", "chan", "struct", "{", "}", ")", "error", "{", "defer", "runtime", ".", "HandleCrash", "(", ")", "\n", "defer", "c", ".", "workqueue", ".", "ShutDown", "(", ...
// Run starts threads workers, returning after receiving a stop signal.
[ "Run", "starts", "threads", "workers", "returning", "after", "receiving", "a", "stop", "signal", "." ]
8125fbda10178887be5dff9e901d6a0a519b67bc
https://github.com/kubernetes/test-infra/blob/8125fbda10178887be5dff9e901d6a0a519b67bc/prow/cmd/pipeline/controller.go#L196-L215
test
kubernetes/test-infra
prow/cmd/pipeline/controller.go
runWorker
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
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...
[ "func", "(", "c", "*", "controller", ")", "runWorker", "(", ")", "{", "for", "{", "key", ",", "shutdown", ":=", "c", ".", "workqueue", ".", "Get", "(", ")", "\n", "if", "shutdown", "{", "return", "\n", "}", "\n", "func", "(", ")", "{", "defer", ...
// runWorker dequeues to reconcile, until the queue has closed.
[ "runWorker", "dequeues", "to", "reconcile", "until", "the", "queue", "has", "closed", "." ]
8125fbda10178887be5dff9e901d6a0a519b67bc
https://github.com/kubernetes/test-infra/blob/8125fbda10178887be5dff9e901d6a0a519b67bc/prow/cmd/pipeline/controller.go#L218-L234
test
kubernetes/test-infra
prow/cmd/pipeline/controller.go
fromKey
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
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 }
[ "func", "fromKey", "(", "key", "string", ")", "(", "string", ",", "string", ",", "string", ",", "error", ")", "{", "parts", ":=", "strings", ".", "Split", "(", "key", ",", "\"/\"", ")", "\n", "if", "len", "(", "parts", ")", "!=", "3", "{", "retur...
// fromKey converts toKey back into its parts
[ "fromKey", "converts", "toKey", "back", "into", "its", "parts" ]
8125fbda10178887be5dff9e901d6a0a519b67bc
https://github.com/kubernetes/test-infra/blob/8125fbda10178887be5dff9e901d6a0a519b67bc/prow/cmd/pipeline/controller.go#L242-L248
test
kubernetes/test-infra
prow/cmd/pipeline/controller.go
enqueueKey
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
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...
[ "func", "(", "c", "*", "controller", ")", "enqueueKey", "(", "ctx", "string", ",", "obj", "interface", "{", "}", ")", "{", "switch", "o", ":=", "obj", ".", "(", "type", ")", "{", "case", "*", "prowjobv1", ".", "ProwJob", ":", "ns", ":=", "o", "."...
// enqueueKey schedules an item for reconciliation
[ "enqueueKey", "schedules", "an", "item", "for", "reconciliation" ]
8125fbda10178887be5dff9e901d6a0a519b67bc
https://github.com/kubernetes/test-infra/blob/8125fbda10178887be5dff9e901d6a0a519b67bc/prow/cmd/pipeline/controller.go#L251-L265
test
kubernetes/test-infra
prow/cmd/pipeline/controller.go
finalState
func finalState(status prowjobv1.ProwJobState) bool { switch status { case "", prowjobv1.PendingState, prowjobv1.TriggeredState: return false } return true }
go
func finalState(status prowjobv1.ProwJobState) bool { switch status { case "", prowjobv1.PendingState, prowjobv1.TriggeredState: return false } return true }
[ "func", "finalState", "(", "status", "prowjobv1", ".", "ProwJobState", ")", "bool", "{", "switch", "status", "{", "case", "\"\"", ",", "prowjobv1", ".", "PendingState", ",", "prowjobv1", ".", "TriggeredState", ":", "return", "false", "\n", "}", "\n", "return...
// finalState returns true if the prowjob has already finished
[ "finalState", "returns", "true", "if", "the", "prowjob", "has", "already", "finished" ]
8125fbda10178887be5dff9e901d6a0a519b67bc
https://github.com/kubernetes/test-infra/blob/8125fbda10178887be5dff9e901d6a0a519b67bc/prow/cmd/pipeline/controller.go#L467-L473
test
kubernetes/test-infra
prow/cmd/pipeline/controller.go
description
func description(cond duckv1alpha1.Condition, fallback string) string { switch { case cond.Message != "": return cond.Message case cond.Reason != "": return cond.Reason } return fallback }
go
func description(cond duckv1alpha1.Condition, fallback string) string { switch { case cond.Message != "": return cond.Message case cond.Reason != "": return cond.Reason } return fallback }
[ "func", "description", "(", "cond", "duckv1alpha1", ".", "Condition", ",", "fallback", "string", ")", "string", "{", "switch", "{", "case", "cond", ".", "Message", "!=", "\"\"", ":", "return", "cond", ".", "Message", "\n", "case", "cond", ".", "Reason", ...
// description computes the ProwJobStatus description for this condition or falling back to a default if none is provided.
[ "description", "computes", "the", "ProwJobStatus", "description", "for", "this", "condition", "or", "falling", "back", "to", "a", "default", "if", "none", "is", "provided", "." ]
8125fbda10178887be5dff9e901d6a0a519b67bc
https://github.com/kubernetes/test-infra/blob/8125fbda10178887be5dff9e901d6a0a519b67bc/prow/cmd/pipeline/controller.go#L476-L484
test
kubernetes/test-infra
prow/cmd/pipeline/controller.go
prowJobStatus
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
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...
[ "func", "prowJobStatus", "(", "ps", "pipelinev1alpha1", ".", "PipelineRunStatus", ")", "(", "prowjobv1", ".", "ProwJobState", ",", "string", ")", "{", "started", ":=", "ps", ".", "StartTime", "\n", "finished", ":=", "ps", ".", "CompletionTime", "\n", "pcond", ...
// prowJobStatus returns the desired state and description based on the pipeline status
[ "prowJobStatus", "returns", "the", "desired", "state", "and", "description", "based", "on", "the", "pipeline", "status" ]
8125fbda10178887be5dff9e901d6a0a519b67bc
https://github.com/kubernetes/test-infra/blob/8125fbda10178887be5dff9e901d6a0a519b67bc/prow/cmd/pipeline/controller.go#L497-L521
test
kubernetes/test-infra
prow/cmd/pipeline/controller.go
pipelineMeta
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
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, } }
[ "func", "pipelineMeta", "(", "pj", "prowjobv1", ".", "ProwJob", ")", "metav1", ".", "ObjectMeta", "{", "labels", ",", "annotations", ":=", "decorate", ".", "LabelsAndAnnotationsForJob", "(", "pj", ")", "\n", "return", "metav1", ".", "ObjectMeta", "{", "Annotat...
// pipelineMeta builds the pipeline metadata from prow job definition
[ "pipelineMeta", "builds", "the", "pipeline", "metadata", "from", "prow", "job", "definition" ]
8125fbda10178887be5dff9e901d6a0a519b67bc
https://github.com/kubernetes/test-infra/blob/8125fbda10178887be5dff9e901d6a0a519b67bc/prow/cmd/pipeline/controller.go#L524-L532
test
kubernetes/test-infra
prow/cmd/pipeline/controller.go
sourceURL
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
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 }
[ "func", "sourceURL", "(", "pj", "prowjobv1", ".", "ProwJob", ")", "string", "{", "if", "pj", ".", "Spec", ".", "Refs", "==", "nil", "{", "return", "\"\"", "\n", "}", "\n", "sourceURL", ":=", "pj", ".", "Spec", ".", "Refs", ".", "CloneURI", "\n", "i...
// sourceURL returns the source URL from prow jobs repository reference
[ "sourceURL", "returns", "the", "source", "URL", "from", "prow", "jobs", "repository", "reference" ]
8125fbda10178887be5dff9e901d6a0a519b67bc
https://github.com/kubernetes/test-infra/blob/8125fbda10178887be5dff9e901d6a0a519b67bc/prow/cmd/pipeline/controller.go#L549-L558
test
kubernetes/test-infra
prow/cmd/pipeline/controller.go
makePipelineGitResource
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
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...
[ "func", "makePipelineGitResource", "(", "pj", "prowjobv1", ".", "ProwJob", ")", "*", "pipelinev1alpha1", ".", "PipelineResource", "{", "var", "revision", "string", "\n", "if", "pj", ".", "Spec", ".", "Refs", "!=", "nil", "{", "if", "len", "(", "pj", ".", ...
// makePipelineGitResource creates a pipeline git resource from prow job
[ "makePipelineGitResource", "creates", "a", "pipeline", "git", "resource", "from", "prow", "job" ]
8125fbda10178887be5dff9e901d6a0a519b67bc
https://github.com/kubernetes/test-infra/blob/8125fbda10178887be5dff9e901d6a0a519b67bc/prow/cmd/pipeline/controller.go#L561-L587
test
kubernetes/test-infra
prow/cmd/pipeline/controller.go
makePipelineRun
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
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...
[ "func", "makePipelineRun", "(", "pj", "prowjobv1", ".", "ProwJob", ",", "pr", "*", "pipelinev1alpha1", ".", "PipelineResource", ")", "(", "*", "pipelinev1alpha1", ".", "PipelineRun", ",", "error", ")", "{", "if", "pj", ".", "Spec", ".", "PipelineRunSpec", "=...
// makePipeline creates a PipelineRun from a prow job using the PipelineRunSpec defined in the prow job
[ "makePipeline", "creates", "a", "PipelineRun", "from", "a", "prow", "job", "using", "the", "PipelineRunSpec", "defined", "in", "the", "prow", "job" ]
8125fbda10178887be5dff9e901d6a0a519b67bc
https://github.com/kubernetes/test-infra/blob/8125fbda10178887be5dff9e901d6a0a519b67bc/prow/cmd/pipeline/controller.go#L590-L616
test
kubernetes/test-infra
prow/plugins/require-matching-label/require-matching-label.go
matchingConfigs
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
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...
[ "func", "matchingConfigs", "(", "org", ",", "repo", ",", "branch", ",", "label", "string", ",", "allConfigs", "[", "]", "plugins", ".", "RequireMatchingLabel", ")", "[", "]", "plugins", ".", "RequireMatchingLabel", "{", "var", "filtered", "[", "]", "plugins"...
// matchingConfigs filters irrelevant RequireMtchingLabel configs from // the list of all configs. // `branch` should be empty for Issues and non-empty for PRs. // `label` should be omitted in the case of 'open' and 'reopen' actions.
[ "matchingConfigs", "filters", "irrelevant", "RequireMtchingLabel", "configs", "from", "the", "list", "of", "all", "configs", ".", "branch", "should", "be", "empty", "for", "Issues", "and", "non", "-", "empty", "for", "PRs", ".", "label", "should", "be", "omitt...
8125fbda10178887be5dff9e901d6a0a519b67bc
https://github.com/kubernetes/test-infra/blob/8125fbda10178887be5dff9e901d6a0a519b67bc/prow/plugins/require-matching-label/require-matching-label.go#L143-L163
test
kubernetes/test-infra
prow/plugins/golint/suggestion/golint_suggestion.go
SuggestCodeChange
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
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 "" }
[ "func", "SuggestCodeChange", "(", "p", "lint", ".", "Problem", ")", "string", "{", "var", "suggestion", "=", "\"\"", "\n", "for", "regex", ",", "handler", ":=", "range", "lintHandlersMap", "{", "matches", ":=", "regex", ".", "FindStringSubmatch", "(", "p", ...
// SuggestCodeChange returns code suggestions for a given lint.Problem // Returns empty string if no suggestion can be given
[ "SuggestCodeChange", "returns", "code", "suggestions", "for", "a", "given", "lint", ".", "Problem", "Returns", "empty", "string", "if", "no", "suggestion", "can", "be", "given" ]
8125fbda10178887be5dff9e901d6a0a519b67bc
https://github.com/kubernetes/test-infra/blob/8125fbda10178887be5dff9e901d6a0a519b67bc/prow/plugins/golint/suggestion/golint_suggestion.go#L47-L57
test
kubernetes/test-infra
prow/pluginhelp/externalplugins/externalplugins.go
ServeExternalPluginHelp
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
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 ...
[ "func", "ServeExternalPluginHelp", "(", "mux", "*", "http", ".", "ServeMux", ",", "log", "*", "logrus", ".", "Entry", ",", "provider", "ExternalPluginHelpProvider", ")", "{", "mux", ".", "HandleFunc", "(", "\"/help\"", ",", "func", "(", "w", "http", ".", "...
// ServeExternalPluginHelp returns a HandlerFunc that serves plugin help information that is // provided by the specified ExternalPluginHelpProvider.
[ "ServeExternalPluginHelp", "returns", "a", "HandlerFunc", "that", "serves", "plugin", "help", "information", "that", "is", "provided", "by", "the", "specified", "ExternalPluginHelpProvider", "." ]
8125fbda10178887be5dff9e901d6a0a519b67bc
https://github.com/kubernetes/test-infra/blob/8125fbda10178887be5dff9e901d6a0a519b67bc/prow/pluginhelp/externalplugins/externalplugins.go#L40-L85
test
kubernetes/test-infra
prow/cmd/branchprotector/protect.go
protect
func (p *protector) protect() { bp := p.cfg.BranchProtection // Scan the branch-protection configuration for orgName := range bp.Orgs { org := bp.GetOrg(orgName) if err := p.UpdateOrg(orgName, *org); err != nil { p.errors.add(fmt.Errorf("update %s: %v", orgName, err)) } } // Do not automatically protect...
go
func (p *protector) protect() { bp := p.cfg.BranchProtection // Scan the branch-protection configuration for orgName := range bp.Orgs { org := bp.GetOrg(orgName) if err := p.UpdateOrg(orgName, *org); err != nil { p.errors.add(fmt.Errorf("update %s: %v", orgName, err)) } } // Do not automatically protect...
[ "func", "(", "p", "*", "protector", ")", "protect", "(", ")", "{", "bp", ":=", "p", ".", "cfg", ".", "BranchProtection", "\n", "for", "orgName", ":=", "range", "bp", ".", "Orgs", "{", "org", ":=", "bp", ".", "GetOrg", "(", "orgName", ")", "\n", "...
// protect protects branches specified in the presubmit and branch-protection config sections.
[ "protect", "protects", "branches", "specified", "in", "the", "presubmit", "and", "branch", "-", "protection", "config", "sections", "." ]
8125fbda10178887be5dff9e901d6a0a519b67bc
https://github.com/kubernetes/test-infra/blob/8125fbda10178887be5dff9e901d6a0a519b67bc/prow/cmd/branchprotector/protect.go#L167-L200
test
kubernetes/test-infra
prow/cmd/branchprotector/protect.go
UpdateOrg
func (p *protector) UpdateOrg(orgName string, org config.Org) error { var repos []string if org.Protect != nil { // Strongly opinionated org, configure every repo in the org. rs, err := p.client.GetRepos(orgName, false) if err != nil { return fmt.Errorf("list repos: %v", err) } for _, r := range rs { ...
go
func (p *protector) UpdateOrg(orgName string, org config.Org) error { var repos []string if org.Protect != nil { // Strongly opinionated org, configure every repo in the org. rs, err := p.client.GetRepos(orgName, false) if err != nil { return fmt.Errorf("list repos: %v", err) } for _, r := range rs { ...
[ "func", "(", "p", "*", "protector", ")", "UpdateOrg", "(", "orgName", "string", ",", "org", "config", ".", "Org", ")", "error", "{", "var", "repos", "[", "]", "string", "\n", "if", "org", ".", "Protect", "!=", "nil", "{", "rs", ",", "err", ":=", ...
// UpdateOrg updates all repos in the org with the specified defaults
[ "UpdateOrg", "updates", "all", "repos", "in", "the", "org", "with", "the", "specified", "defaults" ]
8125fbda10178887be5dff9e901d6a0a519b67bc
https://github.com/kubernetes/test-infra/blob/8125fbda10178887be5dff9e901d6a0a519b67bc/prow/cmd/branchprotector/protect.go#L203-L230
test
kubernetes/test-infra
prow/cmd/branchprotector/protect.go
UpdateRepo
func (p *protector) UpdateRepo(orgName string, repoName string, repo config.Repo) error { p.completedRepos[orgName+"/"+repoName] = true githubRepo, err := p.client.GetRepo(orgName, repoName) if err != nil { return fmt.Errorf("could not get repo to check for archival: %v", err) } if githubRepo.Archived { // no...
go
func (p *protector) UpdateRepo(orgName string, repoName string, repo config.Repo) error { p.completedRepos[orgName+"/"+repoName] = true githubRepo, err := p.client.GetRepo(orgName, repoName) if err != nil { return fmt.Errorf("could not get repo to check for archival: %v", err) } if githubRepo.Archived { // no...
[ "func", "(", "p", "*", "protector", ")", "UpdateRepo", "(", "orgName", "string", ",", "repoName", "string", ",", "repo", "config", ".", "Repo", ")", "error", "{", "p", ".", "completedRepos", "[", "orgName", "+", "\"/\"", "+", "repoName", "]", "=", "tru...
// UpdateRepo updates all branches in the repo with the specified defaults
[ "UpdateRepo", "updates", "all", "branches", "in", "the", "repo", "with", "the", "specified", "defaults" ]
8125fbda10178887be5dff9e901d6a0a519b67bc
https://github.com/kubernetes/test-infra/blob/8125fbda10178887be5dff9e901d6a0a519b67bc/prow/cmd/branchprotector/protect.go#L233-L264
test
kubernetes/test-infra
prow/cmd/branchprotector/protect.go
UpdateBranch
func (p *protector) UpdateBranch(orgName, repo string, branchName string, branch config.Branch, protected bool) error { bp, err := p.cfg.GetPolicy(orgName, repo, branchName, branch) if err != nil { return fmt.Errorf("get policy: %v", err) } if bp == nil || bp.Protect == nil { return nil } if !protected && !*b...
go
func (p *protector) UpdateBranch(orgName, repo string, branchName string, branch config.Branch, protected bool) error { bp, err := p.cfg.GetPolicy(orgName, repo, branchName, branch) if err != nil { return fmt.Errorf("get policy: %v", err) } if bp == nil || bp.Protect == nil { return nil } if !protected && !*b...
[ "func", "(", "p", "*", "protector", ")", "UpdateBranch", "(", "orgName", ",", "repo", "string", ",", "branchName", "string", ",", "branch", "config", ".", "Branch", ",", "protected", "bool", ")", "error", "{", "bp", ",", "err", ":=", "p", ".", "cfg", ...
// UpdateBranch updates the branch with the specified configuration
[ "UpdateBranch", "updates", "the", "branch", "with", "the", "specified", "configuration" ]
8125fbda10178887be5dff9e901d6a0a519b67bc
https://github.com/kubernetes/test-infra/blob/8125fbda10178887be5dff9e901d6a0a519b67bc/prow/cmd/branchprotector/protect.go#L267-L291
test
kubernetes/test-infra
prow/cmd/artifact-uploader/main.go
LoadConfig
func (o *Options) LoadConfig(config string) error { return json.Unmarshal([]byte(config), o) }
go
func (o *Options) LoadConfig(config string) error { return json.Unmarshal([]byte(config), o) }
[ "func", "(", "o", "*", "Options", ")", "LoadConfig", "(", "config", "string", ")", "error", "{", "return", "json", ".", "Unmarshal", "(", "[", "]", "byte", "(", "config", ")", ",", "o", ")", "\n", "}" ]
// LoadConfig loads options from serialized config
[ "LoadConfig", "loads", "options", "from", "serialized", "config" ]
8125fbda10178887be5dff9e901d6a0a519b67bc
https://github.com/kubernetes/test-infra/blob/8125fbda10178887be5dff9e901d6a0a519b67bc/prow/cmd/artifact-uploader/main.go#L86-L88
test
kubernetes/test-infra
prow/cmd/artifact-uploader/main.go
Run
func (o *Options) Run() error { clusterConfig, err := loadClusterConfig() if err != nil { return fmt.Errorf("failed to load cluster config: %v", err) } client, err := kubernetes.NewForConfig(clusterConfig) if err != nil { return err } prowJobClient, err := kube.NewClientInCluster(o.ProwJobNamespace) if er...
go
func (o *Options) Run() error { clusterConfig, err := loadClusterConfig() if err != nil { return fmt.Errorf("failed to load cluster config: %v", err) } client, err := kubernetes.NewForConfig(clusterConfig) if err != nil { return err } prowJobClient, err := kube.NewClientInCluster(o.ProwJobNamespace) if er...
[ "func", "(", "o", "*", "Options", ")", "Run", "(", ")", "error", "{", "clusterConfig", ",", "err", ":=", "loadClusterConfig", "(", ")", "\n", "if", "err", "!=", "nil", "{", "return", "fmt", ".", "Errorf", "(", "\"failed to load cluster config: %v\"", ",", ...
// Run uploads artifacts with the specified options forever. // // Sends a stop message to the artifact uploader when it is interrupted.
[ "Run", "uploads", "artifacts", "with", "the", "specified", "options", "forever", ".", "Sends", "a", "stop", "message", "to", "the", "artifact", "uploader", "when", "it", "is", "interrupted", "." ]
8125fbda10178887be5dff9e901d6a0a519b67bc
https://github.com/kubernetes/test-infra/blob/8125fbda10178887be5dff9e901d6a0a519b67bc/prow/cmd/artifact-uploader/main.go#L127-L151
test
kubernetes/test-infra
prow/config/secret/agent.go
Start
func (a *Agent) Start(paths []string) error { secretsMap, err := LoadSecrets(paths) if err != nil { return err } a.secretsMap = secretsMap // Start one goroutine for each file to monitor and update the secret's values. for secretPath := range secretsMap { go a.reloadSecret(secretPath) } return nil }
go
func (a *Agent) Start(paths []string) error { secretsMap, err := LoadSecrets(paths) if err != nil { return err } a.secretsMap = secretsMap // Start one goroutine for each file to monitor and update the secret's values. for secretPath := range secretsMap { go a.reloadSecret(secretPath) } return nil }
[ "func", "(", "a", "*", "Agent", ")", "Start", "(", "paths", "[", "]", "string", ")", "error", "{", "secretsMap", ",", "err", ":=", "LoadSecrets", "(", "paths", ")", "\n", "if", "err", "!=", "nil", "{", "return", "err", "\n", "}", "\n", "a", ".", ...
// Start creates goroutines to monitor the files that contain the secret value.
[ "Start", "creates", "goroutines", "to", "monitor", "the", "files", "that", "contain", "the", "secret", "value", "." ]
8125fbda10178887be5dff9e901d6a0a519b67bc
https://github.com/kubernetes/test-infra/blob/8125fbda10178887be5dff9e901d6a0a519b67bc/prow/config/secret/agent.go#L35-L49
test
kubernetes/test-infra
prow/config/secret/agent.go
reloadSecret
func (a *Agent) reloadSecret(secretPath string) { var lastModTime time.Time logger := logrus.NewEntry(logrus.StandardLogger()) skips := 0 for range time.Tick(1 * time.Second) { if skips < 600 { // Check if the file changed to see if it needs to be re-read. secretStat, err := os.Stat(secretPath) if err !...
go
func (a *Agent) reloadSecret(secretPath string) { var lastModTime time.Time logger := logrus.NewEntry(logrus.StandardLogger()) skips := 0 for range time.Tick(1 * time.Second) { if skips < 600 { // Check if the file changed to see if it needs to be re-read. secretStat, err := os.Stat(secretPath) if err !...
[ "func", "(", "a", "*", "Agent", ")", "reloadSecret", "(", "secretPath", "string", ")", "{", "var", "lastModTime", "time", ".", "Time", "\n", "logger", ":=", "logrus", ".", "NewEntry", "(", "logrus", ".", "StandardLogger", "(", ")", ")", "\n", "skips", ...
// reloadSecret will begin polling the secret file at the path. If the first load // fails, Start with return the error and abort. Future load failures will log // the failure message but continue attempting to load.
[ "reloadSecret", "will", "begin", "polling", "the", "secret", "file", "at", "the", "path", ".", "If", "the", "first", "load", "fails", "Start", "with", "return", "the", "error", "and", "abort", ".", "Future", "load", "failures", "will", "log", "the", "failu...
8125fbda10178887be5dff9e901d6a0a519b67bc
https://github.com/kubernetes/test-infra/blob/8125fbda10178887be5dff9e901d6a0a519b67bc/prow/config/secret/agent.go#L54-L85
test
kubernetes/test-infra
prow/config/secret/agent.go
GetSecret
func (a *Agent) GetSecret(secretPath string) []byte { a.RLock() defer a.RUnlock() return a.secretsMap[secretPath] }
go
func (a *Agent) GetSecret(secretPath string) []byte { a.RLock() defer a.RUnlock() return a.secretsMap[secretPath] }
[ "func", "(", "a", "*", "Agent", ")", "GetSecret", "(", "secretPath", "string", ")", "[", "]", "byte", "{", "a", ".", "RLock", "(", ")", "\n", "defer", "a", ".", "RUnlock", "(", ")", "\n", "return", "a", ".", "secretsMap", "[", "secretPath", "]", ...
// GetSecret returns the value of a secret stored in a map.
[ "GetSecret", "returns", "the", "value", "of", "a", "secret", "stored", "in", "a", "map", "." ]
8125fbda10178887be5dff9e901d6a0a519b67bc
https://github.com/kubernetes/test-infra/blob/8125fbda10178887be5dff9e901d6a0a519b67bc/prow/config/secret/agent.go#L88-L92
test
kubernetes/test-infra
prow/config/secret/agent.go
setSecret
func (a *Agent) setSecret(secretPath string, secretValue []byte) { a.Lock() defer a.Unlock() a.secretsMap[secretPath] = secretValue }
go
func (a *Agent) setSecret(secretPath string, secretValue []byte) { a.Lock() defer a.Unlock() a.secretsMap[secretPath] = secretValue }
[ "func", "(", "a", "*", "Agent", ")", "setSecret", "(", "secretPath", "string", ",", "secretValue", "[", "]", "byte", ")", "{", "a", ".", "Lock", "(", ")", "\n", "defer", "a", ".", "Unlock", "(", ")", "\n", "a", ".", "secretsMap", "[", "secretPath",...
// setSecret sets a value in a map of secrets.
[ "setSecret", "sets", "a", "value", "in", "a", "map", "of", "secrets", "." ]
8125fbda10178887be5dff9e901d6a0a519b67bc
https://github.com/kubernetes/test-infra/blob/8125fbda10178887be5dff9e901d6a0a519b67bc/prow/config/secret/agent.go#L95-L99
test
kubernetes/test-infra
prow/config/secret/agent.go
GetTokenGenerator
func (a *Agent) GetTokenGenerator(secretPath string) func() []byte { return func() []byte { return a.GetSecret(secretPath) } }
go
func (a *Agent) GetTokenGenerator(secretPath string) func() []byte { return func() []byte { return a.GetSecret(secretPath) } }
[ "func", "(", "a", "*", "Agent", ")", "GetTokenGenerator", "(", "secretPath", "string", ")", "func", "(", ")", "[", "]", "byte", "{", "return", "func", "(", ")", "[", "]", "byte", "{", "return", "a", ".", "GetSecret", "(", "secretPath", ")", "\n", "...
// GetTokenGenerator returns a function that gets the value of a given secret.
[ "GetTokenGenerator", "returns", "a", "function", "that", "gets", "the", "value", "of", "a", "given", "secret", "." ]
8125fbda10178887be5dff9e901d6a0a519b67bc
https://github.com/kubernetes/test-infra/blob/8125fbda10178887be5dff9e901d6a0a519b67bc/prow/config/secret/agent.go#L102-L106
test
kubernetes/test-infra
prow/tide/history/history.go
New
func New(maxRecordsPerKey int, opener io.Opener, path string) (*History, error) { hist := &History{ logs: map[string]*recordLog{}, logSizeLimit: maxRecordsPerKey, opener: opener, path: path, } if path != "" { // Load existing history from GCS. var err error start := time.Now() ...
go
func New(maxRecordsPerKey int, opener io.Opener, path string) (*History, error) { hist := &History{ logs: map[string]*recordLog{}, logSizeLimit: maxRecordsPerKey, opener: opener, path: path, } if path != "" { // Load existing history from GCS. var err error start := time.Now() ...
[ "func", "New", "(", "maxRecordsPerKey", "int", ",", "opener", "io", ".", "Opener", ",", "path", "string", ")", "(", "*", "History", ",", "error", ")", "{", "hist", ":=", "&", "History", "{", "logs", ":", "map", "[", "string", "]", "*", "recordLog", ...
// New creates a new History struct with the specificed recordLog size limit.
[ "New", "creates", "a", "new", "History", "struct", "with", "the", "specificed", "recordLog", "size", "limit", "." ]
8125fbda10178887be5dff9e901d6a0a519b67bc
https://github.com/kubernetes/test-infra/blob/8125fbda10178887be5dff9e901d6a0a519b67bc/prow/tide/history/history.go#L114-L137
test
kubernetes/test-infra
prow/tide/history/history.go
Record
func (h *History) Record(poolKey, action, baseSHA, err string, targets []prowapi.Pull) { t := now() sort.Sort(ByNum(targets)) h.addRecord( poolKey, &Record{ Time: t, Action: action, BaseSHA: baseSHA, Target: targets, Err: err, }, ) }
go
func (h *History) Record(poolKey, action, baseSHA, err string, targets []prowapi.Pull) { t := now() sort.Sort(ByNum(targets)) h.addRecord( poolKey, &Record{ Time: t, Action: action, BaseSHA: baseSHA, Target: targets, Err: err, }, ) }
[ "func", "(", "h", "*", "History", ")", "Record", "(", "poolKey", ",", "action", ",", "baseSHA", ",", "err", "string", ",", "targets", "[", "]", "prowapi", ".", "Pull", ")", "{", "t", ":=", "now", "(", ")", "\n", "sort", ".", "Sort", "(", "ByNum",...
// Record appends an entry to the recordlog specified by the poolKey.
[ "Record", "appends", "an", "entry", "to", "the", "recordlog", "specified", "by", "the", "poolKey", "." ]
8125fbda10178887be5dff9e901d6a0a519b67bc
https://github.com/kubernetes/test-infra/blob/8125fbda10178887be5dff9e901d6a0a519b67bc/prow/tide/history/history.go#L140-L153
test