repo
stringlengths
5
67
path
stringlengths
4
218
func_name
stringlengths
0
151
original_string
stringlengths
52
373k
language
stringclasses
6 values
code
stringlengths
52
373k
code_tokens
listlengths
10
512
docstring
stringlengths
3
47.2k
docstring_tokens
listlengths
3
234
sha
stringlengths
40
40
url
stringlengths
85
339
partition
stringclasses
3 values
kubernetes/test-infra
prow/config/org/org.go
UnmarshalText
func (p *Privacy) UnmarshalText(text []byte) error { v := Privacy(text) if _, ok := privacySettings[v]; !ok { return fmt.Errorf("bad privacy setting: %s", v) } *p = v return nil }
go
func (p *Privacy) UnmarshalText(text []byte) error { v := Privacy(text) if _, ok := privacySettings[v]; !ok { return fmt.Errorf("bad privacy setting: %s", v) } *p = v return nil }
[ "func", "(", "p", "*", "Privacy", ")", "UnmarshalText", "(", "text", "[", "]", "byte", ")", "error", "{", "v", ":=", "Privacy", "(", "text", ")", "\n", "if", "_", ",", "ok", ":=", "privacySettings", "[", "v", "]", ";", "!", "ok", "{", "return", ...
// UnmarshalText returns an error if text != secret or closed
[ "UnmarshalText", "returns", "an", "error", "if", "text", "!", "=", "secret", "or", "closed" ]
8125fbda10178887be5dff9e901d6a0a519b67bc
https://github.com/kubernetes/test-infra/blob/8125fbda10178887be5dff9e901d6a0a519b67bc/prow/config/org/org.go#L103-L110
test
kubernetes/test-infra
prow/plugins/blockade/blockade.go
compileApplicableBlockades
func compileApplicableBlockades(org, repo string, log *logrus.Entry, blockades []plugins.Blockade) []blockade { if len(blockades) == 0 { return nil } orgRepo := fmt.Sprintf("%s/%s", org, repo) var compiled []blockade for _, raw := range blockades { // Only consider blockades that apply to this repo. if !str...
go
func compileApplicableBlockades(org, repo string, log *logrus.Entry, blockades []plugins.Blockade) []blockade { if len(blockades) == 0 { return nil } orgRepo := fmt.Sprintf("%s/%s", org, repo) var compiled []blockade for _, raw := range blockades { // Only consider blockades that apply to this repo. if !str...
[ "func", "compileApplicableBlockades", "(", "org", ",", "repo", "string", ",", "log", "*", "logrus", ".", "Entry", ",", "blockades", "[", "]", "plugins", ".", "Blockade", ")", "[", "]", "blockade", "{", "if", "len", "(", "blockades", ")", "==", "0", "{"...
// compileApplicableBlockades filters the specified blockades and compiles those that apply to the repo.
[ "compileApplicableBlockades", "filters", "the", "specified", "blockades", "and", "compiles", "those", "that", "apply", "to", "the", "repo", "." ]
8125fbda10178887be5dff9e901d6a0a519b67bc
https://github.com/kubernetes/test-infra/blob/8125fbda10178887be5dff9e901d6a0a519b67bc/prow/plugins/blockade/blockade.go#L182-L220
test
kubernetes/test-infra
prow/plugins/blockade/blockade.go
calculateBlocks
func calculateBlocks(changes []github.PullRequestChange, blockades []blockade) summary { sum := make(summary) for _, change := range changes { for _, b := range blockades { if b.isBlocked(change.Filename) { sum[b.explanation] = append(sum[b.explanation], change) } } } return sum }
go
func calculateBlocks(changes []github.PullRequestChange, blockades []blockade) summary { sum := make(summary) for _, change := range changes { for _, b := range blockades { if b.isBlocked(change.Filename) { sum[b.explanation] = append(sum[b.explanation], change) } } } return sum }
[ "func", "calculateBlocks", "(", "changes", "[", "]", "github", ".", "PullRequestChange", ",", "blockades", "[", "]", "blockade", ")", "summary", "{", "sum", ":=", "make", "(", "summary", ")", "\n", "for", "_", ",", "change", ":=", "range", "changes", "{"...
// calculateBlocks determines if a PR should be blocked and returns the summary describing the block.
[ "calculateBlocks", "determines", "if", "a", "PR", "should", "be", "blocked", "and", "returns", "the", "summary", "describing", "the", "block", "." ]
8125fbda10178887be5dff9e901d6a0a519b67bc
https://github.com/kubernetes/test-infra/blob/8125fbda10178887be5dff9e901d6a0a519b67bc/prow/plugins/blockade/blockade.go#L223-L233
test
kubernetes/test-infra
gopherage/pkg/cov/merge.go
MergeMultipleProfiles
func MergeMultipleProfiles(profiles [][]*cover.Profile) ([]*cover.Profile, error) { if len(profiles) < 1 { return nil, errors.New("can't merge zero profiles") } result := profiles[0] for _, profile := range profiles[1:] { var err error if result, err = MergeProfiles(result, profile); err != nil { return ni...
go
func MergeMultipleProfiles(profiles [][]*cover.Profile) ([]*cover.Profile, error) { if len(profiles) < 1 { return nil, errors.New("can't merge zero profiles") } result := profiles[0] for _, profile := range profiles[1:] { var err error if result, err = MergeProfiles(result, profile); err != nil { return ni...
[ "func", "MergeMultipleProfiles", "(", "profiles", "[", "]", "[", "]", "*", "cover", ".", "Profile", ")", "(", "[", "]", "*", "cover", ".", "Profile", ",", "error", ")", "{", "if", "len", "(", "profiles", ")", "<", "1", "{", "return", "nil", ",", ...
// MergeMultipleProfiles merges more than two profiles together. // MergeMultipleProfiles is equivalent to calling MergeProfiles on pairs of profiles // until only one profile remains.
[ "MergeMultipleProfiles", "merges", "more", "than", "two", "profiles", "together", ".", "MergeMultipleProfiles", "is", "equivalent", "to", "calling", "MergeProfiles", "on", "pairs", "of", "profiles", "until", "only", "one", "profile", "remains", "." ]
8125fbda10178887be5dff9e901d6a0a519b67bc
https://github.com/kubernetes/test-infra/blob/8125fbda10178887be5dff9e901d6a0a519b67bc/gopherage/pkg/cov/merge.go#L73-L85
test
kubernetes/test-infra
prow/pod-utils/wrapper/options.go
AddFlags
func (o *Options) AddFlags(fs *flag.FlagSet) { fs.StringVar(&o.ProcessLog, "process-log", "", "path to the log where stdout and stderr are streamed for the process we execute") fs.StringVar(&o.MarkerFile, "marker-file", "", "file we write the return code of the process we execute once it has finished running") fs.St...
go
func (o *Options) AddFlags(fs *flag.FlagSet) { fs.StringVar(&o.ProcessLog, "process-log", "", "path to the log where stdout and stderr are streamed for the process we execute") fs.StringVar(&o.MarkerFile, "marker-file", "", "file we write the return code of the process we execute once it has finished running") fs.St...
[ "func", "(", "o", "*", "Options", ")", "AddFlags", "(", "fs", "*", "flag", ".", "FlagSet", ")", "{", "fs", ".", "StringVar", "(", "&", "o", ".", "ProcessLog", ",", "\"process-log\"", ",", "\"\"", ",", "\"path to the log where stdout and stderr are streamed for...
// AddFlags adds flags to the FlagSet that populate // the wrapper options struct provided.
[ "AddFlags", "adds", "flags", "to", "the", "FlagSet", "that", "populate", "the", "wrapper", "options", "struct", "provided", "." ]
8125fbda10178887be5dff9e901d6a0a519b67bc
https://github.com/kubernetes/test-infra/blob/8125fbda10178887be5dff9e901d6a0a519b67bc/prow/pod-utils/wrapper/options.go#L61-L65
test
kubernetes/test-infra
prow/artifact-uploader/controller.go
processNextItem
func (c *Controller) processNextItem() bool { key, quit := c.queue.Get() if quit { return false } defer c.queue.Done(key) workItem := key.(item) prowJob, err := c.prowJobClient.GetProwJob(workItem.prowJobId) if err != nil { c.handleErr(err, workItem) return true } spec := downwardapi.NewJobSpec(prowJob...
go
func (c *Controller) processNextItem() bool { key, quit := c.queue.Get() if quit { return false } defer c.queue.Done(key) workItem := key.(item) prowJob, err := c.prowJobClient.GetProwJob(workItem.prowJobId) if err != nil { c.handleErr(err, workItem) return true } spec := downwardapi.NewJobSpec(prowJob...
[ "func", "(", "c", "*", "Controller", ")", "processNextItem", "(", ")", "bool", "{", "key", ",", "quit", ":=", "c", ".", "queue", ".", "Get", "(", ")", "\n", "if", "quit", "{", "return", "false", "\n", "}", "\n", "defer", "c", ".", "queue", ".", ...
// processNextItem attempts to upload container logs to GCS
[ "processNextItem", "attempts", "to", "upload", "container", "logs", "to", "GCS" ]
8125fbda10178887be5dff9e901d6a0a519b67bc
https://github.com/kubernetes/test-infra/blob/8125fbda10178887be5dff9e901d6a0a519b67bc/prow/artifact-uploader/controller.go#L147-L184
test
kubernetes/test-infra
prow/artifact-uploader/controller.go
handleErr
func (c *Controller) handleErr(err error, key item) { if c.queue.NumRequeues(key) < 5 { glog.Infof("Error uploading logs for container %v in pod %v: %v", key.containerName, key.podName, err) c.queue.AddRateLimited(key) return } c.queue.Forget(key) glog.Infof("Giving up on upload of logs for container %v in p...
go
func (c *Controller) handleErr(err error, key item) { if c.queue.NumRequeues(key) < 5 { glog.Infof("Error uploading logs for container %v in pod %v: %v", key.containerName, key.podName, err) c.queue.AddRateLimited(key) return } c.queue.Forget(key) glog.Infof("Giving up on upload of logs for container %v in p...
[ "func", "(", "c", "*", "Controller", ")", "handleErr", "(", "err", "error", ",", "key", "item", ")", "{", "if", "c", ".", "queue", ".", "NumRequeues", "(", "key", ")", "<", "5", "{", "glog", ".", "Infof", "(", "\"Error uploading logs for container %v in ...
// handleErr checks if an error happened and makes sure we will retry later.
[ "handleErr", "checks", "if", "an", "error", "happened", "and", "makes", "sure", "we", "will", "retry", "later", "." ]
8125fbda10178887be5dff9e901d6a0a519b67bc
https://github.com/kubernetes/test-infra/blob/8125fbda10178887be5dff9e901d6a0a519b67bc/prow/artifact-uploader/controller.go#L187-L196
test
kubernetes/test-infra
prow/pjutil/filter.go
AggregateFilter
func AggregateFilter(filters []Filter) Filter { return func(presubmit config.Presubmit) (bool, bool, bool) { for _, filter := range filters { if shouldRun, forced, defaults := filter(presubmit); shouldRun { return shouldRun, forced, defaults } } return false, false, false } }
go
func AggregateFilter(filters []Filter) Filter { return func(presubmit config.Presubmit) (bool, bool, bool) { for _, filter := range filters { if shouldRun, forced, defaults := filter(presubmit); shouldRun { return shouldRun, forced, defaults } } return false, false, false } }
[ "func", "AggregateFilter", "(", "filters", "[", "]", "Filter", ")", "Filter", "{", "return", "func", "(", "presubmit", "config", ".", "Presubmit", ")", "(", "bool", ",", "bool", ",", "bool", ")", "{", "for", "_", ",", "filter", ":=", "range", "filters"...
// AggregateFilter builds a filter that evaluates the child filters in order // and returns the first match
[ "AggregateFilter", "builds", "a", "filter", "that", "evaluates", "the", "child", "filters", "in", "order", "and", "returns", "the", "first", "match" ]
8125fbda10178887be5dff9e901d6a0a519b67bc
https://github.com/kubernetes/test-infra/blob/8125fbda10178887be5dff9e901d6a0a519b67bc/prow/pjutil/filter.go#L53-L62
test
kubernetes/test-infra
prow/pjutil/filter.go
FilterPresubmits
func FilterPresubmits(filter Filter, changes config.ChangedFilesProvider, branch string, presubmits []config.Presubmit, logger *logrus.Entry) ([]config.Presubmit, []config.Presubmit, error) { var toTrigger []config.Presubmit var toSkip []config.Presubmit for _, presubmit := range presubmits { matches, forced, def...
go
func FilterPresubmits(filter Filter, changes config.ChangedFilesProvider, branch string, presubmits []config.Presubmit, logger *logrus.Entry) ([]config.Presubmit, []config.Presubmit, error) { var toTrigger []config.Presubmit var toSkip []config.Presubmit for _, presubmit := range presubmits { matches, forced, def...
[ "func", "FilterPresubmits", "(", "filter", "Filter", ",", "changes", "config", ".", "ChangedFilesProvider", ",", "branch", "string", ",", "presubmits", "[", "]", "config", ".", "Presubmit", ",", "logger", "*", "logrus", ".", "Entry", ")", "(", "[", "]", "c...
// FilterPresubmits determines which presubmits should run and which should be skipped // by evaluating the user-provided filter.
[ "FilterPresubmits", "determines", "which", "presubmits", "should", "run", "and", "which", "should", "be", "skipped", "by", "evaluating", "the", "user", "-", "provided", "filter", "." ]
8125fbda10178887be5dff9e901d6a0a519b67bc
https://github.com/kubernetes/test-infra/blob/8125fbda10178887be5dff9e901d6a0a519b67bc/prow/pjutil/filter.go#L66-L88
test
kubernetes/test-infra
gopherage/cmd/filter/filter.go
MakeCommand
func MakeCommand() *cobra.Command { flags := &flags{} cmd := &cobra.Command{ Use: "filter [file]", Short: "Filters a Go coverage file.", Long: `Filters a Go coverage file, removing entries that do not match the given flags.`, Run: func(cmd *cobra.Command, args []string) { run(flags, cmd, args) }, } ...
go
func MakeCommand() *cobra.Command { flags := &flags{} cmd := &cobra.Command{ Use: "filter [file]", Short: "Filters a Go coverage file.", Long: `Filters a Go coverage file, removing entries that do not match the given flags.`, Run: func(cmd *cobra.Command, args []string) { run(flags, cmd, args) }, } ...
[ "func", "MakeCommand", "(", ")", "*", "cobra", ".", "Command", "{", "flags", ":=", "&", "flags", "{", "}", "\n", "cmd", ":=", "&", "cobra", ".", "Command", "{", "Use", ":", "\"filter [file]\"", ",", "Short", ":", "\"Filters a Go coverage file.\"", ",", "...
// MakeCommand returns a `filter` command.
[ "MakeCommand", "returns", "a", "filter", "command", "." ]
8125fbda10178887be5dff9e901d6a0a519b67bc
https://github.com/kubernetes/test-infra/blob/8125fbda10178887be5dff9e901d6a0a519b67bc/gopherage/cmd/filter/filter.go#L36-L50
test
kubernetes/test-infra
velodrome/transform/plugins/fake_open_wrapper.go
Push
func (t *EventTimeHeap) Push(x interface{}) { *t = append(*t, x.(sql.IssueEvent)) }
go
func (t *EventTimeHeap) Push(x interface{}) { *t = append(*t, x.(sql.IssueEvent)) }
[ "func", "(", "t", "*", "EventTimeHeap", ")", "Push", "(", "x", "interface", "{", "}", ")", "{", "*", "t", "=", "append", "(", "*", "t", ",", "x", ".", "(", "sql", ".", "IssueEvent", ")", ")", "\n", "}" ]
// Push adds event to the heap
[ "Push", "adds", "event", "to", "the", "heap" ]
8125fbda10178887be5dff9e901d6a0a519b67bc
https://github.com/kubernetes/test-infra/blob/8125fbda10178887be5dff9e901d6a0a519b67bc/velodrome/transform/plugins/fake_open_wrapper.go#L35-L37
test
kubernetes/test-infra
velodrome/transform/plugins/fake_open_wrapper.go
Pop
func (t *EventTimeHeap) Pop() interface{} { old := *t n := len(old) x := old[n-1] *t = old[0 : n-1] return x }
go
func (t *EventTimeHeap) Pop() interface{} { old := *t n := len(old) x := old[n-1] *t = old[0 : n-1] return x }
[ "func", "(", "t", "*", "EventTimeHeap", ")", "Pop", "(", ")", "interface", "{", "}", "{", "old", ":=", "*", "t", "\n", "n", ":=", "len", "(", "old", ")", "\n", "x", ":=", "old", "[", "n", "-", "1", "]", "\n", "*", "t", "=", "old", "[", "0...
// Pop retrieves the last added event
[ "Pop", "retrieves", "the", "last", "added", "event" ]
8125fbda10178887be5dff9e901d6a0a519b67bc
https://github.com/kubernetes/test-infra/blob/8125fbda10178887be5dff9e901d6a0a519b67bc/velodrome/transform/plugins/fake_open_wrapper.go#L40-L46
test
kubernetes/test-infra
velodrome/transform/plugins/fake_open_wrapper.go
NewFakeOpenPluginWrapper
func NewFakeOpenPluginWrapper(plugin Plugin) *FakeOpenPluginWrapper { return &FakeOpenPluginWrapper{ plugin: plugin, alreadyOpen: map[string]bool{}, } }
go
func NewFakeOpenPluginWrapper(plugin Plugin) *FakeOpenPluginWrapper { return &FakeOpenPluginWrapper{ plugin: plugin, alreadyOpen: map[string]bool{}, } }
[ "func", "NewFakeOpenPluginWrapper", "(", "plugin", "Plugin", ")", "*", "FakeOpenPluginWrapper", "{", "return", "&", "FakeOpenPluginWrapper", "{", "plugin", ":", "plugin", ",", "alreadyOpen", ":", "map", "[", "string", "]", "bool", "{", "}", ",", "}", "\n", "...
// NewFakeOpenPluginWrapper is the constructor for FakeOpenPluginWrapper
[ "NewFakeOpenPluginWrapper", "is", "the", "constructor", "for", "FakeOpenPluginWrapper" ]
8125fbda10178887be5dff9e901d6a0a519b67bc
https://github.com/kubernetes/test-infra/blob/8125fbda10178887be5dff9e901d6a0a519b67bc/velodrome/transform/plugins/fake_open_wrapper.go#L60-L65
test
kubernetes/test-infra
velodrome/transform/plugins/fake_open_wrapper.go
ReceiveIssue
func (o *FakeOpenPluginWrapper) ReceiveIssue(issue sql.Issue) []Point { if _, ok := o.alreadyOpen[issue.ID]; !ok { // Create/Add fake "opened" events heap.Push(&o.openEvents, sql.IssueEvent{ Event: "opened", IssueID: issue.ID, Actor: &issue.User, EventCreatedAt: issue.IssueCrea...
go
func (o *FakeOpenPluginWrapper) ReceiveIssue(issue sql.Issue) []Point { if _, ok := o.alreadyOpen[issue.ID]; !ok { // Create/Add fake "opened" events heap.Push(&o.openEvents, sql.IssueEvent{ Event: "opened", IssueID: issue.ID, Actor: &issue.User, EventCreatedAt: issue.IssueCrea...
[ "func", "(", "o", "*", "FakeOpenPluginWrapper", ")", "ReceiveIssue", "(", "issue", "sql", ".", "Issue", ")", "[", "]", "Point", "{", "if", "_", ",", "ok", ":=", "o", ".", "alreadyOpen", "[", "issue", ".", "ID", "]", ";", "!", "ok", "{", "heap", "...
// ReceiveIssue creates a fake "opened" event
[ "ReceiveIssue", "creates", "a", "fake", "opened", "event" ]
8125fbda10178887be5dff9e901d6a0a519b67bc
https://github.com/kubernetes/test-infra/blob/8125fbda10178887be5dff9e901d6a0a519b67bc/velodrome/transform/plugins/fake_open_wrapper.go#L68-L81
test
kubernetes/test-infra
prow/clonerefs/options.go
Validate
func (o *Options) Validate() error { if o.SrcRoot == "" { return errors.New("no source root specified") } if o.Log == "" { return errors.New("no log file specified") } if len(o.GitRefs) == 0 { return errors.New("no refs specified to clone") } seen := map[string]sets.String{} for _, ref := range o.GitRe...
go
func (o *Options) Validate() error { if o.SrcRoot == "" { return errors.New("no source root specified") } if o.Log == "" { return errors.New("no log file specified") } if len(o.GitRefs) == 0 { return errors.New("no refs specified to clone") } seen := map[string]sets.String{} for _, ref := range o.GitRe...
[ "func", "(", "o", "*", "Options", ")", "Validate", "(", ")", "error", "{", "if", "o", ".", "SrcRoot", "==", "\"\"", "{", "return", "errors", ".", "New", "(", "\"no source root specified\"", ")", "\n", "}", "\n", "if", "o", ".", "Log", "==", "\"\"", ...
// Validate ensures that the configuration options are valid
[ "Validate", "ensures", "that", "the", "configuration", "options", "are", "valid" ]
8125fbda10178887be5dff9e901d6a0a519b67bc
https://github.com/kubernetes/test-infra/blob/8125fbda10178887be5dff9e901d6a0a519b67bc/prow/clonerefs/options.go#L73-L99
test
kubernetes/test-infra
prow/clonerefs/options.go
Complete
func (o *Options) Complete(args []string) { o.GitRefs = o.refs.gitRefs o.KeyFiles = o.keys.data for _, ref := range o.GitRefs { alias, err := o.clonePath.Execute(OrgRepo{Org: ref.Org, Repo: ref.Repo}) if err != nil { panic(err) } ref.PathAlias = alias alias, err = o.cloneURI.Execute(OrgRepo{Org: ref.O...
go
func (o *Options) Complete(args []string) { o.GitRefs = o.refs.gitRefs o.KeyFiles = o.keys.data for _, ref := range o.GitRefs { alias, err := o.clonePath.Execute(OrgRepo{Org: ref.Org, Repo: ref.Repo}) if err != nil { panic(err) } ref.PathAlias = alias alias, err = o.cloneURI.Execute(OrgRepo{Org: ref.O...
[ "func", "(", "o", "*", "Options", ")", "Complete", "(", "args", "[", "]", "string", ")", "{", "o", ".", "GitRefs", "=", "o", ".", "refs", ".", "gitRefs", "\n", "o", ".", "KeyFiles", "=", "o", ".", "keys", ".", "data", "\n", "for", "_", ",", "...
// Complete internalizes command line arguments
[ "Complete", "internalizes", "command", "line", "arguments" ]
8125fbda10178887be5dff9e901d6a0a519b67bc
https://github.com/kubernetes/test-infra/blob/8125fbda10178887be5dff9e901d6a0a519b67bc/prow/clonerefs/options.go#L124-L141
test
kubernetes/test-infra
prow/clonerefs/options.go
Set
func (a *orgRepoFormat) Set(value string) error { templ, err := template.New("format").Parse(value) if err != nil { return err } a.raw = value a.format = templ return nil }
go
func (a *orgRepoFormat) Set(value string) error { templ, err := template.New("format").Parse(value) if err != nil { return err } a.raw = value a.format = templ return nil }
[ "func", "(", "a", "*", "orgRepoFormat", ")", "Set", "(", "value", "string", ")", "error", "{", "templ", ",", "err", ":=", "template", ".", "New", "(", "\"format\"", ")", ".", "Parse", "(", "value", ")", "\n", "if", "err", "!=", "nil", "{", "return"...
// Set parses out overrides from user input
[ "Set", "parses", "out", "overrides", "from", "user", "input" ]
8125fbda10178887be5dff9e901d6a0a519b67bc
https://github.com/kubernetes/test-infra/blob/8125fbda10178887be5dff9e901d6a0a519b67bc/prow/clonerefs/options.go#L209-L217
test
kubernetes/test-infra
prow/cmd/tackle/main.go
ensure
func ensure(binary, install string) error { if _, err := exec.LookPath(binary); err != nil { return fmt.Errorf("%s: %s", binary, install) } return nil }
go
func ensure(binary, install string) error { if _, err := exec.LookPath(binary); err != nil { return fmt.Errorf("%s: %s", binary, install) } return nil }
[ "func", "ensure", "(", "binary", ",", "install", "string", ")", "error", "{", "if", "_", ",", "err", ":=", "exec", ".", "LookPath", "(", "binary", ")", ";", "err", "!=", "nil", "{", "return", "fmt", ".", "Errorf", "(", "\"%s: %s\"", ",", "binary", ...
// ensure will ensure binary is on path or return an error with install message.
[ "ensure", "will", "ensure", "binary", "is", "on", "path", "or", "return", "an", "error", "with", "install", "message", "." ]
8125fbda10178887be5dff9e901d6a0a519b67bc
https://github.com/kubernetes/test-infra/blob/8125fbda10178887be5dff9e901d6a0a519b67bc/prow/cmd/tackle/main.go#L50-L55
test
kubernetes/test-infra
prow/cmd/tackle/main.go
output
func output(args ...string) (string, error) { cmd := exec.Command(args[0], args[1:]...) cmd.Stderr = os.Stderr cmd.Stdin = os.Stdin b, err := cmd.Output() return strings.TrimSpace(string(b)), err }
go
func output(args ...string) (string, error) { cmd := exec.Command(args[0], args[1:]...) cmd.Stderr = os.Stderr cmd.Stdin = os.Stdin b, err := cmd.Output() return strings.TrimSpace(string(b)), err }
[ "func", "output", "(", "args", "...", "string", ")", "(", "string", ",", "error", ")", "{", "cmd", ":=", "exec", ".", "Command", "(", "args", "[", "0", "]", ",", "args", "[", "1", ":", "]", "...", ")", "\n", "cmd", ".", "Stderr", "=", "os", "...
// output returns the trimmed output of running args, or an err on non-zero exit.
[ "output", "returns", "the", "trimmed", "output", "of", "running", "args", "or", "an", "err", "on", "non", "-", "zero", "exit", "." ]
8125fbda10178887be5dff9e901d6a0a519b67bc
https://github.com/kubernetes/test-infra/blob/8125fbda10178887be5dff9e901d6a0a519b67bc/prow/cmd/tackle/main.go#L68-L74
test
kubernetes/test-infra
prow/cmd/tackle/main.go
projects
func projects(max int) ([]string, error) { out, err := output("gcloud", "projects", "list", fmt.Sprintf("--limit=%d", max), "--format=value(project_id)") if err != nil { return nil, err } return strings.Split(out, "\n"), nil }
go
func projects(max int) ([]string, error) { out, err := output("gcloud", "projects", "list", fmt.Sprintf("--limit=%d", max), "--format=value(project_id)") if err != nil { return nil, err } return strings.Split(out, "\n"), nil }
[ "func", "projects", "(", "max", "int", ")", "(", "[", "]", "string", ",", "error", ")", "{", "out", ",", "err", ":=", "output", "(", "\"gcloud\"", ",", "\"projects\"", ",", "\"list\"", ",", "fmt", ".", "Sprintf", "(", "\"--limit=%d\"", ",", "max", ")...
// projects returns the list of accessible gcp projects
[ "projects", "returns", "the", "list", "of", "accessible", "gcp", "projects" ]
8125fbda10178887be5dff9e901d6a0a519b67bc
https://github.com/kubernetes/test-infra/blob/8125fbda10178887be5dff9e901d6a0a519b67bc/prow/cmd/tackle/main.go#L93-L99
test
kubernetes/test-infra
prow/cmd/tackle/main.go
selectProject
func selectProject(choice string) (string, error) { fmt.Print("Getting active GCP account...") who, err := currentAccount() if err != nil { logrus.Warn("Run gcloud auth login to initialize gcloud") return "", err } fmt.Println(who) var projs []string if choice == "" { fmt.Printf("Projects available to %s...
go
func selectProject(choice string) (string, error) { fmt.Print("Getting active GCP account...") who, err := currentAccount() if err != nil { logrus.Warn("Run gcloud auth login to initialize gcloud") return "", err } fmt.Println(who) var projs []string if choice == "" { fmt.Printf("Projects available to %s...
[ "func", "selectProject", "(", "choice", "string", ")", "(", "string", ",", "error", ")", "{", "fmt", ".", "Print", "(", "\"Getting active GCP account...\"", ")", "\n", "who", ",", "err", ":=", "currentAccount", "(", ")", "\n", "if", "err", "!=", "nil", "...
// selectProject returns the user-selected project, defaulting to the current gcloud one.
[ "selectProject", "returns", "the", "user", "-", "selected", "project", "defaulting", "to", "the", "current", "gcloud", "one", "." ]
8125fbda10178887be5dff9e901d6a0a519b67bc
https://github.com/kubernetes/test-infra/blob/8125fbda10178887be5dff9e901d6a0a519b67bc/prow/cmd/tackle/main.go#L102-L162
test
kubernetes/test-infra
prow/cmd/tackle/main.go
createCluster
func createCluster(proj, choice string) (*cluster, error) { const def = "prow" if choice == "" { fmt.Printf("Cluster name [%s]: ", def) fmt.Scanln(&choice) if choice == "" { choice = def } } cmd := exec.Command("gcloud", "container", "clusters", "create", choice) cmd.Stdin = os.Stdin cmd.Stdout = os.S...
go
func createCluster(proj, choice string) (*cluster, error) { const def = "prow" if choice == "" { fmt.Printf("Cluster name [%s]: ", def) fmt.Scanln(&choice) if choice == "" { choice = def } } cmd := exec.Command("gcloud", "container", "clusters", "create", choice) cmd.Stdin = os.Stdin cmd.Stdout = os.S...
[ "func", "createCluster", "(", "proj", ",", "choice", "string", ")", "(", "*", "cluster", ",", "error", ")", "{", "const", "def", "=", "\"prow\"", "\n", "if", "choice", "==", "\"\"", "{", "fmt", ".", "Printf", "(", "\"Cluster name [%s]: \"", ",", "def", ...
// createCluster causes gcloud to create a cluster in project, returning the context name
[ "createCluster", "causes", "gcloud", "to", "create", "a", "cluster", "in", "project", "returning", "the", "context", "name" ]
8125fbda10178887be5dff9e901d6a0a519b67bc
https://github.com/kubernetes/test-infra/blob/8125fbda10178887be5dff9e901d6a0a519b67bc/prow/cmd/tackle/main.go#L197-L225
test
kubernetes/test-infra
prow/cmd/tackle/main.go
createContext
func createContext(co contextOptions) (string, error) { proj, err := selectProject(co.project) if err != nil { logrus.Info("Run gcloud auth login to initialize gcloud") return "", fmt.Errorf("get current project: %v", err) } fmt.Printf("Existing GKE clusters in %s:", proj) fmt.Println() clusters, err := curr...
go
func createContext(co contextOptions) (string, error) { proj, err := selectProject(co.project) if err != nil { logrus.Info("Run gcloud auth login to initialize gcloud") return "", fmt.Errorf("get current project: %v", err) } fmt.Printf("Existing GKE clusters in %s:", proj) fmt.Println() clusters, err := curr...
[ "func", "createContext", "(", "co", "contextOptions", ")", "(", "string", ",", "error", ")", "{", "proj", ",", "err", ":=", "selectProject", "(", "co", ".", "project", ")", "\n", "if", "err", "!=", "nil", "{", "logrus", ".", "Info", "(", "\"Run gcloud ...
// createContext has the user create a context.
[ "createContext", "has", "the", "user", "create", "a", "context", "." ]
8125fbda10178887be5dff9e901d6a0a519b67bc
https://github.com/kubernetes/test-infra/blob/8125fbda10178887be5dff9e901d6a0a519b67bc/prow/cmd/tackle/main.go#L228-L284
test
kubernetes/test-infra
prow/cmd/tackle/main.go
contextConfig
func contextConfig() (clientcmd.ClientConfigLoader, *clientcmdapi.Config, error) { if err := ensureKubectl(); err != nil { fmt.Println("Prow's tackler requires kubectl, please install:") fmt.Println(" *", err) if gerr := ensureGcloud(); gerr != nil { fmt.Println(" *", gerr) } return nil, nil, errors.New...
go
func contextConfig() (clientcmd.ClientConfigLoader, *clientcmdapi.Config, error) { if err := ensureKubectl(); err != nil { fmt.Println("Prow's tackler requires kubectl, please install:") fmt.Println(" *", err) if gerr := ensureGcloud(); gerr != nil { fmt.Println(" *", gerr) } return nil, nil, errors.New...
[ "func", "contextConfig", "(", ")", "(", "clientcmd", ".", "ClientConfigLoader", ",", "*", "clientcmdapi", ".", "Config", ",", "error", ")", "{", "if", "err", ":=", "ensureKubectl", "(", ")", ";", "err", "!=", "nil", "{", "fmt", ".", "Println", "(", "\"...
// contextConfig returns the loader and config, which can create a clientconfig.
[ "contextConfig", "returns", "the", "loader", "and", "config", "which", "can", "create", "a", "clientconfig", "." ]
8125fbda10178887be5dff9e901d6a0a519b67bc
https://github.com/kubernetes/test-infra/blob/8125fbda10178887be5dff9e901d6a0a519b67bc/prow/cmd/tackle/main.go#L287-L300
test
kubernetes/test-infra
prow/cmd/tackle/main.go
selectContext
func selectContext(co contextOptions) (string, error) { fmt.Println("Existing kubernetes contexts:") // get cluster context _, cfg, err := contextConfig() if err != nil { logrus.WithError(err).Fatal("Failed to load ~/.kube/config from any obvious location") } // list contexts and ask to user to choose a context...
go
func selectContext(co contextOptions) (string, error) { fmt.Println("Existing kubernetes contexts:") // get cluster context _, cfg, err := contextConfig() if err != nil { logrus.WithError(err).Fatal("Failed to load ~/.kube/config from any obvious location") } // list contexts and ask to user to choose a context...
[ "func", "selectContext", "(", "co", "contextOptions", ")", "(", "string", ",", "error", ")", "{", "fmt", ".", "Println", "(", "\"Existing kubernetes contexts:\"", ")", "\n", "_", ",", "cfg", ",", "err", ":=", "contextConfig", "(", ")", "\n", "if", "err", ...
// selectContext allows the user to choose a context // This may involve creating a cluster
[ "selectContext", "allows", "the", "user", "to", "choose", "a", "context", "This", "may", "involve", "creating", "a", "cluster" ]
8125fbda10178887be5dff9e901d6a0a519b67bc
https://github.com/kubernetes/test-infra/blob/8125fbda10178887be5dff9e901d6a0a519b67bc/prow/cmd/tackle/main.go#L304-L363
test
kubernetes/test-infra
prow/cmd/tackle/main.go
applyCreate
func applyCreate(ctx string, args ...string) error { create := exec.Command("kubectl", append([]string{"--dry-run=true", "--output=yaml", "create"}, args...)...) create.Stderr = os.Stderr obj, err := create.StdoutPipe() if err != nil { return fmt.Errorf("rolebinding pipe: %v", err) } if err := create.Start(); ...
go
func applyCreate(ctx string, args ...string) error { create := exec.Command("kubectl", append([]string{"--dry-run=true", "--output=yaml", "create"}, args...)...) create.Stderr = os.Stderr obj, err := create.StdoutPipe() if err != nil { return fmt.Errorf("rolebinding pipe: %v", err) } if err := create.Start(); ...
[ "func", "applyCreate", "(", "ctx", "string", ",", "args", "...", "string", ")", "error", "{", "create", ":=", "exec", ".", "Command", "(", "\"kubectl\"", ",", "append", "(", "[", "]", "string", "{", "\"--dry-run=true\"", ",", "\"--output=yaml\"", ",", "\"c...
// applyCreate will dry-run create and then pipe this to kubectl apply. // // If we use the create verb it will fail if the secret already exists. // And kubectl will reject the apply verb with a secret.
[ "applyCreate", "will", "dry", "-", "run", "create", "and", "then", "pipe", "this", "to", "kubectl", "apply", ".", "If", "we", "use", "the", "create", "verb", "it", "will", "fail", "if", "the", "secret", "already", "exists", ".", "And", "kubectl", "will",...
8125fbda10178887be5dff9e901d6a0a519b67bc
https://github.com/kubernetes/test-infra/blob/8125fbda10178887be5dff9e901d6a0a519b67bc/prow/cmd/tackle/main.go#L369-L387
test
kubernetes/test-infra
prow/plugins/trigger/generic-comment.go
determineSkippedPresubmits
func determineSkippedPresubmits(toTrigger, toSkipSuperset []config.Presubmit, logger *logrus.Entry) []config.Presubmit { triggeredContexts := sets.NewString() for _, presubmit := range toTrigger { triggeredContexts.Insert(presubmit.Context) } var toSkip []config.Presubmit for _, presubmit := range toSkipSuperset...
go
func determineSkippedPresubmits(toTrigger, toSkipSuperset []config.Presubmit, logger *logrus.Entry) []config.Presubmit { triggeredContexts := sets.NewString() for _, presubmit := range toTrigger { triggeredContexts.Insert(presubmit.Context) } var toSkip []config.Presubmit for _, presubmit := range toSkipSuperset...
[ "func", "determineSkippedPresubmits", "(", "toTrigger", ",", "toSkipSuperset", "[", "]", "config", ".", "Presubmit", ",", "logger", "*", "logrus", ".", "Entry", ")", "[", "]", "config", ".", "Presubmit", "{", "triggeredContexts", ":=", "sets", ".", "NewString"...
// determineSkippedPresubmits identifies the largest set of contexts we can actually // post skipped contexts for, given a set of presubmits we're triggering. We don't // want to skip a job that posts a context that will be written to by a job we just // identified for triggering or the skipped context will override th...
[ "determineSkippedPresubmits", "identifies", "the", "largest", "set", "of", "contexts", "we", "can", "actually", "post", "skipped", "contexts", "for", "given", "a", "set", "of", "presubmits", "we", "re", "triggering", ".", "We", "don", "t", "want", "to", "skip"...
8125fbda10178887be5dff9e901d6a0a519b67bc
https://github.com/kubernetes/test-infra/blob/8125fbda10178887be5dff9e901d6a0a519b67bc/prow/plugins/trigger/generic-comment.go#L168-L182
test
kubernetes/test-infra
velodrome/transform/transform.go
Dispatch
func Dispatch(plugin plugins.Plugin, DB *InfluxDB, issues chan sql.Issue, eventsCommentsChannel chan interface{}) { for { var points []plugins.Point select { case issue, ok := <-issues: if !ok { return } points = plugin.ReceiveIssue(issue) case event, ok := <-eventsCommentsChannel: if !ok { ...
go
func Dispatch(plugin plugins.Plugin, DB *InfluxDB, issues chan sql.Issue, eventsCommentsChannel chan interface{}) { for { var points []plugins.Point select { case issue, ok := <-issues: if !ok { return } points = plugin.ReceiveIssue(issue) case event, ok := <-eventsCommentsChannel: if !ok { ...
[ "func", "Dispatch", "(", "plugin", "plugins", ".", "Plugin", ",", "DB", "*", "InfluxDB", ",", "issues", "chan", "sql", ".", "Issue", ",", "eventsCommentsChannel", "chan", "interface", "{", "}", ")", "{", "for", "{", "var", "points", "[", "]", "plugins", ...
// Dispatch receives channels to each type of events, and dispatch them to each plugins.
[ "Dispatch", "receives", "channels", "to", "each", "type", "of", "events", "and", "dispatch", "them", "to", "each", "plugins", "." ]
8125fbda10178887be5dff9e901d6a0a519b67bc
https://github.com/kubernetes/test-infra/blob/8125fbda10178887be5dff9e901d6a0a519b67bc/velodrome/transform/transform.go#L66-L95
test
kubernetes/test-infra
pkg/ghclient/wrappers.go
CreateIssue
func (c *Client) CreateIssue(org, repo, title, body string, labels, assignees []string) (*github.Issue, error) { glog.Infof("CreateIssue(dry=%t) Title:%q, Labels:%q, Assignees:%q\n", c.dryRun, title, labels, assignees) if c.dryRun { return nil, nil } issue := &github.IssueRequest{ Title: &title, Body: &body...
go
func (c *Client) CreateIssue(org, repo, title, body string, labels, assignees []string) (*github.Issue, error) { glog.Infof("CreateIssue(dry=%t) Title:%q, Labels:%q, Assignees:%q\n", c.dryRun, title, labels, assignees) if c.dryRun { return nil, nil } issue := &github.IssueRequest{ Title: &title, Body: &body...
[ "func", "(", "c", "*", "Client", ")", "CreateIssue", "(", "org", ",", "repo", ",", "title", ",", "body", "string", ",", "labels", ",", "assignees", "[", "]", "string", ")", "(", "*", "github", ".", "Issue", ",", "error", ")", "{", "glog", ".", "I...
// CreateIssue tries to create and return a new github issue.
[ "CreateIssue", "tries", "to", "create", "and", "return", "a", "new", "github", "issue", "." ]
8125fbda10178887be5dff9e901d6a0a519b67bc
https://github.com/kubernetes/test-infra/blob/8125fbda10178887be5dff9e901d6a0a519b67bc/pkg/ghclient/wrappers.go#L54-L82
test
kubernetes/test-infra
pkg/ghclient/wrappers.go
CreateStatus
func (c *Client) CreateStatus(owner, repo, ref string, status *github.RepoStatus) (*github.RepoStatus, error) { glog.Infof("CreateStatus(dry=%t) ref:%s: %s:%s", c.dryRun, ref, *status.Context, *status.State) if c.dryRun { return nil, nil } var result *github.RepoStatus msg := fmt.Sprintf("creating status for ref...
go
func (c *Client) CreateStatus(owner, repo, ref string, status *github.RepoStatus) (*github.RepoStatus, error) { glog.Infof("CreateStatus(dry=%t) ref:%s: %s:%s", c.dryRun, ref, *status.Context, *status.State) if c.dryRun { return nil, nil } var result *github.RepoStatus msg := fmt.Sprintf("creating status for ref...
[ "func", "(", "c", "*", "Client", ")", "CreateStatus", "(", "owner", ",", "repo", ",", "ref", "string", ",", "status", "*", "github", ".", "RepoStatus", ")", "(", "*", "github", ".", "RepoStatus", ",", "error", ")", "{", "glog", ".", "Infof", "(", "...
// CreateStatus creates or updates a status context on the indicated reference.
[ "CreateStatus", "creates", "or", "updates", "a", "status", "context", "on", "the", "indicated", "reference", "." ]
8125fbda10178887be5dff9e901d6a0a519b67bc
https://github.com/kubernetes/test-infra/blob/8125fbda10178887be5dff9e901d6a0a519b67bc/pkg/ghclient/wrappers.go#L85-L99
test
kubernetes/test-infra
pkg/ghclient/wrappers.go
ForEachPR
func (c *Client) ForEachPR(owner, repo string, opts *github.PullRequestListOptions, continueOnError bool, mungePR PRMungeFunc) error { var lastPage int // Munge each page as we get it (or in other words, wait until we are ready to munge the next // page of issues before getting it). We use depaginate to make the cal...
go
func (c *Client) ForEachPR(owner, repo string, opts *github.PullRequestListOptions, continueOnError bool, mungePR PRMungeFunc) error { var lastPage int // Munge each page as we get it (or in other words, wait until we are ready to munge the next // page of issues before getting it). We use depaginate to make the cal...
[ "func", "(", "c", "*", "Client", ")", "ForEachPR", "(", "owner", ",", "repo", "string", ",", "opts", "*", "github", ".", "PullRequestListOptions", ",", "continueOnError", "bool", ",", "mungePR", "PRMungeFunc", ")", "error", "{", "var", "lastPage", "int", "...
// ForEachPR iterates over all PRs that fit the specified criteria, calling the munge function on every PR. // If the munge function returns a non-nil error, ForEachPR will return immediately with a non-nil // error unless continueOnError is true in which case an error will be logged and the remaining PRs will be munge...
[ "ForEachPR", "iterates", "over", "all", "PRs", "that", "fit", "the", "specified", "criteria", "calling", "the", "munge", "function", "on", "every", "PR", ".", "If", "the", "munge", "function", "returns", "a", "non", "-", "nil", "error", "ForEachPR", "will", ...
8125fbda10178887be5dff9e901d6a0a519b67bc
https://github.com/kubernetes/test-infra/blob/8125fbda10178887be5dff9e901d6a0a519b67bc/pkg/ghclient/wrappers.go#L106-L142
test
kubernetes/test-infra
pkg/ghclient/wrappers.go
GetCollaborators
func (c *Client) GetCollaborators(org, repo string) ([]*github.User, error) { opts := &github.ListCollaboratorsOptions{} collaborators, err := c.depaginate( fmt.Sprintf("getting collaborators for '%s/%s'", org, repo), &opts.ListOptions, func() ([]interface{}, *github.Response, error) { page, resp, err := c.r...
go
func (c *Client) GetCollaborators(org, repo string) ([]*github.User, error) { opts := &github.ListCollaboratorsOptions{} collaborators, err := c.depaginate( fmt.Sprintf("getting collaborators for '%s/%s'", org, repo), &opts.ListOptions, func() ([]interface{}, *github.Response, error) { page, resp, err := c.r...
[ "func", "(", "c", "*", "Client", ")", "GetCollaborators", "(", "org", ",", "repo", "string", ")", "(", "[", "]", "*", "github", ".", "User", ",", "error", ")", "{", "opts", ":=", "&", "github", ".", "ListCollaboratorsOptions", "{", "}", "\n", "collab...
// GetCollaborators returns all github users who are members or outside collaborators of the repo.
[ "GetCollaborators", "returns", "all", "github", "users", "who", "are", "members", "or", "outside", "collaborators", "of", "the", "repo", "." ]
8125fbda10178887be5dff9e901d6a0a519b67bc
https://github.com/kubernetes/test-infra/blob/8125fbda10178887be5dff9e901d6a0a519b67bc/pkg/ghclient/wrappers.go#L145-L169
test
kubernetes/test-infra
pkg/ghclient/wrappers.go
GetCombinedStatus
func (c *Client) GetCombinedStatus(owner, repo, ref string) (*github.CombinedStatus, error) { var result *github.CombinedStatus listOpts := &github.ListOptions{} statuses, err := c.depaginate( fmt.Sprintf("getting combined status for ref '%s'", ref), listOpts, func() ([]interface{}, *github.Response, error) {...
go
func (c *Client) GetCombinedStatus(owner, repo, ref string) (*github.CombinedStatus, error) { var result *github.CombinedStatus listOpts := &github.ListOptions{} statuses, err := c.depaginate( fmt.Sprintf("getting combined status for ref '%s'", ref), listOpts, func() ([]interface{}, *github.Response, error) {...
[ "func", "(", "c", "*", "Client", ")", "GetCombinedStatus", "(", "owner", ",", "repo", ",", "ref", "string", ")", "(", "*", "github", ".", "CombinedStatus", ",", "error", ")", "{", "var", "result", "*", "github", ".", "CombinedStatus", "\n", "listOpts", ...
// GetCombinedStatus retrieves the CombinedStatus for the specified reference.
[ "GetCombinedStatus", "retrieves", "the", "CombinedStatus", "for", "the", "specified", "reference", "." ]
8125fbda10178887be5dff9e901d6a0a519b67bc
https://github.com/kubernetes/test-infra/blob/8125fbda10178887be5dff9e901d6a0a519b67bc/pkg/ghclient/wrappers.go#L172-L210
test
kubernetes/test-infra
pkg/ghclient/wrappers.go
GetIssues
func (c *Client) GetIssues(org, repo string, opts *github.IssueListByRepoOptions) ([]*github.Issue, error) { issues, err := c.depaginate( fmt.Sprintf("getting issues from '%s/%s'", org, repo), &opts.ListOptions, func() ([]interface{}, *github.Response, error) { page, resp, err := c.issueService.ListByRepo(con...
go
func (c *Client) GetIssues(org, repo string, opts *github.IssueListByRepoOptions) ([]*github.Issue, error) { issues, err := c.depaginate( fmt.Sprintf("getting issues from '%s/%s'", org, repo), &opts.ListOptions, func() ([]interface{}, *github.Response, error) { page, resp, err := c.issueService.ListByRepo(con...
[ "func", "(", "c", "*", "Client", ")", "GetIssues", "(", "org", ",", "repo", "string", ",", "opts", "*", "github", ".", "IssueListByRepoOptions", ")", "(", "[", "]", "*", "github", ".", "Issue", ",", "error", ")", "{", "issues", ",", "err", ":=", "c...
// GetIssues gets all the issues in a repo that meet the list options.
[ "GetIssues", "gets", "all", "the", "issues", "in", "a", "repo", "that", "meet", "the", "list", "options", "." ]
8125fbda10178887be5dff9e901d6a0a519b67bc
https://github.com/kubernetes/test-infra/blob/8125fbda10178887be5dff9e901d6a0a519b67bc/pkg/ghclient/wrappers.go#L213-L236
test
kubernetes/test-infra
pkg/ghclient/wrappers.go
GetRepoLabels
func (c *Client) GetRepoLabels(org, repo string) ([]*github.Label, error) { opts := &github.ListOptions{} labels, err := c.depaginate( fmt.Sprintf("getting valid labels for '%s/%s'", org, repo), opts, func() ([]interface{}, *github.Response, error) { page, resp, err := c.issueService.ListLabels(context.Backg...
go
func (c *Client) GetRepoLabels(org, repo string) ([]*github.Label, error) { opts := &github.ListOptions{} labels, err := c.depaginate( fmt.Sprintf("getting valid labels for '%s/%s'", org, repo), opts, func() ([]interface{}, *github.Response, error) { page, resp, err := c.issueService.ListLabels(context.Backg...
[ "func", "(", "c", "*", "Client", ")", "GetRepoLabels", "(", "org", ",", "repo", "string", ")", "(", "[", "]", "*", "github", ".", "Label", ",", "error", ")", "{", "opts", ":=", "&", "github", ".", "ListOptions", "{", "}", "\n", "labels", ",", "er...
// GetRepoLabels gets all the labels that valid in the specified repo.
[ "GetRepoLabels", "gets", "all", "the", "labels", "that", "valid", "in", "the", "specified", "repo", "." ]
8125fbda10178887be5dff9e901d6a0a519b67bc
https://github.com/kubernetes/test-infra/blob/8125fbda10178887be5dff9e901d6a0a519b67bc/pkg/ghclient/wrappers.go#L239-L263
test
kubernetes/test-infra
pkg/ghclient/wrappers.go
GetUser
func (c *Client) GetUser(login string) (*github.User, error) { var result *github.User _, err := c.retry( fmt.Sprintf("getting user '%s'", login), func() (*github.Response, error) { var resp *github.Response var err error result, resp, err = c.userService.Get(context.Background(), login) return resp, ...
go
func (c *Client) GetUser(login string) (*github.User, error) { var result *github.User _, err := c.retry( fmt.Sprintf("getting user '%s'", login), func() (*github.Response, error) { var resp *github.Response var err error result, resp, err = c.userService.Get(context.Background(), login) return resp, ...
[ "func", "(", "c", "*", "Client", ")", "GetUser", "(", "login", "string", ")", "(", "*", "github", ".", "User", ",", "error", ")", "{", "var", "result", "*", "github", ".", "User", "\n", "_", ",", "err", ":=", "c", ".", "retry", "(", "fmt", ".",...
// GetUser gets the github user with the specified login or the currently authenticated user. // To get the currently authenticated user specify a login of "".
[ "GetUser", "gets", "the", "github", "user", "with", "the", "specified", "login", "or", "the", "currently", "authenticated", "user", ".", "To", "get", "the", "currently", "authenticated", "user", "specify", "a", "login", "of", "." ]
8125fbda10178887be5dff9e901d6a0a519b67bc
https://github.com/kubernetes/test-infra/blob/8125fbda10178887be5dff9e901d6a0a519b67bc/pkg/ghclient/wrappers.go#L267-L279
test
kubernetes/test-infra
logexporter/cmd/main.go
checkConfigValidity
func checkConfigValidity() error { glog.Info("Verifying if a valid config has been provided through the flags") if *nodeName == "" { return fmt.Errorf("Flag --node-name has its value unspecified") } if *gcsPath == "" { return fmt.Errorf("Flag --gcs-path has its value unspecified") } if _, err := os.Stat(*gclo...
go
func checkConfigValidity() error { glog.Info("Verifying if a valid config has been provided through the flags") if *nodeName == "" { return fmt.Errorf("Flag --node-name has its value unspecified") } if *gcsPath == "" { return fmt.Errorf("Flag --gcs-path has its value unspecified") } if _, err := os.Stat(*gclo...
[ "func", "checkConfigValidity", "(", ")", "error", "{", "glog", ".", "Info", "(", "\"Verifying if a valid config has been provided through the flags\"", ")", "\n", "if", "*", "nodeName", "==", "\"\"", "{", "return", "fmt", ".", "Errorf", "(", "\"Flag --node-name has it...
// Check if the config provided through the flags take valid values.
[ "Check", "if", "the", "config", "provided", "through", "the", "flags", "take", "valid", "values", "." ]
8125fbda10178887be5dff9e901d6a0a519b67bc
https://github.com/kubernetes/test-infra/blob/8125fbda10178887be5dff9e901d6a0a519b67bc/logexporter/cmd/main.go#L70-L93
test
kubernetes/test-infra
logexporter/cmd/main.go
createSystemdLogfile
func createSystemdLogfile(service string, outputMode string, outputDir string) error { // Generate the journalctl command. journalCmdArgs := []string{fmt.Sprintf("--output=%v", outputMode), "-D", *journalPath} if service == "kern" { journalCmdArgs = append(journalCmdArgs, "-k") } else { journalCmdArgs = append(...
go
func createSystemdLogfile(service string, outputMode string, outputDir string) error { // Generate the journalctl command. journalCmdArgs := []string{fmt.Sprintf("--output=%v", outputMode), "-D", *journalPath} if service == "kern" { journalCmdArgs = append(journalCmdArgs, "-k") } else { journalCmdArgs = append(...
[ "func", "createSystemdLogfile", "(", "service", "string", ",", "outputMode", "string", ",", "outputDir", "string", ")", "error", "{", "journalCmdArgs", ":=", "[", "]", "string", "{", "fmt", ".", "Sprintf", "(", "\"--output=%v\"", ",", "outputMode", ")", ",", ...
// Create logfile for systemd service in outputDir with the given journalctl outputMode.
[ "Create", "logfile", "for", "systemd", "service", "in", "outputDir", "with", "the", "given", "journalctl", "outputMode", "." ]
8125fbda10178887be5dff9e901d6a0a519b67bc
https://github.com/kubernetes/test-infra/blob/8125fbda10178887be5dff9e901d6a0a519b67bc/logexporter/cmd/main.go#L96-L116
test
kubernetes/test-infra
logexporter/cmd/main.go
createFullSystemdLogfile
func createFullSystemdLogfile(outputDir string) error { cmd := exec.Command("journalctl", "--output=short-precise", "-D", *journalPath) // Run the command and record the output to a file. output, err := cmd.Output() if err != nil { return fmt.Errorf("Journalctl command failed: %v", err) } logfile := filepath.Jo...
go
func createFullSystemdLogfile(outputDir string) error { cmd := exec.Command("journalctl", "--output=short-precise", "-D", *journalPath) // Run the command and record the output to a file. output, err := cmd.Output() if err != nil { return fmt.Errorf("Journalctl command failed: %v", err) } logfile := filepath.Jo...
[ "func", "createFullSystemdLogfile", "(", "outputDir", "string", ")", "error", "{", "cmd", ":=", "exec", ".", "Command", "(", "\"journalctl\"", ",", "\"--output=short-precise\"", ",", "\"-D\"", ",", "*", "journalPath", ")", "\n", "output", ",", "err", ":=", "cm...
// createFullSystemdLogfile creates logfile for full systemd journal in the outputDir.
[ "createFullSystemdLogfile", "creates", "logfile", "for", "full", "systemd", "journal", "in", "the", "outputDir", "." ]
8125fbda10178887be5dff9e901d6a0a519b67bc
https://github.com/kubernetes/test-infra/blob/8125fbda10178887be5dff9e901d6a0a519b67bc/logexporter/cmd/main.go#L119-L131
test
kubernetes/test-infra
logexporter/cmd/main.go
createSystemdLogfiles
func createSystemdLogfiles(outputDir string) { services := append(systemdServices, nodeSystemdServices...) for _, service := range services { if err := createSystemdLogfile(service, "cat", outputDir); err != nil { glog.Warningf("Failed to record journalctl logs: %v", err) } } // Service logs specific to VM s...
go
func createSystemdLogfiles(outputDir string) { services := append(systemdServices, nodeSystemdServices...) for _, service := range services { if err := createSystemdLogfile(service, "cat", outputDir); err != nil { glog.Warningf("Failed to record journalctl logs: %v", err) } } // Service logs specific to VM s...
[ "func", "createSystemdLogfiles", "(", "outputDir", "string", ")", "{", "services", ":=", "append", "(", "systemdServices", ",", "nodeSystemdServices", "...", ")", "\n", "for", "_", ",", "service", ":=", "range", "services", "{", "if", "err", ":=", "createSyste...
// Create logfiles for systemd services in outputDir.
[ "Create", "logfiles", "for", "systemd", "services", "in", "outputDir", "." ]
8125fbda10178887be5dff9e901d6a0a519b67bc
https://github.com/kubernetes/test-infra/blob/8125fbda10178887be5dff9e901d6a0a519b67bc/logexporter/cmd/main.go#L134-L152
test
kubernetes/test-infra
logexporter/cmd/main.go
prepareLogfiles
func prepareLogfiles(logDir string) { glog.Info("Preparing logfiles relevant to this node") logfiles := nodeLogs[:] switch *cloudProvider { case "gce", "gke": logfiles = append(logfiles, gceLogs...) case "aws": logfiles = append(logfiles, awsLogs...) default: glog.Errorf("Unknown cloud provider '%v' provid...
go
func prepareLogfiles(logDir string) { glog.Info("Preparing logfiles relevant to this node") logfiles := nodeLogs[:] switch *cloudProvider { case "gce", "gke": logfiles = append(logfiles, gceLogs...) case "aws": logfiles = append(logfiles, awsLogs...) default: glog.Errorf("Unknown cloud provider '%v' provid...
[ "func", "prepareLogfiles", "(", "logDir", "string", ")", "{", "glog", ".", "Info", "(", "\"Preparing logfiles relevant to this node\"", ")", "\n", "logfiles", ":=", "nodeLogs", "[", ":", "]", "\n", "switch", "*", "cloudProvider", "{", "case", "\"gce\"", ",", "...
// Copy logfiles specific to this node based on the cloud-provider, system services, etc // to a temporary directory. Also create logfiles for systemd services if journalctl is present. // We do not expect this function to see an error.
[ "Copy", "logfiles", "specific", "to", "this", "node", "based", "on", "the", "cloud", "-", "provider", "system", "services", "etc", "to", "a", "temporary", "directory", ".", "Also", "create", "logfiles", "for", "systemd", "services", "if", "journalctl", "is", ...
8125fbda10178887be5dff9e901d6a0a519b67bc
https://github.com/kubernetes/test-infra/blob/8125fbda10178887be5dff9e901d6a0a519b67bc/logexporter/cmd/main.go#L157-L194
test
kubernetes/test-infra
logexporter/cmd/main.go
writeSuccessMarkerFile
func writeSuccessMarkerFile() error { markerFilePath := *gcsPath + "/logexported-nodes-registry/" + *nodeName + ".txt" cmd := exec.Command("gsutil", "-q", "cp", "-a", "public-read", "-", markerFilePath) stdin, err := cmd.StdinPipe() if err != nil { return fmt.Errorf("Failed to get stdin pipe to write marker file:...
go
func writeSuccessMarkerFile() error { markerFilePath := *gcsPath + "/logexported-nodes-registry/" + *nodeName + ".txt" cmd := exec.Command("gsutil", "-q", "cp", "-a", "public-read", "-", markerFilePath) stdin, err := cmd.StdinPipe() if err != nil { return fmt.Errorf("Failed to get stdin pipe to write marker file:...
[ "func", "writeSuccessMarkerFile", "(", ")", "error", "{", "markerFilePath", ":=", "*", "gcsPath", "+", "\"/logexported-nodes-registry/\"", "+", "*", "nodeName", "+", "\".txt\"", "\n", "cmd", ":=", "exec", ".", "Command", "(", "\"gsutil\"", ",", "\"-q\"", ",", ...
// Write a marker file to GCS named after this node to indicate logexporter's success. // The directory to which we write this file can then be used as a registry to quickly // fetch the list of nodes on which logexporter succeeded.
[ "Write", "a", "marker", "file", "to", "GCS", "named", "after", "this", "node", "to", "indicate", "logexporter", "s", "success", ".", "The", "directory", "to", "which", "we", "write", "this", "file", "can", "then", "be", "used", "as", "a", "registry", "to...
8125fbda10178887be5dff9e901d6a0a519b67bc
https://github.com/kubernetes/test-infra/blob/8125fbda10178887be5dff9e901d6a0a519b67bc/logexporter/cmd/main.go#L224-L237
test
kubernetes/test-infra
gopherage/cmd/junit/junit.go
MakeCommand
func MakeCommand() *cobra.Command { flags := &flags{} cmd := &cobra.Command{ Use: "junit [profile]", Short: "Summarize coverage profile and produce the result in junit xml format.", Long: `Summarize coverage profile and produce the result in junit xml format. Summary done at per-file and per-package level. An...
go
func MakeCommand() *cobra.Command { flags := &flags{} cmd := &cobra.Command{ Use: "junit [profile]", Short: "Summarize coverage profile and produce the result in junit xml format.", Long: `Summarize coverage profile and produce the result in junit xml format. Summary done at per-file and per-package level. An...
[ "func", "MakeCommand", "(", ")", "*", "cobra", ".", "Command", "{", "flags", ":=", "&", "flags", "{", "}", "\n", "cmd", ":=", "&", "cobra", ".", "Command", "{", "Use", ":", "\"junit [profile]\"", ",", "Short", ":", "\"Summarize coverage profile and produce t...
// MakeCommand returns a `junit` command.
[ "MakeCommand", "returns", "a", "junit", "command", "." ]
8125fbda10178887be5dff9e901d6a0a519b67bc
https://github.com/kubernetes/test-infra/blob/8125fbda10178887be5dff9e901d6a0a519b67bc/gopherage/cmd/junit/junit.go#L35-L50
test
kubernetes/test-infra
prow/plugins/config.go
warnDeprecated
func warnDeprecated(last *time.Time, freq time.Duration, msg string) { // have we warned within the last freq? warnLock.RLock() fresh := time.Now().Sub(*last) <= freq warnLock.RUnlock() if fresh { // we've warned recently return } // Warning is stale, will we win the race to warn? warnLock.Lock() defer warnL...
go
func warnDeprecated(last *time.Time, freq time.Duration, msg string) { // have we warned within the last freq? warnLock.RLock() fresh := time.Now().Sub(*last) <= freq warnLock.RUnlock() if fresh { // we've warned recently return } // Warning is stale, will we win the race to warn? warnLock.Lock() defer warnL...
[ "func", "warnDeprecated", "(", "last", "*", "time", ".", "Time", ",", "freq", "time", ".", "Duration", ",", "msg", "string", ")", "{", "warnLock", ".", "RLock", "(", ")", "\n", "fresh", ":=", "time", ".", "Now", "(", ")", ".", "Sub", "(", "*", "l...
// warnDeprecated prints a deprecation warning for a particular configuration // option.
[ "warnDeprecated", "prints", "a", "deprecation", "warning", "for", "a", "particular", "configuration", "option", "." ]
8125fbda10178887be5dff9e901d6a0a519b67bc
https://github.com/kubernetes/test-infra/blob/8125fbda10178887be5dff9e901d6a0a519b67bc/prow/plugins/config.go#L552-L569
test
kubernetes/test-infra
prow/plugins/config.go
Describe
func (r RequireMatchingLabel) Describe() string { str := &strings.Builder{} fmt.Fprintf(str, "Applies the '%s' label ", r.MissingLabel) if r.MissingComment == "" { fmt.Fprint(str, "to ") } else { fmt.Fprint(str, "and comments on ") } if r.Issues { fmt.Fprint(str, "Issues ") if r.PRs { fmt.Fprint(str, ...
go
func (r RequireMatchingLabel) Describe() string { str := &strings.Builder{} fmt.Fprintf(str, "Applies the '%s' label ", r.MissingLabel) if r.MissingComment == "" { fmt.Fprint(str, "to ") } else { fmt.Fprint(str, "and comments on ") } if r.Issues { fmt.Fprint(str, "Issues ") if r.PRs { fmt.Fprint(str, ...
[ "func", "(", "r", "RequireMatchingLabel", ")", "Describe", "(", ")", "string", "{", "str", ":=", "&", "strings", ".", "Builder", "{", "}", "\n", "fmt", ".", "Fprintf", "(", "str", ",", "\"Applies the '%s' label \"", ",", "r", ".", "MissingLabel", ")", "\...
// Describe generates a human readable description of the behavior that this // configuration specifies.
[ "Describe", "generates", "a", "human", "readable", "description", "of", "the", "behavior", "that", "this", "configuration", "specifies", "." ]
8125fbda10178887be5dff9e901d6a0a519b67bc
https://github.com/kubernetes/test-infra/blob/8125fbda10178887be5dff9e901d6a0a519b67bc/prow/plugins/config.go#L573-L602
test
kubernetes/test-infra
prow/plugins/config.go
TriggerFor
func (c *Configuration) TriggerFor(org, repo string) Trigger { for _, tr := range c.Triggers { for _, r := range tr.Repos { if r == org || r == fmt.Sprintf("%s/%s", org, repo) { return tr } } } return Trigger{} }
go
func (c *Configuration) TriggerFor(org, repo string) Trigger { for _, tr := range c.Triggers { for _, r := range tr.Repos { if r == org || r == fmt.Sprintf("%s/%s", org, repo) { return tr } } } return Trigger{} }
[ "func", "(", "c", "*", "Configuration", ")", "TriggerFor", "(", "org", ",", "repo", "string", ")", "Trigger", "{", "for", "_", ",", "tr", ":=", "range", "c", ".", "Triggers", "{", "for", "_", ",", "r", ":=", "range", "tr", ".", "Repos", "{", "if"...
// TriggerFor finds the Trigger for a repo, if one exists // a trigger can be listed for the repo itself or for the // owning organization
[ "TriggerFor", "finds", "the", "Trigger", "for", "a", "repo", "if", "one", "exists", "a", "trigger", "can", "be", "listed", "for", "the", "repo", "itself", "or", "for", "the", "owning", "organization" ]
8125fbda10178887be5dff9e901d6a0a519b67bc
https://github.com/kubernetes/test-infra/blob/8125fbda10178887be5dff9e901d6a0a519b67bc/prow/plugins/config.go#L607-L616
test
kubernetes/test-infra
prow/plugins/config.go
EnabledReposForPlugin
func (c *Configuration) EnabledReposForPlugin(plugin string) (orgs, repos []string) { for repo, plugins := range c.Plugins { found := false for _, candidate := range plugins { if candidate == plugin { found = true break } } if found { if strings.Contains(repo, "/") { repos = append(repos, ...
go
func (c *Configuration) EnabledReposForPlugin(plugin string) (orgs, repos []string) { for repo, plugins := range c.Plugins { found := false for _, candidate := range plugins { if candidate == plugin { found = true break } } if found { if strings.Contains(repo, "/") { repos = append(repos, ...
[ "func", "(", "c", "*", "Configuration", ")", "EnabledReposForPlugin", "(", "plugin", "string", ")", "(", "orgs", ",", "repos", "[", "]", "string", ")", "{", "for", "repo", ",", "plugins", ":=", "range", "c", ".", "Plugins", "{", "found", ":=", "false",...
// EnabledReposForPlugin returns the orgs and repos that have enabled the passed plugin.
[ "EnabledReposForPlugin", "returns", "the", "orgs", "and", "repos", "that", "have", "enabled", "the", "passed", "plugin", "." ]
8125fbda10178887be5dff9e901d6a0a519b67bc
https://github.com/kubernetes/test-infra/blob/8125fbda10178887be5dff9e901d6a0a519b67bc/prow/plugins/config.go#L619-L637
test
kubernetes/test-infra
prow/plugins/config.go
EnabledReposForExternalPlugin
func (c *Configuration) EnabledReposForExternalPlugin(plugin string) (orgs, repos []string) { for repo, plugins := range c.ExternalPlugins { found := false for _, candidate := range plugins { if candidate.Name == plugin { found = true break } } if found { if strings.Contains(repo, "/") { r...
go
func (c *Configuration) EnabledReposForExternalPlugin(plugin string) (orgs, repos []string) { for repo, plugins := range c.ExternalPlugins { found := false for _, candidate := range plugins { if candidate.Name == plugin { found = true break } } if found { if strings.Contains(repo, "/") { r...
[ "func", "(", "c", "*", "Configuration", ")", "EnabledReposForExternalPlugin", "(", "plugin", "string", ")", "(", "orgs", ",", "repos", "[", "]", "string", ")", "{", "for", "repo", ",", "plugins", ":=", "range", "c", ".", "ExternalPlugins", "{", "found", ...
// EnabledReposForExternalPlugin returns the orgs and repos that have enabled the passed // external plugin.
[ "EnabledReposForExternalPlugin", "returns", "the", "orgs", "and", "repos", "that", "have", "enabled", "the", "passed", "external", "plugin", "." ]
8125fbda10178887be5dff9e901d6a0a519b67bc
https://github.com/kubernetes/test-infra/blob/8125fbda10178887be5dff9e901d6a0a519b67bc/prow/plugins/config.go#L641-L659
test
kubernetes/test-infra
prow/plugins/config.go
SetDefaults
func (c *ConfigUpdater) SetDefaults() { if len(c.Maps) == 0 { cf := c.ConfigFile if cf == "" { cf = "prow/config.yaml" } else { logrus.Warnf(`config_file is deprecated, please switch to "maps": {"%s": "config"} before July 2018`, cf) } pf := c.PluginFile if pf == "" { pf = "prow/plugins.yaml" } ...
go
func (c *ConfigUpdater) SetDefaults() { if len(c.Maps) == 0 { cf := c.ConfigFile if cf == "" { cf = "prow/config.yaml" } else { logrus.Warnf(`config_file is deprecated, please switch to "maps": {"%s": "config"} before July 2018`, cf) } pf := c.PluginFile if pf == "" { pf = "prow/plugins.yaml" } ...
[ "func", "(", "c", "*", "ConfigUpdater", ")", "SetDefaults", "(", ")", "{", "if", "len", "(", "c", ".", "Maps", ")", "==", "0", "{", "cf", ":=", "c", ".", "ConfigFile", "\n", "if", "cf", "==", "\"\"", "{", "cf", "=", "\"prow/config.yaml\"", "\n", ...
// SetDefaults sets default options for config updating
[ "SetDefaults", "sets", "default", "options", "for", "config", "updating" ]
8125fbda10178887be5dff9e901d6a0a519b67bc
https://github.com/kubernetes/test-infra/blob/8125fbda10178887be5dff9e901d6a0a519b67bc/prow/plugins/config.go#L662-L690
test
kubernetes/test-infra
prow/plugins/config.go
validatePlugins
func validatePlugins(plugins map[string][]string) error { var errors []string for _, configuration := range plugins { for _, plugin := range configuration { if _, ok := pluginHelp[plugin]; !ok { errors = append(errors, fmt.Sprintf("unknown plugin: %s", plugin)) } } } for repo, repoConfig := range plug...
go
func validatePlugins(plugins map[string][]string) error { var errors []string for _, configuration := range plugins { for _, plugin := range configuration { if _, ok := pluginHelp[plugin]; !ok { errors = append(errors, fmt.Sprintf("unknown plugin: %s", plugin)) } } } for repo, repoConfig := range plug...
[ "func", "validatePlugins", "(", "plugins", "map", "[", "string", "]", "[", "]", "string", ")", "error", "{", "var", "errors", "[", "]", "string", "\n", "for", "_", ",", "configuration", ":=", "range", "plugins", "{", "for", "_", ",", "plugin", ":=", ...
// validatePlugins will return error if // there are unknown or duplicated plugins.
[ "validatePlugins", "will", "return", "error", "if", "there", "are", "unknown", "or", "duplicated", "plugins", "." ]
8125fbda10178887be5dff9e901d6a0a519b67bc
https://github.com/kubernetes/test-infra/blob/8125fbda10178887be5dff9e901d6a0a519b67bc/prow/plugins/config.go#L744-L766
test
kubernetes/test-infra
prow/gerrit/reporter/reporter.go
ShouldReport
func (c *Client) ShouldReport(pj *v1.ProwJob) bool { if pj.Status.State == v1.TriggeredState || pj.Status.State == v1.PendingState { // not done yet logrus.WithField("prowjob", pj.ObjectMeta.Name).Info("PJ not finished") return false } if pj.Status.State == v1.AbortedState { // aborted (new patchset) log...
go
func (c *Client) ShouldReport(pj *v1.ProwJob) bool { if pj.Status.State == v1.TriggeredState || pj.Status.State == v1.PendingState { // not done yet logrus.WithField("prowjob", pj.ObjectMeta.Name).Info("PJ not finished") return false } if pj.Status.State == v1.AbortedState { // aborted (new patchset) log...
[ "func", "(", "c", "*", "Client", ")", "ShouldReport", "(", "pj", "*", "v1", ".", "ProwJob", ")", "bool", "{", "if", "pj", ".", "Status", ".", "State", "==", "v1", ".", "TriggeredState", "||", "pj", ".", "Status", ".", "State", "==", "v1", ".", "P...
// ShouldReport returns if this prowjob should be reported by the gerrit reporter
[ "ShouldReport", "returns", "if", "this", "prowjob", "should", "be", "reported", "by", "the", "gerrit", "reporter" ]
8125fbda10178887be5dff9e901d6a0a519b67bc
https://github.com/kubernetes/test-infra/blob/8125fbda10178887be5dff9e901d6a0a519b67bc/prow/gerrit/reporter/reporter.go#L62-L112
test
kubernetes/test-infra
prow/pod-utils/clone/clone.go
Run
func Run(refs prowapi.Refs, dir, gitUserName, gitUserEmail, cookiePath string, env []string) Record { logrus.WithFields(logrus.Fields{"refs": refs}).Info("Cloning refs") record := Record{Refs: refs} // This function runs the provided commands in order, logging them as they run, // aborting early and returning if a...
go
func Run(refs prowapi.Refs, dir, gitUserName, gitUserEmail, cookiePath string, env []string) Record { logrus.WithFields(logrus.Fields{"refs": refs}).Info("Cloning refs") record := Record{Refs: refs} // This function runs the provided commands in order, logging them as they run, // aborting early and returning if a...
[ "func", "Run", "(", "refs", "prowapi", ".", "Refs", ",", "dir", ",", "gitUserName", ",", "gitUserEmail", ",", "cookiePath", "string", ",", "env", "[", "]", "string", ")", "Record", "{", "logrus", ".", "WithFields", "(", "logrus", ".", "Fields", "{", "\...
// Run clones the refs under the prescribed directory and optionally // configures the git username and email in the repository as well.
[ "Run", "clones", "the", "refs", "under", "the", "prescribed", "directory", "and", "optionally", "configures", "the", "git", "username", "and", "email", "in", "the", "repository", "as", "well", "." ]
8125fbda10178887be5dff9e901d6a0a519b67bc
https://github.com/kubernetes/test-infra/blob/8125fbda10178887be5dff9e901d6a0a519b67bc/prow/pod-utils/clone/clone.go#L33-L77
test
kubernetes/test-infra
prow/pod-utils/clone/clone.go
PathForRefs
func PathForRefs(baseDir string, refs prowapi.Refs) string { var clonePath string if refs.PathAlias != "" { clonePath = refs.PathAlias } else { clonePath = fmt.Sprintf("github.com/%s/%s", refs.Org, refs.Repo) } return fmt.Sprintf("%s/src/%s", baseDir, clonePath) }
go
func PathForRefs(baseDir string, refs prowapi.Refs) string { var clonePath string if refs.PathAlias != "" { clonePath = refs.PathAlias } else { clonePath = fmt.Sprintf("github.com/%s/%s", refs.Org, refs.Repo) } return fmt.Sprintf("%s/src/%s", baseDir, clonePath) }
[ "func", "PathForRefs", "(", "baseDir", "string", ",", "refs", "prowapi", ".", "Refs", ")", "string", "{", "var", "clonePath", "string", "\n", "if", "refs", ".", "PathAlias", "!=", "\"\"", "{", "clonePath", "=", "refs", ".", "PathAlias", "\n", "}", "else"...
// PathForRefs determines the full path to where // refs should be cloned
[ "PathForRefs", "determines", "the", "full", "path", "to", "where", "refs", "should", "be", "cloned" ]
8125fbda10178887be5dff9e901d6a0a519b67bc
https://github.com/kubernetes/test-infra/blob/8125fbda10178887be5dff9e901d6a0a519b67bc/prow/pod-utils/clone/clone.go#L81-L89
test
kubernetes/test-infra
prow/pod-utils/clone/clone.go
gitCtxForRefs
func gitCtxForRefs(refs prowapi.Refs, baseDir string, env []string) gitCtx { g := gitCtx{ cloneDir: PathForRefs(baseDir, refs), env: env, repositoryURI: fmt.Sprintf("https://github.com/%s/%s.git", refs.Org, refs.Repo), } if refs.CloneURI != "" { g.repositoryURI = refs.CloneURI } return g }
go
func gitCtxForRefs(refs prowapi.Refs, baseDir string, env []string) gitCtx { g := gitCtx{ cloneDir: PathForRefs(baseDir, refs), env: env, repositoryURI: fmt.Sprintf("https://github.com/%s/%s.git", refs.Org, refs.Repo), } if refs.CloneURI != "" { g.repositoryURI = refs.CloneURI } return g }
[ "func", "gitCtxForRefs", "(", "refs", "prowapi", ".", "Refs", ",", "baseDir", "string", ",", "env", "[", "]", "string", ")", "gitCtx", "{", "g", ":=", "gitCtx", "{", "cloneDir", ":", "PathForRefs", "(", "baseDir", ",", "refs", ")", ",", "env", ":", "...
// gitCtxForRefs creates a gitCtx based on the provide refs and baseDir.
[ "gitCtxForRefs", "creates", "a", "gitCtx", "based", "on", "the", "provide", "refs", "and", "baseDir", "." ]
8125fbda10178887be5dff9e901d6a0a519b67bc
https://github.com/kubernetes/test-infra/blob/8125fbda10178887be5dff9e901d6a0a519b67bc/prow/pod-utils/clone/clone.go#L99-L109
test
kubernetes/test-infra
prow/pod-utils/clone/clone.go
commandsForBaseRef
func (g *gitCtx) commandsForBaseRef(refs prowapi.Refs, gitUserName, gitUserEmail, cookiePath string) []cloneCommand { commands := []cloneCommand{{dir: "/", env: g.env, command: "mkdir", args: []string{"-p", g.cloneDir}}} commands = append(commands, g.gitCommand("init")) if gitUserName != "" { commands = append(co...
go
func (g *gitCtx) commandsForBaseRef(refs prowapi.Refs, gitUserName, gitUserEmail, cookiePath string) []cloneCommand { commands := []cloneCommand{{dir: "/", env: g.env, command: "mkdir", args: []string{"-p", g.cloneDir}}} commands = append(commands, g.gitCommand("init")) if gitUserName != "" { commands = append(co...
[ "func", "(", "g", "*", "gitCtx", ")", "commandsForBaseRef", "(", "refs", "prowapi", ".", "Refs", ",", "gitUserName", ",", "gitUserEmail", ",", "cookiePath", "string", ")", "[", "]", "cloneCommand", "{", "commands", ":=", "[", "]", "cloneCommand", "{", "{",...
// commandsForBaseRef returns the list of commands needed to initialize and // configure a local git directory, as well as fetch and check out the provided // base ref.
[ "commandsForBaseRef", "returns", "the", "list", "of", "commands", "needed", "to", "initialize", "and", "configure", "a", "local", "git", "directory", "as", "well", "as", "fetch", "and", "check", "out", "the", "provided", "base", "ref", "." ]
8125fbda10178887be5dff9e901d6a0a519b67bc
https://github.com/kubernetes/test-infra/blob/8125fbda10178887be5dff9e901d6a0a519b67bc/prow/pod-utils/clone/clone.go#L118-L151
test
kubernetes/test-infra
prow/pod-utils/clone/clone.go
gitTimestampEnvs
func gitTimestampEnvs(timestamp int) []string { return []string{ fmt.Sprintf("GIT_AUTHOR_DATE=%d", timestamp), fmt.Sprintf("GIT_COMMITTER_DATE=%d", timestamp), } }
go
func gitTimestampEnvs(timestamp int) []string { return []string{ fmt.Sprintf("GIT_AUTHOR_DATE=%d", timestamp), fmt.Sprintf("GIT_COMMITTER_DATE=%d", timestamp), } }
[ "func", "gitTimestampEnvs", "(", "timestamp", "int", ")", "[", "]", "string", "{", "return", "[", "]", "string", "{", "fmt", ".", "Sprintf", "(", "\"GIT_AUTHOR_DATE=%d\"", ",", "timestamp", ")", ",", "fmt", ".", "Sprintf", "(", "\"GIT_COMMITTER_DATE=%d\"", "...
// gitTimestampEnvs returns the list of environment variables needed to override // git's author and commit timestamps when creating new commits.
[ "gitTimestampEnvs", "returns", "the", "list", "of", "environment", "variables", "needed", "to", "override", "git", "s", "author", "and", "commit", "timestamps", "when", "creating", "new", "commits", "." ]
8125fbda10178887be5dff9e901d6a0a519b67bc
https://github.com/kubernetes/test-infra/blob/8125fbda10178887be5dff9e901d6a0a519b67bc/prow/pod-utils/clone/clone.go#L173-L178
test
kubernetes/test-infra
prow/pod-utils/clone/clone.go
gitRevParse
func (g *gitCtx) gitRevParse() (string, error) { gitRevParseCommand := g.gitCommand("rev-parse", "HEAD") _, commit, err := gitRevParseCommand.run() if err != nil { logrus.WithError(err).Error("git rev-parse HEAD failed!") return "", err } return strings.TrimSpace(commit), nil }
go
func (g *gitCtx) gitRevParse() (string, error) { gitRevParseCommand := g.gitCommand("rev-parse", "HEAD") _, commit, err := gitRevParseCommand.run() if err != nil { logrus.WithError(err).Error("git rev-parse HEAD failed!") return "", err } return strings.TrimSpace(commit), nil }
[ "func", "(", "g", "*", "gitCtx", ")", "gitRevParse", "(", ")", "(", "string", ",", "error", ")", "{", "gitRevParseCommand", ":=", "g", ".", "gitCommand", "(", "\"rev-parse\"", ",", "\"HEAD\"", ")", "\n", "_", ",", "commit", ",", "err", ":=", "gitRevPar...
// gitRevParse returns current commit from HEAD in a git tree
[ "gitRevParse", "returns", "current", "commit", "from", "HEAD", "in", "a", "git", "tree" ]
8125fbda10178887be5dff9e901d6a0a519b67bc
https://github.com/kubernetes/test-infra/blob/8125fbda10178887be5dff9e901d6a0a519b67bc/prow/pod-utils/clone/clone.go#L181-L189
test
kubernetes/test-infra
prow/pod-utils/clone/clone.go
commandsForPullRefs
func (g *gitCtx) commandsForPullRefs(refs prowapi.Refs, fakeTimestamp int) []cloneCommand { var commands []cloneCommand for _, prRef := range refs.Pulls { ref := fmt.Sprintf("pull/%d/head", prRef.Number) if prRef.Ref != "" { ref = prRef.Ref } commands = append(commands, g.gitCommand("fetch", g.repositoryUR...
go
func (g *gitCtx) commandsForPullRefs(refs prowapi.Refs, fakeTimestamp int) []cloneCommand { var commands []cloneCommand for _, prRef := range refs.Pulls { ref := fmt.Sprintf("pull/%d/head", prRef.Number) if prRef.Ref != "" { ref = prRef.Ref } commands = append(commands, g.gitCommand("fetch", g.repositoryUR...
[ "func", "(", "g", "*", "gitCtx", ")", "commandsForPullRefs", "(", "refs", "prowapi", ".", "Refs", ",", "fakeTimestamp", "int", ")", "[", "]", "cloneCommand", "{", "var", "commands", "[", "]", "cloneCommand", "\n", "for", "_", ",", "prRef", ":=", "range",...
// commandsForPullRefs returns the list of commands needed to fetch and // merge any pull refs as well as submodules. These commands should be run only // after the commands provided by commandsForBaseRef have been run // successfully. // Each merge commit will be created at sequential seconds after fakeTimestamp. // I...
[ "commandsForPullRefs", "returns", "the", "list", "of", "commands", "needed", "to", "fetch", "and", "merge", "any", "pull", "refs", "as", "well", "as", "submodules", ".", "These", "commands", "should", "be", "run", "only", "after", "the", "commands", "provided"...
8125fbda10178887be5dff9e901d6a0a519b67bc
https://github.com/kubernetes/test-infra/blob/8125fbda10178887be5dff9e901d6a0a519b67bc/prow/pod-utils/clone/clone.go#L199-L225
test
kubernetes/test-infra
gopherage/pkg/cov/junit/calculation/calculation.go
ProduceCovList
func ProduceCovList(profiles []*cover.Profile) *CoverageList { covList := newCoverageList("summary") for _, prof := range profiles { covList.Group = append(covList.Group, summarizeBlocks(prof)) } return covList }
go
func ProduceCovList(profiles []*cover.Profile) *CoverageList { covList := newCoverageList("summary") for _, prof := range profiles { covList.Group = append(covList.Group, summarizeBlocks(prof)) } return covList }
[ "func", "ProduceCovList", "(", "profiles", "[", "]", "*", "cover", ".", "Profile", ")", "*", "CoverageList", "{", "covList", ":=", "newCoverageList", "(", "\"summary\"", ")", "\n", "for", "_", ",", "prof", ":=", "range", "profiles", "{", "covList", ".", ...
// ProduceCovList summarizes profiles and returns the result
[ "ProduceCovList", "summarizes", "profiles", "and", "returns", "the", "result" ]
8125fbda10178887be5dff9e901d6a0a519b67bc
https://github.com/kubernetes/test-infra/blob/8125fbda10178887be5dff9e901d6a0a519b67bc/gopherage/pkg/cov/junit/calculation/calculation.go#L25-L31
test
kubernetes/test-infra
prow/plugins/blunderbuss/blunderbuss.go
popRandom
func popRandom(set sets.String) string { list := set.List() sort.Strings(list) sel := list[rand.Intn(len(list))] set.Delete(sel) return sel }
go
func popRandom(set sets.String) string { list := set.List() sort.Strings(list) sel := list[rand.Intn(len(list))] set.Delete(sel) return sel }
[ "func", "popRandom", "(", "set", "sets", ".", "String", ")", "string", "{", "list", ":=", "set", ".", "List", "(", ")", "\n", "sort", ".", "Strings", "(", "list", ")", "\n", "sel", ":=", "list", "[", "rand", ".", "Intn", "(", "len", "(", "list", ...
// popRandom randomly selects an element of 'set' and pops it.
[ "popRandom", "randomly", "selects", "an", "element", "of", "set", "and", "pops", "it", "." ]
8125fbda10178887be5dff9e901d6a0a519b67bc
https://github.com/kubernetes/test-infra/blob/8125fbda10178887be5dff9e901d6a0a519b67bc/prow/plugins/blunderbuss/blunderbuss.go#L294-L300
test
kubernetes/test-infra
prow/flagutil/kubernetes_cluster_clients.go
resolve
func (o *ExperimentalKubernetesOptions) resolve(dryRun bool) (err error) { if o.resolved { return nil } o.dryRun = dryRun if dryRun { return nil } clusterConfigs, err := kube.LoadClusterConfigs(o.kubeconfig, o.buildCluster) if err != nil { return fmt.Errorf("load --kubeconfig=%q --build-cluster=%q config...
go
func (o *ExperimentalKubernetesOptions) resolve(dryRun bool) (err error) { if o.resolved { return nil } o.dryRun = dryRun if dryRun { return nil } clusterConfigs, err := kube.LoadClusterConfigs(o.kubeconfig, o.buildCluster) if err != nil { return fmt.Errorf("load --kubeconfig=%q --build-cluster=%q config...
[ "func", "(", "o", "*", "ExperimentalKubernetesOptions", ")", "resolve", "(", "dryRun", "bool", ")", "(", "err", "error", ")", "{", "if", "o", ".", "resolved", "{", "return", "nil", "\n", "}", "\n", "o", ".", "dryRun", "=", "dryRun", "\n", "if", "dryR...
// resolve loads all of the clients we need and caches them for future calls.
[ "resolve", "loads", "all", "of", "the", "clients", "we", "need", "and", "caches", "them", "for", "future", "calls", "." ]
8125fbda10178887be5dff9e901d6a0a519b67bc
https://github.com/kubernetes/test-infra/blob/8125fbda10178887be5dff9e901d6a0a519b67bc/prow/flagutil/kubernetes_cluster_clients.go#L83-L117
test
kubernetes/test-infra
prow/flagutil/kubernetes_cluster_clients.go
ProwJobClientset
func (o *ExperimentalKubernetesOptions) ProwJobClientset(namespace string, dryRun bool) (prowJobClientset prow.Interface, err error) { if err := o.resolve(dryRun); err != nil { return nil, err } if o.dryRun { return nil, errors.New("no dry-run prowjob clientset is supported in dry-run mode") } return o.prowJ...
go
func (o *ExperimentalKubernetesOptions) ProwJobClientset(namespace string, dryRun bool) (prowJobClientset prow.Interface, err error) { if err := o.resolve(dryRun); err != nil { return nil, err } if o.dryRun { return nil, errors.New("no dry-run prowjob clientset is supported in dry-run mode") } return o.prowJ...
[ "func", "(", "o", "*", "ExperimentalKubernetesOptions", ")", "ProwJobClientset", "(", "namespace", "string", ",", "dryRun", "bool", ")", "(", "prowJobClientset", "prow", ".", "Interface", ",", "err", "error", ")", "{", "if", "err", ":=", "o", ".", "resolve",...
// ProwJobClientset returns a ProwJob clientset for use in informer factories.
[ "ProwJobClientset", "returns", "a", "ProwJob", "clientset", "for", "use", "in", "informer", "factories", "." ]
8125fbda10178887be5dff9e901d6a0a519b67bc
https://github.com/kubernetes/test-infra/blob/8125fbda10178887be5dff9e901d6a0a519b67bc/prow/flagutil/kubernetes_cluster_clients.go#L120-L130
test
kubernetes/test-infra
prow/flagutil/kubernetes_cluster_clients.go
ProwJobClient
func (o *ExperimentalKubernetesOptions) ProwJobClient(namespace string, dryRun bool) (prowJobClient prowv1.ProwJobInterface, err error) { if err := o.resolve(dryRun); err != nil { return nil, err } if o.dryRun { return kube.NewDryRunProwJobClient(o.DeckURI), nil } return o.prowJobClientset.ProwV1().ProwJobs(...
go
func (o *ExperimentalKubernetesOptions) ProwJobClient(namespace string, dryRun bool) (prowJobClient prowv1.ProwJobInterface, err error) { if err := o.resolve(dryRun); err != nil { return nil, err } if o.dryRun { return kube.NewDryRunProwJobClient(o.DeckURI), nil } return o.prowJobClientset.ProwV1().ProwJobs(...
[ "func", "(", "o", "*", "ExperimentalKubernetesOptions", ")", "ProwJobClient", "(", "namespace", "string", ",", "dryRun", "bool", ")", "(", "prowJobClient", "prowv1", ".", "ProwJobInterface", ",", "err", "error", ")", "{", "if", "err", ":=", "o", ".", "resolv...
// ProwJobClient returns a ProwJob client.
[ "ProwJobClient", "returns", "a", "ProwJob", "client", "." ]
8125fbda10178887be5dff9e901d6a0a519b67bc
https://github.com/kubernetes/test-infra/blob/8125fbda10178887be5dff9e901d6a0a519b67bc/prow/flagutil/kubernetes_cluster_clients.go#L133-L143
test
kubernetes/test-infra
prow/flagutil/kubernetes_cluster_clients.go
InfrastructureClusterClient
func (o *ExperimentalKubernetesOptions) InfrastructureClusterClient(dryRun bool) (kubernetesClient kubernetes.Interface, err error) { if err := o.resolve(dryRun); err != nil { return nil, err } if o.dryRun { return nil, errors.New("no dry-run kubernetes client is supported in dry-run mode") } return o.kubern...
go
func (o *ExperimentalKubernetesOptions) InfrastructureClusterClient(dryRun bool) (kubernetesClient kubernetes.Interface, err error) { if err := o.resolve(dryRun); err != nil { return nil, err } if o.dryRun { return nil, errors.New("no dry-run kubernetes client is supported in dry-run mode") } return o.kubern...
[ "func", "(", "o", "*", "ExperimentalKubernetesOptions", ")", "InfrastructureClusterClient", "(", "dryRun", "bool", ")", "(", "kubernetesClient", "kubernetes", ".", "Interface", ",", "err", "error", ")", "{", "if", "err", ":=", "o", ".", "resolve", "(", "dryRun...
// InfrastructureClusterClient returns a Kubernetes client for the infrastructure cluster.
[ "InfrastructureClusterClient", "returns", "a", "Kubernetes", "client", "for", "the", "infrastructure", "cluster", "." ]
8125fbda10178887be5dff9e901d6a0a519b67bc
https://github.com/kubernetes/test-infra/blob/8125fbda10178887be5dff9e901d6a0a519b67bc/prow/flagutil/kubernetes_cluster_clients.go#L146-L156
test
kubernetes/test-infra
prow/flagutil/kubernetes_cluster_clients.go
BuildClusterClients
func (o *ExperimentalKubernetesOptions) BuildClusterClients(namespace string, dryRun bool) (buildClusterClients map[string]corev1.PodInterface, err error) { if err := o.resolve(dryRun); err != nil { return nil, err } if o.dryRun { return nil, errors.New("no dry-run pod client is supported for build clusters in ...
go
func (o *ExperimentalKubernetesOptions) BuildClusterClients(namespace string, dryRun bool) (buildClusterClients map[string]corev1.PodInterface, err error) { if err := o.resolve(dryRun); err != nil { return nil, err } if o.dryRun { return nil, errors.New("no dry-run pod client is supported for build clusters in ...
[ "func", "(", "o", "*", "ExperimentalKubernetesOptions", ")", "BuildClusterClients", "(", "namespace", "string", ",", "dryRun", "bool", ")", "(", "buildClusterClients", "map", "[", "string", "]", "corev1", ".", "PodInterface", ",", "err", "error", ")", "{", "if...
// BuildClusterClients returns Pod clients for build clusters.
[ "BuildClusterClients", "returns", "Pod", "clients", "for", "build", "clusters", "." ]
8125fbda10178887be5dff9e901d6a0a519b67bc
https://github.com/kubernetes/test-infra/blob/8125fbda10178887be5dff9e901d6a0a519b67bc/prow/flagutil/kubernetes_cluster_clients.go#L159-L173
test
kubernetes/test-infra
velodrome/transform/plugins/states.go
Age
func (a *ActiveState) Age(t time.Time) time.Duration { return t.Sub(a.startTime) }
go
func (a *ActiveState) Age(t time.Time) time.Duration { return t.Sub(a.startTime) }
[ "func", "(", "a", "*", "ActiveState", ")", "Age", "(", "t", "time", ".", "Time", ")", "time", ".", "Duration", "{", "return", "t", ".", "Sub", "(", "a", ".", "startTime", ")", "\n", "}" ]
// Age gives the time since the state has been activated.
[ "Age", "gives", "the", "time", "since", "the", "state", "has", "been", "activated", "." ]
8125fbda10178887be5dff9e901d6a0a519b67bc
https://github.com/kubernetes/test-infra/blob/8125fbda10178887be5dff9e901d6a0a519b67bc/velodrome/transform/plugins/states.go#L49-L51
test
kubernetes/test-infra
velodrome/transform/plugins/states.go
ReceiveEvent
func (a *ActiveState) ReceiveEvent(eventName, label string, t time.Time) (State, bool) { if a.exit.Match(eventName, label) { return &InactiveState{ entry: a.exit.Opposite(), }, true } return a, false }
go
func (a *ActiveState) ReceiveEvent(eventName, label string, t time.Time) (State, bool) { if a.exit.Match(eventName, label) { return &InactiveState{ entry: a.exit.Opposite(), }, true } return a, false }
[ "func", "(", "a", "*", "ActiveState", ")", "ReceiveEvent", "(", "eventName", ",", "label", "string", ",", "t", "time", ".", "Time", ")", "(", "State", ",", "bool", ")", "{", "if", "a", ".", "exit", ".", "Match", "(", "eventName", ",", "label", ")",...
// ReceiveEvent checks if the event matches the exit criteria. // Returns a new InactiveState or self, and true if it changed.
[ "ReceiveEvent", "checks", "if", "the", "event", "matches", "the", "exit", "criteria", ".", "Returns", "a", "new", "InactiveState", "or", "self", "and", "true", "if", "it", "changed", "." ]
8125fbda10178887be5dff9e901d6a0a519b67bc
https://github.com/kubernetes/test-infra/blob/8125fbda10178887be5dff9e901d6a0a519b67bc/velodrome/transform/plugins/states.go#L55-L62
test
kubernetes/test-infra
velodrome/transform/plugins/states.go
ReceiveEvent
func (i *InactiveState) ReceiveEvent(eventName, label string, t time.Time) (State, bool) { if i.entry.Match(eventName, label) { return &ActiveState{ startTime: t, exit: i.entry.Opposite(), }, true } return i, false }
go
func (i *InactiveState) ReceiveEvent(eventName, label string, t time.Time) (State, bool) { if i.entry.Match(eventName, label) { return &ActiveState{ startTime: t, exit: i.entry.Opposite(), }, true } return i, false }
[ "func", "(", "i", "*", "InactiveState", ")", "ReceiveEvent", "(", "eventName", ",", "label", "string", ",", "t", "time", ".", "Time", ")", "(", "State", ",", "bool", ")", "{", "if", "i", ".", "entry", ".", "Match", "(", "eventName", ",", "label", "...
// ReceiveEvent checks if the event matches the entry criteria // Returns a new ActiveState or self, and true if it changed.
[ "ReceiveEvent", "checks", "if", "the", "event", "matches", "the", "entry", "criteria", "Returns", "a", "new", "ActiveState", "or", "self", "and", "true", "if", "it", "changed", "." ]
8125fbda10178887be5dff9e901d6a0a519b67bc
https://github.com/kubernetes/test-infra/blob/8125fbda10178887be5dff9e901d6a0a519b67bc/velodrome/transform/plugins/states.go#L83-L91
test
kubernetes/test-infra
velodrome/transform/plugins/states.go
Active
func (m *MultiState) Active() bool { for _, state := range m.states { if !state.Active() { return false } } return true }
go
func (m *MultiState) Active() bool { for _, state := range m.states { if !state.Active() { return false } } return true }
[ "func", "(", "m", "*", "MultiState", ")", "Active", "(", ")", "bool", "{", "for", "_", ",", "state", ":=", "range", "m", ".", "states", "{", "if", "!", "state", ".", "Active", "(", ")", "{", "return", "false", "\n", "}", "\n", "}", "\n", "retur...
// Active is true if all the states are active.
[ "Active", "is", "true", "if", "all", "the", "states", "are", "active", "." ]
8125fbda10178887be5dff9e901d6a0a519b67bc
https://github.com/kubernetes/test-infra/blob/8125fbda10178887be5dff9e901d6a0a519b67bc/velodrome/transform/plugins/states.go#L101-L108
test
kubernetes/test-infra
velodrome/transform/plugins/states.go
Age
func (m *MultiState) Age(t time.Time) time.Duration { minAge := time.Duration(1<<63 - 1) for _, state := range m.states { stateAge := state.Age(t) if stateAge < minAge { minAge = stateAge } } return minAge }
go
func (m *MultiState) Age(t time.Time) time.Duration { minAge := time.Duration(1<<63 - 1) for _, state := range m.states { stateAge := state.Age(t) if stateAge < minAge { minAge = stateAge } } return minAge }
[ "func", "(", "m", "*", "MultiState", ")", "Age", "(", "t", "time", ".", "Time", ")", "time", ".", "Duration", "{", "minAge", ":=", "time", ".", "Duration", "(", "1", "<<", "63", "-", "1", ")", "\n", "for", "_", ",", "state", ":=", "range", "m",...
// Age returns the time since all states have been activated. // It will panic if any of the state is not active.
[ "Age", "returns", "the", "time", "since", "all", "states", "have", "been", "activated", ".", "It", "will", "panic", "if", "any", "of", "the", "state", "is", "not", "active", "." ]
8125fbda10178887be5dff9e901d6a0a519b67bc
https://github.com/kubernetes/test-infra/blob/8125fbda10178887be5dff9e901d6a0a519b67bc/velodrome/transform/plugins/states.go#L112-L121
test
kubernetes/test-infra
velodrome/transform/plugins/states.go
ReceiveEvent
func (m *MultiState) ReceiveEvent(eventName, label string, t time.Time) (State, bool) { oneChanged := false for i := range m.states { state, changed := m.states[i].ReceiveEvent(eventName, label, t) if changed { oneChanged = true } m.states[i] = state } return m, oneChanged }
go
func (m *MultiState) ReceiveEvent(eventName, label string, t time.Time) (State, bool) { oneChanged := false for i := range m.states { state, changed := m.states[i].ReceiveEvent(eventName, label, t) if changed { oneChanged = true } m.states[i] = state } return m, oneChanged }
[ "func", "(", "m", "*", "MultiState", ")", "ReceiveEvent", "(", "eventName", ",", "label", "string", ",", "t", "time", ".", "Time", ")", "(", "State", ",", "bool", ")", "{", "oneChanged", ":=", "false", "\n", "for", "i", ":=", "range", "m", ".", "st...
// ReceiveEvent will send the event to each individual state, and update // them if they change.
[ "ReceiveEvent", "will", "send", "the", "event", "to", "each", "individual", "state", "and", "update", "them", "if", "they", "change", "." ]
8125fbda10178887be5dff9e901d6a0a519b67bc
https://github.com/kubernetes/test-infra/blob/8125fbda10178887be5dff9e901d6a0a519b67bc/velodrome/transform/plugins/states.go#L125-L136
test
kubernetes/test-infra
prow/client/informers/externalversions/prowjobs/v1/interface.go
ProwJobs
func (v *version) ProwJobs() ProwJobInformer { return &prowJobInformer{factory: v.factory, namespace: v.namespace, tweakListOptions: v.tweakListOptions} }
go
func (v *version) ProwJobs() ProwJobInformer { return &prowJobInformer{factory: v.factory, namespace: v.namespace, tweakListOptions: v.tweakListOptions} }
[ "func", "(", "v", "*", "version", ")", "ProwJobs", "(", ")", "ProwJobInformer", "{", "return", "&", "prowJobInformer", "{", "factory", ":", "v", ".", "factory", ",", "namespace", ":", "v", ".", "namespace", ",", "tweakListOptions", ":", "v", ".", "tweakL...
// ProwJobs returns a ProwJobInformer.
[ "ProwJobs", "returns", "a", "ProwJobInformer", "." ]
8125fbda10178887be5dff9e901d6a0a519b67bc
https://github.com/kubernetes/test-infra/blob/8125fbda10178887be5dff9e901d6a0a519b67bc/prow/client/informers/externalversions/prowjobs/v1/interface.go#L43-L45
test
kubernetes/test-infra
boskos/common/mason_config.go
ItemToResourcesConfig
func ItemToResourcesConfig(i Item) (ResourcesConfig, error) { conf, ok := i.(ResourcesConfig) if !ok { return ResourcesConfig{}, fmt.Errorf("cannot construct Resource from received object %v", i) } return conf, nil }
go
func ItemToResourcesConfig(i Item) (ResourcesConfig, error) { conf, ok := i.(ResourcesConfig) if !ok { return ResourcesConfig{}, fmt.Errorf("cannot construct Resource from received object %v", i) } return conf, nil }
[ "func", "ItemToResourcesConfig", "(", "i", "Item", ")", "(", "ResourcesConfig", ",", "error", ")", "{", "conf", ",", "ok", ":=", "i", ".", "(", "ResourcesConfig", ")", "\n", "if", "!", "ok", "{", "return", "ResourcesConfig", "{", "}", ",", "fmt", ".", ...
// ItemToResourcesConfig casts an Item object to a ResourcesConfig
[ "ItemToResourcesConfig", "casts", "an", "Item", "object", "to", "a", "ResourcesConfig" ]
8125fbda10178887be5dff9e901d6a0a519b67bc
https://github.com/kubernetes/test-infra/blob/8125fbda10178887be5dff9e901d6a0a519b67bc/boskos/common/mason_config.go#L62-L68
test
kubernetes/test-infra
boskos/common/mason_config.go
Copy
func (t TypeToResources) Copy() TypeToResources { n := TypeToResources{} for k, v := range t { n[k] = v } return n }
go
func (t TypeToResources) Copy() TypeToResources { n := TypeToResources{} for k, v := range t { n[k] = v } return n }
[ "func", "(", "t", "TypeToResources", ")", "Copy", "(", ")", "TypeToResources", "{", "n", ":=", "TypeToResources", "{", "}", "\n", "for", "k", ",", "v", ":=", "range", "t", "{", "n", "[", "k", "]", "=", "v", "\n", "}", "\n", "return", "n", "\n", ...
// Copy returns a copy of the TypeToResources
[ "Copy", "returns", "a", "copy", "of", "the", "TypeToResources" ]
8125fbda10178887be5dff9e901d6a0a519b67bc
https://github.com/kubernetes/test-infra/blob/8125fbda10178887be5dff9e901d6a0a519b67bc/boskos/common/mason_config.go#L71-L77
test
kubernetes/test-infra
gopherage/cmd/aggregate/aggregate.go
MakeCommand
func MakeCommand() *cobra.Command { flags := &flags{} cmd := &cobra.Command{ Use: "aggregate [files...]", Short: "Aggregates multiple Go coverage files.", Long: `Given multiple Go coverage files from identical binaries recorded in "count" or "atomic" mode, produces a new Go coverage file in the same mode that...
go
func MakeCommand() *cobra.Command { flags := &flags{} cmd := &cobra.Command{ Use: "aggregate [files...]", Short: "Aggregates multiple Go coverage files.", Long: `Given multiple Go coverage files from identical binaries recorded in "count" or "atomic" mode, produces a new Go coverage file in the same mode that...
[ "func", "MakeCommand", "(", ")", "*", "cobra", ".", "Command", "{", "flags", ":=", "&", "flags", "{", "}", "\n", "cmd", ":=", "&", "cobra", ".", "Command", "{", "Use", ":", "\"aggregate [files...]\"", ",", "Short", ":", "\"Aggregates multiple Go coverage fil...
// MakeCommand returns an `aggregate` command.
[ "MakeCommand", "returns", "an", "aggregate", "command", "." ]
8125fbda10178887be5dff9e901d6a0a519b67bc
https://github.com/kubernetes/test-infra/blob/8125fbda10178887be5dff9e901d6a0a519b67bc/gopherage/cmd/aggregate/aggregate.go#L34-L48
test
kubernetes/test-infra
prow/plank/controller.go
incrementNumPendingJobs
func (c *Controller) incrementNumPendingJobs(job string) { c.lock.Lock() defer c.lock.Unlock() c.pendingJobs[job]++ }
go
func (c *Controller) incrementNumPendingJobs(job string) { c.lock.Lock() defer c.lock.Unlock() c.pendingJobs[job]++ }
[ "func", "(", "c", "*", "Controller", ")", "incrementNumPendingJobs", "(", "job", "string", ")", "{", "c", ".", "lock", ".", "Lock", "(", ")", "\n", "defer", "c", ".", "lock", ".", "Unlock", "(", ")", "\n", "c", ".", "pendingJobs", "[", "job", "]", ...
// incrementNumPendingJobs increments the amount of // pending ProwJobs for the given job identifier
[ "incrementNumPendingJobs", "increments", "the", "amount", "of", "pending", "ProwJobs", "for", "the", "given", "job", "identifier" ]
8125fbda10178887be5dff9e901d6a0a519b67bc
https://github.com/kubernetes/test-infra/blob/8125fbda10178887be5dff9e901d6a0a519b67bc/prow/plank/controller.go#L144-L148
test
kubernetes/test-infra
prow/plank/controller.go
setPreviousReportState
func (c *Controller) setPreviousReportState(pj prowapi.ProwJob) error { // fetch latest before replace latestPJ, err := c.kc.GetProwJob(pj.ObjectMeta.Name) if err != nil { return err } if latestPJ.Status.PrevReportStates == nil { latestPJ.Status.PrevReportStates = map[string]prowapi.ProwJobState{} } latestP...
go
func (c *Controller) setPreviousReportState(pj prowapi.ProwJob) error { // fetch latest before replace latestPJ, err := c.kc.GetProwJob(pj.ObjectMeta.Name) if err != nil { return err } if latestPJ.Status.PrevReportStates == nil { latestPJ.Status.PrevReportStates = map[string]prowapi.ProwJobState{} } latestP...
[ "func", "(", "c", "*", "Controller", ")", "setPreviousReportState", "(", "pj", "prowapi", ".", "ProwJob", ")", "error", "{", "latestPJ", ",", "err", ":=", "c", ".", "kc", ".", "GetProwJob", "(", "pj", ".", "ObjectMeta", ".", "Name", ")", "\n", "if", ...
// setPreviousReportState sets the github key for PrevReportStates // to current state. This is a work-around for plank -> crier // migration to become seamless.
[ "setPreviousReportState", "sets", "the", "github", "key", "for", "PrevReportStates", "to", "current", "state", ".", "This", "is", "a", "work", "-", "around", "for", "plank", "-", ">", "crier", "migration", "to", "become", "seamless", "." ]
8125fbda10178887be5dff9e901d6a0a519b67bc
https://github.com/kubernetes/test-infra/blob/8125fbda10178887be5dff9e901d6a0a519b67bc/prow/plank/controller.go#L153-L166
test
kubernetes/test-infra
prow/plank/controller.go
SyncMetrics
func (c *Controller) SyncMetrics() { c.pjLock.RLock() defer c.pjLock.RUnlock() kube.GatherProwJobMetrics(c.pjs) }
go
func (c *Controller) SyncMetrics() { c.pjLock.RLock() defer c.pjLock.RUnlock() kube.GatherProwJobMetrics(c.pjs) }
[ "func", "(", "c", "*", "Controller", ")", "SyncMetrics", "(", ")", "{", "c", ".", "pjLock", ".", "RLock", "(", ")", "\n", "defer", "c", ".", "pjLock", ".", "RUnlock", "(", ")", "\n", "kube", ".", "GatherProwJobMetrics", "(", "c", ".", "pjs", ")", ...
// SyncMetrics records metrics for the cached prowjobs.
[ "SyncMetrics", "records", "metrics", "for", "the", "cached", "prowjobs", "." ]
8125fbda10178887be5dff9e901d6a0a519b67bc
https://github.com/kubernetes/test-infra/blob/8125fbda10178887be5dff9e901d6a0a519b67bc/prow/plank/controller.go#L255-L259
test
kubernetes/test-infra
gopherage/pkg/cov/util.go
DumpProfile
func DumpProfile(profiles []*cover.Profile, writer io.Writer) error { if len(profiles) == 0 { return errors.New("can't write an empty profile") } if _, err := io.WriteString(writer, "mode: "+profiles[0].Mode+"\n"); err != nil { return err } for _, profile := range profiles { for _, block := range profile.Blo...
go
func DumpProfile(profiles []*cover.Profile, writer io.Writer) error { if len(profiles) == 0 { return errors.New("can't write an empty profile") } if _, err := io.WriteString(writer, "mode: "+profiles[0].Mode+"\n"); err != nil { return err } for _, profile := range profiles { for _, block := range profile.Blo...
[ "func", "DumpProfile", "(", "profiles", "[", "]", "*", "cover", ".", "Profile", ",", "writer", "io", ".", "Writer", ")", "error", "{", "if", "len", "(", "profiles", ")", "==", "0", "{", "return", "errors", ".", "New", "(", "\"can't write an empty profile...
// DumpProfile dumps the profiles given to writer in go coverage format.
[ "DumpProfile", "dumps", "the", "profiles", "given", "to", "writer", "in", "go", "coverage", "format", "." ]
8125fbda10178887be5dff9e901d6a0a519b67bc
https://github.com/kubernetes/test-infra/blob/8125fbda10178887be5dff9e901d6a0a519b67bc/gopherage/pkg/cov/util.go#L27-L42
test
kubernetes/test-infra
gopherage/pkg/cov/util.go
blocksEqual
func blocksEqual(a cover.ProfileBlock, b cover.ProfileBlock) bool { return a.StartCol == b.StartCol && a.StartLine == b.StartLine && a.EndCol == b.EndCol && a.EndLine == b.EndLine && a.NumStmt == b.NumStmt }
go
func blocksEqual(a cover.ProfileBlock, b cover.ProfileBlock) bool { return a.StartCol == b.StartCol && a.StartLine == b.StartLine && a.EndCol == b.EndCol && a.EndLine == b.EndLine && a.NumStmt == b.NumStmt }
[ "func", "blocksEqual", "(", "a", "cover", ".", "ProfileBlock", ",", "b", "cover", ".", "ProfileBlock", ")", "bool", "{", "return", "a", ".", "StartCol", "==", "b", ".", "StartCol", "&&", "a", ".", "StartLine", "==", "b", ".", "StartLine", "&&", "a", ...
// blocksEqual returns true if the blocks refer to the same code, otherwise false. // It does not care about Count.
[ "blocksEqual", "returns", "true", "if", "the", "blocks", "refer", "to", "the", "same", "code", "otherwise", "false", ".", "It", "does", "not", "care", "about", "Count", "." ]
8125fbda10178887be5dff9e901d6a0a519b67bc
https://github.com/kubernetes/test-infra/blob/8125fbda10178887be5dff9e901d6a0a519b67bc/gopherage/pkg/cov/util.go#L53-L56
test
kubernetes/test-infra
prow/client/informers/externalversions/prowjobs/v1/prowjob.go
NewProwJobInformer
func NewProwJobInformer(client versioned.Interface, namespace string, resyncPeriod time.Duration, indexers cache.Indexers) cache.SharedIndexInformer { return NewFilteredProwJobInformer(client, namespace, resyncPeriod, indexers, nil) }
go
func NewProwJobInformer(client versioned.Interface, namespace string, resyncPeriod time.Duration, indexers cache.Indexers) cache.SharedIndexInformer { return NewFilteredProwJobInformer(client, namespace, resyncPeriod, indexers, nil) }
[ "func", "NewProwJobInformer", "(", "client", "versioned", ".", "Interface", ",", "namespace", "string", ",", "resyncPeriod", "time", ".", "Duration", ",", "indexers", "cache", ".", "Indexers", ")", "cache", ".", "SharedIndexInformer", "{", "return", "NewFilteredPr...
// NewProwJobInformer constructs a new informer for ProwJob type. // Always prefer using an informer factory to get a shared informer instead of getting an independent // one. This reduces memory footprint and number of connections to the server.
[ "NewProwJobInformer", "constructs", "a", "new", "informer", "for", "ProwJob", "type", ".", "Always", "prefer", "using", "an", "informer", "factory", "to", "get", "a", "shared", "informer", "instead", "of", "getting", "an", "independent", "one", ".", "This", "r...
8125fbda10178887be5dff9e901d6a0a519b67bc
https://github.com/kubernetes/test-infra/blob/8125fbda10178887be5dff9e901d6a0a519b67bc/prow/client/informers/externalversions/prowjobs/v1/prowjob.go#L50-L52
test
kubernetes/test-infra
prow/client/informers/externalversions/prowjobs/v1/prowjob.go
NewFilteredProwJobInformer
func NewFilteredProwJobInformer(client versioned.Interface, namespace string, resyncPeriod time.Duration, indexers cache.Indexers, tweakListOptions internalinterfaces.TweakListOptionsFunc) cache.SharedIndexInformer { return cache.NewSharedIndexInformer( &cache.ListWatch{ ListFunc: func(options metav1.ListOptions)...
go
func NewFilteredProwJobInformer(client versioned.Interface, namespace string, resyncPeriod time.Duration, indexers cache.Indexers, tweakListOptions internalinterfaces.TweakListOptionsFunc) cache.SharedIndexInformer { return cache.NewSharedIndexInformer( &cache.ListWatch{ ListFunc: func(options metav1.ListOptions)...
[ "func", "NewFilteredProwJobInformer", "(", "client", "versioned", ".", "Interface", ",", "namespace", "string", ",", "resyncPeriod", "time", ".", "Duration", ",", "indexers", "cache", ".", "Indexers", ",", "tweakListOptions", "internalinterfaces", ".", "TweakListOptio...
// NewFilteredProwJobInformer constructs a new informer for ProwJob type. // Always prefer using an informer factory to get a shared informer instead of getting an independent // one. This reduces memory footprint and number of connections to the server.
[ "NewFilteredProwJobInformer", "constructs", "a", "new", "informer", "for", "ProwJob", "type", ".", "Always", "prefer", "using", "an", "informer", "factory", "to", "get", "a", "shared", "informer", "instead", "of", "getting", "an", "independent", "one", ".", "Thi...
8125fbda10178887be5dff9e901d6a0a519b67bc
https://github.com/kubernetes/test-infra/blob/8125fbda10178887be5dff9e901d6a0a519b67bc/prow/client/informers/externalversions/prowjobs/v1/prowjob.go#L57-L77
test
kubernetes/test-infra
prow/spyglass/spyglass.go
New
func New(ja *jobs.JobAgent, cfg config.Getter, c *storage.Client, ctx context.Context) *Spyglass { return &Spyglass{ JobAgent: ja, config: cfg, PodLogArtifactFetcher: NewPodLogArtifactFetcher(ja), GCSArtifactFetcher: NewGCSArtifactFetcher(c), testgrid: &TestGrid{ conf: cfg...
go
func New(ja *jobs.JobAgent, cfg config.Getter, c *storage.Client, ctx context.Context) *Spyglass { return &Spyglass{ JobAgent: ja, config: cfg, PodLogArtifactFetcher: NewPodLogArtifactFetcher(ja), GCSArtifactFetcher: NewGCSArtifactFetcher(c), testgrid: &TestGrid{ conf: cfg...
[ "func", "New", "(", "ja", "*", "jobs", ".", "JobAgent", ",", "cfg", "config", ".", "Getter", ",", "c", "*", "storage", ".", "Client", ",", "ctx", "context", ".", "Context", ")", "*", "Spyglass", "{", "return", "&", "Spyglass", "{", "JobAgent", ":", ...
// New constructs a Spyglass object from a JobAgent, a config.Agent, and a storage Client.
[ "New", "constructs", "a", "Spyglass", "object", "from", "a", "JobAgent", "a", "config", ".", "Agent", "and", "a", "storage", "Client", "." ]
8125fbda10178887be5dff9e901d6a0a519b67bc
https://github.com/kubernetes/test-infra/blob/8125fbda10178887be5dff9e901d6a0a519b67bc/prow/spyglass/spyglass.go#L79-L91
test
kubernetes/test-infra
prow/spyglass/spyglass.go
Lenses
func (s *Spyglass) Lenses(matchCache map[string][]string) []lenses.Lens { ls := []lenses.Lens{} for lensName, matches := range matchCache { if len(matches) == 0 { continue } lens, err := lenses.GetLens(lensName) if err != nil { logrus.WithField("lensName", lens).WithError(err).Error("Could not find arti...
go
func (s *Spyglass) Lenses(matchCache map[string][]string) []lenses.Lens { ls := []lenses.Lens{} for lensName, matches := range matchCache { if len(matches) == 0 { continue } lens, err := lenses.GetLens(lensName) if err != nil { logrus.WithField("lensName", lens).WithError(err).Error("Could not find arti...
[ "func", "(", "s", "*", "Spyglass", ")", "Lenses", "(", "matchCache", "map", "[", "string", "]", "[", "]", "string", ")", "[", "]", "lenses", ".", "Lens", "{", "ls", ":=", "[", "]", "lenses", ".", "Lens", "{", "}", "\n", "for", "lensName", ",", ...
// Lenses gets all views of all artifact files matching each regexp with a registered lens
[ "Lenses", "gets", "all", "views", "of", "all", "artifact", "files", "matching", "each", "regexp", "with", "a", "registered", "lens" ]
8125fbda10178887be5dff9e901d6a0a519b67bc
https://github.com/kubernetes/test-infra/blob/8125fbda10178887be5dff9e901d6a0a519b67bc/prow/spyglass/spyglass.go#L98-L125
test
kubernetes/test-infra
prow/spyglass/spyglass.go
JobPath
func (s *Spyglass) JobPath(src string) (string, error) { src = strings.TrimSuffix(src, "/") keyType, key, err := splitSrc(src) if err != nil { return "", fmt.Errorf("error parsing src: %v", src) } split := strings.Split(key, "/") switch keyType { case gcsKeyType: if len(split) < 4 { return "", fmt.Errorf(...
go
func (s *Spyglass) JobPath(src string) (string, error) { src = strings.TrimSuffix(src, "/") keyType, key, err := splitSrc(src) if err != nil { return "", fmt.Errorf("error parsing src: %v", src) } split := strings.Split(key, "/") switch keyType { case gcsKeyType: if len(split) < 4 { return "", fmt.Errorf(...
[ "func", "(", "s", "*", "Spyglass", ")", "JobPath", "(", "src", "string", ")", "(", "string", ",", "error", ")", "{", "src", "=", "strings", ".", "TrimSuffix", "(", "src", ",", "\"/\"", ")", "\n", "keyType", ",", "key", ",", "err", ":=", "splitSrc",...
// JobPath returns a link to the GCS directory for the job specified in src
[ "JobPath", "returns", "a", "link", "to", "the", "GCS", "directory", "for", "the", "job", "specified", "in", "src" ]
8125fbda10178887be5dff9e901d6a0a519b67bc
https://github.com/kubernetes/test-infra/blob/8125fbda10178887be5dff9e901d6a0a519b67bc/prow/spyglass/spyglass.go#L172-L218
test
kubernetes/test-infra
prow/spyglass/spyglass.go
RunPath
func (s *Spyglass) RunPath(src string) (string, error) { src = strings.TrimSuffix(src, "/") keyType, key, err := splitSrc(src) if err != nil { return "", fmt.Errorf("error parsing src: %v", src) } switch keyType { case gcsKeyType: return key, nil case prowKeyType: return s.prowToGCS(key) default: return...
go
func (s *Spyglass) RunPath(src string) (string, error) { src = strings.TrimSuffix(src, "/") keyType, key, err := splitSrc(src) if err != nil { return "", fmt.Errorf("error parsing src: %v", src) } switch keyType { case gcsKeyType: return key, nil case prowKeyType: return s.prowToGCS(key) default: return...
[ "func", "(", "s", "*", "Spyglass", ")", "RunPath", "(", "src", "string", ")", "(", "string", ",", "error", ")", "{", "src", "=", "strings", ".", "TrimSuffix", "(", "src", ",", "\"/\"", ")", "\n", "keyType", ",", "key", ",", "err", ":=", "splitSrc",...
// RunPath returns the path to the GCS directory for the job run specified in src.
[ "RunPath", "returns", "the", "path", "to", "the", "GCS", "directory", "for", "the", "job", "run", "specified", "in", "src", "." ]
8125fbda10178887be5dff9e901d6a0a519b67bc
https://github.com/kubernetes/test-infra/blob/8125fbda10178887be5dff9e901d6a0a519b67bc/prow/spyglass/spyglass.go#L221-L235
test
kubernetes/test-infra
prow/spyglass/spyglass.go
ExtraLinks
func (sg *Spyglass) ExtraLinks(src string) ([]ExtraLink, error) { artifacts, err := sg.FetchArtifacts(src, "", 1000000, []string{"started.json"}) // Failing to find started.json is okay, just return nothing quietly. if err != nil || len(artifacts) == 0 { logrus.WithError(err).Debugf("Failed to find started.json wh...
go
func (sg *Spyglass) ExtraLinks(src string) ([]ExtraLink, error) { artifacts, err := sg.FetchArtifacts(src, "", 1000000, []string{"started.json"}) // Failing to find started.json is okay, just return nothing quietly. if err != nil || len(artifacts) == 0 { logrus.WithError(err).Debugf("Failed to find started.json wh...
[ "func", "(", "sg", "*", "Spyglass", ")", "ExtraLinks", "(", "src", "string", ")", "(", "[", "]", "ExtraLink", ",", "error", ")", "{", "artifacts", ",", "err", ":=", "sg", ".", "FetchArtifacts", "(", "src", ",", "\"\"", ",", "1000000", ",", "[", "]"...
// ExtraLinks fetches started.json and extracts links from metadata.links.
[ "ExtraLinks", "fetches", "started", ".", "json", "and", "extracts", "links", "from", "metadata", ".", "links", "." ]
8125fbda10178887be5dff9e901d6a0a519b67bc
https://github.com/kubernetes/test-infra/blob/8125fbda10178887be5dff9e901d6a0a519b67bc/prow/spyglass/spyglass.go#L317-L359
test
kubernetes/test-infra
prow/hook/server.go
needDemux
func (s *Server) needDemux(eventType, srcRepo string) []plugins.ExternalPlugin { var matching []plugins.ExternalPlugin srcOrg := strings.Split(srcRepo, "/")[0] for repo, plugins := range s.Plugins.Config().ExternalPlugins { // Make sure the repositories match if repo != srcRepo && repo != srcOrg { continue ...
go
func (s *Server) needDemux(eventType, srcRepo string) []plugins.ExternalPlugin { var matching []plugins.ExternalPlugin srcOrg := strings.Split(srcRepo, "/")[0] for repo, plugins := range s.Plugins.Config().ExternalPlugins { // Make sure the repositories match if repo != srcRepo && repo != srcOrg { continue ...
[ "func", "(", "s", "*", "Server", ")", "needDemux", "(", "eventType", ",", "srcRepo", "string", ")", "[", "]", "plugins", ".", "ExternalPlugin", "{", "var", "matching", "[", "]", "plugins", ".", "ExternalPlugin", "\n", "srcOrg", ":=", "strings", ".", "Spl...
// needDemux returns whether there are any external plugins that need to // get the present event.
[ "needDemux", "returns", "whether", "there", "are", "any", "external", "plugins", "that", "need", "to", "get", "the", "present", "event", "." ]
8125fbda10178887be5dff9e901d6a0a519b67bc
https://github.com/kubernetes/test-infra/blob/8125fbda10178887be5dff9e901d6a0a519b67bc/prow/hook/server.go#L164-L190
test
kubernetes/test-infra
prow/hook/server.go
demuxExternal
func (s *Server) demuxExternal(l *logrus.Entry, externalPlugins []plugins.ExternalPlugin, payload []byte, h http.Header) { h.Set("User-Agent", "ProwHook") for _, p := range externalPlugins { s.wg.Add(1) go func(p plugins.ExternalPlugin) { defer s.wg.Done() if err := s.dispatch(p.Endpoint, payload, h); err !...
go
func (s *Server) demuxExternal(l *logrus.Entry, externalPlugins []plugins.ExternalPlugin, payload []byte, h http.Header) { h.Set("User-Agent", "ProwHook") for _, p := range externalPlugins { s.wg.Add(1) go func(p plugins.ExternalPlugin) { defer s.wg.Done() if err := s.dispatch(p.Endpoint, payload, h); err !...
[ "func", "(", "s", "*", "Server", ")", "demuxExternal", "(", "l", "*", "logrus", ".", "Entry", ",", "externalPlugins", "[", "]", "plugins", ".", "ExternalPlugin", ",", "payload", "[", "]", "byte", ",", "h", "http", ".", "Header", ")", "{", "h", ".", ...
// demuxExternal dispatches the provided payload to the external plugins.
[ "demuxExternal", "dispatches", "the", "provided", "payload", "to", "the", "external", "plugins", "." ]
8125fbda10178887be5dff9e901d6a0a519b67bc
https://github.com/kubernetes/test-infra/blob/8125fbda10178887be5dff9e901d6a0a519b67bc/prow/hook/server.go#L193-L206
test
kubernetes/test-infra
prow/hook/server.go
dispatch
func (s *Server) dispatch(endpoint string, payload []byte, h http.Header) error { req, err := http.NewRequest(http.MethodPost, endpoint, bytes.NewBuffer(payload)) if err != nil { return err } req.Header = h resp, err := s.do(req) if err != nil { return err } defer resp.Body.Close() rb, err := ioutil.ReadAl...
go
func (s *Server) dispatch(endpoint string, payload []byte, h http.Header) error { req, err := http.NewRequest(http.MethodPost, endpoint, bytes.NewBuffer(payload)) if err != nil { return err } req.Header = h resp, err := s.do(req) if err != nil { return err } defer resp.Body.Close() rb, err := ioutil.ReadAl...
[ "func", "(", "s", "*", "Server", ")", "dispatch", "(", "endpoint", "string", ",", "payload", "[", "]", "byte", ",", "h", "http", ".", "Header", ")", "error", "{", "req", ",", "err", ":=", "http", ".", "NewRequest", "(", "http", ".", "MethodPost", "...
// dispatch creates a new request using the provided payload and headers // and dispatches the request to the provided endpoint.
[ "dispatch", "creates", "a", "new", "request", "using", "the", "provided", "payload", "and", "headers", "and", "dispatches", "the", "request", "to", "the", "provided", "endpoint", "." ]
8125fbda10178887be5dff9e901d6a0a519b67bc
https://github.com/kubernetes/test-infra/blob/8125fbda10178887be5dff9e901d6a0a519b67bc/prow/hook/server.go#L210-L229
test
kubernetes/test-infra
velodrome/transform/plugins/state.go
AddFlags
func (s *StatePlugin) AddFlags(cmd *cobra.Command) { cmd.Flags().StringVar(&s.desc, "state", "", "Description of the state (eg: `opened,!merged,labeled:cool`)") cmd.Flags().IntSliceVar(&s.percentiles, "percentiles", []int{}, "Age percentiles for state") }
go
func (s *StatePlugin) AddFlags(cmd *cobra.Command) { cmd.Flags().StringVar(&s.desc, "state", "", "Description of the state (eg: `opened,!merged,labeled:cool`)") cmd.Flags().IntSliceVar(&s.percentiles, "percentiles", []int{}, "Age percentiles for state") }
[ "func", "(", "s", "*", "StatePlugin", ")", "AddFlags", "(", "cmd", "*", "cobra", ".", "Command", ")", "{", "cmd", ".", "Flags", "(", ")", ".", "StringVar", "(", "&", "s", ".", "desc", ",", "\"state\"", ",", "\"\"", ",", "\"Description of the state (eg:...
// AddFlags adds "state" and "percentiles" to the command help
[ "AddFlags", "adds", "state", "and", "percentiles", "to", "the", "command", "help" ]
8125fbda10178887be5dff9e901d6a0a519b67bc
https://github.com/kubernetes/test-infra/blob/8125fbda10178887be5dff9e901d6a0a519b67bc/velodrome/transform/plugins/state.go#L36-L39
test
kubernetes/test-infra
velodrome/transform/plugins/state.go
CheckFlags
func (s *StatePlugin) CheckFlags() error { s.states = NewBundledStates(s.desc) return nil }
go
func (s *StatePlugin) CheckFlags() error { s.states = NewBundledStates(s.desc) return nil }
[ "func", "(", "s", "*", "StatePlugin", ")", "CheckFlags", "(", ")", "error", "{", "s", ".", "states", "=", "NewBundledStates", "(", "s", ".", "desc", ")", "\n", "return", "nil", "\n", "}" ]
// CheckFlags configures which states to monitor
[ "CheckFlags", "configures", "which", "states", "to", "monitor" ]
8125fbda10178887be5dff9e901d6a0a519b67bc
https://github.com/kubernetes/test-infra/blob/8125fbda10178887be5dff9e901d6a0a519b67bc/velodrome/transform/plugins/state.go#L42-L45
test
kubernetes/test-infra
velodrome/transform/plugins/state.go
ReceiveIssueEvent
func (s *StatePlugin) ReceiveIssueEvent(event sql.IssueEvent) []Point { label := "" if event.Label != nil { label = *event.Label } if !s.states.ReceiveEvent(event.IssueID, event.Event, label, event.EventCreatedAt) { return nil } total, sum := s.states.Total(event.EventCreatedAt) values := map[string]interf...
go
func (s *StatePlugin) ReceiveIssueEvent(event sql.IssueEvent) []Point { label := "" if event.Label != nil { label = *event.Label } if !s.states.ReceiveEvent(event.IssueID, event.Event, label, event.EventCreatedAt) { return nil } total, sum := s.states.Total(event.EventCreatedAt) values := map[string]interf...
[ "func", "(", "s", "*", "StatePlugin", ")", "ReceiveIssueEvent", "(", "event", "sql", ".", "IssueEvent", ")", "[", "]", "Point", "{", "label", ":=", "\"\"", "\n", "if", "event", ".", "Label", "!=", "nil", "{", "label", "=", "*", "event", ".", "Label",...
// ReceiveIssueEvent computes age percentiles and saves them to InfluxDB
[ "ReceiveIssueEvent", "computes", "age", "percentiles", "and", "saves", "them", "to", "InfluxDB" ]
8125fbda10178887be5dff9e901d6a0a519b67bc
https://github.com/kubernetes/test-infra/blob/8125fbda10178887be5dff9e901d6a0a519b67bc/velodrome/transform/plugins/state.go#L53-L78
test
kubernetes/test-infra
prow/config/config.go
Load
func Load(prowConfig, jobConfig string) (c *Config, err error) { // we never want config loading to take down the prow components defer func() { if r := recover(); r != nil { c, err = nil, fmt.Errorf("panic loading config: %v", r) } }() c, err = loadConfig(prowConfig, jobConfig) if err != nil { return nil...
go
func Load(prowConfig, jobConfig string) (c *Config, err error) { // we never want config loading to take down the prow components defer func() { if r := recover(); r != nil { c, err = nil, fmt.Errorf("panic loading config: %v", r) } }() c, err = loadConfig(prowConfig, jobConfig) if err != nil { return nil...
[ "func", "Load", "(", "prowConfig", ",", "jobConfig", "string", ")", "(", "c", "*", "Config", ",", "err", "error", ")", "{", "defer", "func", "(", ")", "{", "if", "r", ":=", "recover", "(", ")", ";", "r", "!=", "nil", "{", "c", ",", "err", "=", ...
// Load loads and parses the config at path.
[ "Load", "loads", "and", "parses", "the", "config", "at", "path", "." ]
8125fbda10178887be5dff9e901d6a0a519b67bc
https://github.com/kubernetes/test-infra/blob/8125fbda10178887be5dff9e901d6a0a519b67bc/prow/config/config.go#L414-L435
test
kubernetes/test-infra
prow/config/config.go
loadConfig
func loadConfig(prowConfig, jobConfig string) (*Config, error) { stat, err := os.Stat(prowConfig) if err != nil { return nil, err } if stat.IsDir() { return nil, fmt.Errorf("prowConfig cannot be a dir - %s", prowConfig) } var nc Config if err := yamlToConfig(prowConfig, &nc); err != nil { return nil, err...
go
func loadConfig(prowConfig, jobConfig string) (*Config, error) { stat, err := os.Stat(prowConfig) if err != nil { return nil, err } if stat.IsDir() { return nil, fmt.Errorf("prowConfig cannot be a dir - %s", prowConfig) } var nc Config if err := yamlToConfig(prowConfig, &nc); err != nil { return nil, err...
[ "func", "loadConfig", "(", "prowConfig", ",", "jobConfig", "string", ")", "(", "*", "Config", ",", "error", ")", "{", "stat", ",", "err", ":=", "os", ".", "Stat", "(", "prowConfig", ")", "\n", "if", "err", "!=", "nil", "{", "return", "nil", ",", "e...
// loadConfig loads one or multiple config files and returns a config object.
[ "loadConfig", "loads", "one", "or", "multiple", "config", "files", "and", "returns", "a", "config", "object", "." ]
8125fbda10178887be5dff9e901d6a0a519b67bc
https://github.com/kubernetes/test-infra/blob/8125fbda10178887be5dff9e901d6a0a519b67bc/prow/config/config.go#L438-L525
test
kubernetes/test-infra
prow/config/config.go
yamlToConfig
func yamlToConfig(path string, nc interface{}) error { b, err := ReadFileMaybeGZIP(path) if err != nil { return fmt.Errorf("error reading %s: %v", path, err) } if err := yaml.Unmarshal(b, nc); err != nil { return fmt.Errorf("error unmarshaling %s: %v", path, err) } var jc *JobConfig switch v := nc.(type) { ...
go
func yamlToConfig(path string, nc interface{}) error { b, err := ReadFileMaybeGZIP(path) if err != nil { return fmt.Errorf("error reading %s: %v", path, err) } if err := yaml.Unmarshal(b, nc); err != nil { return fmt.Errorf("error unmarshaling %s: %v", path, err) } var jc *JobConfig switch v := nc.(type) { ...
[ "func", "yamlToConfig", "(", "path", "string", ",", "nc", "interface", "{", "}", ")", "error", "{", "b", ",", "err", ":=", "ReadFileMaybeGZIP", "(", "path", ")", "\n", "if", "err", "!=", "nil", "{", "return", "fmt", ".", "Errorf", "(", "\"error reading...
// yamlToConfig converts a yaml file into a Config object
[ "yamlToConfig", "converts", "a", "yaml", "file", "into", "a", "Config", "object" ]
8125fbda10178887be5dff9e901d6a0a519b67bc
https://github.com/kubernetes/test-infra/blob/8125fbda10178887be5dff9e901d6a0a519b67bc/prow/config/config.go#L528-L570
test
kubernetes/test-infra
prow/config/config.go
ReadFileMaybeGZIP
func ReadFileMaybeGZIP(path string) ([]byte, error) { b, err := ioutil.ReadFile(path) if err != nil { return nil, err } // check if file contains gzip header: http://www.zlib.org/rfc-gzip.html if !bytes.HasPrefix(b, []byte("\x1F\x8B")) { // go ahead and return the contents if not gzipped return b, nil } //...
go
func ReadFileMaybeGZIP(path string) ([]byte, error) { b, err := ioutil.ReadFile(path) if err != nil { return nil, err } // check if file contains gzip header: http://www.zlib.org/rfc-gzip.html if !bytes.HasPrefix(b, []byte("\x1F\x8B")) { // go ahead and return the contents if not gzipped return b, nil } //...
[ "func", "ReadFileMaybeGZIP", "(", "path", "string", ")", "(", "[", "]", "byte", ",", "error", ")", "{", "b", ",", "err", ":=", "ioutil", ".", "ReadFile", "(", "path", ")", "\n", "if", "err", "!=", "nil", "{", "return", "nil", ",", "err", "\n", "}...
// ReadFileMaybeGZIP wraps ioutil.ReadFile, returning the decompressed contents // if the file is gzipped, or otherwise the raw contents
[ "ReadFileMaybeGZIP", "wraps", "ioutil", ".", "ReadFile", "returning", "the", "decompressed", "contents", "if", "the", "file", "is", "gzipped", "or", "otherwise", "the", "raw", "contents" ]
8125fbda10178887be5dff9e901d6a0a519b67bc
https://github.com/kubernetes/test-infra/blob/8125fbda10178887be5dff9e901d6a0a519b67bc/prow/config/config.go#L574-L590
test
kubernetes/test-infra
prow/config/config.go
finalizeJobConfig
func (c *Config) finalizeJobConfig() error { if c.decorationRequested() { if c.Plank.DefaultDecorationConfig == nil { return errors.New("no default decoration config provided for plank") } if c.Plank.DefaultDecorationConfig.UtilityImages == nil { return errors.New("no default decoration image pull specs pr...
go
func (c *Config) finalizeJobConfig() error { if c.decorationRequested() { if c.Plank.DefaultDecorationConfig == nil { return errors.New("no default decoration config provided for plank") } if c.Plank.DefaultDecorationConfig.UtilityImages == nil { return errors.New("no default decoration image pull specs pr...
[ "func", "(", "c", "*", "Config", ")", "finalizeJobConfig", "(", ")", "error", "{", "if", "c", ".", "decorationRequested", "(", ")", "{", "if", "c", ".", "Plank", ".", "DefaultDecorationConfig", "==", "nil", "{", "return", "errors", ".", "New", "(", "\"...
// finalizeJobConfig mutates and fixes entries for jobspecs
[ "finalizeJobConfig", "mutates", "and", "fixes", "entries", "for", "jobspecs" ]
8125fbda10178887be5dff9e901d6a0a519b67bc
https://github.com/kubernetes/test-infra/blob/8125fbda10178887be5dff9e901d6a0a519b67bc/prow/config/config.go#L656-L723
test
kubernetes/test-infra
prow/config/config.go
validateComponentConfig
func (c *Config) validateComponentConfig() error { if c.Plank.JobURLPrefix != "" && c.Plank.JobURLPrefixConfig["*"] != "" { return errors.New(`Planks job_url_prefix must be unset when job_url_prefix_config["*"] is set. The former is deprecated, use the latter`) } for k, v := range c.Plank.JobURLPrefixConfig { if...
go
func (c *Config) validateComponentConfig() error { if c.Plank.JobURLPrefix != "" && c.Plank.JobURLPrefixConfig["*"] != "" { return errors.New(`Planks job_url_prefix must be unset when job_url_prefix_config["*"] is set. The former is deprecated, use the latter`) } for k, v := range c.Plank.JobURLPrefixConfig { if...
[ "func", "(", "c", "*", "Config", ")", "validateComponentConfig", "(", ")", "error", "{", "if", "c", ".", "Plank", ".", "JobURLPrefix", "!=", "\"\"", "&&", "c", ".", "Plank", ".", "JobURLPrefixConfig", "[", "\"*\"", "]", "!=", "\"\"", "{", "return", "er...
// validateComponentConfig validates the infrastructure component configuration
[ "validateComponentConfig", "validates", "the", "infrastructure", "component", "configuration" ]
8125fbda10178887be5dff9e901d6a0a519b67bc
https://github.com/kubernetes/test-infra/blob/8125fbda10178887be5dff9e901d6a0a519b67bc/prow/config/config.go#L726-L742
test
kubernetes/test-infra
prow/config/config.go
ConfigPath
func ConfigPath(value string) string { if value != "" { return value } logrus.Warningf("defaulting to %s until 15 July 2019, please migrate", DefaultConfigPath) return DefaultConfigPath }
go
func ConfigPath(value string) string { if value != "" { return value } logrus.Warningf("defaulting to %s until 15 July 2019, please migrate", DefaultConfigPath) return DefaultConfigPath }
[ "func", "ConfigPath", "(", "value", "string", ")", "string", "{", "if", "value", "!=", "\"\"", "{", "return", "value", "\n", "}", "\n", "logrus", ".", "Warningf", "(", "\"defaulting to %s until 15 July 2019, please migrate\"", ",", "DefaultConfigPath", ")", "\n", ...
// ConfigPath returns the value for the component's configPath if provided // explicitly or default otherwise.
[ "ConfigPath", "returns", "the", "value", "for", "the", "component", "s", "configPath", "if", "provided", "explicitly", "or", "default", "otherwise", "." ]
8125fbda10178887be5dff9e901d6a0a519b67bc
https://github.com/kubernetes/test-infra/blob/8125fbda10178887be5dff9e901d6a0a519b67bc/prow/config/config.go#L861-L868
test