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
boskos/client/client.go
ReleaseAll
func (c *Client) ReleaseAll(dest string) error { c.lock.Lock() defer c.lock.Unlock() resources, err := c.storage.List() if err != nil { return err } if len(resources) == 0 { return fmt.Errorf("no holding resource") } var allErrors error for _, r := range resources { c.storage.Delete(r.GetName()) err :=...
go
func (c *Client) ReleaseAll(dest string) error { c.lock.Lock() defer c.lock.Unlock() resources, err := c.storage.List() if err != nil { return err } if len(resources) == 0 { return fmt.Errorf("no holding resource") } var allErrors error for _, r := range resources { c.storage.Delete(r.GetName()) err :=...
[ "func", "(", "c", "*", "Client", ")", "ReleaseAll", "(", "dest", "string", ")", "error", "{", "c", ".", "lock", ".", "Lock", "(", ")", "\n", "defer", "c", ".", "lock", ".", "Unlock", "(", ")", "\n", "resources", ",", "err", ":=", "c", ".", "sto...
// ReleaseAll returns all resources hold by the client back to boskos and set them to dest state.
[ "ReleaseAll", "returns", "all", "resources", "hold", "by", "the", "client", "back", "to", "boskos", "and", "set", "them", "to", "dest", "state", "." ]
8125fbda10178887be5dff9e901d6a0a519b67bc
https://github.com/kubernetes/test-infra/blob/8125fbda10178887be5dff9e901d6a0a519b67bc/boskos/client/client.go#L193-L212
test
kubernetes/test-infra
boskos/client/client.go
ReleaseOne
func (c *Client) ReleaseOne(name, dest string) error { c.lock.Lock() defer c.lock.Unlock() if _, err := c.storage.Get(name); err != nil { return fmt.Errorf("no resource name %v", name) } c.storage.Delete(name) if err := c.release(name, dest); err != nil { return err } return nil }
go
func (c *Client) ReleaseOne(name, dest string) error { c.lock.Lock() defer c.lock.Unlock() if _, err := c.storage.Get(name); err != nil { return fmt.Errorf("no resource name %v", name) } c.storage.Delete(name) if err := c.release(name, dest); err != nil { return err } return nil }
[ "func", "(", "c", "*", "Client", ")", "ReleaseOne", "(", "name", ",", "dest", "string", ")", "error", "{", "c", ".", "lock", ".", "Lock", "(", ")", "\n", "defer", "c", ".", "lock", ".", "Unlock", "(", ")", "\n", "if", "_", ",", "err", ":=", "...
// ReleaseOne returns one of owned resources back to boskos and set it to dest state.
[ "ReleaseOne", "returns", "one", "of", "owned", "resources", "back", "to", "boskos", "and", "set", "it", "to", "dest", "state", "." ]
8125fbda10178887be5dff9e901d6a0a519b67bc
https://github.com/kubernetes/test-infra/blob/8125fbda10178887be5dff9e901d6a0a519b67bc/boskos/client/client.go#L215-L227
test
kubernetes/test-infra
boskos/client/client.go
UpdateAll
func (c *Client) UpdateAll(state string) error { c.lock.Lock() defer c.lock.Unlock() resources, err := c.storage.List() if err != nil { return err } if len(resources) == 0 { return fmt.Errorf("no holding resource") } var allErrors error for _, r := range resources { if err := c.update(r.GetName(), state...
go
func (c *Client) UpdateAll(state string) error { c.lock.Lock() defer c.lock.Unlock() resources, err := c.storage.List() if err != nil { return err } if len(resources) == 0 { return fmt.Errorf("no holding resource") } var allErrors error for _, r := range resources { if err := c.update(r.GetName(), state...
[ "func", "(", "c", "*", "Client", ")", "UpdateAll", "(", "state", "string", ")", "error", "{", "c", ".", "lock", ".", "Lock", "(", ")", "\n", "defer", "c", ".", "lock", ".", "Unlock", "(", ")", "\n", "resources", ",", "err", ":=", "c", ".", "sto...
// UpdateAll signals update for all resources hold by the client.
[ "UpdateAll", "signals", "update", "for", "all", "resources", "hold", "by", "the", "client", "." ]
8125fbda10178887be5dff9e901d6a0a519b67bc
https://github.com/kubernetes/test-infra/blob/8125fbda10178887be5dff9e901d6a0a519b67bc/boskos/client/client.go#L230-L252
test
kubernetes/test-infra
boskos/client/client.go
SyncAll
func (c *Client) SyncAll() error { c.lock.Lock() defer c.lock.Unlock() resources, err := c.storage.List() if err != nil { return err } if len(resources) == 0 { logrus.Info("no resource to sync") return nil } var allErrors error for _, i := range resources { r, err := common.ItemToResource(i) if err ...
go
func (c *Client) SyncAll() error { c.lock.Lock() defer c.lock.Unlock() resources, err := c.storage.List() if err != nil { return err } if len(resources) == 0 { logrus.Info("no resource to sync") return nil } var allErrors error for _, i := range resources { r, err := common.ItemToResource(i) if err ...
[ "func", "(", "c", "*", "Client", ")", "SyncAll", "(", ")", "error", "{", "c", ".", "lock", ".", "Lock", "(", ")", "\n", "defer", "c", ".", "lock", ".", "Unlock", "(", ")", "\n", "resources", ",", "err", ":=", "c", ".", "storage", ".", "List", ...
// SyncAll signals update for all resources hold by the client.
[ "SyncAll", "signals", "update", "for", "all", "resources", "hold", "by", "the", "client", "." ]
8125fbda10178887be5dff9e901d6a0a519b67bc
https://github.com/kubernetes/test-infra/blob/8125fbda10178887be5dff9e901d6a0a519b67bc/boskos/client/client.go#L255-L283
test
kubernetes/test-infra
boskos/client/client.go
UpdateOne
func (c *Client) UpdateOne(name, state string, userData *common.UserData) error { c.lock.Lock() defer c.lock.Unlock() r, err := c.storage.Get(name) if err != nil { return fmt.Errorf("no resource name %v", name) } if err := c.update(r.GetName(), state, userData); err != nil { return err } return c.updateLoc...
go
func (c *Client) UpdateOne(name, state string, userData *common.UserData) error { c.lock.Lock() defer c.lock.Unlock() r, err := c.storage.Get(name) if err != nil { return fmt.Errorf("no resource name %v", name) } if err := c.update(r.GetName(), state, userData); err != nil { return err } return c.updateLoc...
[ "func", "(", "c", "*", "Client", ")", "UpdateOne", "(", "name", ",", "state", "string", ",", "userData", "*", "common", ".", "UserData", ")", "error", "{", "c", ".", "lock", ".", "Lock", "(", ")", "\n", "defer", "c", ".", "lock", ".", "Unlock", "...
// UpdateOne signals update for one of the resources hold by the client.
[ "UpdateOne", "signals", "update", "for", "one", "of", "the", "resources", "hold", "by", "the", "client", "." ]
8125fbda10178887be5dff9e901d6a0a519b67bc
https://github.com/kubernetes/test-infra/blob/8125fbda10178887be5dff9e901d6a0a519b67bc/boskos/client/client.go#L286-L298
test
kubernetes/test-infra
boskos/client/client.go
Metric
func (c *Client) Metric(rtype string) (common.Metric, error) { return c.metric(rtype) }
go
func (c *Client) Metric(rtype string) (common.Metric, error) { return c.metric(rtype) }
[ "func", "(", "c", "*", "Client", ")", "Metric", "(", "rtype", "string", ")", "(", "common", ".", "Metric", ",", "error", ")", "{", "return", "c", ".", "metric", "(", "rtype", ")", "\n", "}" ]
// Metric will query current metric for target resource type. // Return a common.Metric object on success.
[ "Metric", "will", "query", "current", "metric", "for", "target", "resource", "type", ".", "Return", "a", "common", ".", "Metric", "object", "on", "success", "." ]
8125fbda10178887be5dff9e901d6a0a519b67bc
https://github.com/kubernetes/test-infra/blob/8125fbda10178887be5dff9e901d6a0a519b67bc/boskos/client/client.go#L308-L310
test
kubernetes/test-infra
boskos/client/client.go
HasResource
func (c *Client) HasResource() bool { resources, _ := c.storage.List() return len(resources) > 0 }
go
func (c *Client) HasResource() bool { resources, _ := c.storage.List() return len(resources) > 0 }
[ "func", "(", "c", "*", "Client", ")", "HasResource", "(", ")", "bool", "{", "resources", ",", "_", ":=", "c", ".", "storage", ".", "List", "(", ")", "\n", "return", "len", "(", "resources", ")", ">", "0", "\n", "}" ]
// HasResource tells if current client holds any resources
[ "HasResource", "tells", "if", "current", "client", "holds", "any", "resources" ]
8125fbda10178887be5dff9e901d6a0a519b67bc
https://github.com/kubernetes/test-infra/blob/8125fbda10178887be5dff9e901d6a0a519b67bc/boskos/client/client.go#L313-L316
test
kubernetes/test-infra
boskos/client/client.go
DialContext
func (d *DialerWithRetry) DialContext(ctx context.Context, network, address string) (net.Conn, error) { // Always bump the retry count by 1 in order to equal the actual number of // attempts. For example, if a retry count of 2 is specified, the intent // is for three attempts -- the initial attempt with two retries ...
go
func (d *DialerWithRetry) DialContext(ctx context.Context, network, address string) (net.Conn, error) { // Always bump the retry count by 1 in order to equal the actual number of // attempts. For example, if a retry count of 2 is specified, the intent // is for three attempts -- the initial attempt with two retries ...
[ "func", "(", "d", "*", "DialerWithRetry", ")", "DialContext", "(", "ctx", "context", ".", "Context", ",", "network", ",", "address", "string", ")", "(", "net", ".", "Conn", ",", "error", ")", "{", "count", ":=", "d", ".", "RetryCount", "+", "1", "\n"...
// DialContext connects to the address on the named network using the provided context.
[ "DialContext", "connects", "to", "the", "address", "on", "the", "named", "network", "using", "the", "provided", "context", "." ]
8125fbda10178887be5dff9e901d6a0a519b67bc
https://github.com/kubernetes/test-infra/blob/8125fbda10178887be5dff9e901d6a0a519b67bc/boskos/client/client.go#L507-L533
test
kubernetes/test-infra
prow/prstatus/prstatus.go
NewDashboardAgent
func NewDashboardAgent(repos []string, config *config.GitHubOAuthConfig, log *logrus.Entry) *DashboardAgent { return &DashboardAgent{ repos: repos, goac: config, log: log, } }
go
func NewDashboardAgent(repos []string, config *config.GitHubOAuthConfig, log *logrus.Entry) *DashboardAgent { return &DashboardAgent{ repos: repos, goac: config, log: log, } }
[ "func", "NewDashboardAgent", "(", "repos", "[", "]", "string", ",", "config", "*", "config", ".", "GitHubOAuthConfig", ",", "log", "*", "logrus", ".", "Entry", ")", "*", "DashboardAgent", "{", "return", "&", "DashboardAgent", "{", "repos", ":", "repos", ",...
// NewDashboardAgent creates a new user dashboard agent .
[ "NewDashboardAgent", "creates", "a", "new", "user", "dashboard", "agent", "." ]
8125fbda10178887be5dff9e901d6a0a519b67bc
https://github.com/kubernetes/test-infra/blob/8125fbda10178887be5dff9e901d6a0a519b67bc/prow/prstatus/prstatus.go#L146-L152
test
kubernetes/test-infra
prow/prstatus/prstatus.go
QueryPullRequests
func (da *DashboardAgent) QueryPullRequests(ctx context.Context, ghc githubClient, query string) ([]PullRequest, error) { var prs []PullRequest vars := map[string]interface{}{ "query": (githubql.String)(query), "searchCursor": (*githubql.String)(nil), } var totalCost int var remaining int for { sq :=...
go
func (da *DashboardAgent) QueryPullRequests(ctx context.Context, ghc githubClient, query string) ([]PullRequest, error) { var prs []PullRequest vars := map[string]interface{}{ "query": (githubql.String)(query), "searchCursor": (*githubql.String)(nil), } var totalCost int var remaining int for { sq :=...
[ "func", "(", "da", "*", "DashboardAgent", ")", "QueryPullRequests", "(", "ctx", "context", ".", "Context", ",", "ghc", "githubClient", ",", "query", "string", ")", "(", "[", "]", "PullRequest", ",", "error", ")", "{", "var", "prs", "[", "]", "PullRequest...
// QueryPullRequests is a query function that returns a list of open pull requests owned by the user whose access token // is consumed by the github client.
[ "QueryPullRequests", "is", "a", "query", "function", "that", "returns", "a", "list", "of", "open", "pull", "requests", "owned", "by", "the", "user", "whose", "access", "token", "is", "consumed", "by", "the", "github", "client", "." ]
8125fbda10178887be5dff9e901d6a0a519b67bc
https://github.com/kubernetes/test-infra/blob/8125fbda10178887be5dff9e901d6a0a519b67bc/prow/prstatus/prstatus.go#L292-L317
test
kubernetes/test-infra
prow/prstatus/prstatus.go
GetHeadContexts
func (da *DashboardAgent) GetHeadContexts(ghc githubClient, pr PullRequest) ([]Context, error) { org := string(pr.Repository.Owner.Login) repo := string(pr.Repository.Name) combined, err := ghc.GetCombinedStatus(org, repo, string(pr.HeadRefOID)) if err != nil { return nil, fmt.Errorf("failed to get the combined s...
go
func (da *DashboardAgent) GetHeadContexts(ghc githubClient, pr PullRequest) ([]Context, error) { org := string(pr.Repository.Owner.Login) repo := string(pr.Repository.Name) combined, err := ghc.GetCombinedStatus(org, repo, string(pr.HeadRefOID)) if err != nil { return nil, fmt.Errorf("failed to get the combined s...
[ "func", "(", "da", "*", "DashboardAgent", ")", "GetHeadContexts", "(", "ghc", "githubClient", ",", "pr", "PullRequest", ")", "(", "[", "]", "Context", ",", "error", ")", "{", "org", ":=", "string", "(", "pr", ".", "Repository", ".", "Owner", ".", "Logi...
// GetHeadContexts returns the status checks' contexts of the head commit of the PR.
[ "GetHeadContexts", "returns", "the", "status", "checks", "contexts", "of", "the", "head", "commit", "of", "the", "PR", "." ]
8125fbda10178887be5dff9e901d6a0a519b67bc
https://github.com/kubernetes/test-infra/blob/8125fbda10178887be5dff9e901d6a0a519b67bc/prow/prstatus/prstatus.go#L320-L339
test
kubernetes/test-infra
prow/prstatus/prstatus.go
ConstructSearchQuery
func (da *DashboardAgent) ConstructSearchQuery(login string) string { tokens := []string{"is:pr", "state:open", "author:" + login} for i := range da.repos { tokens = append(tokens, fmt.Sprintf("repo:\"%s\"", da.repos[i])) } return strings.Join(tokens, " ") }
go
func (da *DashboardAgent) ConstructSearchQuery(login string) string { tokens := []string{"is:pr", "state:open", "author:" + login} for i := range da.repos { tokens = append(tokens, fmt.Sprintf("repo:\"%s\"", da.repos[i])) } return strings.Join(tokens, " ") }
[ "func", "(", "da", "*", "DashboardAgent", ")", "ConstructSearchQuery", "(", "login", "string", ")", "string", "{", "tokens", ":=", "[", "]", "string", "{", "\"is:pr\"", ",", "\"state:open\"", ",", "\"author:\"", "+", "login", "}", "\n", "for", "i", ":=", ...
// ConstructSearchQuery returns the GitHub search query string for PRs that are open and authored // by the user passed. The search is scoped to repositories that are configured with either Prow or // Tide.
[ "ConstructSearchQuery", "returns", "the", "GitHub", "search", "query", "string", "for", "PRs", "that", "are", "open", "and", "authored", "by", "the", "user", "passed", ".", "The", "search", "is", "scoped", "to", "repositories", "that", "are", "configured", "wi...
8125fbda10178887be5dff9e901d6a0a519b67bc
https://github.com/kubernetes/test-infra/blob/8125fbda10178887be5dff9e901d6a0a519b67bc/prow/prstatus/prstatus.go#L344-L350
test
kubernetes/test-infra
velodrome/transform/plugins/bundle.go
NewBundledStates
func NewBundledStates(description string) BundledStates { return BundledStates{ description: description, states: map[string]State{}, } }
go
func NewBundledStates(description string) BundledStates { return BundledStates{ description: description, states: map[string]State{}, } }
[ "func", "NewBundledStates", "(", "description", "string", ")", "BundledStates", "{", "return", "BundledStates", "{", "description", ":", "description", ",", "states", ":", "map", "[", "string", "]", "State", "{", "}", ",", "}", "\n", "}" ]
// NewBundledStates is the constructor for BundledStates
[ "NewBundledStates", "is", "the", "constructor", "for", "BundledStates" ]
8125fbda10178887be5dff9e901d6a0a519b67bc
https://github.com/kubernetes/test-infra/blob/8125fbda10178887be5dff9e901d6a0a519b67bc/velodrome/transform/plugins/bundle.go#L47-L52
test
kubernetes/test-infra
velodrome/transform/plugins/bundle.go
ReceiveEvent
func (b BundledStates) ReceiveEvent(ID string, eventName, label string, t time.Time) bool { state, ok := b.states[ID] if !ok { state = NewState(b.description) } state, changed := state.ReceiveEvent(eventName, label, t) b.states[ID] = state return changed }
go
func (b BundledStates) ReceiveEvent(ID string, eventName, label string, t time.Time) bool { state, ok := b.states[ID] if !ok { state = NewState(b.description) } state, changed := state.ReceiveEvent(eventName, label, t) b.states[ID] = state return changed }
[ "func", "(", "b", "BundledStates", ")", "ReceiveEvent", "(", "ID", "string", ",", "eventName", ",", "label", "string", ",", "t", "time", ".", "Time", ")", "bool", "{", "state", ",", "ok", ":=", "b", ".", "states", "[", "ID", "]", "\n", "if", "!", ...
// ReceiveEvent is called when something happens on an issue. The state // for that issue is updated.
[ "ReceiveEvent", "is", "called", "when", "something", "happens", "on", "an", "issue", ".", "The", "state", "for", "that", "issue", "is", "updated", "." ]
8125fbda10178887be5dff9e901d6a0a519b67bc
https://github.com/kubernetes/test-infra/blob/8125fbda10178887be5dff9e901d6a0a519b67bc/velodrome/transform/plugins/bundle.go#L56-L64
test
kubernetes/test-infra
velodrome/transform/plugins/bundle.go
ages
func (b BundledStates) ages(t time.Time) map[string]time.Duration { ages := map[string]time.Duration{} for id, state := range b.states { if !state.Active() { continue } ages[id] = state.Age(t) } return ages }
go
func (b BundledStates) ages(t time.Time) map[string]time.Duration { ages := map[string]time.Duration{} for id, state := range b.states { if !state.Active() { continue } ages[id] = state.Age(t) } return ages }
[ "func", "(", "b", "BundledStates", ")", "ages", "(", "t", "time", ".", "Time", ")", "map", "[", "string", "]", "time", ".", "Duration", "{", "ages", ":=", "map", "[", "string", "]", "time", ".", "Duration", "{", "}", "\n", "for", "id", ",", "stat...
// ages return the age of each active states
[ "ages", "return", "the", "age", "of", "each", "active", "states" ]
8125fbda10178887be5dff9e901d6a0a519b67bc
https://github.com/kubernetes/test-infra/blob/8125fbda10178887be5dff9e901d6a0a519b67bc/velodrome/transform/plugins/bundle.go#L67-L77
test
kubernetes/test-infra
velodrome/transform/plugins/bundle.go
Percentile
func (b BundledStates) Percentile(t time.Time, percentile int) time.Duration { if percentile > 100 || percentile <= 0 { panic(fmt.Errorf("percentile %d is out of scope", percentile)) } ages := []time.Duration{} for _, age := range b.ages(t) { ages = append(ages, age) } if len(ages) == 0 { return 0 } so...
go
func (b BundledStates) Percentile(t time.Time, percentile int) time.Duration { if percentile > 100 || percentile <= 0 { panic(fmt.Errorf("percentile %d is out of scope", percentile)) } ages := []time.Duration{} for _, age := range b.ages(t) { ages = append(ages, age) } if len(ages) == 0 { return 0 } so...
[ "func", "(", "b", "BundledStates", ")", "Percentile", "(", "t", "time", ".", "Time", ",", "percentile", "int", ")", "time", ".", "Duration", "{", "if", "percentile", ">", "100", "||", "percentile", "<=", "0", "{", "panic", "(", "fmt", ".", "Errorf", ...
// Percentile returns given percentile for age of all active states at time t
[ "Percentile", "returns", "given", "percentile", "for", "age", "of", "all", "active", "states", "at", "time", "t" ]
8125fbda10178887be5dff9e901d6a0a519b67bc
https://github.com/kubernetes/test-infra/blob/8125fbda10178887be5dff9e901d6a0a519b67bc/velodrome/transform/plugins/bundle.go#L89-L110
test
kubernetes/test-infra
prow/jenkins/metrics.go
NewMetrics
func NewMetrics() *Metrics { return &Metrics{ ClientMetrics: &ClientMetrics{ Requests: requests, RequestRetries: requestRetries, RequestLatency: requestLatency, }, ResyncPeriod: resyncPeriod, } }
go
func NewMetrics() *Metrics { return &Metrics{ ClientMetrics: &ClientMetrics{ Requests: requests, RequestRetries: requestRetries, RequestLatency: requestLatency, }, ResyncPeriod: resyncPeriod, } }
[ "func", "NewMetrics", "(", ")", "*", "Metrics", "{", "return", "&", "Metrics", "{", "ClientMetrics", ":", "&", "ClientMetrics", "{", "Requests", ":", "requests", ",", "RequestRetries", ":", "requestRetries", ",", "RequestLatency", ":", "requestLatency", ",", "...
// NewMetrics creates a new set of metrics for the Jenkins operator.
[ "NewMetrics", "creates", "a", "new", "set", "of", "metrics", "for", "the", "Jenkins", "operator", "." ]
8125fbda10178887be5dff9e901d6a0a519b67bc
https://github.com/kubernetes/test-infra/blob/8125fbda10178887be5dff9e901d6a0a519b67bc/prow/jenkins/metrics.go#L76-L85
test
kubernetes/test-infra
ghproxy/ghcache/ghcache.go
NewDiskCache
func NewDiskCache(delegate http.RoundTripper, cacheDir string, cacheSizeGB, maxConcurrency int) http.RoundTripper { return NewFromCache(delegate, diskcache.NewWithDiskv( diskv.New(diskv.Options{ BasePath: path.Join(cacheDir, "data"), TempDir: path.Join(cacheDir, "temp"), CacheSizeMax: uint64(cacheS...
go
func NewDiskCache(delegate http.RoundTripper, cacheDir string, cacheSizeGB, maxConcurrency int) http.RoundTripper { return NewFromCache(delegate, diskcache.NewWithDiskv( diskv.New(diskv.Options{ BasePath: path.Join(cacheDir, "data"), TempDir: path.Join(cacheDir, "temp"), CacheSizeMax: uint64(cacheS...
[ "func", "NewDiskCache", "(", "delegate", "http", ".", "RoundTripper", ",", "cacheDir", "string", ",", "cacheSizeGB", ",", "maxConcurrency", "int", ")", "http", ".", "RoundTripper", "{", "return", "NewFromCache", "(", "delegate", ",", "diskcache", ".", "NewWithDi...
// NewDiskCache creates a GitHub cache RoundTripper that is backed by a disk // cache.
[ "NewDiskCache", "creates", "a", "GitHub", "cache", "RoundTripper", "that", "is", "backed", "by", "a", "disk", "cache", "." ]
8125fbda10178887be5dff9e901d6a0a519b67bc
https://github.com/kubernetes/test-infra/blob/8125fbda10178887be5dff9e901d6a0a519b67bc/ghproxy/ghcache/ghcache.go#L176-L185
test
kubernetes/test-infra
ghproxy/ghcache/ghcache.go
NewMemCache
func NewMemCache(delegate http.RoundTripper, maxConcurrency int) http.RoundTripper { return NewFromCache(delegate, httpcache.NewMemoryCache(), maxConcurrency) }
go
func NewMemCache(delegate http.RoundTripper, maxConcurrency int) http.RoundTripper { return NewFromCache(delegate, httpcache.NewMemoryCache(), maxConcurrency) }
[ "func", "NewMemCache", "(", "delegate", "http", ".", "RoundTripper", ",", "maxConcurrency", "int", ")", "http", ".", "RoundTripper", "{", "return", "NewFromCache", "(", "delegate", ",", "httpcache", ".", "NewMemoryCache", "(", ")", ",", "maxConcurrency", ")", ...
// NewMemCache creates a GitHub cache RoundTripper that is backed by a memory // cache.
[ "NewMemCache", "creates", "a", "GitHub", "cache", "RoundTripper", "that", "is", "backed", "by", "a", "memory", "cache", "." ]
8125fbda10178887be5dff9e901d6a0a519b67bc
https://github.com/kubernetes/test-infra/blob/8125fbda10178887be5dff9e901d6a0a519b67bc/ghproxy/ghcache/ghcache.go#L189-L191
test
kubernetes/test-infra
ghproxy/ghcache/ghcache.go
NewFromCache
func NewFromCache(delegate http.RoundTripper, cache httpcache.Cache, maxConcurrency int) http.RoundTripper { cacheTransport := httpcache.NewTransport(cache) cacheTransport.Transport = newThrottlingTransport(maxConcurrency, upstreamTransport{delegate: delegate}) return &requestCoalescer{ keys: make(map[string]*...
go
func NewFromCache(delegate http.RoundTripper, cache httpcache.Cache, maxConcurrency int) http.RoundTripper { cacheTransport := httpcache.NewTransport(cache) cacheTransport.Transport = newThrottlingTransport(maxConcurrency, upstreamTransport{delegate: delegate}) return &requestCoalescer{ keys: make(map[string]*...
[ "func", "NewFromCache", "(", "delegate", "http", ".", "RoundTripper", ",", "cache", "httpcache", ".", "Cache", ",", "maxConcurrency", "int", ")", "http", ".", "RoundTripper", "{", "cacheTransport", ":=", "httpcache", ".", "NewTransport", "(", "cache", ")", "\n...
// NewFromCache creates a GitHub cache RoundTripper that is backed by the // specified httpcache.Cache implementation.
[ "NewFromCache", "creates", "a", "GitHub", "cache", "RoundTripper", "that", "is", "backed", "by", "the", "specified", "httpcache", ".", "Cache", "implementation", "." ]
8125fbda10178887be5dff9e901d6a0a519b67bc
https://github.com/kubernetes/test-infra/blob/8125fbda10178887be5dff9e901d6a0a519b67bc/ghproxy/ghcache/ghcache.go#L195-L202
test
kubernetes/test-infra
prow/client/clientset/versioned/fake/clientset_generated.go
ProwV1
func (c *Clientset) ProwV1() prowv1.ProwV1Interface { return &fakeprowv1.FakeProwV1{Fake: &c.Fake} }
go
func (c *Clientset) ProwV1() prowv1.ProwV1Interface { return &fakeprowv1.FakeProwV1{Fake: &c.Fake} }
[ "func", "(", "c", "*", "Clientset", ")", "ProwV1", "(", ")", "prowv1", ".", "ProwV1Interface", "{", "return", "&", "fakeprowv1", ".", "FakeProwV1", "{", "Fake", ":", "&", "c", ".", "Fake", "}", "\n", "}" ]
// ProwV1 retrieves the ProwV1Client
[ "ProwV1", "retrieves", "the", "ProwV1Client" ]
8125fbda10178887be5dff9e901d6a0a519b67bc
https://github.com/kubernetes/test-infra/blob/8125fbda10178887be5dff9e901d6a0a519b67bc/prow/client/clientset/versioned/fake/clientset_generated.go#L75-L77
test
kubernetes/test-infra
prow/client/clientset/versioned/fake/clientset_generated.go
Prow
func (c *Clientset) Prow() prowv1.ProwV1Interface { return &fakeprowv1.FakeProwV1{Fake: &c.Fake} }
go
func (c *Clientset) Prow() prowv1.ProwV1Interface { return &fakeprowv1.FakeProwV1{Fake: &c.Fake} }
[ "func", "(", "c", "*", "Clientset", ")", "Prow", "(", ")", "prowv1", ".", "ProwV1Interface", "{", "return", "&", "fakeprowv1", ".", "FakeProwV1", "{", "Fake", ":", "&", "c", ".", "Fake", "}", "\n", "}" ]
// Prow retrieves the ProwV1Client
[ "Prow", "retrieves", "the", "ProwV1Client" ]
8125fbda10178887be5dff9e901d6a0a519b67bc
https://github.com/kubernetes/test-infra/blob/8125fbda10178887be5dff9e901d6a0a519b67bc/prow/client/clientset/versioned/fake/clientset_generated.go#L80-L82
test
kubernetes/test-infra
prow/plugins/approve/approvers/owners.go
NewOwners
func NewOwners(log *logrus.Entry, filenames []string, r Repo, s int64) Owners { return Owners{filenames: filenames, repo: r, seed: s, log: log} }
go
func NewOwners(log *logrus.Entry, filenames []string, r Repo, s int64) Owners { return Owners{filenames: filenames, repo: r, seed: s, log: log} }
[ "func", "NewOwners", "(", "log", "*", "logrus", ".", "Entry", ",", "filenames", "[", "]", "string", ",", "r", "Repo", ",", "s", "int64", ")", "Owners", "{", "return", "Owners", "{", "filenames", ":", "filenames", ",", "repo", ":", "r", ",", "seed", ...
// NewOwners consturcts a new Owners instance. filenames is the slice of files changed.
[ "NewOwners", "consturcts", "a", "new", "Owners", "instance", ".", "filenames", "is", "the", "slice", "of", "files", "changed", "." ]
8125fbda10178887be5dff9e901d6a0a519b67bc
https://github.com/kubernetes/test-infra/blob/8125fbda10178887be5dff9e901d6a0a519b67bc/prow/plugins/approve/approvers/owners.go#L59-L61
test
kubernetes/test-infra
prow/plugins/approve/approvers/owners.go
GetApprovers
func (o Owners) GetApprovers() map[string]sets.String { ownersToApprovers := map[string]sets.String{} for fn := range o.GetOwnersSet() { ownersToApprovers[fn] = o.repo.Approvers(fn) } return ownersToApprovers }
go
func (o Owners) GetApprovers() map[string]sets.String { ownersToApprovers := map[string]sets.String{} for fn := range o.GetOwnersSet() { ownersToApprovers[fn] = o.repo.Approvers(fn) } return ownersToApprovers }
[ "func", "(", "o", "Owners", ")", "GetApprovers", "(", ")", "map", "[", "string", "]", "sets", ".", "String", "{", "ownersToApprovers", ":=", "map", "[", "string", "]", "sets", ".", "String", "{", "}", "\n", "for", "fn", ":=", "range", "o", ".", "Ge...
// GetApprovers returns a map from ownersFiles -> people that are approvers in them
[ "GetApprovers", "returns", "a", "map", "from", "ownersFiles", "-", ">", "people", "that", "are", "approvers", "in", "them" ]
8125fbda10178887be5dff9e901d6a0a519b67bc
https://github.com/kubernetes/test-infra/blob/8125fbda10178887be5dff9e901d6a0a519b67bc/prow/plugins/approve/approvers/owners.go#L64-L72
test
kubernetes/test-infra
prow/plugins/approve/approvers/owners.go
GetAllPotentialApprovers
func (o Owners) GetAllPotentialApprovers() []string { approversOnly := []string{} for _, approverList := range o.GetLeafApprovers() { for approver := range approverList { approversOnly = append(approversOnly, approver) } } sort.Strings(approversOnly) if len(approversOnly) == 0 { o.log.Debug("No potential ...
go
func (o Owners) GetAllPotentialApprovers() []string { approversOnly := []string{} for _, approverList := range o.GetLeafApprovers() { for approver := range approverList { approversOnly = append(approversOnly, approver) } } sort.Strings(approversOnly) if len(approversOnly) == 0 { o.log.Debug("No potential ...
[ "func", "(", "o", "Owners", ")", "GetAllPotentialApprovers", "(", ")", "[", "]", "string", "{", "approversOnly", ":=", "[", "]", "string", "{", "}", "\n", "for", "_", ",", "approverList", ":=", "range", "o", ".", "GetLeafApprovers", "(", ")", "{", "for...
// GetAllPotentialApprovers returns the people from relevant owners files needed to get the PR approved
[ "GetAllPotentialApprovers", "returns", "the", "people", "from", "relevant", "owners", "files", "needed", "to", "get", "the", "PR", "approved" ]
8125fbda10178887be5dff9e901d6a0a519b67bc
https://github.com/kubernetes/test-infra/blob/8125fbda10178887be5dff9e901d6a0a519b67bc/prow/plugins/approve/approvers/owners.go#L86-L98
test
kubernetes/test-infra
prow/plugins/approve/approvers/owners.go
GetReverseMap
func (o Owners) GetReverseMap(approvers map[string]sets.String) map[string]sets.String { approverOwnersfiles := map[string]sets.String{} for ownersFile, approvers := range approvers { for approver := range approvers { if _, ok := approverOwnersfiles[approver]; ok { approverOwnersfiles[approver].Insert(owners...
go
func (o Owners) GetReverseMap(approvers map[string]sets.String) map[string]sets.String { approverOwnersfiles := map[string]sets.String{} for ownersFile, approvers := range approvers { for approver := range approvers { if _, ok := approverOwnersfiles[approver]; ok { approverOwnersfiles[approver].Insert(owners...
[ "func", "(", "o", "Owners", ")", "GetReverseMap", "(", "approvers", "map", "[", "string", "]", "sets", ".", "String", ")", "map", "[", "string", "]", "sets", ".", "String", "{", "approverOwnersfiles", ":=", "map", "[", "string", "]", "sets", ".", "Stri...
// GetReverseMap returns a map from people -> OWNERS files for which they are an approver
[ "GetReverseMap", "returns", "a", "map", "from", "people", "-", ">", "OWNERS", "files", "for", "which", "they", "are", "an", "approver" ]
8125fbda10178887be5dff9e901d6a0a519b67bc
https://github.com/kubernetes/test-infra/blob/8125fbda10178887be5dff9e901d6a0a519b67bc/prow/plugins/approve/approvers/owners.go#L101-L113
test
kubernetes/test-infra
prow/plugins/approve/approvers/owners.go
temporaryUnapprovedFiles
func (o Owners) temporaryUnapprovedFiles(approvers sets.String) sets.String { ap := NewApprovers(o) for approver := range approvers { ap.AddApprover(approver, "", false) } return ap.UnapprovedFiles() }
go
func (o Owners) temporaryUnapprovedFiles(approvers sets.String) sets.String { ap := NewApprovers(o) for approver := range approvers { ap.AddApprover(approver, "", false) } return ap.UnapprovedFiles() }
[ "func", "(", "o", "Owners", ")", "temporaryUnapprovedFiles", "(", "approvers", "sets", ".", "String", ")", "sets", ".", "String", "{", "ap", ":=", "NewApprovers", "(", "o", ")", "\n", "for", "approver", ":=", "range", "approvers", "{", "ap", ".", "AddApp...
// temporaryUnapprovedFiles returns the list of files that wouldn't be // approved by the given set of approvers.
[ "temporaryUnapprovedFiles", "returns", "the", "list", "of", "files", "that", "wouldn", "t", "be", "approved", "by", "the", "given", "set", "of", "approvers", "." ]
8125fbda10178887be5dff9e901d6a0a519b67bc
https://github.com/kubernetes/test-infra/blob/8125fbda10178887be5dff9e901d6a0a519b67bc/prow/plugins/approve/approvers/owners.go#L130-L136
test
kubernetes/test-infra
prow/plugins/approve/approvers/owners.go
KeepCoveringApprovers
func (o Owners) KeepCoveringApprovers(reverseMap map[string]sets.String, knownApprovers sets.String, potentialApprovers []string) sets.String { if len(potentialApprovers) == 0 { o.log.Debug("No potential approvers exist to filter for relevance. Does this repo have OWNERS files?") } keptApprovers := sets.NewString(...
go
func (o Owners) KeepCoveringApprovers(reverseMap map[string]sets.String, knownApprovers sets.String, potentialApprovers []string) sets.String { if len(potentialApprovers) == 0 { o.log.Debug("No potential approvers exist to filter for relevance. Does this repo have OWNERS files?") } keptApprovers := sets.NewString(...
[ "func", "(", "o", "Owners", ")", "KeepCoveringApprovers", "(", "reverseMap", "map", "[", "string", "]", "sets", ".", "String", ",", "knownApprovers", "sets", ".", "String", ",", "potentialApprovers", "[", "]", "string", ")", "sets", ".", "String", "{", "if...
// KeepCoveringApprovers finds who we should keep as suggested approvers given a pre-selection // knownApprovers must be a subset of potentialApprovers.
[ "KeepCoveringApprovers", "finds", "who", "we", "should", "keep", "as", "suggested", "approvers", "given", "a", "pre", "-", "selection", "knownApprovers", "must", "be", "a", "subset", "of", "potentialApprovers", "." ]
8125fbda10178887be5dff9e901d6a0a519b67bc
https://github.com/kubernetes/test-infra/blob/8125fbda10178887be5dff9e901d6a0a519b67bc/prow/plugins/approve/approvers/owners.go#L140-L155
test
kubernetes/test-infra
prow/plugins/approve/approvers/owners.go
GetSuggestedApprovers
func (o Owners) GetSuggestedApprovers(reverseMap map[string]sets.String, potentialApprovers []string) sets.String { ap := NewApprovers(o) for !ap.RequirementsMet() { newApprover := findMostCoveringApprover(potentialApprovers, reverseMap, ap.UnapprovedFiles()) if newApprover == "" { o.log.Warnf("Couldn't find/s...
go
func (o Owners) GetSuggestedApprovers(reverseMap map[string]sets.String, potentialApprovers []string) sets.String { ap := NewApprovers(o) for !ap.RequirementsMet() { newApprover := findMostCoveringApprover(potentialApprovers, reverseMap, ap.UnapprovedFiles()) if newApprover == "" { o.log.Warnf("Couldn't find/s...
[ "func", "(", "o", "Owners", ")", "GetSuggestedApprovers", "(", "reverseMap", "map", "[", "string", "]", "sets", ".", "String", ",", "potentialApprovers", "[", "]", "string", ")", "sets", ".", "String", "{", "ap", ":=", "NewApprovers", "(", "o", ")", "\n"...
// GetSuggestedApprovers solves the exact cover problem, finding an approver capable of // approving every OWNERS file in the PR
[ "GetSuggestedApprovers", "solves", "the", "exact", "cover", "problem", "finding", "an", "approver", "capable", "of", "approving", "every", "OWNERS", "file", "in", "the", "PR" ]
8125fbda10178887be5dff9e901d6a0a519b67bc
https://github.com/kubernetes/test-infra/blob/8125fbda10178887be5dff9e901d6a0a519b67bc/prow/plugins/approve/approvers/owners.go#L159-L171
test
kubernetes/test-infra
prow/plugins/approve/approvers/owners.go
GetOwnersSet
func (o Owners) GetOwnersSet() sets.String { owners := sets.NewString() for _, fn := range o.filenames { owners.Insert(o.repo.FindApproverOwnersForFile(fn)) } o.removeSubdirs(owners) return owners }
go
func (o Owners) GetOwnersSet() sets.String { owners := sets.NewString() for _, fn := range o.filenames { owners.Insert(o.repo.FindApproverOwnersForFile(fn)) } o.removeSubdirs(owners) return owners }
[ "func", "(", "o", "Owners", ")", "GetOwnersSet", "(", ")", "sets", ".", "String", "{", "owners", ":=", "sets", ".", "NewString", "(", ")", "\n", "for", "_", ",", "fn", ":=", "range", "o", ".", "filenames", "{", "owners", ".", "Insert", "(", "o", ...
// GetOwnersSet returns a set containing all the Owners files necessary to get the PR approved
[ "GetOwnersSet", "returns", "a", "set", "containing", "all", "the", "Owners", "files", "necessary", "to", "get", "the", "PR", "approved" ]
8125fbda10178887be5dff9e901d6a0a519b67bc
https://github.com/kubernetes/test-infra/blob/8125fbda10178887be5dff9e901d6a0a519b67bc/prow/plugins/approve/approvers/owners.go#L174-L181
test
kubernetes/test-infra
prow/plugins/approve/approvers/owners.go
GetShuffledApprovers
func (o Owners) GetShuffledApprovers() []string { approversList := o.GetAllPotentialApprovers() order := rand.New(rand.NewSource(o.seed)).Perm(len(approversList)) people := make([]string, 0, len(approversList)) for _, i := range order { people = append(people, approversList[i]) } return people }
go
func (o Owners) GetShuffledApprovers() []string { approversList := o.GetAllPotentialApprovers() order := rand.New(rand.NewSource(o.seed)).Perm(len(approversList)) people := make([]string, 0, len(approversList)) for _, i := range order { people = append(people, approversList[i]) } return people }
[ "func", "(", "o", "Owners", ")", "GetShuffledApprovers", "(", ")", "[", "]", "string", "{", "approversList", ":=", "o", ".", "GetAllPotentialApprovers", "(", ")", "\n", "order", ":=", "rand", ".", "New", "(", "rand", ".", "NewSource", "(", "o", ".", "s...
// GetShuffledApprovers shuffles the potential approvers so that we don't // always suggest the same people.
[ "GetShuffledApprovers", "shuffles", "the", "potential", "approvers", "so", "that", "we", "don", "t", "always", "suggest", "the", "same", "people", "." ]
8125fbda10178887be5dff9e901d6a0a519b67bc
https://github.com/kubernetes/test-infra/blob/8125fbda10178887be5dff9e901d6a0a519b67bc/prow/plugins/approve/approvers/owners.go#L185-L193
test
kubernetes/test-infra
prow/plugins/approve/approvers/owners.go
String
func (a Approval) String() string { return fmt.Sprintf( `*<a href="%s" title="%s">%s</a>*`, a.Reference, a.How, a.Login, ) }
go
func (a Approval) String() string { return fmt.Sprintf( `*<a href="%s" title="%s">%s</a>*`, a.Reference, a.How, a.Login, ) }
[ "func", "(", "a", "Approval", ")", "String", "(", ")", "string", "{", "return", "fmt", ".", "Sprintf", "(", "`*<a href=\"%s\" title=\"%s\">%s</a>*`", ",", "a", ".", "Reference", ",", "a", ".", "How", ",", "a", ".", "Login", ",", ")", "\n", "}" ]
// String creates a link for the approval. Use `Login` if you just want the name.
[ "String", "creates", "a", "link", "for", "the", "approval", ".", "Use", "Login", "if", "you", "just", "want", "the", "name", "." ]
8125fbda10178887be5dff9e901d6a0a519b67bc
https://github.com/kubernetes/test-infra/blob/8125fbda10178887be5dff9e901d6a0a519b67bc/prow/plugins/approve/approvers/owners.go#L231-L238
test
kubernetes/test-infra
prow/plugins/approve/approvers/owners.go
IntersectSetsCase
func IntersectSetsCase(one, other sets.String) sets.String { lower := sets.NewString() for item := range other { lower.Insert(strings.ToLower(item)) } intersection := sets.NewString() for item := range one { if lower.Has(strings.ToLower(item)) { intersection.Insert(item) } } return intersection }
go
func IntersectSetsCase(one, other sets.String) sets.String { lower := sets.NewString() for item := range other { lower.Insert(strings.ToLower(item)) } intersection := sets.NewString() for item := range one { if lower.Has(strings.ToLower(item)) { intersection.Insert(item) } } return intersection }
[ "func", "IntersectSetsCase", "(", "one", ",", "other", "sets", ".", "String", ")", "sets", ".", "String", "{", "lower", ":=", "sets", ".", "NewString", "(", ")", "\n", "for", "item", ":=", "range", "other", "{", "lower", ".", "Insert", "(", "strings", ...
// IntersectSetsCase runs the intersection between to sets.String in a // case-insensitive way. It returns the name with the case of "one".
[ "IntersectSetsCase", "runs", "the", "intersection", "between", "to", "sets", ".", "String", "in", "a", "case", "-", "insensitive", "way", ".", "It", "returns", "the", "name", "with", "the", "case", "of", "one", "." ]
8125fbda10178887be5dff9e901d6a0a519b67bc
https://github.com/kubernetes/test-infra/blob/8125fbda10178887be5dff9e901d6a0a519b67bc/prow/plugins/approve/approvers/owners.go#L254-L267
test
kubernetes/test-infra
prow/plugins/approve/approvers/owners.go
NewApprovers
func NewApprovers(owners Owners) Approvers { return Approvers{ owners: owners, approvers: map[string]Approval{}, assignees: sets.NewString(), ManuallyApproved: func() bool { return false }, } }
go
func NewApprovers(owners Owners) Approvers { return Approvers{ owners: owners, approvers: map[string]Approval{}, assignees: sets.NewString(), ManuallyApproved: func() bool { return false }, } }
[ "func", "NewApprovers", "(", "owners", "Owners", ")", "Approvers", "{", "return", "Approvers", "{", "owners", ":", "owners", ",", "approvers", ":", "map", "[", "string", "]", "Approval", "{", "}", ",", "assignees", ":", "sets", ".", "NewString", "(", ")"...
// NewApprovers create a new "Approvers" with no approval.
[ "NewApprovers", "create", "a", "new", "Approvers", "with", "no", "approval", "." ]
8125fbda10178887be5dff9e901d6a0a519b67bc
https://github.com/kubernetes/test-infra/blob/8125fbda10178887be5dff9e901d6a0a519b67bc/prow/plugins/approve/approvers/owners.go#L270-L280
test
kubernetes/test-infra
prow/plugins/approve/approvers/owners.go
AddLGTMer
func (ap *Approvers) AddLGTMer(login, reference string, noIssue bool) { if ap.shouldNotOverrideApproval(login, noIssue) { return } ap.approvers[strings.ToLower(login)] = Approval{ Login: login, How: "LGTM", Reference: reference, NoIssue: noIssue, } }
go
func (ap *Approvers) AddLGTMer(login, reference string, noIssue bool) { if ap.shouldNotOverrideApproval(login, noIssue) { return } ap.approvers[strings.ToLower(login)] = Approval{ Login: login, How: "LGTM", Reference: reference, NoIssue: noIssue, } }
[ "func", "(", "ap", "*", "Approvers", ")", "AddLGTMer", "(", "login", ",", "reference", "string", ",", "noIssue", "bool", ")", "{", "if", "ap", ".", "shouldNotOverrideApproval", "(", "login", ",", "noIssue", ")", "{", "return", "\n", "}", "\n", "ap", "....
// AddLGTMer adds a new LGTM Approver
[ "AddLGTMer", "adds", "a", "new", "LGTM", "Approver" ]
8125fbda10178887be5dff9e901d6a0a519b67bc
https://github.com/kubernetes/test-infra/blob/8125fbda10178887be5dff9e901d6a0a519b67bc/prow/plugins/approve/approvers/owners.go#L295-L305
test
kubernetes/test-infra
prow/plugins/approve/approvers/owners.go
RemoveApprover
func (ap *Approvers) RemoveApprover(login string) { delete(ap.approvers, strings.ToLower(login)) }
go
func (ap *Approvers) RemoveApprover(login string) { delete(ap.approvers, strings.ToLower(login)) }
[ "func", "(", "ap", "*", "Approvers", ")", "RemoveApprover", "(", "login", "string", ")", "{", "delete", "(", "ap", ".", "approvers", ",", "strings", ".", "ToLower", "(", "login", ")", ")", "\n", "}" ]
// RemoveApprover removes an approver from the list.
[ "RemoveApprover", "removes", "an", "approver", "from", "the", "list", "." ]
8125fbda10178887be5dff9e901d6a0a519b67bc
https://github.com/kubernetes/test-infra/blob/8125fbda10178887be5dff9e901d6a0a519b67bc/prow/plugins/approve/approvers/owners.go#L334-L336
test
kubernetes/test-infra
prow/plugins/approve/approvers/owners.go
AddAssignees
func (ap *Approvers) AddAssignees(logins ...string) { for _, login := range logins { ap.assignees.Insert(strings.ToLower(login)) } }
go
func (ap *Approvers) AddAssignees(logins ...string) { for _, login := range logins { ap.assignees.Insert(strings.ToLower(login)) } }
[ "func", "(", "ap", "*", "Approvers", ")", "AddAssignees", "(", "logins", "...", "string", ")", "{", "for", "_", ",", "login", ":=", "range", "logins", "{", "ap", ".", "assignees", ".", "Insert", "(", "strings", ".", "ToLower", "(", "login", ")", ")",...
// AddAssignees adds assignees to the list
[ "AddAssignees", "adds", "assignees", "to", "the", "list" ]
8125fbda10178887be5dff9e901d6a0a519b67bc
https://github.com/kubernetes/test-infra/blob/8125fbda10178887be5dff9e901d6a0a519b67bc/prow/plugins/approve/approvers/owners.go#L339-L343
test
kubernetes/test-infra
prow/plugins/approve/approvers/owners.go
GetCurrentApproversSetCased
func (ap Approvers) GetCurrentApproversSetCased() sets.String { currentApprovers := sets.NewString() for _, approval := range ap.approvers { currentApprovers.Insert(approval.Login) } return currentApprovers }
go
func (ap Approvers) GetCurrentApproversSetCased() sets.String { currentApprovers := sets.NewString() for _, approval := range ap.approvers { currentApprovers.Insert(approval.Login) } return currentApprovers }
[ "func", "(", "ap", "Approvers", ")", "GetCurrentApproversSetCased", "(", ")", "sets", ".", "String", "{", "currentApprovers", ":=", "sets", ".", "NewString", "(", ")", "\n", "for", "_", ",", "approval", ":=", "range", "ap", ".", "approvers", "{", "currentA...
// GetCurrentApproversSetCased returns the set of approvers logins with the original cases.
[ "GetCurrentApproversSetCased", "returns", "the", "set", "of", "approvers", "logins", "with", "the", "original", "cases", "." ]
8125fbda10178887be5dff9e901d6a0a519b67bc
https://github.com/kubernetes/test-infra/blob/8125fbda10178887be5dff9e901d6a0a519b67bc/prow/plugins/approve/approvers/owners.go#L357-L365
test
kubernetes/test-infra
prow/plugins/approve/approvers/owners.go
GetFilesApprovers
func (ap Approvers) GetFilesApprovers() map[string]sets.String { filesApprovers := map[string]sets.String{} currentApprovers := ap.GetCurrentApproversSetCased() for fn, potentialApprovers := range ap.owners.GetApprovers() { // The order of parameter matters here: // - currentApprovers is the list of github handl...
go
func (ap Approvers) GetFilesApprovers() map[string]sets.String { filesApprovers := map[string]sets.String{} currentApprovers := ap.GetCurrentApproversSetCased() for fn, potentialApprovers := range ap.owners.GetApprovers() { // The order of parameter matters here: // - currentApprovers is the list of github handl...
[ "func", "(", "ap", "Approvers", ")", "GetFilesApprovers", "(", ")", "map", "[", "string", "]", "sets", ".", "String", "{", "filesApprovers", ":=", "map", "[", "string", "]", "sets", ".", "String", "{", "}", "\n", "currentApprovers", ":=", "ap", ".", "G...
// GetFilesApprovers returns a map from files -> list of current approvers.
[ "GetFilesApprovers", "returns", "a", "map", "from", "files", "-", ">", "list", "of", "current", "approvers", "." ]
8125fbda10178887be5dff9e901d6a0a519b67bc
https://github.com/kubernetes/test-infra/blob/8125fbda10178887be5dff9e901d6a0a519b67bc/prow/plugins/approve/approvers/owners.go#L380-L396
test
kubernetes/test-infra
prow/plugins/approve/approvers/owners.go
NoIssueApprovers
func (ap Approvers) NoIssueApprovers() map[string]Approval { nia := map[string]Approval{} reverseMap := ap.owners.GetReverseMap(ap.owners.GetApprovers()) for login, approver := range ap.approvers { if !approver.NoIssue { continue } if len(reverseMap[login]) == 0 { continue } nia[login] = approver ...
go
func (ap Approvers) NoIssueApprovers() map[string]Approval { nia := map[string]Approval{} reverseMap := ap.owners.GetReverseMap(ap.owners.GetApprovers()) for login, approver := range ap.approvers { if !approver.NoIssue { continue } if len(reverseMap[login]) == 0 { continue } nia[login] = approver ...
[ "func", "(", "ap", "Approvers", ")", "NoIssueApprovers", "(", ")", "map", "[", "string", "]", "Approval", "{", "nia", ":=", "map", "[", "string", "]", "Approval", "{", "}", "\n", "reverseMap", ":=", "ap", ".", "owners", ".", "GetReverseMap", "(", "ap",...
// NoIssueApprovers returns the list of people who have "no-issue" // approved the pull-request. They are included in the list iff they can // approve one of the files.
[ "NoIssueApprovers", "returns", "the", "list", "of", "people", "who", "have", "no", "-", "issue", "approved", "the", "pull", "-", "request", ".", "They", "are", "included", "in", "the", "list", "iff", "they", "can", "approve", "one", "of", "the", "files", ...
8125fbda10178887be5dff9e901d6a0a519b67bc
https://github.com/kubernetes/test-infra/blob/8125fbda10178887be5dff9e901d6a0a519b67bc/prow/plugins/approve/approvers/owners.go#L401-L418
test
kubernetes/test-infra
prow/plugins/approve/approvers/owners.go
UnapprovedFiles
func (ap Approvers) UnapprovedFiles() sets.String { unapproved := sets.NewString() for fn, approvers := range ap.GetFilesApprovers() { if len(approvers) == 0 { unapproved.Insert(fn) } } return unapproved }
go
func (ap Approvers) UnapprovedFiles() sets.String { unapproved := sets.NewString() for fn, approvers := range ap.GetFilesApprovers() { if len(approvers) == 0 { unapproved.Insert(fn) } } return unapproved }
[ "func", "(", "ap", "Approvers", ")", "UnapprovedFiles", "(", ")", "sets", ".", "String", "{", "unapproved", ":=", "sets", ".", "NewString", "(", ")", "\n", "for", "fn", ",", "approvers", ":=", "range", "ap", ".", "GetFilesApprovers", "(", ")", "{", "if...
// UnapprovedFiles returns owners files that still need approval
[ "UnapprovedFiles", "returns", "owners", "files", "that", "still", "need", "approval" ]
8125fbda10178887be5dff9e901d6a0a519b67bc
https://github.com/kubernetes/test-infra/blob/8125fbda10178887be5dff9e901d6a0a519b67bc/prow/plugins/approve/approvers/owners.go#L421-L429
test
kubernetes/test-infra
prow/plugins/approve/approvers/owners.go
GetFiles
func (ap Approvers) GetFiles(baseURL *url.URL, branch string) []File { allOwnersFiles := []File{} filesApprovers := ap.GetFilesApprovers() for _, file := range ap.owners.GetOwnersSet().List() { if len(filesApprovers[file]) == 0 { allOwnersFiles = append(allOwnersFiles, UnapprovedFile{ baseURL: baseURL, ...
go
func (ap Approvers) GetFiles(baseURL *url.URL, branch string) []File { allOwnersFiles := []File{} filesApprovers := ap.GetFilesApprovers() for _, file := range ap.owners.GetOwnersSet().List() { if len(filesApprovers[file]) == 0 { allOwnersFiles = append(allOwnersFiles, UnapprovedFile{ baseURL: baseURL, ...
[ "func", "(", "ap", "Approvers", ")", "GetFiles", "(", "baseURL", "*", "url", ".", "URL", ",", "branch", "string", ")", "[", "]", "File", "{", "allOwnersFiles", ":=", "[", "]", "File", "{", "}", "\n", "filesApprovers", ":=", "ap", ".", "GetFilesApprover...
// GetFiles returns owners files that still need approval.
[ "GetFiles", "returns", "owners", "files", "that", "still", "need", "approval", "." ]
8125fbda10178887be5dff9e901d6a0a519b67bc
https://github.com/kubernetes/test-infra/blob/8125fbda10178887be5dff9e901d6a0a519b67bc/prow/plugins/approve/approvers/owners.go#L432-L453
test
kubernetes/test-infra
prow/plugins/approve/approvers/owners.go
IsApproved
func (ap Approvers) IsApproved() bool { reqsMet := ap.RequirementsMet() if !reqsMet && ap.ManuallyApproved() { return true } return reqsMet }
go
func (ap Approvers) IsApproved() bool { reqsMet := ap.RequirementsMet() if !reqsMet && ap.ManuallyApproved() { return true } return reqsMet }
[ "func", "(", "ap", "Approvers", ")", "IsApproved", "(", ")", "bool", "{", "reqsMet", ":=", "ap", ".", "RequirementsMet", "(", ")", "\n", "if", "!", "reqsMet", "&&", "ap", ".", "ManuallyApproved", "(", ")", "{", "return", "true", "\n", "}", "\n", "ret...
// IsApproved returns a bool indicating whether the PR is fully approved. // If a human manually added the approved label, this returns true, ignoring normal approval rules.
[ "IsApproved", "returns", "a", "bool", "indicating", "whether", "the", "PR", "is", "fully", "approved", ".", "If", "a", "human", "manually", "added", "the", "approved", "label", "this", "returns", "true", "ignoring", "normal", "approval", "rules", "." ]
8125fbda10178887be5dff9e901d6a0a519b67bc
https://github.com/kubernetes/test-infra/blob/8125fbda10178887be5dff9e901d6a0a519b67bc/prow/plugins/approve/approvers/owners.go#L505-L511
test
kubernetes/test-infra
prow/plugins/approve/approvers/owners.go
ListApprovals
func (ap Approvers) ListApprovals() []Approval { approvals := []Approval{} for _, approver := range ap.GetCurrentApproversSet().List() { approvals = append(approvals, ap.approvers[approver]) } return approvals }
go
func (ap Approvers) ListApprovals() []Approval { approvals := []Approval{} for _, approver := range ap.GetCurrentApproversSet().List() { approvals = append(approvals, ap.approvers[approver]) } return approvals }
[ "func", "(", "ap", "Approvers", ")", "ListApprovals", "(", ")", "[", "]", "Approval", "{", "approvals", ":=", "[", "]", "Approval", "{", "}", "\n", "for", "_", ",", "approver", ":=", "range", "ap", ".", "GetCurrentApproversSet", "(", ")", ".", "List", ...
// ListApprovals returns the list of approvals
[ "ListApprovals", "returns", "the", "list", "of", "approvals" ]
8125fbda10178887be5dff9e901d6a0a519b67bc
https://github.com/kubernetes/test-infra/blob/8125fbda10178887be5dff9e901d6a0a519b67bc/prow/plugins/approve/approvers/owners.go#L514-L522
test
kubernetes/test-infra
prow/plugins/approve/approvers/owners.go
ListNoIssueApprovals
func (ap Approvers) ListNoIssueApprovals() []Approval { approvals := []Approval{} for _, approver := range ap.GetNoIssueApproversSet().List() { approvals = append(approvals, ap.approvers[approver]) } return approvals }
go
func (ap Approvers) ListNoIssueApprovals() []Approval { approvals := []Approval{} for _, approver := range ap.GetNoIssueApproversSet().List() { approvals = append(approvals, ap.approvers[approver]) } return approvals }
[ "func", "(", "ap", "Approvers", ")", "ListNoIssueApprovals", "(", ")", "[", "]", "Approval", "{", "approvals", ":=", "[", "]", "Approval", "{", "}", "\n", "for", "_", ",", "approver", ":=", "range", "ap", ".", "GetNoIssueApproversSet", "(", ")", ".", "...
// ListNoIssueApprovals returns the list of "no-issue" approvals
[ "ListNoIssueApprovals", "returns", "the", "list", "of", "no", "-", "issue", "approvals" ]
8125fbda10178887be5dff9e901d6a0a519b67bc
https://github.com/kubernetes/test-infra/blob/8125fbda10178887be5dff9e901d6a0a519b67bc/prow/plugins/approve/approvers/owners.go#L525-L533
test
kubernetes/test-infra
prow/plugins/approve/approvers/owners.go
GenerateTemplate
func GenerateTemplate(templ, name string, data interface{}) (string, error) { buf := bytes.NewBufferString("") if messageTempl, err := template.New(name).Parse(templ); err != nil { return "", fmt.Errorf("failed to parse template for %s: %v", name, err) } else if err := messageTempl.Execute(buf, data); err != nil {...
go
func GenerateTemplate(templ, name string, data interface{}) (string, error) { buf := bytes.NewBufferString("") if messageTempl, err := template.New(name).Parse(templ); err != nil { return "", fmt.Errorf("failed to parse template for %s: %v", name, err) } else if err := messageTempl.Execute(buf, data); err != nil {...
[ "func", "GenerateTemplate", "(", "templ", ",", "name", "string", ",", "data", "interface", "{", "}", ")", "(", "string", ",", "error", ")", "{", "buf", ":=", "bytes", ".", "NewBufferString", "(", "\"\"", ")", "\n", "if", "messageTempl", ",", "err", ":=...
// GenerateTemplate takes a template, name and data, and generates // the corresponding string.
[ "GenerateTemplate", "takes", "a", "template", "name", "and", "data", "and", "generates", "the", "corresponding", "string", "." ]
8125fbda10178887be5dff9e901d6a0a519b67bc
https://github.com/kubernetes/test-infra/blob/8125fbda10178887be5dff9e901d6a0a519b67bc/prow/plugins/approve/approvers/owners.go#L584-L592
test
kubernetes/test-infra
label_sync/main.go
writeTemplate
func writeTemplate(templatePath string, outputPath string, data interface{}) error { // set up template funcMap := template.FuncMap{ "anchor": func(input string) string { return strings.Replace(input, ":", " ", -1) }, } t, err := template.New(filepath.Base(templatePath)).Funcs(funcMap).ParseFiles(templatePat...
go
func writeTemplate(templatePath string, outputPath string, data interface{}) error { // set up template funcMap := template.FuncMap{ "anchor": func(input string) string { return strings.Replace(input, ":", " ", -1) }, } t, err := template.New(filepath.Base(templatePath)).Funcs(funcMap).ParseFiles(templatePat...
[ "func", "writeTemplate", "(", "templatePath", "string", ",", "outputPath", "string", ",", "data", "interface", "{", "}", ")", "error", "{", "funcMap", ":=", "template", ".", "FuncMap", "{", "\"anchor\"", ":", "func", "(", "input", "string", ")", "string", ...
// Writes the golang text template at templatePath to outputPath using the given data
[ "Writes", "the", "golang", "text", "template", "at", "templatePath", "to", "outputPath", "using", "the", "given", "data" ]
8125fbda10178887be5dff9e901d6a0a519b67bc
https://github.com/kubernetes/test-infra/blob/8125fbda10178887be5dff9e901d6a0a519b67bc/label_sync/main.go#L148-L183
test
kubernetes/test-infra
label_sync/main.go
Labels
func (c Configuration) Labels() []Label { var labelarrays [][]Label labelarrays = append(labelarrays, c.Default.Labels) for _, repo := range c.Repos { labelarrays = append(labelarrays, repo.Labels) } labelmap := make(map[string]Label) for _, labels := range labelarrays { for _, l := range labels { name :=...
go
func (c Configuration) Labels() []Label { var labelarrays [][]Label labelarrays = append(labelarrays, c.Default.Labels) for _, repo := range c.Repos { labelarrays = append(labelarrays, repo.Labels) } labelmap := make(map[string]Label) for _, labels := range labelarrays { for _, l := range labels { name :=...
[ "func", "(", "c", "Configuration", ")", "Labels", "(", ")", "[", "]", "Label", "{", "var", "labelarrays", "[", "]", "[", "]", "Label", "\n", "labelarrays", "=", "append", "(", "labelarrays", ",", "c", ".", "Default", ".", "Labels", ")", "\n", "for", ...
// Labels returns a sorted list of labels unique by name
[ "Labels", "returns", "a", "sorted", "list", "of", "labels", "unique", "by", "name" ]
8125fbda10178887be5dff9e901d6a0a519b67bc
https://github.com/kubernetes/test-infra/blob/8125fbda10178887be5dff9e901d6a0a519b67bc/label_sync/main.go#L224-L247
test
kubernetes/test-infra
label_sync/main.go
LabelsForTarget
func LabelsForTarget(labels []Label, target LabelTarget) (filteredLabels []Label) { for _, label := range labels { if target == label.Target { filteredLabels = append(filteredLabels, label) } } // We also sort to make nice tables sort.Slice(filteredLabels, func(i, j int) bool { return filteredLabels[i].Name ...
go
func LabelsForTarget(labels []Label, target LabelTarget) (filteredLabels []Label) { for _, label := range labels { if target == label.Target { filteredLabels = append(filteredLabels, label) } } // We also sort to make nice tables sort.Slice(filteredLabels, func(i, j int) bool { return filteredLabels[i].Name ...
[ "func", "LabelsForTarget", "(", "labels", "[", "]", "Label", ",", "target", "LabelTarget", ")", "(", "filteredLabels", "[", "]", "Label", ")", "{", "for", "_", ",", "label", ":=", "range", "labels", "{", "if", "target", "==", "label", ".", "Target", "{...
// LabelsForTarget returns labels that have a given target
[ "LabelsForTarget", "returns", "labels", "that", "have", "a", "given", "target" ]
8125fbda10178887be5dff9e901d6a0a519b67bc
https://github.com/kubernetes/test-infra/blob/8125fbda10178887be5dff9e901d6a0a519b67bc/label_sync/main.go#L281-L290
test
kubernetes/test-infra
label_sync/main.go
LoadConfig
func LoadConfig(path string, orgs string) (*Configuration, error) { if path == "" { return nil, errors.New("empty path") } var c Configuration data, err := ioutil.ReadFile(path) if err != nil { return nil, err } if err = yaml.Unmarshal(data, &c); err != nil { return nil, err } if err = c.validate(orgs); ...
go
func LoadConfig(path string, orgs string) (*Configuration, error) { if path == "" { return nil, errors.New("empty path") } var c Configuration data, err := ioutil.ReadFile(path) if err != nil { return nil, err } if err = yaml.Unmarshal(data, &c); err != nil { return nil, err } if err = c.validate(orgs); ...
[ "func", "LoadConfig", "(", "path", "string", ",", "orgs", "string", ")", "(", "*", "Configuration", ",", "error", ")", "{", "if", "path", "==", "\"\"", "{", "return", "nil", ",", "errors", ".", "New", "(", "\"empty path\"", ")", "\n", "}", "\n", "var...
// LoadConfig reads the yaml config at path
[ "LoadConfig", "reads", "the", "yaml", "config", "at", "path" ]
8125fbda10178887be5dff9e901d6a0a519b67bc
https://github.com/kubernetes/test-infra/blob/8125fbda10178887be5dff9e901d6a0a519b67bc/label_sync/main.go#L293-L309
test
kubernetes/test-infra
label_sync/main.go
loadLabels
func loadLabels(gc client, org string, repos []string) (*RepoLabels, error) { repoChan := make(chan string, len(repos)) for _, repo := range repos { repoChan <- repo } close(repoChan) wg := sync.WaitGroup{} wg.Add(maxConcurrentWorkers) labels := make(chan RepoLabels, len(repos)) errChan := make(chan error, l...
go
func loadLabels(gc client, org string, repos []string) (*RepoLabels, error) { repoChan := make(chan string, len(repos)) for _, repo := range repos { repoChan <- repo } close(repoChan) wg := sync.WaitGroup{} wg.Add(maxConcurrentWorkers) labels := make(chan RepoLabels, len(repos)) errChan := make(chan error, l...
[ "func", "loadLabels", "(", "gc", "client", ",", "org", "string", ",", "repos", "[", "]", "string", ")", "(", "*", "RepoLabels", ",", "error", ")", "{", "repoChan", ":=", "make", "(", "chan", "string", ",", "len", "(", "repos", ")", ")", "\n", "for"...
// loadLabels returns what labels exist in github
[ "loadLabels", "returns", "what", "labels", "exist", "in", "github" ]
8125fbda10178887be5dff9e901d6a0a519b67bc
https://github.com/kubernetes/test-infra/blob/8125fbda10178887be5dff9e901d6a0a519b67bc/label_sync/main.go#L340-L387
test
kubernetes/test-infra
label_sync/main.go
kill
func kill(repo string, label Label) Update { logrus.WithField("repo", repo).WithField("label", label.Name).Info("kill") return Update{Why: "dead", Current: &label, repo: repo} }
go
func kill(repo string, label Label) Update { logrus.WithField("repo", repo).WithField("label", label.Name).Info("kill") return Update{Why: "dead", Current: &label, repo: repo} }
[ "func", "kill", "(", "repo", "string", ",", "label", "Label", ")", "Update", "{", "logrus", ".", "WithField", "(", "\"repo\"", ",", "repo", ")", ".", "WithField", "(", "\"label\"", ",", "label", ".", "Name", ")", ".", "Info", "(", "\"kill\"", ")", "\...
// Delete the label
[ "Delete", "the", "label" ]
8125fbda10178887be5dff9e901d6a0a519b67bc
https://github.com/kubernetes/test-infra/blob/8125fbda10178887be5dff9e901d6a0a519b67bc/label_sync/main.go#L390-L393
test
kubernetes/test-infra
label_sync/main.go
create
func create(repo string, label Label) Update { logrus.WithField("repo", repo).WithField("label", label.Name).Info("create") return Update{Why: "missing", Wanted: &label, repo: repo} }
go
func create(repo string, label Label) Update { logrus.WithField("repo", repo).WithField("label", label.Name).Info("create") return Update{Why: "missing", Wanted: &label, repo: repo} }
[ "func", "create", "(", "repo", "string", ",", "label", "Label", ")", "Update", "{", "logrus", ".", "WithField", "(", "\"repo\"", ",", "repo", ")", ".", "WithField", "(", "\"label\"", ",", "label", ".", "Name", ")", ".", "Info", "(", "\"create\"", ")", ...
// Create the label
[ "Create", "the", "label" ]
8125fbda10178887be5dff9e901d6a0a519b67bc
https://github.com/kubernetes/test-infra/blob/8125fbda10178887be5dff9e901d6a0a519b67bc/label_sync/main.go#L396-L399
test
kubernetes/test-infra
label_sync/main.go
classifyLabels
func classifyLabels(labels []Label, required, archaic, dead map[string]Label, now time.Time, parent *Label) (map[string]Label, map[string]Label, map[string]Label) { newRequired := copyLabelMap(required) newArchaic := copyLabelMap(archaic) newDead := copyLabelMap(dead) for i, l := range labels { first := parent ...
go
func classifyLabels(labels []Label, required, archaic, dead map[string]Label, now time.Time, parent *Label) (map[string]Label, map[string]Label, map[string]Label) { newRequired := copyLabelMap(required) newArchaic := copyLabelMap(archaic) newDead := copyLabelMap(dead) for i, l := range labels { first := parent ...
[ "func", "classifyLabels", "(", "labels", "[", "]", "Label", ",", "required", ",", "archaic", ",", "dead", "map", "[", "string", "]", "Label", ",", "now", "time", ".", "Time", ",", "parent", "*", "Label", ")", "(", "map", "[", "string", "]", "Label", ...
// classifyLabels will put labels into the required, archaic, dead maps as appropriate.
[ "classifyLabels", "will", "put", "labels", "into", "the", "required", "archaic", "dead", "maps", "as", "appropriate", "." ]
8125fbda10178887be5dff9e901d6a0a519b67bc
https://github.com/kubernetes/test-infra/blob/8125fbda10178887be5dff9e901d6a0a519b67bc/label_sync/main.go#L420-L442
test
kubernetes/test-infra
label_sync/main.go
linkify
func linkify(text string) string { // swap space with dash link := strings.Replace(text, " ", "-", -1) // discard some special characters discard, _ := regexp.Compile("[,/]") link = discard.ReplaceAllString(link, "") // lowercase return strings.ToLower(link) }
go
func linkify(text string) string { // swap space with dash link := strings.Replace(text, " ", "-", -1) // discard some special characters discard, _ := regexp.Compile("[,/]") link = discard.ReplaceAllString(link, "") // lowercase return strings.ToLower(link) }
[ "func", "linkify", "(", "text", "string", ")", "string", "{", "link", ":=", "strings", ".", "Replace", "(", "text", ",", "\" \"", ",", "\"-\"", ",", "-", "1", ")", "\n", "discard", ",", "_", ":=", "regexp", ".", "Compile", "(", "\"[,/]\"", ")", "\n...
// linkify transforms a string into a markdown anchor link // I could not find a proper doc, so rules here a mostly empirical
[ "linkify", "transforms", "a", "string", "into", "a", "markdown", "anchor", "link", "I", "could", "not", "find", "a", "proper", "doc", "so", "rules", "here", "a", "mostly", "empirical" ]
8125fbda10178887be5dff9e901d6a0a519b67bc
https://github.com/kubernetes/test-infra/blob/8125fbda10178887be5dff9e901d6a0a519b67bc/label_sync/main.go#L825-L833
test
kubernetes/test-infra
greenhouse/diskcache/cache.go
NewCache
func NewCache(diskRoot string) *Cache { return &Cache{ diskRoot: strings.TrimSuffix(diskRoot, string(os.PathListSeparator)), } }
go
func NewCache(diskRoot string) *Cache { return &Cache{ diskRoot: strings.TrimSuffix(diskRoot, string(os.PathListSeparator)), } }
[ "func", "NewCache", "(", "diskRoot", "string", ")", "*", "Cache", "{", "return", "&", "Cache", "{", "diskRoot", ":", "strings", ".", "TrimSuffix", "(", "diskRoot", ",", "string", "(", "os", ".", "PathListSeparator", ")", ")", ",", "}", "\n", "}" ]
// NewCache returns a new Cache given the root directory that should be used // on disk for cache storage
[ "NewCache", "returns", "a", "new", "Cache", "given", "the", "root", "directory", "that", "should", "be", "used", "on", "disk", "for", "cache", "storage" ]
8125fbda10178887be5dff9e901d6a0a519b67bc
https://github.com/kubernetes/test-infra/blob/8125fbda10178887be5dff9e901d6a0a519b67bc/greenhouse/diskcache/cache.go#L47-L51
test
kubernetes/test-infra
greenhouse/diskcache/cache.go
KeyToPath
func (c *Cache) KeyToPath(key string) string { return filepath.Join(c.diskRoot, key) }
go
func (c *Cache) KeyToPath(key string) string { return filepath.Join(c.diskRoot, key) }
[ "func", "(", "c", "*", "Cache", ")", "KeyToPath", "(", "key", "string", ")", "string", "{", "return", "filepath", ".", "Join", "(", "c", ".", "diskRoot", ",", "key", ")", "\n", "}" ]
// KeyToPath converts a cache entry key to a path on disk
[ "KeyToPath", "converts", "a", "cache", "entry", "key", "to", "a", "path", "on", "disk" ]
8125fbda10178887be5dff9e901d6a0a519b67bc
https://github.com/kubernetes/test-infra/blob/8125fbda10178887be5dff9e901d6a0a519b67bc/greenhouse/diskcache/cache.go#L54-L56
test
kubernetes/test-infra
greenhouse/diskcache/cache.go
ensureDir
func ensureDir(dir string) error { if exists(dir) { return nil } return os.MkdirAll(dir, os.FileMode(0744)) }
go
func ensureDir(dir string) error { if exists(dir) { return nil } return os.MkdirAll(dir, os.FileMode(0744)) }
[ "func", "ensureDir", "(", "dir", "string", ")", "error", "{", "if", "exists", "(", "dir", ")", "{", "return", "nil", "\n", "}", "\n", "return", "os", ".", "MkdirAll", "(", "dir", ",", "os", ".", "FileMode", "(", "0744", ")", ")", "\n", "}" ]
// file path helper
[ "file", "path", "helper" ]
8125fbda10178887be5dff9e901d6a0a519b67bc
https://github.com/kubernetes/test-infra/blob/8125fbda10178887be5dff9e901d6a0a519b67bc/greenhouse/diskcache/cache.go#L76-L81
test
kubernetes/test-infra
greenhouse/diskcache/cache.go
Put
func (c *Cache) Put(key string, content io.Reader, contentSHA256 string) error { // make sure directory exists path := c.KeyToPath(key) dir := filepath.Dir(path) err := ensureDir(dir) if err != nil { logrus.WithError(err).Errorf("error ensuring directory '%s' exists", dir) } // create a temp file to get the c...
go
func (c *Cache) Put(key string, content io.Reader, contentSHA256 string) error { // make sure directory exists path := c.KeyToPath(key) dir := filepath.Dir(path) err := ensureDir(dir) if err != nil { logrus.WithError(err).Errorf("error ensuring directory '%s' exists", dir) } // create a temp file to get the c...
[ "func", "(", "c", "*", "Cache", ")", "Put", "(", "key", "string", ",", "content", "io", ".", "Reader", ",", "contentSHA256", "string", ")", "error", "{", "path", ":=", "c", ".", "KeyToPath", "(", "key", ")", "\n", "dir", ":=", "filepath", ".", "Dir...
// Put copies the content reader until the end into the cache at key // if contentSHA256 is not "" then the contents will only be stored in the // cache if the content's hex string SHA256 matches
[ "Put", "copies", "the", "content", "reader", "until", "the", "end", "into", "the", "cache", "at", "key", "if", "contentSHA256", "is", "not", "then", "the", "contents", "will", "only", "be", "stored", "in", "the", "cache", "if", "the", "content", "s", "he...
8125fbda10178887be5dff9e901d6a0a519b67bc
https://github.com/kubernetes/test-infra/blob/8125fbda10178887be5dff9e901d6a0a519b67bc/greenhouse/diskcache/cache.go#L93-L145
test
kubernetes/test-infra
greenhouse/diskcache/cache.go
Get
func (c *Cache) Get(key string, readHandler ReadHandler) error { path := c.KeyToPath(key) f, err := os.Open(path) if err != nil { if os.IsNotExist(err) { return readHandler(false, nil) } return fmt.Errorf("failed to get key: %v", err) } return readHandler(true, f) }
go
func (c *Cache) Get(key string, readHandler ReadHandler) error { path := c.KeyToPath(key) f, err := os.Open(path) if err != nil { if os.IsNotExist(err) { return readHandler(false, nil) } return fmt.Errorf("failed to get key: %v", err) } return readHandler(true, f) }
[ "func", "(", "c", "*", "Cache", ")", "Get", "(", "key", "string", ",", "readHandler", "ReadHandler", ")", "error", "{", "path", ":=", "c", ".", "KeyToPath", "(", "key", ")", "\n", "f", ",", "err", ":=", "os", ".", "Open", "(", "path", ")", "\n", ...
// Get provides your readHandler with the contents at key
[ "Get", "provides", "your", "readHandler", "with", "the", "contents", "at", "key" ]
8125fbda10178887be5dff9e901d6a0a519b67bc
https://github.com/kubernetes/test-infra/blob/8125fbda10178887be5dff9e901d6a0a519b67bc/greenhouse/diskcache/cache.go#L148-L158
test
kubernetes/test-infra
greenhouse/diskcache/cache.go
Delete
func (c *Cache) Delete(key string) error { return os.Remove(c.KeyToPath(key)) }
go
func (c *Cache) Delete(key string) error { return os.Remove(c.KeyToPath(key)) }
[ "func", "(", "c", "*", "Cache", ")", "Delete", "(", "key", "string", ")", "error", "{", "return", "os", ".", "Remove", "(", "c", ".", "KeyToPath", "(", "key", ")", ")", "\n", "}" ]
// Delete deletes the file at key
[ "Delete", "deletes", "the", "file", "at", "key" ]
8125fbda10178887be5dff9e901d6a0a519b67bc
https://github.com/kubernetes/test-infra/blob/8125fbda10178887be5dff9e901d6a0a519b67bc/greenhouse/diskcache/cache.go#L191-L193
test
kubernetes/test-infra
prow/spyglass/gcsartifact.go
NewGCSArtifact
func NewGCSArtifact(ctx context.Context, handle artifactHandle, link string, path string, sizeLimit int64) *GCSArtifact { return &GCSArtifact{ handle: handle, link: link, path: path, sizeLimit: sizeLimit, ctx: ctx, } }
go
func NewGCSArtifact(ctx context.Context, handle artifactHandle, link string, path string, sizeLimit int64) *GCSArtifact { return &GCSArtifact{ handle: handle, link: link, path: path, sizeLimit: sizeLimit, ctx: ctx, } }
[ "func", "NewGCSArtifact", "(", "ctx", "context", ".", "Context", ",", "handle", "artifactHandle", ",", "link", "string", ",", "path", "string", ",", "sizeLimit", "int64", ")", "*", "GCSArtifact", "{", "return", "&", "GCSArtifact", "{", "handle", ":", "handle...
// NewGCSArtifact returns a new GCSArtifact with a given handle, canonical link, and path within the job
[ "NewGCSArtifact", "returns", "a", "new", "GCSArtifact", "with", "a", "given", "handle", "canonical", "link", "and", "path", "within", "the", "job" ]
8125fbda10178887be5dff9e901d6a0a519b67bc
https://github.com/kubernetes/test-infra/blob/8125fbda10178887be5dff9e901d6a0a519b67bc/prow/spyglass/gcsartifact.go#L57-L65
test
kubernetes/test-infra
prow/spyglass/gcsartifact.go
Size
func (a *GCSArtifact) Size() (int64, error) { attrs, err := a.handle.Attrs(a.ctx) if err != nil { return 0, fmt.Errorf("error getting gcs attributes for artifact: %v", err) } return attrs.Size, nil }
go
func (a *GCSArtifact) Size() (int64, error) { attrs, err := a.handle.Attrs(a.ctx) if err != nil { return 0, fmt.Errorf("error getting gcs attributes for artifact: %v", err) } return attrs.Size, nil }
[ "func", "(", "a", "*", "GCSArtifact", ")", "Size", "(", ")", "(", "int64", ",", "error", ")", "{", "attrs", ",", "err", ":=", "a", ".", "handle", ".", "Attrs", "(", "a", ".", "ctx", ")", "\n", "if", "err", "!=", "nil", "{", "return", "0", ","...
// Size returns the size of the artifact in GCS
[ "Size", "returns", "the", "size", "of", "the", "artifact", "in", "GCS" ]
8125fbda10178887be5dff9e901d6a0a519b67bc
https://github.com/kubernetes/test-infra/blob/8125fbda10178887be5dff9e901d6a0a519b67bc/prow/spyglass/gcsartifact.go#L74-L80
test
kubernetes/test-infra
prow/spyglass/gcsartifact.go
ReadAll
func (a *GCSArtifact) ReadAll() ([]byte, error) { size, err := a.Size() if err != nil { return nil, fmt.Errorf("error getting artifact size: %v", err) } if size > a.sizeLimit { return nil, lenses.ErrFileTooLarge } reader, err := a.handle.NewReader(a.ctx) if err != nil { return nil, fmt.Errorf("error gettin...
go
func (a *GCSArtifact) ReadAll() ([]byte, error) { size, err := a.Size() if err != nil { return nil, fmt.Errorf("error getting artifact size: %v", err) } if size > a.sizeLimit { return nil, lenses.ErrFileTooLarge } reader, err := a.handle.NewReader(a.ctx) if err != nil { return nil, fmt.Errorf("error gettin...
[ "func", "(", "a", "*", "GCSArtifact", ")", "ReadAll", "(", ")", "(", "[", "]", "byte", ",", "error", ")", "{", "size", ",", "err", ":=", "a", ".", "Size", "(", ")", "\n", "if", "err", "!=", "nil", "{", "return", "nil", ",", "fmt", ".", "Error...
// ReadAll will either read the entire file or throw an error if file size is too big
[ "ReadAll", "will", "either", "read", "the", "entire", "file", "or", "throw", "an", "error", "if", "file", "size", "is", "too", "big" ]
8125fbda10178887be5dff9e901d6a0a519b67bc
https://github.com/kubernetes/test-infra/blob/8125fbda10178887be5dff9e901d6a0a519b67bc/prow/spyglass/gcsartifact.go#L192-L210
test
kubernetes/test-infra
prow/spyglass/gcsartifact.go
ReadTail
func (a *GCSArtifact) ReadTail(n int64) ([]byte, error) { gzipped, err := a.gzipped() if err != nil { return nil, fmt.Errorf("error checking artifact for gzip compression: %v", err) } if gzipped { return nil, lenses.ErrGzipOffsetRead } size, err := a.Size() if err != nil { return nil, fmt.Errorf("error get...
go
func (a *GCSArtifact) ReadTail(n int64) ([]byte, error) { gzipped, err := a.gzipped() if err != nil { return nil, fmt.Errorf("error checking artifact for gzip compression: %v", err) } if gzipped { return nil, lenses.ErrGzipOffsetRead } size, err := a.Size() if err != nil { return nil, fmt.Errorf("error get...
[ "func", "(", "a", "*", "GCSArtifact", ")", "ReadTail", "(", "n", "int64", ")", "(", "[", "]", "byte", ",", "error", ")", "{", "gzipped", ",", "err", ":=", "a", ".", "gzipped", "(", ")", "\n", "if", "err", "!=", "nil", "{", "return", "nil", ",",...
// ReadTail reads the last n bytes from a file in GCS
[ "ReadTail", "reads", "the", "last", "n", "bytes", "from", "a", "file", "in", "GCS" ]
8125fbda10178887be5dff9e901d6a0a519b67bc
https://github.com/kubernetes/test-infra/blob/8125fbda10178887be5dff9e901d6a0a519b67bc/prow/spyglass/gcsartifact.go#L213-L241
test
kubernetes/test-infra
prow/spyglass/gcsartifact.go
gzipped
func (a *GCSArtifact) gzipped() (bool, error) { attrs, err := a.handle.Attrs(a.ctx) if err != nil { return false, fmt.Errorf("error getting gcs attributes for artifact: %v", err) } return attrs.ContentEncoding == "gzip", nil }
go
func (a *GCSArtifact) gzipped() (bool, error) { attrs, err := a.handle.Attrs(a.ctx) if err != nil { return false, fmt.Errorf("error getting gcs attributes for artifact: %v", err) } return attrs.ContentEncoding == "gzip", nil }
[ "func", "(", "a", "*", "GCSArtifact", ")", "gzipped", "(", ")", "(", "bool", ",", "error", ")", "{", "attrs", ",", "err", ":=", "a", ".", "handle", ".", "Attrs", "(", "a", ".", "ctx", ")", "\n", "if", "err", "!=", "nil", "{", "return", "false",...
// gzipped returns whether the file is gzip-encoded in GCS
[ "gzipped", "returns", "whether", "the", "file", "is", "gzip", "-", "encoded", "in", "GCS" ]
8125fbda10178887be5dff9e901d6a0a519b67bc
https://github.com/kubernetes/test-infra/blob/8125fbda10178887be5dff9e901d6a0a519b67bc/prow/spyglass/gcsartifact.go#L244-L250
test
kubernetes/test-infra
prow/plugins/welcome/welcome.go
optionsForRepo
func optionsForRepo(config *plugins.Configuration, org, repo string) *plugins.Welcome { fullName := fmt.Sprintf("%s/%s", org, repo) // First search for repo config for _, c := range config.Welcome { if !strInSlice(fullName, c.Repos) { continue } return &c } // If you don't find anything, loop again look...
go
func optionsForRepo(config *plugins.Configuration, org, repo string) *plugins.Welcome { fullName := fmt.Sprintf("%s/%s", org, repo) // First search for repo config for _, c := range config.Welcome { if !strInSlice(fullName, c.Repos) { continue } return &c } // If you don't find anything, loop again look...
[ "func", "optionsForRepo", "(", "config", "*", "plugins", ".", "Configuration", ",", "org", ",", "repo", "string", ")", "*", "plugins", ".", "Welcome", "{", "fullName", ":=", "fmt", ".", "Sprintf", "(", "\"%s/%s\"", ",", "org", ",", "repo", ")", "\n", "...
// optionsForRepo gets the plugins.Welcome struct that is applicable to the indicated repo.
[ "optionsForRepo", "gets", "the", "plugins", ".", "Welcome", "struct", "that", "is", "applicable", "to", "the", "indicated", "repo", "." ]
8125fbda10178887be5dff9e901d6a0a519b67bc
https://github.com/kubernetes/test-infra/blob/8125fbda10178887be5dff9e901d6a0a519b67bc/prow/plugins/welcome/welcome.go#L145-L166
test
kubernetes/test-infra
prow/client/listers/prowjobs/v1/prowjob.go
List
func (s *prowJobLister) List(selector labels.Selector) (ret []*v1.ProwJob, err error) { err = cache.ListAll(s.indexer, selector, func(m interface{}) { ret = append(ret, m.(*v1.ProwJob)) }) return ret, err }
go
func (s *prowJobLister) List(selector labels.Selector) (ret []*v1.ProwJob, err error) { err = cache.ListAll(s.indexer, selector, func(m interface{}) { ret = append(ret, m.(*v1.ProwJob)) }) return ret, err }
[ "func", "(", "s", "*", "prowJobLister", ")", "List", "(", "selector", "labels", ".", "Selector", ")", "(", "ret", "[", "]", "*", "v1", ".", "ProwJob", ",", "err", "error", ")", "{", "err", "=", "cache", ".", "ListAll", "(", "s", ".", "indexer", "...
// List lists all ProwJobs in the indexer.
[ "List", "lists", "all", "ProwJobs", "in", "the", "indexer", "." ]
8125fbda10178887be5dff9e901d6a0a519b67bc
https://github.com/kubernetes/test-infra/blob/8125fbda10178887be5dff9e901d6a0a519b67bc/prow/client/listers/prowjobs/v1/prowjob.go#L48-L53
test
kubernetes/test-infra
prow/client/listers/prowjobs/v1/prowjob.go
ProwJobs
func (s *prowJobLister) ProwJobs(namespace string) ProwJobNamespaceLister { return prowJobNamespaceLister{indexer: s.indexer, namespace: namespace} }
go
func (s *prowJobLister) ProwJobs(namespace string) ProwJobNamespaceLister { return prowJobNamespaceLister{indexer: s.indexer, namespace: namespace} }
[ "func", "(", "s", "*", "prowJobLister", ")", "ProwJobs", "(", "namespace", "string", ")", "ProwJobNamespaceLister", "{", "return", "prowJobNamespaceLister", "{", "indexer", ":", "s", ".", "indexer", ",", "namespace", ":", "namespace", "}", "\n", "}" ]
// ProwJobs returns an object that can list and get ProwJobs.
[ "ProwJobs", "returns", "an", "object", "that", "can", "list", "and", "get", "ProwJobs", "." ]
8125fbda10178887be5dff9e901d6a0a519b67bc
https://github.com/kubernetes/test-infra/blob/8125fbda10178887be5dff9e901d6a0a519b67bc/prow/client/listers/prowjobs/v1/prowjob.go#L56-L58
test
kubernetes/test-infra
prow/client/listers/prowjobs/v1/prowjob.go
List
func (s prowJobNamespaceLister) List(selector labels.Selector) (ret []*v1.ProwJob, err error) { err = cache.ListAllByNamespace(s.indexer, s.namespace, selector, func(m interface{}) { ret = append(ret, m.(*v1.ProwJob)) }) return ret, err }
go
func (s prowJobNamespaceLister) List(selector labels.Selector) (ret []*v1.ProwJob, err error) { err = cache.ListAllByNamespace(s.indexer, s.namespace, selector, func(m interface{}) { ret = append(ret, m.(*v1.ProwJob)) }) return ret, err }
[ "func", "(", "s", "prowJobNamespaceLister", ")", "List", "(", "selector", "labels", ".", "Selector", ")", "(", "ret", "[", "]", "*", "v1", ".", "ProwJob", ",", "err", "error", ")", "{", "err", "=", "cache", ".", "ListAllByNamespace", "(", "s", ".", "...
// List lists all ProwJobs in the indexer for a given namespace.
[ "List", "lists", "all", "ProwJobs", "in", "the", "indexer", "for", "a", "given", "namespace", "." ]
8125fbda10178887be5dff9e901d6a0a519b67bc
https://github.com/kubernetes/test-infra/blob/8125fbda10178887be5dff9e901d6a0a519b67bc/prow/client/listers/prowjobs/v1/prowjob.go#L77-L82
test
kubernetes/test-infra
prow/config/jobs.go
RunsAgainstAllBranch
func (br Brancher) RunsAgainstAllBranch() bool { return len(br.SkipBranches) == 0 && len(br.Branches) == 0 }
go
func (br Brancher) RunsAgainstAllBranch() bool { return len(br.SkipBranches) == 0 && len(br.Branches) == 0 }
[ "func", "(", "br", "Brancher", ")", "RunsAgainstAllBranch", "(", ")", "bool", "{", "return", "len", "(", "br", ".", "SkipBranches", ")", "==", "0", "&&", "len", "(", "br", ".", "Branches", ")", "==", "0", "\n", "}" ]
// RunsAgainstAllBranch returns true if there are both branches and skip_branches are unset
[ "RunsAgainstAllBranch", "returns", "true", "if", "there", "are", "both", "branches", "and", "skip_branches", "are", "unset" ]
8125fbda10178887be5dff9e901d6a0a519b67bc
https://github.com/kubernetes/test-infra/blob/8125fbda10178887be5dff9e901d6a0a519b67bc/prow/config/jobs.go#L219-L221
test
kubernetes/test-infra
prow/config/jobs.go
Intersects
func (br Brancher) Intersects(other Brancher) bool { if br.RunsAgainstAllBranch() || other.RunsAgainstAllBranch() { return true } if len(br.Branches) > 0 { baseBranches := sets.NewString(br.Branches...) if len(other.Branches) > 0 { otherBranches := sets.NewString(other.Branches...) if baseBranches.Inters...
go
func (br Brancher) Intersects(other Brancher) bool { if br.RunsAgainstAllBranch() || other.RunsAgainstAllBranch() { return true } if len(br.Branches) > 0 { baseBranches := sets.NewString(br.Branches...) if len(other.Branches) > 0 { otherBranches := sets.NewString(other.Branches...) if baseBranches.Inters...
[ "func", "(", "br", "Brancher", ")", "Intersects", "(", "other", "Brancher", ")", "bool", "{", "if", "br", ".", "RunsAgainstAllBranch", "(", ")", "||", "other", ".", "RunsAgainstAllBranch", "(", ")", "{", "return", "true", "\n", "}", "\n", "if", "len", ...
// Intersects checks if other Brancher would trigger for the same branch.
[ "Intersects", "checks", "if", "other", "Brancher", "would", "trigger", "for", "the", "same", "branch", "." ]
8125fbda10178887be5dff9e901d6a0a519b67bc
https://github.com/kubernetes/test-infra/blob/8125fbda10178887be5dff9e901d6a0a519b67bc/prow/config/jobs.go#L240-L268
test
kubernetes/test-infra
prow/config/jobs.go
ShouldRun
func (cm RegexpChangeMatcher) ShouldRun(changes ChangedFilesProvider) (determined bool, shouldRun bool, err error) { if cm.CouldRun() { changeList, err := changes() if err != nil { return true, false, err } return true, cm.RunsAgainstChanges(changeList), nil } return false, false, nil }
go
func (cm RegexpChangeMatcher) ShouldRun(changes ChangedFilesProvider) (determined bool, shouldRun bool, err error) { if cm.CouldRun() { changeList, err := changes() if err != nil { return true, false, err } return true, cm.RunsAgainstChanges(changeList), nil } return false, false, nil }
[ "func", "(", "cm", "RegexpChangeMatcher", ")", "ShouldRun", "(", "changes", "ChangedFilesProvider", ")", "(", "determined", "bool", ",", "shouldRun", "bool", ",", "err", "error", ")", "{", "if", "cm", ".", "CouldRun", "(", ")", "{", "changeList", ",", "err...
// ShouldRun determines if we can know for certain that the job should run. We can either // know for certain that the job should or should not run based on the matcher, or we can // not be able to determine that fact at all.
[ "ShouldRun", "determines", "if", "we", "can", "know", "for", "certain", "that", "the", "job", "should", "run", ".", "We", "can", "either", "know", "for", "certain", "that", "the", "job", "should", "or", "should", "not", "run", "based", "on", "the", "matc...
8125fbda10178887be5dff9e901d6a0a519b67bc
https://github.com/kubernetes/test-infra/blob/8125fbda10178887be5dff9e901d6a0a519b67bc/prow/config/jobs.go#L278-L287
test
kubernetes/test-infra
prow/config/jobs.go
RunsAgainstChanges
func (cm RegexpChangeMatcher) RunsAgainstChanges(changes []string) bool { for _, change := range changes { if cm.reChanges.MatchString(change) { return true } } return false }
go
func (cm RegexpChangeMatcher) RunsAgainstChanges(changes []string) bool { for _, change := range changes { if cm.reChanges.MatchString(change) { return true } } return false }
[ "func", "(", "cm", "RegexpChangeMatcher", ")", "RunsAgainstChanges", "(", "changes", "[", "]", "string", ")", "bool", "{", "for", "_", ",", "change", ":=", "range", "changes", "{", "if", "cm", ".", "reChanges", ".", "MatchString", "(", "change", ")", "{"...
// RunsAgainstChanges returns true if any of the changed input paths match the run_if_changed regex.
[ "RunsAgainstChanges", "returns", "true", "if", "any", "of", "the", "changed", "input", "paths", "match", "the", "run_if_changed", "regex", "." ]
8125fbda10178887be5dff9e901d6a0a519b67bc
https://github.com/kubernetes/test-infra/blob/8125fbda10178887be5dff9e901d6a0a519b67bc/prow/config/jobs.go#L290-L297
test
kubernetes/test-infra
prow/config/jobs.go
CouldRun
func (ps Postsubmit) CouldRun(baseRef string) bool { return ps.Brancher.ShouldRun(baseRef) }
go
func (ps Postsubmit) CouldRun(baseRef string) bool { return ps.Brancher.ShouldRun(baseRef) }
[ "func", "(", "ps", "Postsubmit", ")", "CouldRun", "(", "baseRef", "string", ")", "bool", "{", "return", "ps", ".", "Brancher", ".", "ShouldRun", "(", "baseRef", ")", "\n", "}" ]
// CouldRun determines if the postsubmit could run against a specific // base ref
[ "CouldRun", "determines", "if", "the", "postsubmit", "could", "run", "against", "a", "specific", "base", "ref" ]
8125fbda10178887be5dff9e901d6a0a519b67bc
https://github.com/kubernetes/test-infra/blob/8125fbda10178887be5dff9e901d6a0a519b67bc/prow/config/jobs.go#L301-L303
test
kubernetes/test-infra
prow/config/jobs.go
ShouldRun
func (ps Postsubmit) ShouldRun(baseRef string, changes ChangedFilesProvider) (bool, error) { if !ps.CouldRun(baseRef) { return false, nil } if determined, shouldRun, err := ps.RegexpChangeMatcher.ShouldRun(changes); err != nil { return false, err } else if determined { return shouldRun, nil } // Postsubmits...
go
func (ps Postsubmit) ShouldRun(baseRef string, changes ChangedFilesProvider) (bool, error) { if !ps.CouldRun(baseRef) { return false, nil } if determined, shouldRun, err := ps.RegexpChangeMatcher.ShouldRun(changes); err != nil { return false, err } else if determined { return shouldRun, nil } // Postsubmits...
[ "func", "(", "ps", "Postsubmit", ")", "ShouldRun", "(", "baseRef", "string", ",", "changes", "ChangedFilesProvider", ")", "(", "bool", ",", "error", ")", "{", "if", "!", "ps", ".", "CouldRun", "(", "baseRef", ")", "{", "return", "false", ",", "nil", "\...
// ShouldRun determines if the postsubmit should run in response to a // set of changes. This is evaluated lazily, if necessary.
[ "ShouldRun", "determines", "if", "the", "postsubmit", "should", "run", "in", "response", "to", "a", "set", "of", "changes", ".", "This", "is", "evaluated", "lazily", "if", "necessary", "." ]
8125fbda10178887be5dff9e901d6a0a519b67bc
https://github.com/kubernetes/test-infra/blob/8125fbda10178887be5dff9e901d6a0a519b67bc/prow/config/jobs.go#L307-L318
test
kubernetes/test-infra
prow/config/jobs.go
CouldRun
func (ps Presubmit) CouldRun(baseRef string) bool { return ps.Brancher.ShouldRun(baseRef) }
go
func (ps Presubmit) CouldRun(baseRef string) bool { return ps.Brancher.ShouldRun(baseRef) }
[ "func", "(", "ps", "Presubmit", ")", "CouldRun", "(", "baseRef", "string", ")", "bool", "{", "return", "ps", ".", "Brancher", ".", "ShouldRun", "(", "baseRef", ")", "\n", "}" ]
// CouldRun determines if the presubmit could run against a specific // base ref
[ "CouldRun", "determines", "if", "the", "presubmit", "could", "run", "against", "a", "specific", "base", "ref" ]
8125fbda10178887be5dff9e901d6a0a519b67bc
https://github.com/kubernetes/test-infra/blob/8125fbda10178887be5dff9e901d6a0a519b67bc/prow/config/jobs.go#L322-L324
test
kubernetes/test-infra
prow/config/jobs.go
ShouldRun
func (ps Presubmit) ShouldRun(baseRef string, changes ChangedFilesProvider, forced, defaults bool) (bool, error) { if !ps.CouldRun(baseRef) { return false, nil } if ps.AlwaysRun { return true, nil } if forced { return true, nil } if determined, shouldRun, err := ps.RegexpChangeMatcher.ShouldRun(changes); e...
go
func (ps Presubmit) ShouldRun(baseRef string, changes ChangedFilesProvider, forced, defaults bool) (bool, error) { if !ps.CouldRun(baseRef) { return false, nil } if ps.AlwaysRun { return true, nil } if forced { return true, nil } if determined, shouldRun, err := ps.RegexpChangeMatcher.ShouldRun(changes); e...
[ "func", "(", "ps", "Presubmit", ")", "ShouldRun", "(", "baseRef", "string", ",", "changes", "ChangedFilesProvider", ",", "forced", ",", "defaults", "bool", ")", "(", "bool", ",", "error", ")", "{", "if", "!", "ps", ".", "CouldRun", "(", "baseRef", ")", ...
// ShouldRun determines if the presubmit should run against a specific // base ref, or in response to a set of changes. The latter mechanism // is evaluated lazily, if necessary.
[ "ShouldRun", "determines", "if", "the", "presubmit", "should", "run", "against", "a", "specific", "base", "ref", "or", "in", "response", "to", "a", "set", "of", "changes", ".", "The", "latter", "mechanism", "is", "evaluated", "lazily", "if", "necessary", "."...
8125fbda10178887be5dff9e901d6a0a519b67bc
https://github.com/kubernetes/test-infra/blob/8125fbda10178887be5dff9e901d6a0a519b67bc/prow/config/jobs.go#L329-L345
test
kubernetes/test-infra
prow/config/jobs.go
GetPresubmit
func (c *JobConfig) GetPresubmit(repo, jobName string) *Presubmit { presubmits := c.AllPresubmits([]string{repo}) for i := range presubmits { ps := presubmits[i] if ps.Name == jobName { return &ps } } return nil }
go
func (c *JobConfig) GetPresubmit(repo, jobName string) *Presubmit { presubmits := c.AllPresubmits([]string{repo}) for i := range presubmits { ps := presubmits[i] if ps.Name == jobName { return &ps } } return nil }
[ "func", "(", "c", "*", "JobConfig", ")", "GetPresubmit", "(", "repo", ",", "jobName", "string", ")", "*", "Presubmit", "{", "presubmits", ":=", "c", ".", "AllPresubmits", "(", "[", "]", "string", "{", "repo", "}", ")", "\n", "for", "i", ":=", "range"...
// GetPresubmit returns the presubmit job for the provided repo and job name.
[ "GetPresubmit", "returns", "the", "presubmit", "job", "for", "the", "provided", "repo", "and", "job", "name", "." ]
8125fbda10178887be5dff9e901d6a0a519b67bc
https://github.com/kubernetes/test-infra/blob/8125fbda10178887be5dff9e901d6a0a519b67bc/prow/config/jobs.go#L441-L450
test
kubernetes/test-infra
prow/config/jobs.go
SetPresubmits
func (c *JobConfig) SetPresubmits(jobs map[string][]Presubmit) error { nj := map[string][]Presubmit{} for k, v := range jobs { nj[k] = make([]Presubmit, len(v)) copy(nj[k], v) if err := SetPresubmitRegexes(nj[k]); err != nil { return err } } c.Presubmits = nj return nil }
go
func (c *JobConfig) SetPresubmits(jobs map[string][]Presubmit) error { nj := map[string][]Presubmit{} for k, v := range jobs { nj[k] = make([]Presubmit, len(v)) copy(nj[k], v) if err := SetPresubmitRegexes(nj[k]); err != nil { return err } } c.Presubmits = nj return nil }
[ "func", "(", "c", "*", "JobConfig", ")", "SetPresubmits", "(", "jobs", "map", "[", "string", "]", "[", "]", "Presubmit", ")", "error", "{", "nj", ":=", "map", "[", "string", "]", "[", "]", "Presubmit", "{", "}", "\n", "for", "k", ",", "v", ":=", ...
// SetPresubmits updates c.Presubmits to jobs, after compiling and validating their regexes.
[ "SetPresubmits", "updates", "c", ".", "Presubmits", "to", "jobs", "after", "compiling", "and", "validating", "their", "regexes", "." ]
8125fbda10178887be5dff9e901d6a0a519b67bc
https://github.com/kubernetes/test-infra/blob/8125fbda10178887be5dff9e901d6a0a519b67bc/prow/config/jobs.go#L453-L464
test
kubernetes/test-infra
prow/config/jobs.go
SetPostsubmits
func (c *JobConfig) SetPostsubmits(jobs map[string][]Postsubmit) error { nj := map[string][]Postsubmit{} for k, v := range jobs { nj[k] = make([]Postsubmit, len(v)) copy(nj[k], v) if err := SetPostsubmitRegexes(nj[k]); err != nil { return err } } c.Postsubmits = nj return nil }
go
func (c *JobConfig) SetPostsubmits(jobs map[string][]Postsubmit) error { nj := map[string][]Postsubmit{} for k, v := range jobs { nj[k] = make([]Postsubmit, len(v)) copy(nj[k], v) if err := SetPostsubmitRegexes(nj[k]); err != nil { return err } } c.Postsubmits = nj return nil }
[ "func", "(", "c", "*", "JobConfig", ")", "SetPostsubmits", "(", "jobs", "map", "[", "string", "]", "[", "]", "Postsubmit", ")", "error", "{", "nj", ":=", "map", "[", "string", "]", "[", "]", "Postsubmit", "{", "}", "\n", "for", "k", ",", "v", ":=...
// SetPostsubmits updates c.Postsubmits to jobs, after compiling and validating their regexes.
[ "SetPostsubmits", "updates", "c", ".", "Postsubmits", "to", "jobs", "after", "compiling", "and", "validating", "their", "regexes", "." ]
8125fbda10178887be5dff9e901d6a0a519b67bc
https://github.com/kubernetes/test-infra/blob/8125fbda10178887be5dff9e901d6a0a519b67bc/prow/config/jobs.go#L467-L478
test
kubernetes/test-infra
prow/config/jobs.go
AllPresubmits
func (c *JobConfig) AllPresubmits(repos []string) []Presubmit { var res []Presubmit for repo, v := range c.Presubmits { if len(repos) == 0 { res = append(res, v...) } else { for _, r := range repos { if r == repo { res = append(res, v...) break } } } } return res }
go
func (c *JobConfig) AllPresubmits(repos []string) []Presubmit { var res []Presubmit for repo, v := range c.Presubmits { if len(repos) == 0 { res = append(res, v...) } else { for _, r := range repos { if r == repo { res = append(res, v...) break } } } } return res }
[ "func", "(", "c", "*", "JobConfig", ")", "AllPresubmits", "(", "repos", "[", "]", "string", ")", "[", "]", "Presubmit", "{", "var", "res", "[", "]", "Presubmit", "\n", "for", "repo", ",", "v", ":=", "range", "c", ".", "Presubmits", "{", "if", "len"...
// AllPresubmits returns all prow presubmit jobs in repos. // if repos is empty, return all presubmits.
[ "AllPresubmits", "returns", "all", "prow", "presubmit", "jobs", "in", "repos", ".", "if", "repos", "is", "empty", "return", "all", "presubmits", "." ]
8125fbda10178887be5dff9e901d6a0a519b67bc
https://github.com/kubernetes/test-infra/blob/8125fbda10178887be5dff9e901d6a0a519b67bc/prow/config/jobs.go#L482-L499
test
kubernetes/test-infra
prow/config/jobs.go
AllPostsubmits
func (c *JobConfig) AllPostsubmits(repos []string) []Postsubmit { var res []Postsubmit for repo, v := range c.Postsubmits { if len(repos) == 0 { res = append(res, v...) } else { for _, r := range repos { if r == repo { res = append(res, v...) break } } } } return res }
go
func (c *JobConfig) AllPostsubmits(repos []string) []Postsubmit { var res []Postsubmit for repo, v := range c.Postsubmits { if len(repos) == 0 { res = append(res, v...) } else { for _, r := range repos { if r == repo { res = append(res, v...) break } } } } return res }
[ "func", "(", "c", "*", "JobConfig", ")", "AllPostsubmits", "(", "repos", "[", "]", "string", ")", "[", "]", "Postsubmit", "{", "var", "res", "[", "]", "Postsubmit", "\n", "for", "repo", ",", "v", ":=", "range", "c", ".", "Postsubmits", "{", "if", "...
// AllPostsubmits returns all prow postsubmit jobs in repos. // if repos is empty, return all postsubmits.
[ "AllPostsubmits", "returns", "all", "prow", "postsubmit", "jobs", "in", "repos", ".", "if", "repos", "is", "empty", "return", "all", "postsubmits", "." ]
8125fbda10178887be5dff9e901d6a0a519b67bc
https://github.com/kubernetes/test-infra/blob/8125fbda10178887be5dff9e901d6a0a519b67bc/prow/config/jobs.go#L503-L520
test
kubernetes/test-infra
prow/config/jobs.go
AllPeriodics
func (c *JobConfig) AllPeriodics() []Periodic { var listPeriodic func(ps []Periodic) []Periodic listPeriodic = func(ps []Periodic) []Periodic { var res []Periodic for _, p := range ps { res = append(res, p) } return res } return listPeriodic(c.Periodics) }
go
func (c *JobConfig) AllPeriodics() []Periodic { var listPeriodic func(ps []Periodic) []Periodic listPeriodic = func(ps []Periodic) []Periodic { var res []Periodic for _, p := range ps { res = append(res, p) } return res } return listPeriodic(c.Periodics) }
[ "func", "(", "c", "*", "JobConfig", ")", "AllPeriodics", "(", ")", "[", "]", "Periodic", "{", "var", "listPeriodic", "func", "(", "ps", "[", "]", "Periodic", ")", "[", "]", "Periodic", "\n", "listPeriodic", "=", "func", "(", "ps", "[", "]", "Periodic...
// AllPeriodics returns all prow periodic jobs.
[ "AllPeriodics", "returns", "all", "prow", "periodic", "jobs", "." ]
8125fbda10178887be5dff9e901d6a0a519b67bc
https://github.com/kubernetes/test-infra/blob/8125fbda10178887be5dff9e901d6a0a519b67bc/prow/config/jobs.go#L523-L534
test
kubernetes/test-infra
prow/config/jobs.go
ClearCompiledRegexes
func ClearCompiledRegexes(presubmits []Presubmit) { for i := range presubmits { presubmits[i].re = nil presubmits[i].Brancher.re = nil presubmits[i].Brancher.reSkip = nil presubmits[i].RegexpChangeMatcher.reChanges = nil } }
go
func ClearCompiledRegexes(presubmits []Presubmit) { for i := range presubmits { presubmits[i].re = nil presubmits[i].Brancher.re = nil presubmits[i].Brancher.reSkip = nil presubmits[i].RegexpChangeMatcher.reChanges = nil } }
[ "func", "ClearCompiledRegexes", "(", "presubmits", "[", "]", "Presubmit", ")", "{", "for", "i", ":=", "range", "presubmits", "{", "presubmits", "[", "i", "]", ".", "re", "=", "nil", "\n", "presubmits", "[", "i", "]", ".", "Brancher", ".", "re", "=", ...
// ClearCompiledRegexes removes compiled regexes from the presubmits, // useful for testing when deep equality is needed between presubmits
[ "ClearCompiledRegexes", "removes", "compiled", "regexes", "from", "the", "presubmits", "useful", "for", "testing", "when", "deep", "equality", "is", "needed", "between", "presubmits" ]
8125fbda10178887be5dff9e901d6a0a519b67bc
https://github.com/kubernetes/test-infra/blob/8125fbda10178887be5dff9e901d6a0a519b67bc/prow/config/jobs.go#L538-L545
test
kubernetes/test-infra
prow/repoowners/repoowners.go
Empty
func (s *SimpleConfig) Empty() bool { return len(s.Approvers) == 0 && len(s.Reviewers) == 0 && len(s.RequiredReviewers) == 0 && len(s.Labels) == 0 }
go
func (s *SimpleConfig) Empty() bool { return len(s.Approvers) == 0 && len(s.Reviewers) == 0 && len(s.RequiredReviewers) == 0 && len(s.Labels) == 0 }
[ "func", "(", "s", "*", "SimpleConfig", ")", "Empty", "(", ")", "bool", "{", "return", "len", "(", "s", ".", "Approvers", ")", "==", "0", "&&", "len", "(", "s", ".", "Reviewers", ")", "==", "0", "&&", "len", "(", "s", ".", "RequiredReviewers", ")"...
// Empty checks if a SimpleConfig could be considered empty
[ "Empty", "checks", "if", "a", "SimpleConfig", "could", "be", "considered", "empty" ]
8125fbda10178887be5dff9e901d6a0a519b67bc
https://github.com/kubernetes/test-infra/blob/8125fbda10178887be5dff9e901d6a0a519b67bc/prow/repoowners/repoowners.go#L66-L68
test
kubernetes/test-infra
prow/repoowners/repoowners.go
NewClient
func NewClient( gc *git.Client, ghc *github.Client, mdYAMLEnabled func(org, repo string) bool, skipCollaborators func(org, repo string) bool, ownersDirBlacklist func() prowConf.OwnersDirBlacklist, ) *Client { return &Client{ git: gc, ghc: ghc, logger: logrus.WithField("client", "repoowners"), cache:...
go
func NewClient( gc *git.Client, ghc *github.Client, mdYAMLEnabled func(org, repo string) bool, skipCollaborators func(org, repo string) bool, ownersDirBlacklist func() prowConf.OwnersDirBlacklist, ) *Client { return &Client{ git: gc, ghc: ghc, logger: logrus.WithField("client", "repoowners"), cache:...
[ "func", "NewClient", "(", "gc", "*", "git", ".", "Client", ",", "ghc", "*", "github", ".", "Client", ",", "mdYAMLEnabled", "func", "(", "org", ",", "repo", "string", ")", "bool", ",", "skipCollaborators", "func", "(", "org", ",", "repo", "string", ")",...
// NewClient is the constructor for Client
[ "NewClient", "is", "the", "constructor", "for", "Client" ]
8125fbda10178887be5dff9e901d6a0a519b67bc
https://github.com/kubernetes/test-infra/blob/8125fbda10178887be5dff9e901d6a0a519b67bc/prow/repoowners/repoowners.go#L119-L136
test
kubernetes/test-infra
prow/repoowners/repoowners.go
ExpandAlias
func (a RepoAliases) ExpandAlias(alias string) sets.String { if a == nil { return nil } return a[github.NormLogin(alias)] }
go
func (a RepoAliases) ExpandAlias(alias string) sets.String { if a == nil { return nil } return a[github.NormLogin(alias)] }
[ "func", "(", "a", "RepoAliases", ")", "ExpandAlias", "(", "alias", "string", ")", "sets", ".", "String", "{", "if", "a", "==", "nil", "{", "return", "nil", "\n", "}", "\n", "return", "a", "[", "github", ".", "NormLogin", "(", "alias", ")", "]", "\n...
// ExpandAlias returns members of an alias
[ "ExpandAlias", "returns", "members", "of", "an", "alias" ]
8125fbda10178887be5dff9e901d6a0a519b67bc
https://github.com/kubernetes/test-infra/blob/8125fbda10178887be5dff9e901d6a0a519b67bc/prow/repoowners/repoowners.go#L299-L304
test
kubernetes/test-infra
prow/repoowners/repoowners.go
ExpandAliases
func (a RepoAliases) ExpandAliases(logins sets.String) sets.String { if a == nil { return logins } // Make logins a copy of the original set to avoid modifying the original. logins = logins.Union(nil) for _, login := range logins.List() { if expanded := a.ExpandAlias(login); len(expanded) > 0 { logins.Delet...
go
func (a RepoAliases) ExpandAliases(logins sets.String) sets.String { if a == nil { return logins } // Make logins a copy of the original set to avoid modifying the original. logins = logins.Union(nil) for _, login := range logins.List() { if expanded := a.ExpandAlias(login); len(expanded) > 0 { logins.Delet...
[ "func", "(", "a", "RepoAliases", ")", "ExpandAliases", "(", "logins", "sets", ".", "String", ")", "sets", ".", "String", "{", "if", "a", "==", "nil", "{", "return", "logins", "\n", "}", "\n", "logins", "=", "logins", ".", "Union", "(", "nil", ")", ...
// ExpandAliases returns members of multiple aliases, duplicates are pruned
[ "ExpandAliases", "returns", "members", "of", "multiple", "aliases", "duplicates", "are", "pruned" ]
8125fbda10178887be5dff9e901d6a0a519b67bc
https://github.com/kubernetes/test-infra/blob/8125fbda10178887be5dff9e901d6a0a519b67bc/prow/repoowners/repoowners.go#L307-L320
test
kubernetes/test-infra
prow/repoowners/repoowners.go
ParseFullConfig
func ParseFullConfig(b []byte) (FullConfig, error) { full := new(FullConfig) err := yaml.Unmarshal(b, full) return *full, err }
go
func ParseFullConfig(b []byte) (FullConfig, error) { full := new(FullConfig) err := yaml.Unmarshal(b, full) return *full, err }
[ "func", "ParseFullConfig", "(", "b", "[", "]", "byte", ")", "(", "FullConfig", ",", "error", ")", "{", "full", ":=", "new", "(", "FullConfig", ")", "\n", "err", ":=", "yaml", ".", "Unmarshal", "(", "b", ",", "full", ")", "\n", "return", "*", "full"...
// ParseFullConfig will unmarshal OWNERS file's content into a FullConfig // Returns an error if the content cannot be unmarshalled
[ "ParseFullConfig", "will", "unmarshal", "OWNERS", "file", "s", "content", "into", "a", "FullConfig", "Returns", "an", "error", "if", "the", "content", "cannot", "be", "unmarshalled" ]
8125fbda10178887be5dff9e901d6a0a519b67bc
https://github.com/kubernetes/test-infra/blob/8125fbda10178887be5dff9e901d6a0a519b67bc/prow/repoowners/repoowners.go#L457-L461
test
kubernetes/test-infra
prow/repoowners/repoowners.go
ParseSimpleConfig
func ParseSimpleConfig(b []byte) (SimpleConfig, error) { simple := new(SimpleConfig) err := yaml.Unmarshal(b, simple) return *simple, err }
go
func ParseSimpleConfig(b []byte) (SimpleConfig, error) { simple := new(SimpleConfig) err := yaml.Unmarshal(b, simple) return *simple, err }
[ "func", "ParseSimpleConfig", "(", "b", "[", "]", "byte", ")", "(", "SimpleConfig", ",", "error", ")", "{", "simple", ":=", "new", "(", "SimpleConfig", ")", "\n", "err", ":=", "yaml", ".", "Unmarshal", "(", "b", ",", "simple", ")", "\n", "return", "*"...
// ParseSimpleConfig will unmarshal an OWNERS file's content into a SimpleConfig // Returns an error if the content cannot be unmarshalled
[ "ParseSimpleConfig", "will", "unmarshal", "an", "OWNERS", "file", "s", "content", "into", "a", "SimpleConfig", "Returns", "an", "error", "if", "the", "content", "cannot", "be", "unmarshalled" ]
8125fbda10178887be5dff9e901d6a0a519b67bc
https://github.com/kubernetes/test-infra/blob/8125fbda10178887be5dff9e901d6a0a519b67bc/prow/repoowners/repoowners.go#L465-L469
test
kubernetes/test-infra
prow/repoowners/repoowners.go
decodeOwnersMdConfig
func decodeOwnersMdConfig(path string, config *SimpleConfig) error { fileBytes, err := ioutil.ReadFile(path) if err != nil { return err } // Parse the yaml header from the top of the file. Will return an empty string if regex does not match. meta := mdStructuredHeaderRegex.FindString(string(fileBytes)) // Unm...
go
func decodeOwnersMdConfig(path string, config *SimpleConfig) error { fileBytes, err := ioutil.ReadFile(path) if err != nil { return err } // Parse the yaml header from the top of the file. Will return an empty string if regex does not match. meta := mdStructuredHeaderRegex.FindString(string(fileBytes)) // Unm...
[ "func", "decodeOwnersMdConfig", "(", "path", "string", ",", "config", "*", "SimpleConfig", ")", "error", "{", "fileBytes", ",", "err", ":=", "ioutil", ".", "ReadFile", "(", "path", ")", "\n", "if", "err", "!=", "nil", "{", "return", "err", "\n", "}", "...
// decodeOwnersMdConfig will parse the yaml header if it exists and unmarshal it into a singleOwnersConfig. // If no yaml header is found, do nothing // Returns an error if the file cannot be read or the yaml header is found but cannot be unmarshalled.
[ "decodeOwnersMdConfig", "will", "parse", "the", "yaml", "header", "if", "it", "exists", "and", "unmarshal", "it", "into", "a", "singleOwnersConfig", ".", "If", "no", "yaml", "header", "is", "found", "do", "nothing", "Returns", "an", "error", "if", "the", "fi...
8125fbda10178887be5dff9e901d6a0a519b67bc
https://github.com/kubernetes/test-infra/blob/8125fbda10178887be5dff9e901d6a0a519b67bc/prow/repoowners/repoowners.go#L476-L486
test
kubernetes/test-infra
prow/repoowners/repoowners.go
findOwnersForFile
func findOwnersForFile(log *logrus.Entry, path string, ownerMap map[string]map[*regexp.Regexp]sets.String) string { d := path for ; d != baseDirConvention; d = canonicalize(filepath.Dir(d)) { relative, err := filepath.Rel(d, path) if err != nil { log.WithError(err).WithField("path", path).Errorf("Unable to fi...
go
func findOwnersForFile(log *logrus.Entry, path string, ownerMap map[string]map[*regexp.Regexp]sets.String) string { d := path for ; d != baseDirConvention; d = canonicalize(filepath.Dir(d)) { relative, err := filepath.Rel(d, path) if err != nil { log.WithError(err).WithField("path", path).Errorf("Unable to fi...
[ "func", "findOwnersForFile", "(", "log", "*", "logrus", ".", "Entry", ",", "path", "string", ",", "ownerMap", "map", "[", "string", "]", "map", "[", "*", "regexp", ".", "Regexp", "]", "sets", ".", "String", ")", "string", "{", "d", ":=", "path", "\n"...
// findOwnersForFile returns the OWNERS file path furthest down the tree for a specified file // using ownerMap to check for entries
[ "findOwnersForFile", "returns", "the", "OWNERS", "file", "path", "furthest", "down", "the", "tree", "for", "a", "specified", "file", "using", "ownerMap", "to", "check", "for", "entries" ]
8125fbda10178887be5dff9e901d6a0a519b67bc
https://github.com/kubernetes/test-infra/blob/8125fbda10178887be5dff9e901d6a0a519b67bc/prow/repoowners/repoowners.go#L556-L575
test
kubernetes/test-infra
prow/repoowners/repoowners.go
FindApproverOwnersForFile
func (o *RepoOwners) FindApproverOwnersForFile(path string) string { return findOwnersForFile(o.log, path, o.approvers) }
go
func (o *RepoOwners) FindApproverOwnersForFile(path string) string { return findOwnersForFile(o.log, path, o.approvers) }
[ "func", "(", "o", "*", "RepoOwners", ")", "FindApproverOwnersForFile", "(", "path", "string", ")", "string", "{", "return", "findOwnersForFile", "(", "o", ".", "log", ",", "path", ",", "o", ".", "approvers", ")", "\n", "}" ]
// FindApproverOwnersForFile returns the OWNERS file path furthest down the tree for a specified file // that contains an approvers section
[ "FindApproverOwnersForFile", "returns", "the", "OWNERS", "file", "path", "furthest", "down", "the", "tree", "for", "a", "specified", "file", "that", "contains", "an", "approvers", "section" ]
8125fbda10178887be5dff9e901d6a0a519b67bc
https://github.com/kubernetes/test-infra/blob/8125fbda10178887be5dff9e901d6a0a519b67bc/prow/repoowners/repoowners.go#L579-L581
test
kubernetes/test-infra
prow/repoowners/repoowners.go
FindReviewersOwnersForFile
func (o *RepoOwners) FindReviewersOwnersForFile(path string) string { return findOwnersForFile(o.log, path, o.reviewers) }
go
func (o *RepoOwners) FindReviewersOwnersForFile(path string) string { return findOwnersForFile(o.log, path, o.reviewers) }
[ "func", "(", "o", "*", "RepoOwners", ")", "FindReviewersOwnersForFile", "(", "path", "string", ")", "string", "{", "return", "findOwnersForFile", "(", "o", ".", "log", ",", "path", ",", "o", ".", "reviewers", ")", "\n", "}" ]
// FindReviewersOwnersForFile returns the OWNERS file path furthest down the tree for a specified file // that contains a reviewers section
[ "FindReviewersOwnersForFile", "returns", "the", "OWNERS", "file", "path", "furthest", "down", "the", "tree", "for", "a", "specified", "file", "that", "contains", "a", "reviewers", "section" ]
8125fbda10178887be5dff9e901d6a0a519b67bc
https://github.com/kubernetes/test-infra/blob/8125fbda10178887be5dff9e901d6a0a519b67bc/prow/repoowners/repoowners.go#L585-L587
test
kubernetes/test-infra
prow/repoowners/repoowners.go
FindLabelsForFile
func (o *RepoOwners) FindLabelsForFile(path string) sets.String { return o.entriesForFile(path, o.labels, false) }
go
func (o *RepoOwners) FindLabelsForFile(path string) sets.String { return o.entriesForFile(path, o.labels, false) }
[ "func", "(", "o", "*", "RepoOwners", ")", "FindLabelsForFile", "(", "path", "string", ")", "sets", ".", "String", "{", "return", "o", ".", "entriesForFile", "(", "path", ",", "o", ".", "labels", ",", "false", ")", "\n", "}" ]
// FindLabelsForFile returns a set of labels which should be applied to PRs // modifying files under the given path.
[ "FindLabelsForFile", "returns", "a", "set", "of", "labels", "which", "should", "be", "applied", "to", "PRs", "modifying", "files", "under", "the", "given", "path", "." ]
8125fbda10178887be5dff9e901d6a0a519b67bc
https://github.com/kubernetes/test-infra/blob/8125fbda10178887be5dff9e901d6a0a519b67bc/prow/repoowners/repoowners.go#L591-L593
test
kubernetes/test-infra
prow/repoowners/repoowners.go
IsNoParentOwners
func (o *RepoOwners) IsNoParentOwners(path string) bool { return o.options[path].NoParentOwners }
go
func (o *RepoOwners) IsNoParentOwners(path string) bool { return o.options[path].NoParentOwners }
[ "func", "(", "o", "*", "RepoOwners", ")", "IsNoParentOwners", "(", "path", "string", ")", "bool", "{", "return", "o", ".", "options", "[", "path", "]", ".", "NoParentOwners", "\n", "}" ]
// IsNoParentOwners checks if an OWNERS file path refers to an OWNERS file with NoParentOwners enabled.
[ "IsNoParentOwners", "checks", "if", "an", "OWNERS", "file", "path", "refers", "to", "an", "OWNERS", "file", "with", "NoParentOwners", "enabled", "." ]
8125fbda10178887be5dff9e901d6a0a519b67bc
https://github.com/kubernetes/test-infra/blob/8125fbda10178887be5dff9e901d6a0a519b67bc/prow/repoowners/repoowners.go#L596-L598
test
kubernetes/test-infra
gopherage/pkg/cov/junit/calculation/coverage.go
Ratio
func (c *Coverage) Ratio() float32 { if c.NumAllStmts == 0 { return 1 } return float32(c.NumCoveredStmts) / float32(c.NumAllStmts) }
go
func (c *Coverage) Ratio() float32 { if c.NumAllStmts == 0 { return 1 } return float32(c.NumCoveredStmts) / float32(c.NumAllStmts) }
[ "func", "(", "c", "*", "Coverage", ")", "Ratio", "(", ")", "float32", "{", "if", "c", ".", "NumAllStmts", "==", "0", "{", "return", "1", "\n", "}", "\n", "return", "float32", "(", "c", ".", "NumCoveredStmts", ")", "/", "float32", "(", "c", ".", "...
// Ratio returns the percentage of statements that are covered
[ "Ratio", "returns", "the", "percentage", "of", "statements", "that", "are", "covered" ]
8125fbda10178887be5dff9e901d6a0a519b67bc
https://github.com/kubernetes/test-infra/blob/8125fbda10178887be5dff9e901d6a0a519b67bc/gopherage/pkg/cov/junit/calculation/coverage.go#L27-L32
test
kubernetes/test-infra
prow/pubsub/subscriber/subscriber.go
FromPayload
func (pe *PeriodicProwJobEvent) FromPayload(data []byte) error { if err := json.Unmarshal(data, pe); err != nil { return err } return nil }
go
func (pe *PeriodicProwJobEvent) FromPayload(data []byte) error { if err := json.Unmarshal(data, pe); err != nil { return err } return nil }
[ "func", "(", "pe", "*", "PeriodicProwJobEvent", ")", "FromPayload", "(", "data", "[", "]", "byte", ")", "error", "{", "if", "err", ":=", "json", ".", "Unmarshal", "(", "data", ",", "pe", ")", ";", "err", "!=", "nil", "{", "return", "err", "\n", "}"...
// FromPayload set the PeriodicProwJobEvent from the PubSub message payload.
[ "FromPayload", "set", "the", "PeriodicProwJobEvent", "from", "the", "PubSub", "message", "payload", "." ]
8125fbda10178887be5dff9e901d6a0a519b67bc
https://github.com/kubernetes/test-infra/blob/8125fbda10178887be5dff9e901d6a0a519b67bc/prow/pubsub/subscriber/subscriber.go#L48-L53
test
kubernetes/test-infra
prow/pubsub/subscriber/subscriber.go
ToMessage
func (pe *PeriodicProwJobEvent) ToMessage() (*pubsub.Message, error) { data, err := json.Marshal(pe) if err != nil { return nil, err } message := pubsub.Message{ Data: data, Attributes: map[string]string{ prowEventType: periodicProwJobEvent, }, } return &message, nil }
go
func (pe *PeriodicProwJobEvent) ToMessage() (*pubsub.Message, error) { data, err := json.Marshal(pe) if err != nil { return nil, err } message := pubsub.Message{ Data: data, Attributes: map[string]string{ prowEventType: periodicProwJobEvent, }, } return &message, nil }
[ "func", "(", "pe", "*", "PeriodicProwJobEvent", ")", "ToMessage", "(", ")", "(", "*", "pubsub", ".", "Message", ",", "error", ")", "{", "data", ",", "err", ":=", "json", ".", "Marshal", "(", "pe", ")", "\n", "if", "err", "!=", "nil", "{", "return",...
// ToMessage generates a PubSub Message from a PeriodicProwJobEvent.
[ "ToMessage", "generates", "a", "PubSub", "Message", "from", "a", "PeriodicProwJobEvent", "." ]
8125fbda10178887be5dff9e901d6a0a519b67bc
https://github.com/kubernetes/test-infra/blob/8125fbda10178887be5dff9e901d6a0a519b67bc/prow/pubsub/subscriber/subscriber.go#L56-L68
test