repo stringlengths 5 67 | path stringlengths 4 218 | func_name stringlengths 0 151 | original_string stringlengths 52 373k | language stringclasses 6
values | code stringlengths 52 373k | code_tokens listlengths 10 512 | docstring stringlengths 3 47.2k | docstring_tokens listlengths 3 234 | sha stringlengths 40 40 | url stringlengths 85 339 | partition stringclasses 3
values |
|---|---|---|---|---|---|---|---|---|---|---|---|
kubernetes/test-infra | boskos/crds/client.go | Validate | func (o *KubernetesClientOptions) Validate() error {
if o.kubeConfig != "" {
if _, err := os.Stat(o.kubeConfig); err != nil {
return err
}
}
return nil
} | go | func (o *KubernetesClientOptions) Validate() error {
if o.kubeConfig != "" {
if _, err := os.Stat(o.kubeConfig); err != nil {
return err
}
}
return nil
} | [
"func",
"(",
"o",
"*",
"KubernetesClientOptions",
")",
"Validate",
"(",
")",
"error",
"{",
"if",
"o",
".",
"kubeConfig",
"!=",
"\"\"",
"{",
"if",
"_",
",",
"err",
":=",
"os",
".",
"Stat",
"(",
"o",
".",
"kubeConfig",
")",
";",
"err",
"!=",
"nil",
... | // Validate validates Kubernetes client options. | [
"Validate",
"validates",
"Kubernetes",
"client",
"options",
"."
] | 8125fbda10178887be5dff9e901d6a0a519b67bc | https://github.com/kubernetes/test-infra/blob/8125fbda10178887be5dff9e901d6a0a519b67bc/boskos/crds/client.go#L57-L64 | test |
kubernetes/test-infra | boskos/crds/client.go | Client | func (o *KubernetesClientOptions) Client(t Type) (ClientInterface, error) {
if o.inMemory {
return newDummyClient(t), nil
}
return o.newCRDClient(t)
} | go | func (o *KubernetesClientOptions) Client(t Type) (ClientInterface, error) {
if o.inMemory {
return newDummyClient(t), nil
}
return o.newCRDClient(t)
} | [
"func",
"(",
"o",
"*",
"KubernetesClientOptions",
")",
"Client",
"(",
"t",
"Type",
")",
"(",
"ClientInterface",
",",
"error",
")",
"{",
"if",
"o",
".",
"inMemory",
"{",
"return",
"newDummyClient",
"(",
"t",
")",
",",
"nil",
"\n",
"}",
"\n",
"return",
... | // Client returns a ClientInterface based on the flags provided. | [
"Client",
"returns",
"a",
"ClientInterface",
"based",
"on",
"the",
"flags",
"provided",
"."
] | 8125fbda10178887be5dff9e901d6a0a519b67bc | https://github.com/kubernetes/test-infra/blob/8125fbda10178887be5dff9e901d6a0a519b67bc/boskos/crds/client.go#L67-L72 | test |
kubernetes/test-infra | boskos/crds/client.go | newCRDClient | func (o *KubernetesClientOptions) newCRDClient(t Type) (*Client, error) {
config, scheme, err := createRESTConfig(o.kubeConfig, t)
if err != nil {
return nil, err
}
if err = registerResource(config, t); err != nil {
return nil, err
}
// creates the client
var restClient *rest.RESTClient
restClient, err = r... | go | func (o *KubernetesClientOptions) newCRDClient(t Type) (*Client, error) {
config, scheme, err := createRESTConfig(o.kubeConfig, t)
if err != nil {
return nil, err
}
if err = registerResource(config, t); err != nil {
return nil, err
}
// creates the client
var restClient *rest.RESTClient
restClient, err = r... | [
"func",
"(",
"o",
"*",
"KubernetesClientOptions",
")",
"newCRDClient",
"(",
"t",
"Type",
")",
"(",
"*",
"Client",
",",
"error",
")",
"{",
"config",
",",
"scheme",
",",
"err",
":=",
"createRESTConfig",
"(",
"o",
".",
"kubeConfig",
",",
"t",
")",
"\n",
... | // newClientFromFlags creates a CRD rest client from provided flags. | [
"newClientFromFlags",
"creates",
"a",
"CRD",
"rest",
"client",
"from",
"provided",
"flags",
"."
] | 8125fbda10178887be5dff9e901d6a0a519b67bc | https://github.com/kubernetes/test-infra/blob/8125fbda10178887be5dff9e901d6a0a519b67bc/boskos/crds/client.go#L75-L93 | test |
kubernetes/test-infra | boskos/crds/client.go | createRESTConfig | func createRESTConfig(kubeconfig string, t Type) (config *rest.Config, types *runtime.Scheme, err error) {
if kubeconfig == "" {
config, err = rest.InClusterConfig()
} else {
config, err = clientcmd.BuildConfigFromFlags("", kubeconfig)
}
if err != nil {
return
}
version := schema.GroupVersion{
Group: ... | go | func createRESTConfig(kubeconfig string, t Type) (config *rest.Config, types *runtime.Scheme, err error) {
if kubeconfig == "" {
config, err = rest.InClusterConfig()
} else {
config, err = clientcmd.BuildConfigFromFlags("", kubeconfig)
}
if err != nil {
return
}
version := schema.GroupVersion{
Group: ... | [
"func",
"createRESTConfig",
"(",
"kubeconfig",
"string",
",",
"t",
"Type",
")",
"(",
"config",
"*",
"rest",
".",
"Config",
",",
"types",
"*",
"runtime",
".",
"Scheme",
",",
"err",
"error",
")",
"{",
"if",
"kubeconfig",
"==",
"\"\"",
"{",
"config",
",",... | // createRESTConfig for cluster API server, pass empty config file for in-cluster | [
"createRESTConfig",
"for",
"cluster",
"API",
"server",
"pass",
"empty",
"config",
"file",
"for",
"in",
"-",
"cluster"
] | 8125fbda10178887be5dff9e901d6a0a519b67bc | https://github.com/kubernetes/test-infra/blob/8125fbda10178887be5dff9e901d6a0a519b67bc/boskos/crds/client.go#L120-L151 | test |
kubernetes/test-infra | boskos/crds/client.go | registerResource | func registerResource(config *rest.Config, t Type) error {
c, err := apiextensionsclient.NewForConfig(config)
if err != nil {
return err
}
crd := &apiextensionsv1beta1.CustomResourceDefinition{
ObjectMeta: v1.ObjectMeta{
Name: fmt.Sprintf("%s.%s", t.Plural, group),
},
Spec: apiextensionsv1beta1.CustomRe... | go | func registerResource(config *rest.Config, t Type) error {
c, err := apiextensionsclient.NewForConfig(config)
if err != nil {
return err
}
crd := &apiextensionsv1beta1.CustomResourceDefinition{
ObjectMeta: v1.ObjectMeta{
Name: fmt.Sprintf("%s.%s", t.Plural, group),
},
Spec: apiextensionsv1beta1.CustomRe... | [
"func",
"registerResource",
"(",
"config",
"*",
"rest",
".",
"Config",
",",
"t",
"Type",
")",
"error",
"{",
"c",
",",
"err",
":=",
"apiextensionsclient",
".",
"NewForConfig",
"(",
"config",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"err",
"\n... | // registerResource sends a request to create CRDs and waits for them to initialize | [
"registerResource",
"sends",
"a",
"request",
"to",
"create",
"CRDs",
"and",
"waits",
"for",
"them",
"to",
"initialize"
] | 8125fbda10178887be5dff9e901d6a0a519b67bc | https://github.com/kubernetes/test-infra/blob/8125fbda10178887be5dff9e901d6a0a519b67bc/boskos/crds/client.go#L154-L180 | test |
kubernetes/test-infra | boskos/crds/client.go | newDummyClient | func newDummyClient(t Type) *dummyClient {
c := &dummyClient{
t: t,
objects: make(map[string]Object),
}
return c
} | go | func newDummyClient(t Type) *dummyClient {
c := &dummyClient{
t: t,
objects: make(map[string]Object),
}
return c
} | [
"func",
"newDummyClient",
"(",
"t",
"Type",
")",
"*",
"dummyClient",
"{",
"c",
":=",
"&",
"dummyClient",
"{",
"t",
":",
"t",
",",
"objects",
":",
"make",
"(",
"map",
"[",
"string",
"]",
"Object",
")",
",",
"}",
"\n",
"return",
"c",
"\n",
"}"
] | // newDummyClient creates a in memory client representation for testing, such that we do not need to use a kubernetes API Server. | [
"newDummyClient",
"creates",
"a",
"in",
"memory",
"client",
"representation",
"for",
"testing",
"such",
"that",
"we",
"do",
"not",
"need",
"to",
"use",
"a",
"kubernetes",
"API",
"Server",
"."
] | 8125fbda10178887be5dff9e901d6a0a519b67bc | https://github.com/kubernetes/test-infra/blob/8125fbda10178887be5dff9e901d6a0a519b67bc/boskos/crds/client.go#L183-L189 | test |
kubernetes/test-infra | boskos/crds/client.go | Update | func (c *dummyClient) Update(obj Object) (Object, error) {
_, ok := c.objects[obj.GetName()]
if !ok {
return nil, fmt.Errorf("cannot find object %s", obj.GetName())
}
c.objects[obj.GetName()] = obj
return obj, nil
} | go | func (c *dummyClient) Update(obj Object) (Object, error) {
_, ok := c.objects[obj.GetName()]
if !ok {
return nil, fmt.Errorf("cannot find object %s", obj.GetName())
}
c.objects[obj.GetName()] = obj
return obj, nil
} | [
"func",
"(",
"c",
"*",
"dummyClient",
")",
"Update",
"(",
"obj",
"Object",
")",
"(",
"Object",
",",
"error",
")",
"{",
"_",
",",
"ok",
":=",
"c",
".",
"objects",
"[",
"obj",
".",
"GetName",
"(",
")",
"]",
"\n",
"if",
"!",
"ok",
"{",
"return",
... | // Update implements ClientInterface | [
"Update",
"implements",
"ClientInterface"
] | 8125fbda10178887be5dff9e901d6a0a519b67bc | https://github.com/kubernetes/test-infra/blob/8125fbda10178887be5dff9e901d6a0a519b67bc/boskos/crds/client.go#L232-L239 | test |
kubernetes/test-infra | prow/plugins/trigger/pull-request.go | TrustedPullRequest | func TrustedPullRequest(ghc githubClient, trigger plugins.Trigger, author, org, repo string, num int, l []github.Label) ([]github.Label, bool, error) {
// First check if the author is a member of the org.
if orgMember, err := TrustedUser(ghc, trigger, author, org, repo); err != nil {
return l, false, fmt.Errorf("er... | go | func TrustedPullRequest(ghc githubClient, trigger plugins.Trigger, author, org, repo string, num int, l []github.Label) ([]github.Label, bool, error) {
// First check if the author is a member of the org.
if orgMember, err := TrustedUser(ghc, trigger, author, org, repo); err != nil {
return l, false, fmt.Errorf("er... | [
"func",
"TrustedPullRequest",
"(",
"ghc",
"githubClient",
",",
"trigger",
"plugins",
".",
"Trigger",
",",
"author",
",",
"org",
",",
"repo",
"string",
",",
"num",
"int",
",",
"l",
"[",
"]",
"github",
".",
"Label",
")",
"(",
"[",
"]",
"github",
".",
"... | // TrustedPullRequest returns whether or not the given PR should be tested.
// It first checks if the author is in the org, then looks for "ok-to-test" label. | [
"TrustedPullRequest",
"returns",
"whether",
"or",
"not",
"the",
"given",
"PR",
"should",
"be",
"tested",
".",
"It",
"first",
"checks",
"if",
"the",
"author",
"is",
"in",
"the",
"org",
"then",
"looks",
"for",
"ok",
"-",
"to",
"-",
"test",
"label",
"."
] | 8125fbda10178887be5dff9e901d6a0a519b67bc | https://github.com/kubernetes/test-infra/blob/8125fbda10178887be5dff9e901d6a0a519b67bc/prow/plugins/trigger/pull-request.go#L207-L223 | test |
kubernetes/test-infra | prow/plugins/trigger/pull-request.go | buildAll | func buildAll(c Client, pr *github.PullRequest, eventGUID string, elideSkippedContexts bool) error {
org, repo, number, branch := pr.Base.Repo.Owner.Login, pr.Base.Repo.Name, pr.Number, pr.Base.Ref
changes := config.NewGitHubDeferredChangedFilesProvider(c.GitHubClient, org, repo, number)
toTest, toSkipSuperset, err ... | go | func buildAll(c Client, pr *github.PullRequest, eventGUID string, elideSkippedContexts bool) error {
org, repo, number, branch := pr.Base.Repo.Owner.Login, pr.Base.Repo.Name, pr.Number, pr.Base.Ref
changes := config.NewGitHubDeferredChangedFilesProvider(c.GitHubClient, org, repo, number)
toTest, toSkipSuperset, err ... | [
"func",
"buildAll",
"(",
"c",
"Client",
",",
"pr",
"*",
"github",
".",
"PullRequest",
",",
"eventGUID",
"string",
",",
"elideSkippedContexts",
"bool",
")",
"error",
"{",
"org",
",",
"repo",
",",
"number",
",",
"branch",
":=",
"pr",
".",
"Base",
".",
"R... | // buildAll ensures that all builds that should run and will be required are built | [
"buildAll",
"ensures",
"that",
"all",
"builds",
"that",
"should",
"run",
"and",
"will",
"be",
"required",
"are",
"built"
] | 8125fbda10178887be5dff9e901d6a0a519b67bc | https://github.com/kubernetes/test-infra/blob/8125fbda10178887be5dff9e901d6a0a519b67bc/prow/plugins/trigger/pull-request.go#L226-L236 | test |
kubernetes/test-infra | prow/sidecar/run.go | Run | func (o Options) Run(ctx context.Context) (int, error) {
spec, err := downwardapi.ResolveSpecFromEnv()
if err != nil {
return 0, fmt.Errorf("could not resolve job spec: %v", err)
}
ctx, cancel := context.WithCancel(ctx)
// If we are being asked to terminate by the kubelet but we have
// NOT seen the test proc... | go | func (o Options) Run(ctx context.Context) (int, error) {
spec, err := downwardapi.ResolveSpecFromEnv()
if err != nil {
return 0, fmt.Errorf("could not resolve job spec: %v", err)
}
ctx, cancel := context.WithCancel(ctx)
// If we are being asked to terminate by the kubelet but we have
// NOT seen the test proc... | [
"func",
"(",
"o",
"Options",
")",
"Run",
"(",
"ctx",
"context",
".",
"Context",
")",
"(",
"int",
",",
"error",
")",
"{",
"spec",
",",
"err",
":=",
"downwardapi",
".",
"ResolveSpecFromEnv",
"(",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"0... | // Run will watch for the process being wrapped to exit
// and then post the status of that process and any artifacts
// to cloud storage. | [
"Run",
"will",
"watch",
"for",
"the",
"process",
"being",
"wrapped",
"to",
"exit",
"and",
"then",
"post",
"the",
"status",
"of",
"that",
"process",
"and",
"any",
"artifacts",
"to",
"cloud",
"storage",
"."
] | 8125fbda10178887be5dff9e901d6a0a519b67bc | https://github.com/kubernetes/test-infra/blob/8125fbda10178887be5dff9e901d6a0a519b67bc/prow/sidecar/run.go#L63-L106 | test |
kubernetes/test-infra | boskos/mason/storage.go | AddConfig | func (s *Storage) AddConfig(conf common.ResourcesConfig) error {
return s.configs.Add(conf)
} | go | func (s *Storage) AddConfig(conf common.ResourcesConfig) error {
return s.configs.Add(conf)
} | [
"func",
"(",
"s",
"*",
"Storage",
")",
"AddConfig",
"(",
"conf",
"common",
".",
"ResourcesConfig",
")",
"error",
"{",
"return",
"s",
".",
"configs",
".",
"Add",
"(",
"conf",
")",
"\n",
"}"
] | // AddConfig adds a new config | [
"AddConfig",
"adds",
"a",
"new",
"config"
] | 8125fbda10178887be5dff9e901d6a0a519b67bc | https://github.com/kubernetes/test-infra/blob/8125fbda10178887be5dff9e901d6a0a519b67bc/boskos/mason/storage.go#L43-L45 | test |
kubernetes/test-infra | boskos/mason/storage.go | DeleteConfig | func (s *Storage) DeleteConfig(name string) error {
return s.configs.Delete(name)
} | go | func (s *Storage) DeleteConfig(name string) error {
return s.configs.Delete(name)
} | [
"func",
"(",
"s",
"*",
"Storage",
")",
"DeleteConfig",
"(",
"name",
"string",
")",
"error",
"{",
"return",
"s",
".",
"configs",
".",
"Delete",
"(",
"name",
")",
"\n",
"}"
] | // DeleteConfig deletes an existing config if it exists or fail otherwise | [
"DeleteConfig",
"deletes",
"an",
"existing",
"config",
"if",
"it",
"exists",
"or",
"fail",
"otherwise"
] | 8125fbda10178887be5dff9e901d6a0a519b67bc | https://github.com/kubernetes/test-infra/blob/8125fbda10178887be5dff9e901d6a0a519b67bc/boskos/mason/storage.go#L48-L50 | test |
kubernetes/test-infra | boskos/mason/storage.go | UpdateConfig | func (s *Storage) UpdateConfig(conf common.ResourcesConfig) error {
return s.configs.Update(conf)
} | go | func (s *Storage) UpdateConfig(conf common.ResourcesConfig) error {
return s.configs.Update(conf)
} | [
"func",
"(",
"s",
"*",
"Storage",
")",
"UpdateConfig",
"(",
"conf",
"common",
".",
"ResourcesConfig",
")",
"error",
"{",
"return",
"s",
".",
"configs",
".",
"Update",
"(",
"conf",
")",
"\n",
"}"
] | // UpdateConfig updates a given if it exists or fail otherwise | [
"UpdateConfig",
"updates",
"a",
"given",
"if",
"it",
"exists",
"or",
"fail",
"otherwise"
] | 8125fbda10178887be5dff9e901d6a0a519b67bc | https://github.com/kubernetes/test-infra/blob/8125fbda10178887be5dff9e901d6a0a519b67bc/boskos/mason/storage.go#L53-L55 | test |
kubernetes/test-infra | boskos/mason/storage.go | GetConfig | func (s *Storage) GetConfig(name string) (common.ResourcesConfig, error) {
i, err := s.configs.Get(name)
if err != nil {
return common.ResourcesConfig{}, err
}
var conf common.ResourcesConfig
conf, err = common.ItemToResourcesConfig(i)
if err != nil {
return common.ResourcesConfig{}, err
}
return conf, nil
... | go | func (s *Storage) GetConfig(name string) (common.ResourcesConfig, error) {
i, err := s.configs.Get(name)
if err != nil {
return common.ResourcesConfig{}, err
}
var conf common.ResourcesConfig
conf, err = common.ItemToResourcesConfig(i)
if err != nil {
return common.ResourcesConfig{}, err
}
return conf, nil
... | [
"func",
"(",
"s",
"*",
"Storage",
")",
"GetConfig",
"(",
"name",
"string",
")",
"(",
"common",
".",
"ResourcesConfig",
",",
"error",
")",
"{",
"i",
",",
"err",
":=",
"s",
".",
"configs",
".",
"Get",
"(",
"name",
")",
"\n",
"if",
"err",
"!=",
"nil... | // GetConfig returns an existing if it exists errors out otherwise | [
"GetConfig",
"returns",
"an",
"existing",
"if",
"it",
"exists",
"errors",
"out",
"otherwise"
] | 8125fbda10178887be5dff9e901d6a0a519b67bc | https://github.com/kubernetes/test-infra/blob/8125fbda10178887be5dff9e901d6a0a519b67bc/boskos/mason/storage.go#L58-L69 | test |
kubernetes/test-infra | boskos/mason/storage.go | GetConfigs | func (s *Storage) GetConfigs() ([]common.ResourcesConfig, error) {
var configs []common.ResourcesConfig
items, err := s.configs.List()
if err != nil {
return configs, err
}
for _, i := range items {
var conf common.ResourcesConfig
conf, err = common.ItemToResourcesConfig(i)
if err != nil {
return nil, e... | go | func (s *Storage) GetConfigs() ([]common.ResourcesConfig, error) {
var configs []common.ResourcesConfig
items, err := s.configs.List()
if err != nil {
return configs, err
}
for _, i := range items {
var conf common.ResourcesConfig
conf, err = common.ItemToResourcesConfig(i)
if err != nil {
return nil, e... | [
"func",
"(",
"s",
"*",
"Storage",
")",
"GetConfigs",
"(",
")",
"(",
"[",
"]",
"common",
".",
"ResourcesConfig",
",",
"error",
")",
"{",
"var",
"configs",
"[",
"]",
"common",
".",
"ResourcesConfig",
"\n",
"items",
",",
"err",
":=",
"s",
".",
"configs"... | // GetConfigs returns all configs | [
"GetConfigs",
"returns",
"all",
"configs"
] | 8125fbda10178887be5dff9e901d6a0a519b67bc | https://github.com/kubernetes/test-infra/blob/8125fbda10178887be5dff9e901d6a0a519b67bc/boskos/mason/storage.go#L72-L87 | test |
kubernetes/test-infra | boskos/mason/storage.go | SyncConfigs | func (s *Storage) SyncConfigs(newConfigs []common.ResourcesConfig) error {
s.configsLock.Lock()
defer s.configsLock.Unlock()
currentConfigs, err := s.GetConfigs()
if err != nil {
logrus.WithError(err).Error("cannot find configs")
return err
}
currentSet := mapset.NewSet()
newSet := mapset.NewSet()
toUpdat... | go | func (s *Storage) SyncConfigs(newConfigs []common.ResourcesConfig) error {
s.configsLock.Lock()
defer s.configsLock.Unlock()
currentConfigs, err := s.GetConfigs()
if err != nil {
logrus.WithError(err).Error("cannot find configs")
return err
}
currentSet := mapset.NewSet()
newSet := mapset.NewSet()
toUpdat... | [
"func",
"(",
"s",
"*",
"Storage",
")",
"SyncConfigs",
"(",
"newConfigs",
"[",
"]",
"common",
".",
"ResourcesConfig",
")",
"error",
"{",
"s",
".",
"configsLock",
".",
"Lock",
"(",
")",
"\n",
"defer",
"s",
".",
"configsLock",
".",
"Unlock",
"(",
")",
"... | // SyncConfigs syncs new configs | [
"SyncConfigs",
"syncs",
"new",
"configs"
] | 8125fbda10178887be5dff9e901d6a0a519b67bc | https://github.com/kubernetes/test-infra/blob/8125fbda10178887be5dff9e901d6a0a519b67bc/boskos/mason/storage.go#L90-L155 | test |
kubernetes/test-infra | prow/apis/prowjobs/v1/register.go | addKnownTypes | func addKnownTypes(scheme *runtime.Scheme) error {
scheme.AddKnownTypes(SchemeGroupVersion,
&ProwJob{},
&ProwJobList{},
)
metav1.AddToGroupVersion(scheme, SchemeGroupVersion)
return nil
} | go | func addKnownTypes(scheme *runtime.Scheme) error {
scheme.AddKnownTypes(SchemeGroupVersion,
&ProwJob{},
&ProwJobList{},
)
metav1.AddToGroupVersion(scheme, SchemeGroupVersion)
return nil
} | [
"func",
"addKnownTypes",
"(",
"scheme",
"*",
"runtime",
".",
"Scheme",
")",
"error",
"{",
"scheme",
".",
"AddKnownTypes",
"(",
"SchemeGroupVersion",
",",
"&",
"ProwJob",
"{",
"}",
",",
"&",
"ProwJobList",
"{",
"}",
",",
")",
"\n",
"metav1",
".",
"AddToGr... | // Adds the list of known types to the Scheme. | [
"Adds",
"the",
"list",
"of",
"known",
"types",
"to",
"the",
"Scheme",
"."
] | 8125fbda10178887be5dff9e901d6a0a519b67bc | https://github.com/kubernetes/test-infra/blob/8125fbda10178887be5dff9e901d6a0a519b67bc/prow/apis/prowjobs/v1/register.go#L48-L55 | test |
kubernetes/test-infra | prow/statusreconciler/controller.go | NewController | func NewController(continueOnError bool, addedPresubmitBlacklist sets.String, prowJobClient prowv1.ProwJobInterface, githubClient *github.Client, configAgent *config.Agent, pluginAgent *plugins.ConfigAgent) *Controller {
return &Controller{
continueOnError: continueOnError,
addedPresubmitBlacklist: addedPr... | go | func NewController(continueOnError bool, addedPresubmitBlacklist sets.String, prowJobClient prowv1.ProwJobInterface, githubClient *github.Client, configAgent *config.Agent, pluginAgent *plugins.ConfigAgent) *Controller {
return &Controller{
continueOnError: continueOnError,
addedPresubmitBlacklist: addedPr... | [
"func",
"NewController",
"(",
"continueOnError",
"bool",
",",
"addedPresubmitBlacklist",
"sets",
".",
"String",
",",
"prowJobClient",
"prowv1",
".",
"ProwJobInterface",
",",
"githubClient",
"*",
"github",
".",
"Client",
",",
"configAgent",
"*",
"config",
".",
"Age... | // NewController constructs a new controller to reconcile stauses on config change | [
"NewController",
"constructs",
"a",
"new",
"controller",
"to",
"reconcile",
"stauses",
"on",
"config",
"change"
] | 8125fbda10178887be5dff9e901d6a0a519b67bc | https://github.com/kubernetes/test-infra/blob/8125fbda10178887be5dff9e901d6a0a519b67bc/prow/statusreconciler/controller.go#L38-L57 | test |
kubernetes/test-infra | prow/statusreconciler/controller.go | Run | func (c *Controller) Run(stop <-chan os.Signal, changes <-chan config.Delta) {
for {
select {
case change := <-changes:
start := time.Now()
if err := c.reconcile(change); err != nil {
logrus.WithError(err).Error("Error reconciling statuses.")
}
logrus.WithField("duration", fmt.Sprintf("%v", time.Si... | go | func (c *Controller) Run(stop <-chan os.Signal, changes <-chan config.Delta) {
for {
select {
case change := <-changes:
start := time.Now()
if err := c.reconcile(change); err != nil {
logrus.WithError(err).Error("Error reconciling statuses.")
}
logrus.WithField("duration", fmt.Sprintf("%v", time.Si... | [
"func",
"(",
"c",
"*",
"Controller",
")",
"Run",
"(",
"stop",
"<-",
"chan",
"os",
".",
"Signal",
",",
"changes",
"<-",
"chan",
"config",
".",
"Delta",
")",
"{",
"for",
"{",
"select",
"{",
"case",
"change",
":=",
"<-",
"changes",
":",
"start",
":=",... | // Run monitors the incoming configuration changes to determine when statuses need to be
// reconciled on PRs in flight when blocking presubmits change | [
"Run",
"monitors",
"the",
"incoming",
"configuration",
"changes",
"to",
"determine",
"when",
"statuses",
"need",
"to",
"be",
"reconciled",
"on",
"PRs",
"in",
"flight",
"when",
"blocking",
"presubmits",
"change"
] | 8125fbda10178887be5dff9e901d6a0a519b67bc | https://github.com/kubernetes/test-infra/blob/8125fbda10178887be5dff9e901d6a0a519b67bc/prow/statusreconciler/controller.go#L139-L153 | test |
kubernetes/test-infra | prow/statusreconciler/controller.go | addedBlockingPresubmits | func addedBlockingPresubmits(old, new map[string][]config.Presubmit) map[string][]config.Presubmit {
added := map[string][]config.Presubmit{}
for repo, oldPresubmits := range old {
added[repo] = []config.Presubmit{}
for _, newPresubmit := range new[repo] {
if !newPresubmit.ContextRequired() || newPresubmit.Ne... | go | func addedBlockingPresubmits(old, new map[string][]config.Presubmit) map[string][]config.Presubmit {
added := map[string][]config.Presubmit{}
for repo, oldPresubmits := range old {
added[repo] = []config.Presubmit{}
for _, newPresubmit := range new[repo] {
if !newPresubmit.ContextRequired() || newPresubmit.Ne... | [
"func",
"addedBlockingPresubmits",
"(",
"old",
",",
"new",
"map",
"[",
"string",
"]",
"[",
"]",
"config",
".",
"Presubmit",
")",
"map",
"[",
"string",
"]",
"[",
"]",
"config",
".",
"Presubmit",
"{",
"added",
":=",
"map",
"[",
"string",
"]",
"[",
"]",... | // addedBlockingPresubmits determines new blocking presubmits based on a
// config update. New blocking presubmits are either brand-new presubmits
// or extant presubmits that are now reporting. Previous presubmits that
// reported but were optional that are no longer optional require no action
// as their contexts wil... | [
"addedBlockingPresubmits",
"determines",
"new",
"blocking",
"presubmits",
"based",
"on",
"a",
"config",
"update",
".",
"New",
"blocking",
"presubmits",
"are",
"either",
"brand",
"-",
"new",
"presubmits",
"or",
"extant",
"presubmits",
"that",
"are",
"now",
"reporti... | 8125fbda10178887be5dff9e901d6a0a519b67bc | https://github.com/kubernetes/test-infra/blob/8125fbda10178887be5dff9e901d6a0a519b67bc/prow/statusreconciler/controller.go#L293-L339 | test |
kubernetes/test-infra | prow/statusreconciler/controller.go | removedBlockingPresubmits | func removedBlockingPresubmits(old, new map[string][]config.Presubmit) map[string][]config.Presubmit {
removed := map[string][]config.Presubmit{}
for repo, oldPresubmits := range old {
removed[repo] = []config.Presubmit{}
for _, oldPresubmit := range oldPresubmits {
if !oldPresubmit.ContextRequired() {
co... | go | func removedBlockingPresubmits(old, new map[string][]config.Presubmit) map[string][]config.Presubmit {
removed := map[string][]config.Presubmit{}
for repo, oldPresubmits := range old {
removed[repo] = []config.Presubmit{}
for _, oldPresubmit := range oldPresubmits {
if !oldPresubmit.ContextRequired() {
co... | [
"func",
"removedBlockingPresubmits",
"(",
"old",
",",
"new",
"map",
"[",
"string",
"]",
"[",
"]",
"config",
".",
"Presubmit",
")",
"map",
"[",
"string",
"]",
"[",
"]",
"config",
".",
"Presubmit",
"{",
"removed",
":=",
"map",
"[",
"string",
"]",
"[",
... | // removedBlockingPresubmits determines stale blocking presubmits based on a
// config update. Presubmits that are no longer blocking due to no longer
// reporting or being optional require no action as Tide will honor those
// statuses correctly. | [
"removedBlockingPresubmits",
"determines",
"stale",
"blocking",
"presubmits",
"based",
"on",
"a",
"config",
"update",
".",
"Presubmits",
"that",
"are",
"no",
"longer",
"blocking",
"due",
"to",
"no",
"longer",
"reporting",
"or",
"being",
"optional",
"require",
"no"... | 8125fbda10178887be5dff9e901d6a0a519b67bc | https://github.com/kubernetes/test-infra/blob/8125fbda10178887be5dff9e901d6a0a519b67bc/prow/statusreconciler/controller.go#L345-L377 | test |
kubernetes/test-infra | prow/statusreconciler/controller.go | migratedBlockingPresubmits | func migratedBlockingPresubmits(old, new map[string][]config.Presubmit) map[string][]presubmitMigration {
migrated := map[string][]presubmitMigration{}
for repo, oldPresubmits := range old {
migrated[repo] = []presubmitMigration{}
for _, newPresubmit := range new[repo] {
if !newPresubmit.ContextRequired() {
... | go | func migratedBlockingPresubmits(old, new map[string][]config.Presubmit) map[string][]presubmitMigration {
migrated := map[string][]presubmitMigration{}
for repo, oldPresubmits := range old {
migrated[repo] = []presubmitMigration{}
for _, newPresubmit := range new[repo] {
if !newPresubmit.ContextRequired() {
... | [
"func",
"migratedBlockingPresubmits",
"(",
"old",
",",
"new",
"map",
"[",
"string",
"]",
"[",
"]",
"config",
".",
"Presubmit",
")",
"map",
"[",
"string",
"]",
"[",
"]",
"presubmitMigration",
"{",
"migrated",
":=",
"map",
"[",
"string",
"]",
"[",
"]",
"... | // migratedBlockingPresubmits determines blocking presubmits that have had
// their status contexts migrated. This is a best-effort evaluation as we
// can only track a presubmit between configuration versions by its name.
// A presubmit "migration" that had its underlying job and context changed
// will be treated as ... | [
"migratedBlockingPresubmits",
"determines",
"blocking",
"presubmits",
"that",
"have",
"had",
"their",
"status",
"contexts",
"migrated",
".",
"This",
"is",
"a",
"best",
"-",
"effort",
"evaluation",
"as",
"we",
"can",
"only",
"track",
"a",
"presubmit",
"between",
... | 8125fbda10178887be5dff9e901d6a0a519b67bc | https://github.com/kubernetes/test-infra/blob/8125fbda10178887be5dff9e901d6a0a519b67bc/prow/statusreconciler/controller.go#L388-L417 | test |
kubernetes/test-infra | prow/pod-utils/options/load.go | Load | func Load(loader OptionLoader) error {
if jsonConfig, provided := os.LookupEnv(loader.ConfigVar()); provided {
if err := loader.LoadConfig(jsonConfig); err != nil {
return fmt.Errorf("could not load config from JSON var %s: %v", loader.ConfigVar(), err)
}
return nil
}
fs := flag.NewFlagSet(os.Args[0], flag... | go | func Load(loader OptionLoader) error {
if jsonConfig, provided := os.LookupEnv(loader.ConfigVar()); provided {
if err := loader.LoadConfig(jsonConfig); err != nil {
return fmt.Errorf("could not load config from JSON var %s: %v", loader.ConfigVar(), err)
}
return nil
}
fs := flag.NewFlagSet(os.Args[0], flag... | [
"func",
"Load",
"(",
"loader",
"OptionLoader",
")",
"error",
"{",
"if",
"jsonConfig",
",",
"provided",
":=",
"os",
".",
"LookupEnv",
"(",
"loader",
".",
"ConfigVar",
"(",
")",
")",
";",
"provided",
"{",
"if",
"err",
":=",
"loader",
".",
"LoadConfig",
"... | // Load loads the set of options, preferring to use
// JSON config from an env var, but falling back to
// command line flags if not possible. | [
"Load",
"loads",
"the",
"set",
"of",
"options",
"preferring",
"to",
"use",
"JSON",
"config",
"from",
"an",
"env",
"var",
"but",
"falling",
"back",
"to",
"command",
"line",
"flags",
"if",
"not",
"possible",
"."
] | 8125fbda10178887be5dff9e901d6a0a519b67bc | https://github.com/kubernetes/test-infra/blob/8125fbda10178887be5dff9e901d6a0a519b67bc/prow/pod-utils/options/load.go#L36-L50 | test |
kubernetes/test-infra | prow/jenkins/controller.go | canExecuteConcurrently | func (c *Controller) canExecuteConcurrently(pj *prowapi.ProwJob) bool {
c.lock.Lock()
defer c.lock.Unlock()
if max := c.config().MaxConcurrency; max > 0 {
var running int
for _, num := range c.pendingJobs {
running += num
}
if running >= max {
c.log.WithFields(pjutil.ProwJobFields(pj)).Debugf("Not sta... | go | func (c *Controller) canExecuteConcurrently(pj *prowapi.ProwJob) bool {
c.lock.Lock()
defer c.lock.Unlock()
if max := c.config().MaxConcurrency; max > 0 {
var running int
for _, num := range c.pendingJobs {
running += num
}
if running >= max {
c.log.WithFields(pjutil.ProwJobFields(pj)).Debugf("Not sta... | [
"func",
"(",
"c",
"*",
"Controller",
")",
"canExecuteConcurrently",
"(",
"pj",
"*",
"prowapi",
".",
"ProwJob",
")",
"bool",
"{",
"c",
".",
"lock",
".",
"Lock",
"(",
")",
"\n",
"defer",
"c",
".",
"lock",
".",
"Unlock",
"(",
")",
"\n",
"if",
"max",
... | // canExecuteConcurrently checks whether the provided ProwJob can
// be executed concurrently. | [
"canExecuteConcurrently",
"checks",
"whether",
"the",
"provided",
"ProwJob",
"can",
"be",
"executed",
"concurrently",
"."
] | 8125fbda10178887be5dff9e901d6a0a519b67bc | https://github.com/kubernetes/test-infra/blob/8125fbda10178887be5dff9e901d6a0a519b67bc/prow/jenkins/controller.go#L128-L155 | test |
kubernetes/test-infra | prow/jenkins/controller.go | getJenkinsJobs | func getJenkinsJobs(pjs []prowapi.ProwJob) []BuildQueryParams {
jenkinsJobs := []BuildQueryParams{}
for _, pj := range pjs {
if pj.Complete() {
continue
}
jenkinsJobs = append(jenkinsJobs, BuildQueryParams{
JobName: getJobName(&pj.Spec),
ProwJobID: pj.Name,
})
}
return jenkinsJobs
} | go | func getJenkinsJobs(pjs []prowapi.ProwJob) []BuildQueryParams {
jenkinsJobs := []BuildQueryParams{}
for _, pj := range pjs {
if pj.Complete() {
continue
}
jenkinsJobs = append(jenkinsJobs, BuildQueryParams{
JobName: getJobName(&pj.Spec),
ProwJobID: pj.Name,
})
}
return jenkinsJobs
} | [
"func",
"getJenkinsJobs",
"(",
"pjs",
"[",
"]",
"prowapi",
".",
"ProwJob",
")",
"[",
"]",
"BuildQueryParams",
"{",
"jenkinsJobs",
":=",
"[",
"]",
"BuildQueryParams",
"{",
"}",
"\n",
"for",
"_",
",",
"pj",
":=",
"range",
"pjs",
"{",
"if",
"pj",
".",
"... | // getJenkinsJobs returns all the Jenkins jobs for all active
// prowjobs from the provided list. It handles deduplication. | [
"getJenkinsJobs",
"returns",
"all",
"the",
"Jenkins",
"jobs",
"for",
"all",
"active",
"prowjobs",
"from",
"the",
"provided",
"list",
".",
"It",
"handles",
"deduplication",
"."
] | 8125fbda10178887be5dff9e901d6a0a519b67bc | https://github.com/kubernetes/test-infra/blob/8125fbda10178887be5dff9e901d6a0a519b67bc/prow/jenkins/controller.go#L241-L256 | test |
kubernetes/test-infra | prow/jenkins/controller.go | terminateDupes | func (c *Controller) terminateDupes(pjs []prowapi.ProwJob, jbs map[string]Build) error {
// "job org/repo#number" -> newest job
dupes := make(map[string]int)
for i, pj := range pjs {
if pj.Complete() || pj.Spec.Type != prowapi.PresubmitJob {
continue
}
n := fmt.Sprintf("%s %s/%s#%d", pj.Spec.Job, pj.Spec.Re... | go | func (c *Controller) terminateDupes(pjs []prowapi.ProwJob, jbs map[string]Build) error {
// "job org/repo#number" -> newest job
dupes := make(map[string]int)
for i, pj := range pjs {
if pj.Complete() || pj.Spec.Type != prowapi.PresubmitJob {
continue
}
n := fmt.Sprintf("%s %s/%s#%d", pj.Spec.Job, pj.Spec.Re... | [
"func",
"(",
"c",
"*",
"Controller",
")",
"terminateDupes",
"(",
"pjs",
"[",
"]",
"prowapi",
".",
"ProwJob",
",",
"jbs",
"map",
"[",
"string",
"]",
"Build",
")",
"error",
"{",
"dupes",
":=",
"make",
"(",
"map",
"[",
"string",
"]",
"int",
")",
"\n",... | // terminateDupes aborts presubmits that have a newer version. It modifies pjs
// in-place when it aborts. | [
"terminateDupes",
"aborts",
"presubmits",
"that",
"have",
"a",
"newer",
"version",
".",
"It",
"modifies",
"pjs",
"in",
"-",
"place",
"when",
"it",
"aborts",
"."
] | 8125fbda10178887be5dff9e901d6a0a519b67bc | https://github.com/kubernetes/test-infra/blob/8125fbda10178887be5dff9e901d6a0a519b67bc/prow/jenkins/controller.go#L260-L307 | test |
kubernetes/test-infra | prow/github/client.go | Throttle | func (c *Client) Throttle(hourlyTokens, burst int) {
c.log("Throttle", hourlyTokens, burst)
c.throttle.lock.Lock()
defer c.throttle.lock.Unlock()
previouslyThrottled := c.throttle.ticker != nil
if hourlyTokens <= 0 || burst <= 0 { // Disable throttle
if previouslyThrottled { // Unwrap clients if necessary
c.c... | go | func (c *Client) Throttle(hourlyTokens, burst int) {
c.log("Throttle", hourlyTokens, burst)
c.throttle.lock.Lock()
defer c.throttle.lock.Unlock()
previouslyThrottled := c.throttle.ticker != nil
if hourlyTokens <= 0 || burst <= 0 { // Disable throttle
if previouslyThrottled { // Unwrap clients if necessary
c.c... | [
"func",
"(",
"c",
"*",
"Client",
")",
"Throttle",
"(",
"hourlyTokens",
",",
"burst",
"int",
")",
"{",
"c",
".",
"log",
"(",
"\"Throttle\"",
",",
"hourlyTokens",
",",
"burst",
")",
"\n",
"c",
".",
"throttle",
".",
"lock",
".",
"Lock",
"(",
")",
"\n"... | // Throttle client to a rate of at most hourlyTokens requests per hour,
// allowing burst tokens. | [
"Throttle",
"client",
"to",
"a",
"rate",
"of",
"at",
"most",
"hourlyTokens",
"requests",
"per",
"hour",
"allowing",
"burst",
"tokens",
"."
] | 8125fbda10178887be5dff9e901d6a0a519b67bc | https://github.com/kubernetes/test-infra/blob/8125fbda10178887be5dff9e901d6a0a519b67bc/prow/github/client.go#L187-L224 | test |
kubernetes/test-infra | prow/github/client.go | NewClientWithFields | func NewClientWithFields(fields logrus.Fields, getToken func() []byte, graphqlEndpoint string, bases ...string) *Client {
return &Client{
logger: logrus.WithFields(fields).WithField("client", "github"),
time: &standardTime{},
gqlc: githubql.NewEnterpriseClient(
graphqlEndpoint,
&http.Client{
Timeout:... | go | func NewClientWithFields(fields logrus.Fields, getToken func() []byte, graphqlEndpoint string, bases ...string) *Client {
return &Client{
logger: logrus.WithFields(fields).WithField("client", "github"),
time: &standardTime{},
gqlc: githubql.NewEnterpriseClient(
graphqlEndpoint,
&http.Client{
Timeout:... | [
"func",
"NewClientWithFields",
"(",
"fields",
"logrus",
".",
"Fields",
",",
"getToken",
"func",
"(",
")",
"[",
"]",
"byte",
",",
"graphqlEndpoint",
"string",
",",
"bases",
"...",
"string",
")",
"*",
"Client",
"{",
"return",
"&",
"Client",
"{",
"logger",
... | // NewClientWithFields creates a new fully operational GitHub client. With
// added logging fields.
// 'getToken' is a generator for the GitHub access token to use.
// 'bases' is a variadic slice of endpoints to use in order of preference.
// An endpoint is used when all preceding endpoints have returned a conn err.
... | [
"NewClientWithFields",
"creates",
"a",
"new",
"fully",
"operational",
"GitHub",
"client",
".",
"With",
"added",
"logging",
"fields",
".",
"getToken",
"is",
"a",
"generator",
"for",
"the",
"GitHub",
"access",
"token",
"to",
"use",
".",
"bases",
"is",
"a",
"va... | 8125fbda10178887be5dff9e901d6a0a519b67bc | https://github.com/kubernetes/test-infra/blob/8125fbda10178887be5dff9e901d6a0a519b67bc/prow/github/client.go#L233-L248 | test |
kubernetes/test-infra | prow/github/client.go | NewClient | func NewClient(getToken func() []byte, graphqlEndpoint string, bases ...string) *Client {
return NewClientWithFields(logrus.Fields{}, getToken, graphqlEndpoint, bases...)
} | go | func NewClient(getToken func() []byte, graphqlEndpoint string, bases ...string) *Client {
return NewClientWithFields(logrus.Fields{}, getToken, graphqlEndpoint, bases...)
} | [
"func",
"NewClient",
"(",
"getToken",
"func",
"(",
")",
"[",
"]",
"byte",
",",
"graphqlEndpoint",
"string",
",",
"bases",
"...",
"string",
")",
"*",
"Client",
"{",
"return",
"NewClientWithFields",
"(",
"logrus",
".",
"Fields",
"{",
"}",
",",
"getToken",
... | // NewClient creates a new fully operational GitHub client. | [
"NewClient",
"creates",
"a",
"new",
"fully",
"operational",
"GitHub",
"client",
"."
] | 8125fbda10178887be5dff9e901d6a0a519b67bc | https://github.com/kubernetes/test-infra/blob/8125fbda10178887be5dff9e901d6a0a519b67bc/prow/github/client.go#L251-L253 | test |
kubernetes/test-infra | prow/github/client.go | NewDryRunClient | func NewDryRunClient(getToken func() []byte, graphqlEndpoint string, bases ...string) *Client {
return NewDryRunClientWithFields(logrus.Fields{}, getToken, graphqlEndpoint, bases...)
} | go | func NewDryRunClient(getToken func() []byte, graphqlEndpoint string, bases ...string) *Client {
return NewDryRunClientWithFields(logrus.Fields{}, getToken, graphqlEndpoint, bases...)
} | [
"func",
"NewDryRunClient",
"(",
"getToken",
"func",
"(",
")",
"[",
"]",
"byte",
",",
"graphqlEndpoint",
"string",
",",
"bases",
"...",
"string",
")",
"*",
"Client",
"{",
"return",
"NewDryRunClientWithFields",
"(",
"logrus",
".",
"Fields",
"{",
"}",
",",
"g... | // NewDryRunClient creates a new client that will not perform mutating actions
// such as setting statuses or commenting, but it will still query GitHub and
// use up API tokens.
// 'getToken' is a generator the GitHub access token to use.
// 'bases' is a variadic slice of endpoints to use in order of preference.
// ... | [
"NewDryRunClient",
"creates",
"a",
"new",
"client",
"that",
"will",
"not",
"perform",
"mutating",
"actions",
"such",
"as",
"setting",
"statuses",
"or",
"commenting",
"but",
"it",
"will",
"still",
"query",
"GitHub",
"and",
"use",
"up",
"API",
"tokens",
".",
"... | 8125fbda10178887be5dff9e901d6a0a519b67bc | https://github.com/kubernetes/test-infra/blob/8125fbda10178887be5dff9e901d6a0a519b67bc/prow/github/client.go#L288-L290 | test |
kubernetes/test-infra | prow/github/client.go | NewFakeClient | func NewFakeClient() *Client {
return &Client{
logger: logrus.WithField("client", "github"),
time: &standardTime{},
fake: true,
dry: true,
}
} | go | func NewFakeClient() *Client {
return &Client{
logger: logrus.WithField("client", "github"),
time: &standardTime{},
fake: true,
dry: true,
}
} | [
"func",
"NewFakeClient",
"(",
")",
"*",
"Client",
"{",
"return",
"&",
"Client",
"{",
"logger",
":",
"logrus",
".",
"WithField",
"(",
"\"client\"",
",",
"\"github\"",
")",
",",
"time",
":",
"&",
"standardTime",
"{",
"}",
",",
"fake",
":",
"true",
",",
... | // NewFakeClient creates a new client that will not perform any actions at all. | [
"NewFakeClient",
"creates",
"a",
"new",
"client",
"that",
"will",
"not",
"perform",
"any",
"actions",
"at",
"all",
"."
] | 8125fbda10178887be5dff9e901d6a0a519b67bc | https://github.com/kubernetes/test-infra/blob/8125fbda10178887be5dff9e901d6a0a519b67bc/prow/github/client.go#L293-L300 | test |
kubernetes/test-infra | prow/github/client.go | request | func (c *Client) request(r *request, ret interface{}) (int, error) {
statusCode, b, err := c.requestRaw(r)
if err != nil {
return statusCode, err
}
if ret != nil {
if err := json.Unmarshal(b, ret); err != nil {
return statusCode, err
}
}
return statusCode, nil
} | go | func (c *Client) request(r *request, ret interface{}) (int, error) {
statusCode, b, err := c.requestRaw(r)
if err != nil {
return statusCode, err
}
if ret != nil {
if err := json.Unmarshal(b, ret); err != nil {
return statusCode, err
}
}
return statusCode, nil
} | [
"func",
"(",
"c",
"*",
"Client",
")",
"request",
"(",
"r",
"*",
"request",
",",
"ret",
"interface",
"{",
"}",
")",
"(",
"int",
",",
"error",
")",
"{",
"statusCode",
",",
"b",
",",
"err",
":=",
"c",
".",
"requestRaw",
"(",
"r",
")",
"\n",
"if",
... | // Make a request with retries. If ret is not nil, unmarshal the response body
// into it. Returns an error if the exit code is not one of the provided codes. | [
"Make",
"a",
"request",
"with",
"retries",
".",
"If",
"ret",
"is",
"not",
"nil",
"unmarshal",
"the",
"response",
"body",
"into",
"it",
".",
"Returns",
"an",
"error",
"if",
"the",
"exit",
"code",
"is",
"not",
"one",
"of",
"the",
"provided",
"codes",
"."... | 8125fbda10178887be5dff9e901d6a0a519b67bc | https://github.com/kubernetes/test-infra/blob/8125fbda10178887be5dff9e901d6a0a519b67bc/prow/github/client.go#L348-L359 | test |
kubernetes/test-infra | prow/github/client.go | requestRaw | func (c *Client) requestRaw(r *request) (int, []byte, error) {
if c.fake || (c.dry && r.method != http.MethodGet) {
return r.exitCodes[0], nil, nil
}
resp, err := c.requestRetry(r.method, r.path, r.accept, r.requestBody)
if err != nil {
return 0, nil, err
}
defer resp.Body.Close()
b, err := ioutil.ReadAll(re... | go | func (c *Client) requestRaw(r *request) (int, []byte, error) {
if c.fake || (c.dry && r.method != http.MethodGet) {
return r.exitCodes[0], nil, nil
}
resp, err := c.requestRetry(r.method, r.path, r.accept, r.requestBody)
if err != nil {
return 0, nil, err
}
defer resp.Body.Close()
b, err := ioutil.ReadAll(re... | [
"func",
"(",
"c",
"*",
"Client",
")",
"requestRaw",
"(",
"r",
"*",
"request",
")",
"(",
"int",
",",
"[",
"]",
"byte",
",",
"error",
")",
"{",
"if",
"c",
".",
"fake",
"||",
"(",
"c",
".",
"dry",
"&&",
"r",
".",
"method",
"!=",
"http",
".",
"... | // requestRaw makes a request with retries and returns the response body.
// Returns an error if the exit code is not one of the provided codes. | [
"requestRaw",
"makes",
"a",
"request",
"with",
"retries",
"and",
"returns",
"the",
"response",
"body",
".",
"Returns",
"an",
"error",
"if",
"the",
"exit",
"code",
"is",
"not",
"one",
"of",
"the",
"provided",
"codes",
"."
] | 8125fbda10178887be5dff9e901d6a0a519b67bc | https://github.com/kubernetes/test-infra/blob/8125fbda10178887be5dff9e901d6a0a519b67bc/prow/github/client.go#L363-L391 | test |
kubernetes/test-infra | prow/github/client.go | getUserData | func (c *Client) getUserData() error {
c.log("User")
var u User
_, err := c.request(&request{
method: http.MethodGet,
path: "/user",
exitCodes: []int{200},
}, &u)
if err != nil {
return err
}
c.botName = u.Login
// email needs to be publicly accessible via the profile
// of the current account.... | go | func (c *Client) getUserData() error {
c.log("User")
var u User
_, err := c.request(&request{
method: http.MethodGet,
path: "/user",
exitCodes: []int{200},
}, &u)
if err != nil {
return err
}
c.botName = u.Login
// email needs to be publicly accessible via the profile
// of the current account.... | [
"func",
"(",
"c",
"*",
"Client",
")",
"getUserData",
"(",
")",
"error",
"{",
"c",
".",
"log",
"(",
"\"User\"",
")",
"\n",
"var",
"u",
"User",
"\n",
"_",
",",
"err",
":=",
"c",
".",
"request",
"(",
"&",
"request",
"{",
"method",
":",
"http",
"."... | // Not thread-safe - callers need to hold c.mut. | [
"Not",
"thread",
"-",
"safe",
"-",
"callers",
"need",
"to",
"hold",
"c",
".",
"mut",
"."
] | 8125fbda10178887be5dff9e901d6a0a519b67bc | https://github.com/kubernetes/test-infra/blob/8125fbda10178887be5dff9e901d6a0a519b67bc/prow/github/client.go#L514-L531 | test |
kubernetes/test-infra | prow/github/client.go | readPaginatedResultsWithValues | func (c *Client) readPaginatedResultsWithValues(path string, values url.Values, accept string, newObj func() interface{}, accumulate func(interface{})) error {
pagedPath := path
if len(values) > 0 {
pagedPath += "?" + values.Encode()
}
for {
resp, err := c.requestRetry(http.MethodGet, pagedPath, accept, nil)
... | go | func (c *Client) readPaginatedResultsWithValues(path string, values url.Values, accept string, newObj func() interface{}, accumulate func(interface{})) error {
pagedPath := path
if len(values) > 0 {
pagedPath += "?" + values.Encode()
}
for {
resp, err := c.requestRetry(http.MethodGet, pagedPath, accept, nil)
... | [
"func",
"(",
"c",
"*",
"Client",
")",
"readPaginatedResultsWithValues",
"(",
"path",
"string",
",",
"values",
"url",
".",
"Values",
",",
"accept",
"string",
",",
"newObj",
"func",
"(",
")",
"interface",
"{",
"}",
",",
"accumulate",
"func",
"(",
"interface"... | // readPaginatedResultsWithValues is an override that allows control over the query string. | [
"readPaginatedResultsWithValues",
"is",
"an",
"override",
"that",
"allows",
"control",
"over",
"the",
"query",
"string",
"."
] | 8125fbda10178887be5dff9e901d6a0a519b67bc | https://github.com/kubernetes/test-infra/blob/8125fbda10178887be5dff9e901d6a0a519b67bc/prow/github/client.go#L983-L1021 | test |
kubernetes/test-infra | prow/github/client.go | UpdatePullRequest | func (c *Client) UpdatePullRequest(org, repo string, number int, title, body *string, open *bool, branch *string, canModify *bool) error {
c.log("UpdatePullRequest", org, repo, title)
data := struct {
State *string `json:"state,omitempty"`
Title *string `json:"title,omitempty"`
Body *string `json:"body,omitemp... | go | func (c *Client) UpdatePullRequest(org, repo string, number int, title, body *string, open *bool, branch *string, canModify *bool) error {
c.log("UpdatePullRequest", org, repo, title)
data := struct {
State *string `json:"state,omitempty"`
Title *string `json:"title,omitempty"`
Body *string `json:"body,omitemp... | [
"func",
"(",
"c",
"*",
"Client",
")",
"UpdatePullRequest",
"(",
"org",
",",
"repo",
"string",
",",
"number",
"int",
",",
"title",
",",
"body",
"*",
"string",
",",
"open",
"*",
"bool",
",",
"branch",
"*",
"string",
",",
"canModify",
"*",
"bool",
")",
... | // UpdatePullRequest modifies the title, body, open state | [
"UpdatePullRequest",
"modifies",
"the",
"title",
"body",
"open",
"state"
] | 8125fbda10178887be5dff9e901d6a0a519b67bc | https://github.com/kubernetes/test-infra/blob/8125fbda10178887be5dff9e901d6a0a519b67bc/prow/github/client.go#L1154-L1188 | test |
kubernetes/test-infra | prow/github/client.go | getLabels | func (c *Client) getLabels(path string) ([]Label, error) {
var labels []Label
if c.fake {
return labels, nil
}
err := c.readPaginatedResults(
path,
"application/vnd.github.symmetra-preview+json", // allow the description field -- https://developer.github.com/changes/2018-02-22-label-description-search-preview... | go | func (c *Client) getLabels(path string) ([]Label, error) {
var labels []Label
if c.fake {
return labels, nil
}
err := c.readPaginatedResults(
path,
"application/vnd.github.symmetra-preview+json", // allow the description field -- https://developer.github.com/changes/2018-02-22-label-description-search-preview... | [
"func",
"(",
"c",
"*",
"Client",
")",
"getLabels",
"(",
"path",
"string",
")",
"(",
"[",
"]",
"Label",
",",
"error",
")",
"{",
"var",
"labels",
"[",
"]",
"Label",
"\n",
"if",
"c",
".",
"fake",
"{",
"return",
"labels",
",",
"nil",
"\n",
"}",
"\n... | // getLabels is a helper function that retrieves a paginated list of labels from a github URI path. | [
"getLabels",
"is",
"a",
"helper",
"function",
"that",
"retrieves",
"a",
"paginated",
"list",
"of",
"labels",
"from",
"a",
"github",
"URI",
"path",
"."
] | 8125fbda10178887be5dff9e901d6a0a519b67bc | https://github.com/kubernetes/test-infra/blob/8125fbda10178887be5dff9e901d6a0a519b67bc/prow/github/client.go#L1496-L1515 | test |
kubernetes/test-infra | prow/github/client.go | stateCannotBeChangedOrOriginalError | func stateCannotBeChangedOrOriginalError(err error) error {
requestErr, ok := err.(requestError)
if ok {
for _, errorMsg := range requestErr.ErrorMessages() {
if strings.Contains(errorMsg, stateCannotBeChangedMessagePrefix) {
return StateCannotBeChanged{
Message: errorMsg,
}
}
}
}
return err
... | go | func stateCannotBeChangedOrOriginalError(err error) error {
requestErr, ok := err.(requestError)
if ok {
for _, errorMsg := range requestErr.ErrorMessages() {
if strings.Contains(errorMsg, stateCannotBeChangedMessagePrefix) {
return StateCannotBeChanged{
Message: errorMsg,
}
}
}
}
return err
... | [
"func",
"stateCannotBeChangedOrOriginalError",
"(",
"err",
"error",
")",
"error",
"{",
"requestErr",
",",
"ok",
":=",
"err",
".",
"(",
"requestError",
")",
"\n",
"if",
"ok",
"{",
"for",
"_",
",",
"errorMsg",
":=",
"range",
"requestErr",
".",
"ErrorMessages",... | // convert to a StateCannotBeChanged if appropriate or else return the original error | [
"convert",
"to",
"a",
"StateCannotBeChanged",
"if",
"appropriate",
"or",
"else",
"return",
"the",
"original",
"error"
] | 8125fbda10178887be5dff9e901d6a0a519b67bc | https://github.com/kubernetes/test-infra/blob/8125fbda10178887be5dff9e901d6a0a519b67bc/prow/github/client.go#L1845-L1857 | test |
kubernetes/test-infra | prow/github/client.go | IsMergeable | func (c *Client) IsMergeable(org, repo string, number int, SHA string) (bool, error) {
backoff := time.Second * 3
maxTries := 3
for try := 0; try < maxTries; try++ {
pr, err := c.GetPullRequest(org, repo, number)
if err != nil {
return false, err
}
if pr.Head.SHA != SHA {
return false, fmt.Errorf("pull... | go | func (c *Client) IsMergeable(org, repo string, number int, SHA string) (bool, error) {
backoff := time.Second * 3
maxTries := 3
for try := 0; try < maxTries; try++ {
pr, err := c.GetPullRequest(org, repo, number)
if err != nil {
return false, err
}
if pr.Head.SHA != SHA {
return false, fmt.Errorf("pull... | [
"func",
"(",
"c",
"*",
"Client",
")",
"IsMergeable",
"(",
"org",
",",
"repo",
"string",
",",
"number",
"int",
",",
"SHA",
"string",
")",
"(",
"bool",
",",
"error",
")",
"{",
"backoff",
":=",
"time",
".",
"Second",
"*",
"3",
"\n",
"maxTries",
":=",
... | // IsMergeable determines if a PR can be merged.
// Mergeability is calculated by a background job on GitHub and is not immediately available when
// new commits are added so the PR must be polled until the background job completes. | [
"IsMergeable",
"determines",
"if",
"a",
"PR",
"can",
"be",
"merged",
".",
"Mergeability",
"is",
"calculated",
"by",
"a",
"background",
"job",
"on",
"GitHub",
"and",
"is",
"not",
"immediately",
"available",
"when",
"new",
"commits",
"are",
"added",
"so",
"the... | 8125fbda10178887be5dff9e901d6a0a519b67bc | https://github.com/kubernetes/test-infra/blob/8125fbda10178887be5dff9e901d6a0a519b67bc/prow/github/client.go#L2480-L2503 | test |
kubernetes/test-infra | prow/github/client.go | Token | func (s *reloadingTokenSource) Token() (*oauth2.Token, error) {
return &oauth2.Token{
AccessToken: string(s.getToken()),
}, nil
} | go | func (s *reloadingTokenSource) Token() (*oauth2.Token, error) {
return &oauth2.Token{
AccessToken: string(s.getToken()),
}, nil
} | [
"func",
"(",
"s",
"*",
"reloadingTokenSource",
")",
"Token",
"(",
")",
"(",
"*",
"oauth2",
".",
"Token",
",",
"error",
")",
"{",
"return",
"&",
"oauth2",
".",
"Token",
"{",
"AccessToken",
":",
"string",
"(",
"s",
".",
"getToken",
"(",
")",
")",
","... | // Token is an implementation for oauth2.TokenSource interface. | [
"Token",
"is",
"an",
"implementation",
"for",
"oauth2",
".",
"TokenSource",
"interface",
"."
] | 8125fbda10178887be5dff9e901d6a0a519b67bc | https://github.com/kubernetes/test-infra/blob/8125fbda10178887be5dff9e901d6a0a519b67bc/prow/github/client.go#L2603-L2607 | test |
kubernetes/test-infra | prow/spyglass/artifacts.go | ListArtifacts | func (s *Spyglass) ListArtifacts(src string) ([]string, error) {
keyType, key, err := splitSrc(src)
if err != nil {
return []string{}, fmt.Errorf("error parsing src: %v", err)
}
gcsKey := ""
switch keyType {
case gcsKeyType:
gcsKey = key
case prowKeyType:
if gcsKey, err = s.prowToGCS(key); err != nil {
... | go | func (s *Spyglass) ListArtifacts(src string) ([]string, error) {
keyType, key, err := splitSrc(src)
if err != nil {
return []string{}, fmt.Errorf("error parsing src: %v", err)
}
gcsKey := ""
switch keyType {
case gcsKeyType:
gcsKey = key
case prowKeyType:
if gcsKey, err = s.prowToGCS(key); err != nil {
... | [
"func",
"(",
"s",
"*",
"Spyglass",
")",
"ListArtifacts",
"(",
"src",
"string",
")",
"(",
"[",
"]",
"string",
",",
"error",
")",
"{",
"keyType",
",",
"key",
",",
"err",
":=",
"splitSrc",
"(",
"src",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"retur... | // ListArtifacts gets the names of all artifacts available from the given source | [
"ListArtifacts",
"gets",
"the",
"names",
"of",
"all",
"artifacts",
"available",
"from",
"the",
"given",
"source"
] | 8125fbda10178887be5dff9e901d6a0a519b67bc | https://github.com/kubernetes/test-infra/blob/8125fbda10178887be5dff9e901d6a0a519b67bc/prow/spyglass/artifacts.go#L29-L58 | test |
kubernetes/test-infra | prow/spyglass/artifacts.go | KeyToJob | func (*Spyglass) KeyToJob(src string) (jobName string, buildID string, err error) {
src = strings.Trim(src, "/")
parsed := strings.Split(src, "/")
if len(parsed) < 2 {
return "", "", fmt.Errorf("expected at least two path components in %q", src)
}
jobName = parsed[len(parsed)-2]
buildID = parsed[len(parsed)-1]
... | go | func (*Spyglass) KeyToJob(src string) (jobName string, buildID string, err error) {
src = strings.Trim(src, "/")
parsed := strings.Split(src, "/")
if len(parsed) < 2 {
return "", "", fmt.Errorf("expected at least two path components in %q", src)
}
jobName = parsed[len(parsed)-2]
buildID = parsed[len(parsed)-1]
... | [
"func",
"(",
"*",
"Spyglass",
")",
"KeyToJob",
"(",
"src",
"string",
")",
"(",
"jobName",
"string",
",",
"buildID",
"string",
",",
"err",
"error",
")",
"{",
"src",
"=",
"strings",
".",
"Trim",
"(",
"src",
",",
"\"/\"",
")",
"\n",
"parsed",
":=",
"s... | // KeyToJob takes a spyglass URL and returns the jobName and buildID. | [
"KeyToJob",
"takes",
"a",
"spyglass",
"URL",
"and",
"returns",
"the",
"jobName",
"and",
"buildID",
"."
] | 8125fbda10178887be5dff9e901d6a0a519b67bc | https://github.com/kubernetes/test-infra/blob/8125fbda10178887be5dff9e901d6a0a519b67bc/prow/spyglass/artifacts.go#L61-L70 | test |
kubernetes/test-infra | prow/spyglass/artifacts.go | prowToGCS | func (s *Spyglass) prowToGCS(prowKey string) (string, error) {
jobName, buildID, err := s.KeyToJob(prowKey)
if err != nil {
return "", fmt.Errorf("could not get GCS src: %v", err)
}
job, err := s.jobAgent.GetProwJob(jobName, buildID)
if err != nil {
return "", fmt.Errorf("Failed to get prow job from src %q: %... | go | func (s *Spyglass) prowToGCS(prowKey string) (string, error) {
jobName, buildID, err := s.KeyToJob(prowKey)
if err != nil {
return "", fmt.Errorf("could not get GCS src: %v", err)
}
job, err := s.jobAgent.GetProwJob(jobName, buildID)
if err != nil {
return "", fmt.Errorf("Failed to get prow job from src %q: %... | [
"func",
"(",
"s",
"*",
"Spyglass",
")",
"prowToGCS",
"(",
"prowKey",
"string",
")",
"(",
"string",
",",
"error",
")",
"{",
"jobName",
",",
"buildID",
",",
"err",
":=",
"s",
".",
"KeyToJob",
"(",
"prowKey",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
... | // prowToGCS returns the GCS key corresponding to the given prow key | [
"prowToGCS",
"returns",
"the",
"GCS",
"key",
"corresponding",
"to",
"the",
"given",
"prow",
"key"
] | 8125fbda10178887be5dff9e901d6a0a519b67bc | https://github.com/kubernetes/test-infra/blob/8125fbda10178887be5dff9e901d6a0a519b67bc/prow/spyglass/artifacts.go#L73-L90 | test |
kubernetes/test-infra | prow/spyglass/artifacts.go | FetchArtifacts | func (s *Spyglass) FetchArtifacts(src string, podName string, sizeLimit int64, artifactNames []string) ([]lenses.Artifact, error) {
artStart := time.Now()
arts := []lenses.Artifact{}
keyType, key, err := splitSrc(src)
if err != nil {
return arts, fmt.Errorf("error parsing src: %v", err)
}
jobName, buildID, err ... | go | func (s *Spyglass) FetchArtifacts(src string, podName string, sizeLimit int64, artifactNames []string) ([]lenses.Artifact, error) {
artStart := time.Now()
arts := []lenses.Artifact{}
keyType, key, err := splitSrc(src)
if err != nil {
return arts, fmt.Errorf("error parsing src: %v", err)
}
jobName, buildID, err ... | [
"func",
"(",
"s",
"*",
"Spyglass",
")",
"FetchArtifacts",
"(",
"src",
"string",
",",
"podName",
"string",
",",
"sizeLimit",
"int64",
",",
"artifactNames",
"[",
"]",
"string",
")",
"(",
"[",
"]",
"lenses",
".",
"Artifact",
",",
"error",
")",
"{",
"artSt... | // FetchArtifacts constructs and returns Artifact objects for each artifact name in the list.
// This includes getting any handles needed for read write operations, direct artifact links, etc. | [
"FetchArtifacts",
"constructs",
"and",
"returns",
"Artifact",
"objects",
"for",
"each",
"artifact",
"name",
"in",
"the",
"list",
".",
"This",
"includes",
"getting",
"any",
"handles",
"needed",
"for",
"read",
"write",
"operations",
"direct",
"artifact",
"links",
... | 8125fbda10178887be5dff9e901d6a0a519b67bc | https://github.com/kubernetes/test-infra/blob/8125fbda10178887be5dff9e901d6a0a519b67bc/prow/spyglass/artifacts.go#L94-L146 | test |
kubernetes/test-infra | prow/apis/prowjobs/v1/zz_generated.deepcopy.go | DeepCopy | func (in *DecorationConfig) DeepCopy() *DecorationConfig {
if in == nil {
return nil
}
out := new(DecorationConfig)
in.DeepCopyInto(out)
return out
} | go | func (in *DecorationConfig) DeepCopy() *DecorationConfig {
if in == nil {
return nil
}
out := new(DecorationConfig)
in.DeepCopyInto(out)
return out
} | [
"func",
"(",
"in",
"*",
"DecorationConfig",
")",
"DeepCopy",
"(",
")",
"*",
"DecorationConfig",
"{",
"if",
"in",
"==",
"nil",
"{",
"return",
"nil",
"\n",
"}",
"\n",
"out",
":=",
"new",
"(",
"DecorationConfig",
")",
"\n",
"in",
".",
"DeepCopyInto",
"(",... | // DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new DecorationConfig. | [
"DeepCopy",
"is",
"an",
"autogenerated",
"deepcopy",
"function",
"copying",
"the",
"receiver",
"creating",
"a",
"new",
"DecorationConfig",
"."
] | 8125fbda10178887be5dff9e901d6a0a519b67bc | https://github.com/kubernetes/test-infra/blob/8125fbda10178887be5dff9e901d6a0a519b67bc/prow/apis/prowjobs/v1/zz_generated.deepcopy.go#L64-L71 | test |
kubernetes/test-infra | prow/apis/prowjobs/v1/zz_generated.deepcopy.go | DeepCopy | func (in *GCSConfiguration) DeepCopy() *GCSConfiguration {
if in == nil {
return nil
}
out := new(GCSConfiguration)
in.DeepCopyInto(out)
return out
} | go | func (in *GCSConfiguration) DeepCopy() *GCSConfiguration {
if in == nil {
return nil
}
out := new(GCSConfiguration)
in.DeepCopyInto(out)
return out
} | [
"func",
"(",
"in",
"*",
"GCSConfiguration",
")",
"DeepCopy",
"(",
")",
"*",
"GCSConfiguration",
"{",
"if",
"in",
"==",
"nil",
"{",
"return",
"nil",
"\n",
"}",
"\n",
"out",
":=",
"new",
"(",
"GCSConfiguration",
")",
"\n",
"in",
".",
"DeepCopyInto",
"(",... | // DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new GCSConfiguration. | [
"DeepCopy",
"is",
"an",
"autogenerated",
"deepcopy",
"function",
"copying",
"the",
"receiver",
"creating",
"a",
"new",
"GCSConfiguration",
"."
] | 8125fbda10178887be5dff9e901d6a0a519b67bc | https://github.com/kubernetes/test-infra/blob/8125fbda10178887be5dff9e901d6a0a519b67bc/prow/apis/prowjobs/v1/zz_generated.deepcopy.go#L96-L103 | test |
kubernetes/test-infra | prow/apis/prowjobs/v1/zz_generated.deepcopy.go | DeepCopy | func (in *JenkinsSpec) DeepCopy() *JenkinsSpec {
if in == nil {
return nil
}
out := new(JenkinsSpec)
in.DeepCopyInto(out)
return out
} | go | func (in *JenkinsSpec) DeepCopy() *JenkinsSpec {
if in == nil {
return nil
}
out := new(JenkinsSpec)
in.DeepCopyInto(out)
return out
} | [
"func",
"(",
"in",
"*",
"JenkinsSpec",
")",
"DeepCopy",
"(",
")",
"*",
"JenkinsSpec",
"{",
"if",
"in",
"==",
"nil",
"{",
"return",
"nil",
"\n",
"}",
"\n",
"out",
":=",
"new",
"(",
"JenkinsSpec",
")",
"\n",
"in",
".",
"DeepCopyInto",
"(",
"out",
")"... | // DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new JenkinsSpec. | [
"DeepCopy",
"is",
"an",
"autogenerated",
"deepcopy",
"function",
"copying",
"the",
"receiver",
"creating",
"a",
"new",
"JenkinsSpec",
"."
] | 8125fbda10178887be5dff9e901d6a0a519b67bc | https://github.com/kubernetes/test-infra/blob/8125fbda10178887be5dff9e901d6a0a519b67bc/prow/apis/prowjobs/v1/zz_generated.deepcopy.go#L112-L119 | test |
kubernetes/test-infra | prow/apis/prowjobs/v1/zz_generated.deepcopy.go | DeepCopy | func (in *ProwJob) DeepCopy() *ProwJob {
if in == nil {
return nil
}
out := new(ProwJob)
in.DeepCopyInto(out)
return out
} | go | func (in *ProwJob) DeepCopy() *ProwJob {
if in == nil {
return nil
}
out := new(ProwJob)
in.DeepCopyInto(out)
return out
} | [
"func",
"(",
"in",
"*",
"ProwJob",
")",
"DeepCopy",
"(",
")",
"*",
"ProwJob",
"{",
"if",
"in",
"==",
"nil",
"{",
"return",
"nil",
"\n",
"}",
"\n",
"out",
":=",
"new",
"(",
"ProwJob",
")",
"\n",
"in",
".",
"DeepCopyInto",
"(",
"out",
")",
"\n",
... | // DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ProwJob. | [
"DeepCopy",
"is",
"an",
"autogenerated",
"deepcopy",
"function",
"copying",
"the",
"receiver",
"creating",
"a",
"new",
"ProwJob",
"."
] | 8125fbda10178887be5dff9e901d6a0a519b67bc | https://github.com/kubernetes/test-infra/blob/8125fbda10178887be5dff9e901d6a0a519b67bc/prow/apis/prowjobs/v1/zz_generated.deepcopy.go#L132-L139 | test |
kubernetes/test-infra | prow/apis/prowjobs/v1/zz_generated.deepcopy.go | DeepCopy | func (in *ProwJobList) DeepCopy() *ProwJobList {
if in == nil {
return nil
}
out := new(ProwJobList)
in.DeepCopyInto(out)
return out
} | go | func (in *ProwJobList) DeepCopy() *ProwJobList {
if in == nil {
return nil
}
out := new(ProwJobList)
in.DeepCopyInto(out)
return out
} | [
"func",
"(",
"in",
"*",
"ProwJobList",
")",
"DeepCopy",
"(",
")",
"*",
"ProwJobList",
"{",
"if",
"in",
"==",
"nil",
"{",
"return",
"nil",
"\n",
"}",
"\n",
"out",
":=",
"new",
"(",
"ProwJobList",
")",
"\n",
"in",
".",
"DeepCopyInto",
"(",
"out",
")"... | // DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ProwJobList. | [
"DeepCopy",
"is",
"an",
"autogenerated",
"deepcopy",
"function",
"copying",
"the",
"receiver",
"creating",
"a",
"new",
"ProwJobList",
"."
] | 8125fbda10178887be5dff9e901d6a0a519b67bc | https://github.com/kubernetes/test-infra/blob/8125fbda10178887be5dff9e901d6a0a519b67bc/prow/apis/prowjobs/v1/zz_generated.deepcopy.go#L165-L172 | test |
kubernetes/test-infra | prow/apis/prowjobs/v1/zz_generated.deepcopy.go | DeepCopy | func (in *ProwJobSpec) DeepCopy() *ProwJobSpec {
if in == nil {
return nil
}
out := new(ProwJobSpec)
in.DeepCopyInto(out)
return out
} | go | func (in *ProwJobSpec) DeepCopy() *ProwJobSpec {
if in == nil {
return nil
}
out := new(ProwJobSpec)
in.DeepCopyInto(out)
return out
} | [
"func",
"(",
"in",
"*",
"ProwJobSpec",
")",
"DeepCopy",
"(",
")",
"*",
"ProwJobSpec",
"{",
"if",
"in",
"==",
"nil",
"{",
"return",
"nil",
"\n",
"}",
"\n",
"out",
":=",
"new",
"(",
"ProwJobSpec",
")",
"\n",
"in",
".",
"DeepCopyInto",
"(",
"out",
")"... | // DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ProwJobSpec. | [
"DeepCopy",
"is",
"an",
"autogenerated",
"deepcopy",
"function",
"copying",
"the",
"receiver",
"creating",
"a",
"new",
"ProwJobSpec",
"."
] | 8125fbda10178887be5dff9e901d6a0a519b67bc | https://github.com/kubernetes/test-infra/blob/8125fbda10178887be5dff9e901d6a0a519b67bc/prow/apis/prowjobs/v1/zz_generated.deepcopy.go#L226-L233 | test |
kubernetes/test-infra | prow/apis/prowjobs/v1/zz_generated.deepcopy.go | DeepCopy | func (in *ProwJobStatus) DeepCopy() *ProwJobStatus {
if in == nil {
return nil
}
out := new(ProwJobStatus)
in.DeepCopyInto(out)
return out
} | go | func (in *ProwJobStatus) DeepCopy() *ProwJobStatus {
if in == nil {
return nil
}
out := new(ProwJobStatus)
in.DeepCopyInto(out)
return out
} | [
"func",
"(",
"in",
"*",
"ProwJobStatus",
")",
"DeepCopy",
"(",
")",
"*",
"ProwJobStatus",
"{",
"if",
"in",
"==",
"nil",
"{",
"return",
"nil",
"\n",
"}",
"\n",
"out",
":=",
"new",
"(",
"ProwJobStatus",
")",
"\n",
"in",
".",
"DeepCopyInto",
"(",
"out",... | // DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ProwJobStatus. | [
"DeepCopy",
"is",
"an",
"autogenerated",
"deepcopy",
"function",
"copying",
"the",
"receiver",
"creating",
"a",
"new",
"ProwJobStatus",
"."
] | 8125fbda10178887be5dff9e901d6a0a519b67bc | https://github.com/kubernetes/test-infra/blob/8125fbda10178887be5dff9e901d6a0a519b67bc/prow/apis/prowjobs/v1/zz_generated.deepcopy.go#L254-L261 | test |
kubernetes/test-infra | prow/apis/prowjobs/v1/zz_generated.deepcopy.go | DeepCopy | func (in *Pull) DeepCopy() *Pull {
if in == nil {
return nil
}
out := new(Pull)
in.DeepCopyInto(out)
return out
} | go | func (in *Pull) DeepCopy() *Pull {
if in == nil {
return nil
}
out := new(Pull)
in.DeepCopyInto(out)
return out
} | [
"func",
"(",
"in",
"*",
"Pull",
")",
"DeepCopy",
"(",
")",
"*",
"Pull",
"{",
"if",
"in",
"==",
"nil",
"{",
"return",
"nil",
"\n",
"}",
"\n",
"out",
":=",
"new",
"(",
"Pull",
")",
"\n",
"in",
".",
"DeepCopyInto",
"(",
"out",
")",
"\n",
"return",... | // DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new Pull. | [
"DeepCopy",
"is",
"an",
"autogenerated",
"deepcopy",
"function",
"copying",
"the",
"receiver",
"creating",
"a",
"new",
"Pull",
"."
] | 8125fbda10178887be5dff9e901d6a0a519b67bc | https://github.com/kubernetes/test-infra/blob/8125fbda10178887be5dff9e901d6a0a519b67bc/prow/apis/prowjobs/v1/zz_generated.deepcopy.go#L270-L277 | test |
kubernetes/test-infra | prow/apis/prowjobs/v1/zz_generated.deepcopy.go | DeepCopy | func (in *Refs) DeepCopy() *Refs {
if in == nil {
return nil
}
out := new(Refs)
in.DeepCopyInto(out)
return out
} | go | func (in *Refs) DeepCopy() *Refs {
if in == nil {
return nil
}
out := new(Refs)
in.DeepCopyInto(out)
return out
} | [
"func",
"(",
"in",
"*",
"Refs",
")",
"DeepCopy",
"(",
")",
"*",
"Refs",
"{",
"if",
"in",
"==",
"nil",
"{",
"return",
"nil",
"\n",
"}",
"\n",
"out",
":=",
"new",
"(",
"Refs",
")",
"\n",
"in",
".",
"DeepCopyInto",
"(",
"out",
")",
"\n",
"return",... | // DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new Refs. | [
"DeepCopy",
"is",
"an",
"autogenerated",
"deepcopy",
"function",
"copying",
"the",
"receiver",
"creating",
"a",
"new",
"Refs",
"."
] | 8125fbda10178887be5dff9e901d6a0a519b67bc | https://github.com/kubernetes/test-infra/blob/8125fbda10178887be5dff9e901d6a0a519b67bc/prow/apis/prowjobs/v1/zz_generated.deepcopy.go#L291-L298 | test |
kubernetes/test-infra | prow/apis/prowjobs/v1/zz_generated.deepcopy.go | DeepCopy | func (in *UtilityImages) DeepCopy() *UtilityImages {
if in == nil {
return nil
}
out := new(UtilityImages)
in.DeepCopyInto(out)
return out
} | go | func (in *UtilityImages) DeepCopy() *UtilityImages {
if in == nil {
return nil
}
out := new(UtilityImages)
in.DeepCopyInto(out)
return out
} | [
"func",
"(",
"in",
"*",
"UtilityImages",
")",
"DeepCopy",
"(",
")",
"*",
"UtilityImages",
"{",
"if",
"in",
"==",
"nil",
"{",
"return",
"nil",
"\n",
"}",
"\n",
"out",
":=",
"new",
"(",
"UtilityImages",
")",
"\n",
"in",
".",
"DeepCopyInto",
"(",
"out",... | // DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new UtilityImages. | [
"DeepCopy",
"is",
"an",
"autogenerated",
"deepcopy",
"function",
"copying",
"the",
"receiver",
"creating",
"a",
"new",
"UtilityImages",
"."
] | 8125fbda10178887be5dff9e901d6a0a519b67bc | https://github.com/kubernetes/test-infra/blob/8125fbda10178887be5dff9e901d6a0a519b67bc/prow/apis/prowjobs/v1/zz_generated.deepcopy.go#L307-L314 | test |
kubernetes/test-infra | experiment/resultstore/upload.go | upload | func upload(rsClient *resultstore.Client, inv resultstore.Invocation, target resultstore.Target, test resultstore.Test) (string, error) {
targetID := test.Name
const configID = resultstore.Default
invName, err := rsClient.Invocations().Create(inv)
if err != nil {
return "", fmt.Errorf("create invocation: %v", er... | go | func upload(rsClient *resultstore.Client, inv resultstore.Invocation, target resultstore.Target, test resultstore.Test) (string, error) {
targetID := test.Name
const configID = resultstore.Default
invName, err := rsClient.Invocations().Create(inv)
if err != nil {
return "", fmt.Errorf("create invocation: %v", er... | [
"func",
"upload",
"(",
"rsClient",
"*",
"resultstore",
".",
"Client",
",",
"inv",
"resultstore",
".",
"Invocation",
",",
"target",
"resultstore",
".",
"Target",
",",
"test",
"resultstore",
".",
"Test",
")",
"(",
"string",
",",
"error",
")",
"{",
"targetID"... | // upload the result downloaded from path into project. | [
"upload",
"the",
"result",
"downloaded",
"from",
"path",
"into",
"project",
"."
] | 8125fbda10178887be5dff9e901d6a0a519b67bc | https://github.com/kubernetes/test-infra/blob/8125fbda10178887be5dff9e901d6a0a519b67bc/experiment/resultstore/upload.go#L44-L70 | test |
kubernetes/test-infra | prow/apis/prowjobs/v1/types.go | ApplyDefault | func (d *DecorationConfig) ApplyDefault(def *DecorationConfig) *DecorationConfig {
if d == nil && def == nil {
return nil
}
var merged DecorationConfig
if d != nil {
merged = *d
} else {
merged = *def
}
if d == nil || def == nil {
return &merged
}
merged.UtilityImages = merged.UtilityImages.ApplyDefaul... | go | func (d *DecorationConfig) ApplyDefault(def *DecorationConfig) *DecorationConfig {
if d == nil && def == nil {
return nil
}
var merged DecorationConfig
if d != nil {
merged = *d
} else {
merged = *def
}
if d == nil || def == nil {
return &merged
}
merged.UtilityImages = merged.UtilityImages.ApplyDefaul... | [
"func",
"(",
"d",
"*",
"DecorationConfig",
")",
"ApplyDefault",
"(",
"def",
"*",
"DecorationConfig",
")",
"*",
"DecorationConfig",
"{",
"if",
"d",
"==",
"nil",
"&&",
"def",
"==",
"nil",
"{",
"return",
"nil",
"\n",
"}",
"\n",
"var",
"merged",
"DecorationC... | // ApplyDefault applies the defaults for the ProwJob decoration. If a field has a zero value, it
// replaces that with the value set in def. | [
"ApplyDefault",
"applies",
"the",
"defaults",
"for",
"the",
"ProwJob",
"decoration",
".",
"If",
"a",
"field",
"has",
"a",
"zero",
"value",
"it",
"replaces",
"that",
"with",
"the",
"value",
"set",
"in",
"def",
"."
] | 8125fbda10178887be5dff9e901d6a0a519b67bc | https://github.com/kubernetes/test-infra/blob/8125fbda10178887be5dff9e901d6a0a519b67bc/prow/apis/prowjobs/v1/types.go#L233-L272 | test |
kubernetes/test-infra | prow/apis/prowjobs/v1/types.go | Validate | func (d *DecorationConfig) Validate() error {
if d.UtilityImages == nil {
return errors.New("utility image config is not specified")
}
var missing []string
if d.UtilityImages.CloneRefs == "" {
missing = append(missing, "clonerefs")
}
if d.UtilityImages.InitUpload == "" {
missing = append(missing, "inituploa... | go | func (d *DecorationConfig) Validate() error {
if d.UtilityImages == nil {
return errors.New("utility image config is not specified")
}
var missing []string
if d.UtilityImages.CloneRefs == "" {
missing = append(missing, "clonerefs")
}
if d.UtilityImages.InitUpload == "" {
missing = append(missing, "inituploa... | [
"func",
"(",
"d",
"*",
"DecorationConfig",
")",
"Validate",
"(",
")",
"error",
"{",
"if",
"d",
".",
"UtilityImages",
"==",
"nil",
"{",
"return",
"errors",
".",
"New",
"(",
"\"utility image config is not specified\"",
")",
"\n",
"}",
"\n",
"var",
"missing",
... | // Validate ensures all the values set in the DecorationConfig are valid. | [
"Validate",
"ensures",
"all",
"the",
"values",
"set",
"in",
"the",
"DecorationConfig",
"are",
"valid",
"."
] | 8125fbda10178887be5dff9e901d6a0a519b67bc | https://github.com/kubernetes/test-infra/blob/8125fbda10178887be5dff9e901d6a0a519b67bc/prow/apis/prowjobs/v1/types.go#L275-L306 | test |
kubernetes/test-infra | prow/apis/prowjobs/v1/types.go | ApplyDefault | func (u *UtilityImages) ApplyDefault(def *UtilityImages) *UtilityImages {
if u == nil {
return def
} else if def == nil {
return u
}
merged := *u
if merged.CloneRefs == "" {
merged.CloneRefs = def.CloneRefs
}
if merged.InitUpload == "" {
merged.InitUpload = def.InitUpload
}
if merged.Entrypoint == "" ... | go | func (u *UtilityImages) ApplyDefault(def *UtilityImages) *UtilityImages {
if u == nil {
return def
} else if def == nil {
return u
}
merged := *u
if merged.CloneRefs == "" {
merged.CloneRefs = def.CloneRefs
}
if merged.InitUpload == "" {
merged.InitUpload = def.InitUpload
}
if merged.Entrypoint == "" ... | [
"func",
"(",
"u",
"*",
"UtilityImages",
")",
"ApplyDefault",
"(",
"def",
"*",
"UtilityImages",
")",
"*",
"UtilityImages",
"{",
"if",
"u",
"==",
"nil",
"{",
"return",
"def",
"\n",
"}",
"else",
"if",
"def",
"==",
"nil",
"{",
"return",
"u",
"\n",
"}",
... | // ApplyDefault applies the defaults for the UtilityImages decorations. If a field has a zero value,
// it replaces that with the value set in def. | [
"ApplyDefault",
"applies",
"the",
"defaults",
"for",
"the",
"UtilityImages",
"decorations",
".",
"If",
"a",
"field",
"has",
"a",
"zero",
"value",
"it",
"replaces",
"that",
"with",
"the",
"value",
"set",
"in",
"def",
"."
] | 8125fbda10178887be5dff9e901d6a0a519b67bc | https://github.com/kubernetes/test-infra/blob/8125fbda10178887be5dff9e901d6a0a519b67bc/prow/apis/prowjobs/v1/types.go#L323-L344 | test |
kubernetes/test-infra | prow/apis/prowjobs/v1/types.go | ApplyDefault | func (g *GCSConfiguration) ApplyDefault(def *GCSConfiguration) *GCSConfiguration {
if g == nil && def == nil {
return nil
}
var merged GCSConfiguration
if g != nil {
merged = *g
} else {
merged = *def
}
if g == nil || def == nil {
return &merged
}
if merged.Bucket == "" {
merged.Bucket = def.Bucket
... | go | func (g *GCSConfiguration) ApplyDefault(def *GCSConfiguration) *GCSConfiguration {
if g == nil && def == nil {
return nil
}
var merged GCSConfiguration
if g != nil {
merged = *g
} else {
merged = *def
}
if g == nil || def == nil {
return &merged
}
if merged.Bucket == "" {
merged.Bucket = def.Bucket
... | [
"func",
"(",
"g",
"*",
"GCSConfiguration",
")",
"ApplyDefault",
"(",
"def",
"*",
"GCSConfiguration",
")",
"*",
"GCSConfiguration",
"{",
"if",
"g",
"==",
"nil",
"&&",
"def",
"==",
"nil",
"{",
"return",
"nil",
"\n",
"}",
"\n",
"var",
"merged",
"GCSConfigur... | // ApplyDefault applies the defaults for GCSConfiguration decorations. If a field has a zero value,
// it replaces that with the value set in def. | [
"ApplyDefault",
"applies",
"the",
"defaults",
"for",
"GCSConfiguration",
"decorations",
".",
"If",
"a",
"field",
"has",
"a",
"zero",
"value",
"it",
"replaces",
"that",
"with",
"the",
"value",
"set",
"in",
"def",
"."
] | 8125fbda10178887be5dff9e901d6a0a519b67bc | https://github.com/kubernetes/test-infra/blob/8125fbda10178887be5dff9e901d6a0a519b67bc/prow/apis/prowjobs/v1/types.go#L375-L405 | test |
kubernetes/test-infra | prow/apis/prowjobs/v1/types.go | Validate | func (g *GCSConfiguration) Validate() error {
if g.PathStrategy != PathStrategyLegacy && g.PathStrategy != PathStrategyExplicit && g.PathStrategy != PathStrategySingle {
return fmt.Errorf("gcs_path_strategy must be one of %q, %q, or %q", PathStrategyLegacy, PathStrategyExplicit, PathStrategySingle)
}
if g.PathStra... | go | func (g *GCSConfiguration) Validate() error {
if g.PathStrategy != PathStrategyLegacy && g.PathStrategy != PathStrategyExplicit && g.PathStrategy != PathStrategySingle {
return fmt.Errorf("gcs_path_strategy must be one of %q, %q, or %q", PathStrategyLegacy, PathStrategyExplicit, PathStrategySingle)
}
if g.PathStra... | [
"func",
"(",
"g",
"*",
"GCSConfiguration",
")",
"Validate",
"(",
")",
"error",
"{",
"if",
"g",
".",
"PathStrategy",
"!=",
"PathStrategyLegacy",
"&&",
"g",
".",
"PathStrategy",
"!=",
"PathStrategyExplicit",
"&&",
"g",
".",
"PathStrategy",
"!=",
"PathStrategySin... | // Validate ensures all the values set in the GCSConfiguration are valid. | [
"Validate",
"ensures",
"all",
"the",
"values",
"set",
"in",
"the",
"GCSConfiguration",
"are",
"valid",
"."
] | 8125fbda10178887be5dff9e901d6a0a519b67bc | https://github.com/kubernetes/test-infra/blob/8125fbda10178887be5dff9e901d6a0a519b67bc/prow/apis/prowjobs/v1/types.go#L408-L416 | test |
kubernetes/test-infra | prow/apis/prowjobs/v1/types.go | ClusterAlias | func (j *ProwJob) ClusterAlias() string {
if j.Spec.Cluster == "" {
return DefaultClusterAlias
}
return j.Spec.Cluster
} | go | func (j *ProwJob) ClusterAlias() string {
if j.Spec.Cluster == "" {
return DefaultClusterAlias
}
return j.Spec.Cluster
} | [
"func",
"(",
"j",
"*",
"ProwJob",
")",
"ClusterAlias",
"(",
")",
"string",
"{",
"if",
"j",
".",
"Spec",
".",
"Cluster",
"==",
"\"\"",
"{",
"return",
"DefaultClusterAlias",
"\n",
"}",
"\n",
"return",
"j",
".",
"Spec",
".",
"Cluster",
"\n",
"}"
] | // ClusterAlias specifies the key in the clusters map to use.
//
// This allows scheduling a prow job somewhere aside from the default build cluster. | [
"ClusterAlias",
"specifies",
"the",
"key",
"in",
"the",
"clusters",
"map",
"to",
"use",
".",
"This",
"allows",
"scheduling",
"a",
"prow",
"job",
"somewhere",
"aside",
"from",
"the",
"default",
"build",
"cluster",
"."
] | 8125fbda10178887be5dff9e901d6a0a519b67bc | https://github.com/kubernetes/test-infra/blob/8125fbda10178887be5dff9e901d6a0a519b67bc/prow/apis/prowjobs/v1/types.go#L465-L470 | test |
kubernetes/test-infra | boskos/common/common.go | NewResource | func NewResource(name, rtype, state, owner string, t time.Time) Resource {
return Resource{
Name: name,
Type: rtype,
State: state,
Owner: owner,
LastUpdate: t,
UserData: &UserData{},
}
} | go | func NewResource(name, rtype, state, owner string, t time.Time) Resource {
return Resource{
Name: name,
Type: rtype,
State: state,
Owner: owner,
LastUpdate: t,
UserData: &UserData{},
}
} | [
"func",
"NewResource",
"(",
"name",
",",
"rtype",
",",
"state",
",",
"owner",
"string",
",",
"t",
"time",
".",
"Time",
")",
"Resource",
"{",
"return",
"Resource",
"{",
"Name",
":",
"name",
",",
"Type",
":",
"rtype",
",",
"State",
":",
"state",
",",
... | // NewResource creates a new Boskos Resource. | [
"NewResource",
"creates",
"a",
"new",
"Boskos",
"Resource",
"."
] | 8125fbda10178887be5dff9e901d6a0a519b67bc | https://github.com/kubernetes/test-infra/blob/8125fbda10178887be5dff9e901d6a0a519b67bc/boskos/common/common.go#L93-L102 | test |
kubernetes/test-infra | boskos/common/common.go | NewResourcesFromConfig | func NewResourcesFromConfig(e ResourceEntry) []Resource {
var resources []Resource
for _, name := range e.Names {
resources = append(resources, NewResource(name, e.Type, e.State, "", time.Time{}))
}
return resources
} | go | func NewResourcesFromConfig(e ResourceEntry) []Resource {
var resources []Resource
for _, name := range e.Names {
resources = append(resources, NewResource(name, e.Type, e.State, "", time.Time{}))
}
return resources
} | [
"func",
"NewResourcesFromConfig",
"(",
"e",
"ResourceEntry",
")",
"[",
"]",
"Resource",
"{",
"var",
"resources",
"[",
"]",
"Resource",
"\n",
"for",
"_",
",",
"name",
":=",
"range",
"e",
".",
"Names",
"{",
"resources",
"=",
"append",
"(",
"resources",
","... | // NewResourcesFromConfig parse the a ResourceEntry into a list of resources | [
"NewResourcesFromConfig",
"parse",
"the",
"a",
"ResourceEntry",
"into",
"a",
"list",
"of",
"resources"
] | 8125fbda10178887be5dff9e901d6a0a519b67bc | https://github.com/kubernetes/test-infra/blob/8125fbda10178887be5dff9e901d6a0a519b67bc/boskos/common/common.go#L105-L111 | test |
kubernetes/test-infra | boskos/common/common.go | UserDataFromMap | func UserDataFromMap(m UserDataMap) *UserData {
ud := &UserData{}
for k, v := range m {
ud.Store(k, v)
}
return ud
} | go | func UserDataFromMap(m UserDataMap) *UserData {
ud := &UserData{}
for k, v := range m {
ud.Store(k, v)
}
return ud
} | [
"func",
"UserDataFromMap",
"(",
"m",
"UserDataMap",
")",
"*",
"UserData",
"{",
"ud",
":=",
"&",
"UserData",
"{",
"}",
"\n",
"for",
"k",
",",
"v",
":=",
"range",
"m",
"{",
"ud",
".",
"Store",
"(",
"k",
",",
"v",
")",
"\n",
"}",
"\n",
"return",
"... | // UserDataFromMap returns a UserData from a map | [
"UserDataFromMap",
"returns",
"a",
"UserData",
"from",
"a",
"map"
] | 8125fbda10178887be5dff9e901d6a0a519b67bc | https://github.com/kubernetes/test-infra/blob/8125fbda10178887be5dff9e901d6a0a519b67bc/boskos/common/common.go#L114-L120 | test |
kubernetes/test-infra | boskos/common/common.go | Set | func (r *CommaSeparatedStrings) Set(value string) error {
if len(*r) > 0 {
return errors.New("resTypes flag already set")
}
for _, rtype := range strings.Split(value, ",") {
*r = append(*r, rtype)
}
return nil
} | go | func (r *CommaSeparatedStrings) Set(value string) error {
if len(*r) > 0 {
return errors.New("resTypes flag already set")
}
for _, rtype := range strings.Split(value, ",") {
*r = append(*r, rtype)
}
return nil
} | [
"func",
"(",
"r",
"*",
"CommaSeparatedStrings",
")",
"Set",
"(",
"value",
"string",
")",
"error",
"{",
"if",
"len",
"(",
"*",
"r",
")",
">",
"0",
"{",
"return",
"errors",
".",
"New",
"(",
"\"resTypes flag already set\"",
")",
"\n",
"}",
"\n",
"for",
... | // Set parses the flag value into a CommaSeparatedStrings | [
"Set",
"parses",
"the",
"flag",
"value",
"into",
"a",
"CommaSeparatedStrings"
] | 8125fbda10178887be5dff9e901d6a0a519b67bc | https://github.com/kubernetes/test-infra/blob/8125fbda10178887be5dff9e901d6a0a519b67bc/boskos/common/common.go#L153-L161 | test |
kubernetes/test-infra | boskos/common/common.go | UnmarshalJSON | func (ud *UserData) UnmarshalJSON(data []byte) error {
tmpMap := UserDataMap{}
if err := json.Unmarshal(data, &tmpMap); err != nil {
return err
}
ud.FromMap(tmpMap)
return nil
} | go | func (ud *UserData) UnmarshalJSON(data []byte) error {
tmpMap := UserDataMap{}
if err := json.Unmarshal(data, &tmpMap); err != nil {
return err
}
ud.FromMap(tmpMap)
return nil
} | [
"func",
"(",
"ud",
"*",
"UserData",
")",
"UnmarshalJSON",
"(",
"data",
"[",
"]",
"byte",
")",
"error",
"{",
"tmpMap",
":=",
"UserDataMap",
"{",
"}",
"\n",
"if",
"err",
":=",
"json",
".",
"Unmarshal",
"(",
"data",
",",
"&",
"tmpMap",
")",
";",
"err"... | // UnmarshalJSON implements JSON Unmarshaler interface | [
"UnmarshalJSON",
"implements",
"JSON",
"Unmarshaler",
"interface"
] | 8125fbda10178887be5dff9e901d6a0a519b67bc | https://github.com/kubernetes/test-infra/blob/8125fbda10178887be5dff9e901d6a0a519b67bc/boskos/common/common.go#L171-L178 | test |
kubernetes/test-infra | boskos/common/common.go | Extract | func (ud *UserData) Extract(id string, out interface{}) error {
content, ok := ud.Load(id)
if !ok {
return &UserDataNotFound{id}
}
return yaml.Unmarshal([]byte(content.(string)), out)
} | go | func (ud *UserData) Extract(id string, out interface{}) error {
content, ok := ud.Load(id)
if !ok {
return &UserDataNotFound{id}
}
return yaml.Unmarshal([]byte(content.(string)), out)
} | [
"func",
"(",
"ud",
"*",
"UserData",
")",
"Extract",
"(",
"id",
"string",
",",
"out",
"interface",
"{",
"}",
")",
"error",
"{",
"content",
",",
"ok",
":=",
"ud",
".",
"Load",
"(",
"id",
")",
"\n",
"if",
"!",
"ok",
"{",
"return",
"&",
"UserDataNotF... | // Extract unmarshalls a string a given struct if it exists | [
"Extract",
"unmarshalls",
"a",
"string",
"a",
"given",
"struct",
"if",
"it",
"exists"
] | 8125fbda10178887be5dff9e901d6a0a519b67bc | https://github.com/kubernetes/test-infra/blob/8125fbda10178887be5dff9e901d6a0a519b67bc/boskos/common/common.go#L186-L192 | test |
kubernetes/test-infra | boskos/common/common.go | Set | func (ud *UserData) Set(id string, in interface{}) error {
b, err := yaml.Marshal(in)
if err != nil {
return err
}
ud.Store(id, string(b))
return nil
} | go | func (ud *UserData) Set(id string, in interface{}) error {
b, err := yaml.Marshal(in)
if err != nil {
return err
}
ud.Store(id, string(b))
return nil
} | [
"func",
"(",
"ud",
"*",
"UserData",
")",
"Set",
"(",
"id",
"string",
",",
"in",
"interface",
"{",
"}",
")",
"error",
"{",
"b",
",",
"err",
":=",
"yaml",
".",
"Marshal",
"(",
"in",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"err",
"\n",... | // User Data are used to store custom information mainly by Mason and Masonable implementation.
// Mason used a LeasedResource keys to store information about other resources that used to
// create the given resource.
// Set marshalls a struct to a string into the UserData | [
"User",
"Data",
"are",
"used",
"to",
"store",
"custom",
"information",
"mainly",
"by",
"Mason",
"and",
"Masonable",
"implementation",
".",
"Mason",
"used",
"a",
"LeasedResource",
"keys",
"to",
"store",
"information",
"about",
"other",
"resources",
"that",
"used"... | 8125fbda10178887be5dff9e901d6a0a519b67bc | https://github.com/kubernetes/test-infra/blob/8125fbda10178887be5dff9e901d6a0a519b67bc/boskos/common/common.go#L199-L206 | test |
kubernetes/test-infra | boskos/common/common.go | Update | func (ud *UserData) Update(new *UserData) {
if new == nil {
return
}
new.Range(func(key, value interface{}) bool {
if value.(string) != "" {
ud.Store(key, value)
} else {
ud.Delete(key)
}
return true
})
} | go | func (ud *UserData) Update(new *UserData) {
if new == nil {
return
}
new.Range(func(key, value interface{}) bool {
if value.(string) != "" {
ud.Store(key, value)
} else {
ud.Delete(key)
}
return true
})
} | [
"func",
"(",
"ud",
"*",
"UserData",
")",
"Update",
"(",
"new",
"*",
"UserData",
")",
"{",
"if",
"new",
"==",
"nil",
"{",
"return",
"\n",
"}",
"\n",
"new",
".",
"Range",
"(",
"func",
"(",
"key",
",",
"value",
"interface",
"{",
"}",
")",
"bool",
... | // Update updates existing UserData with new UserData.
// If a key as an empty string, the key will be deleted | [
"Update",
"updates",
"existing",
"UserData",
"with",
"new",
"UserData",
".",
"If",
"a",
"key",
"as",
"an",
"empty",
"string",
"the",
"key",
"will",
"be",
"deleted"
] | 8125fbda10178887be5dff9e901d6a0a519b67bc | https://github.com/kubernetes/test-infra/blob/8125fbda10178887be5dff9e901d6a0a519b67bc/boskos/common/common.go#L210-L222 | test |
kubernetes/test-infra | boskos/common/common.go | ToMap | func (ud *UserData) ToMap() UserDataMap {
m := UserDataMap{}
ud.Range(func(key, value interface{}) bool {
m[key.(string)] = value.(string)
return true
})
return m
} | go | func (ud *UserData) ToMap() UserDataMap {
m := UserDataMap{}
ud.Range(func(key, value interface{}) bool {
m[key.(string)] = value.(string)
return true
})
return m
} | [
"func",
"(",
"ud",
"*",
"UserData",
")",
"ToMap",
"(",
")",
"UserDataMap",
"{",
"m",
":=",
"UserDataMap",
"{",
"}",
"\n",
"ud",
".",
"Range",
"(",
"func",
"(",
"key",
",",
"value",
"interface",
"{",
"}",
")",
"bool",
"{",
"m",
"[",
"key",
".",
... | // ToMap converts a UserData to UserDataMap | [
"ToMap",
"converts",
"a",
"UserData",
"to",
"UserDataMap"
] | 8125fbda10178887be5dff9e901d6a0a519b67bc | https://github.com/kubernetes/test-infra/blob/8125fbda10178887be5dff9e901d6a0a519b67bc/boskos/common/common.go#L225-L232 | test |
kubernetes/test-infra | boskos/common/common.go | FromMap | func (ud *UserData) FromMap(m UserDataMap) {
for key, value := range m {
ud.Store(key, value)
}
} | go | func (ud *UserData) FromMap(m UserDataMap) {
for key, value := range m {
ud.Store(key, value)
}
} | [
"func",
"(",
"ud",
"*",
"UserData",
")",
"FromMap",
"(",
"m",
"UserDataMap",
")",
"{",
"for",
"key",
",",
"value",
":=",
"range",
"m",
"{",
"ud",
".",
"Store",
"(",
"key",
",",
"value",
")",
"\n",
"}",
"\n",
"}"
] | // FromMap feels updates user data from a map | [
"FromMap",
"feels",
"updates",
"user",
"data",
"from",
"a",
"map"
] | 8125fbda10178887be5dff9e901d6a0a519b67bc | https://github.com/kubernetes/test-infra/blob/8125fbda10178887be5dff9e901d6a0a519b67bc/boskos/common/common.go#L235-L239 | test |
kubernetes/test-infra | boskos/common/common.go | ItemToResource | func ItemToResource(i Item) (Resource, error) {
res, ok := i.(Resource)
if !ok {
return Resource{}, fmt.Errorf("cannot construct Resource from received object %v", i)
}
return res, nil
} | go | func ItemToResource(i Item) (Resource, error) {
res, ok := i.(Resource)
if !ok {
return Resource{}, fmt.Errorf("cannot construct Resource from received object %v", i)
}
return res, nil
} | [
"func",
"ItemToResource",
"(",
"i",
"Item",
")",
"(",
"Resource",
",",
"error",
")",
"{",
"res",
",",
"ok",
":=",
"i",
".",
"(",
"Resource",
")",
"\n",
"if",
"!",
"ok",
"{",
"return",
"Resource",
"{",
"}",
",",
"fmt",
".",
"Errorf",
"(",
"\"canno... | // ItemToResource casts a Item back to a Resource | [
"ItemToResource",
"casts",
"a",
"Item",
"back",
"to",
"a",
"Resource"
] | 8125fbda10178887be5dff9e901d6a0a519b67bc | https://github.com/kubernetes/test-infra/blob/8125fbda10178887be5dff9e901d6a0a519b67bc/boskos/common/common.go#L242-L248 | test |
kubernetes/test-infra | prow/clonerefs/run.go | Run | func (o Options) Run() error {
var env []string
if len(o.KeyFiles) > 0 {
var err error
env, err = addSSHKeys(o.KeyFiles)
if err != nil {
logrus.WithError(err).Error("Failed to add SSH keys.")
// Continue on error. Clones will fail with an appropriate error message
// that initupload can consume whereas... | go | func (o Options) Run() error {
var env []string
if len(o.KeyFiles) > 0 {
var err error
env, err = addSSHKeys(o.KeyFiles)
if err != nil {
logrus.WithError(err).Error("Failed to add SSH keys.")
// Continue on error. Clones will fail with an appropriate error message
// that initupload can consume whereas... | [
"func",
"(",
"o",
"Options",
")",
"Run",
"(",
")",
"error",
"{",
"var",
"env",
"[",
"]",
"string",
"\n",
"if",
"len",
"(",
"o",
".",
"KeyFiles",
")",
">",
"0",
"{",
"var",
"err",
"error",
"\n",
"env",
",",
"err",
"=",
"addSSHKeys",
"(",
"o",
... | // Run clones the configured refs | [
"Run",
"clones",
"the",
"configured",
"refs"
] | 8125fbda10178887be5dff9e901d6a0a519b67bc | https://github.com/kubernetes/test-infra/blob/8125fbda10178887be5dff9e901d6a0a519b67bc/prow/clonerefs/run.go#L37-L100 | test |
kubernetes/test-infra | prow/clonerefs/run.go | addSSHKeys | func addSSHKeys(paths []string) ([]string, error) {
vars, err := exec.Command("ssh-agent").CombinedOutput()
if err != nil {
return []string{}, fmt.Errorf("failed to start ssh-agent: %v", err)
}
logrus.Info("Started SSH agent")
// ssh-agent will output three lines of text, in the form:
// SSH_AUTH_SOCK=xxx; expo... | go | func addSSHKeys(paths []string) ([]string, error) {
vars, err := exec.Command("ssh-agent").CombinedOutput()
if err != nil {
return []string{}, fmt.Errorf("failed to start ssh-agent: %v", err)
}
logrus.Info("Started SSH agent")
// ssh-agent will output three lines of text, in the form:
// SSH_AUTH_SOCK=xxx; expo... | [
"func",
"addSSHKeys",
"(",
"paths",
"[",
"]",
"string",
")",
"(",
"[",
"]",
"string",
",",
"error",
")",
"{",
"vars",
",",
"err",
":=",
"exec",
".",
"Command",
"(",
"\"ssh-agent\"",
")",
".",
"CombinedOutput",
"(",
")",
"\n",
"if",
"err",
"!=",
"ni... | // addSSHKeys will start the ssh-agent and add all the specified
// keys, returning the ssh-agent environment variables for reuse | [
"addSSHKeys",
"will",
"start",
"the",
"ssh",
"-",
"agent",
"and",
"add",
"all",
"the",
"specified",
"keys",
"returning",
"the",
"ssh",
"-",
"agent",
"environment",
"variables",
"for",
"reuse"
] | 8125fbda10178887be5dff9e901d6a0a519b67bc | https://github.com/kubernetes/test-infra/blob/8125fbda10178887be5dff9e901d6a0a519b67bc/prow/clonerefs/run.go#L119-L161 | test |
kubernetes/test-infra | robots/issue-creator/sources/triage-filer.go | Issues | func (f *TriageFiler) Issues(c *creator.IssueCreator) ([]creator.Issue, error) {
f.creator = c
rawjson, err := ReadHTTP(clusterDataURL)
if err != nil {
return nil, err
}
clusters, err := f.loadClusters(rawjson)
if err != nil {
return nil, err
}
topclusters := topClusters(clusters, f.topClustersCount)
issue... | go | func (f *TriageFiler) Issues(c *creator.IssueCreator) ([]creator.Issue, error) {
f.creator = c
rawjson, err := ReadHTTP(clusterDataURL)
if err != nil {
return nil, err
}
clusters, err := f.loadClusters(rawjson)
if err != nil {
return nil, err
}
topclusters := topClusters(clusters, f.topClustersCount)
issue... | [
"func",
"(",
"f",
"*",
"TriageFiler",
")",
"Issues",
"(",
"c",
"*",
"creator",
".",
"IssueCreator",
")",
"(",
"[",
"]",
"creator",
".",
"Issue",
",",
"error",
")",
"{",
"f",
".",
"creator",
"=",
"c",
"\n",
"rawjson",
",",
"err",
":=",
"ReadHTTP",
... | // Issues is the main work function of the TriageFiler. It fetches and parses cluster data,
// then syncs the top issues to github with the IssueCreator. | [
"Issues",
"is",
"the",
"main",
"work",
"function",
"of",
"the",
"TriageFiler",
".",
"It",
"fetches",
"and",
"parses",
"cluster",
"data",
"then",
"syncs",
"the",
"top",
"issues",
"to",
"github",
"with",
"the",
"IssueCreator",
"."
] | 8125fbda10178887be5dff9e901d6a0a519b67bc | https://github.com/kubernetes/test-infra/blob/8125fbda10178887be5dff9e901d6a0a519b67bc/robots/issue-creator/sources/triage-filer.go#L62-L78 | test |
kubernetes/test-infra | robots/issue-creator/sources/triage-filer.go | loadClusters | func (f *TriageFiler) loadClusters(jsonIn []byte) ([]*Cluster, error) {
var err error
f.data, err = parseTriageData(jsonIn)
if err != nil {
return nil, err
}
if err = f.filterAndValidate(f.windowDays); err != nil {
return nil, err
}
// Aggregate failing builds in each cluster by job (independent of tests).
... | go | func (f *TriageFiler) loadClusters(jsonIn []byte) ([]*Cluster, error) {
var err error
f.data, err = parseTriageData(jsonIn)
if err != nil {
return nil, err
}
if err = f.filterAndValidate(f.windowDays); err != nil {
return nil, err
}
// Aggregate failing builds in each cluster by job (independent of tests).
... | [
"func",
"(",
"f",
"*",
"TriageFiler",
")",
"loadClusters",
"(",
"jsonIn",
"[",
"]",
"byte",
")",
"(",
"[",
"]",
"*",
"Cluster",
",",
"error",
")",
"{",
"var",
"err",
"error",
"\n",
"f",
".",
"data",
",",
"err",
"=",
"parseTriageData",
"(",
"jsonIn"... | // loadClusters parses and filters the json data, then populates every Cluster struct with
// aggregated job data and totals. The job data specifies all jobs that failed in a cluster and the
// builds that failed for each job, independent of which tests the jobs or builds failed. | [
"loadClusters",
"parses",
"and",
"filters",
"the",
"json",
"data",
"then",
"populates",
"every",
"Cluster",
"struct",
"with",
"aggregated",
"job",
"data",
"and",
"totals",
".",
"The",
"job",
"data",
"specifies",
"all",
"jobs",
"that",
"failed",
"in",
"a",
"c... | 8125fbda10178887be5dff9e901d6a0a519b67bc | https://github.com/kubernetes/test-infra/blob/8125fbda10178887be5dff9e901d6a0a519b67bc/robots/issue-creator/sources/triage-filer.go#L242-L281 | test |
kubernetes/test-infra | robots/issue-creator/sources/triage-filer.go | parseTriageData | func parseTriageData(jsonIn []byte) (*triageData, error) {
var data triageData
if err := json.Unmarshal(jsonIn, &data); err != nil {
return nil, err
}
if data.Builds.Cols.Started == nil {
return nil, fmt.Errorf("triage data json is missing the builds.cols.started key")
}
if data.Builds.JobsRaw == nil {
ret... | go | func parseTriageData(jsonIn []byte) (*triageData, error) {
var data triageData
if err := json.Unmarshal(jsonIn, &data); err != nil {
return nil, err
}
if data.Builds.Cols.Started == nil {
return nil, fmt.Errorf("triage data json is missing the builds.cols.started key")
}
if data.Builds.JobsRaw == nil {
ret... | [
"func",
"parseTriageData",
"(",
"jsonIn",
"[",
"]",
"byte",
")",
"(",
"*",
"triageData",
",",
"error",
")",
"{",
"var",
"data",
"triageData",
"\n",
"if",
"err",
":=",
"json",
".",
"Unmarshal",
"(",
"jsonIn",
",",
"&",
"data",
")",
";",
"err",
"!=",
... | // parseTriageData unmarshals raw json data into a triageData struct and creates a BuildIndexer for
// every job. | [
"parseTriageData",
"unmarshals",
"raw",
"json",
"data",
"into",
"a",
"triageData",
"struct",
"and",
"creates",
"a",
"BuildIndexer",
"for",
"every",
"job",
"."
] | 8125fbda10178887be5dff9e901d6a0a519b67bc | https://github.com/kubernetes/test-infra/blob/8125fbda10178887be5dff9e901d6a0a519b67bc/robots/issue-creator/sources/triage-filer.go#L285-L322 | test |
kubernetes/test-infra | robots/issue-creator/sources/triage-filer.go | topClusters | func topClusters(clusters []*Cluster, count int) []*Cluster {
less := func(i, j int) bool { return clusters[i].totalBuilds > clusters[j].totalBuilds }
sort.SliceStable(clusters, less)
if len(clusters) < count {
count = len(clusters)
}
return clusters[0:count]
} | go | func topClusters(clusters []*Cluster, count int) []*Cluster {
less := func(i, j int) bool { return clusters[i].totalBuilds > clusters[j].totalBuilds }
sort.SliceStable(clusters, less)
if len(clusters) < count {
count = len(clusters)
}
return clusters[0:count]
} | [
"func",
"topClusters",
"(",
"clusters",
"[",
"]",
"*",
"Cluster",
",",
"count",
"int",
")",
"[",
"]",
"*",
"Cluster",
"{",
"less",
":=",
"func",
"(",
"i",
",",
"j",
"int",
")",
"bool",
"{",
"return",
"clusters",
"[",
"i",
"]",
".",
"totalBuilds",
... | // topClusters gets the 'count' most important clusters from a slice of clusters based on number of build failures. | [
"topClusters",
"gets",
"the",
"count",
"most",
"important",
"clusters",
"from",
"a",
"slice",
"of",
"clusters",
"based",
"on",
"number",
"of",
"build",
"failures",
"."
] | 8125fbda10178887be5dff9e901d6a0a519b67bc | https://github.com/kubernetes/test-infra/blob/8125fbda10178887be5dff9e901d6a0a519b67bc/robots/issue-creator/sources/triage-filer.go#L325-L333 | test |
kubernetes/test-infra | robots/issue-creator/sources/triage-filer.go | topJobsFailed | func (c *Cluster) topJobsFailed(count int) []*Job {
slice := make([]*Job, len(c.jobs))
i := 0
for jobName, builds := range c.jobs {
slice[i] = &Job{Name: jobName, Builds: builds}
i++
}
less := func(i, j int) bool { return len(slice[i].Builds) > len(slice[j].Builds) }
sort.SliceStable(slice, less)
if len(sli... | go | func (c *Cluster) topJobsFailed(count int) []*Job {
slice := make([]*Job, len(c.jobs))
i := 0
for jobName, builds := range c.jobs {
slice[i] = &Job{Name: jobName, Builds: builds}
i++
}
less := func(i, j int) bool { return len(slice[i].Builds) > len(slice[j].Builds) }
sort.SliceStable(slice, less)
if len(sli... | [
"func",
"(",
"c",
"*",
"Cluster",
")",
"topJobsFailed",
"(",
"count",
"int",
")",
"[",
"]",
"*",
"Job",
"{",
"slice",
":=",
"make",
"(",
"[",
"]",
"*",
"Job",
",",
"len",
"(",
"c",
".",
"jobs",
")",
")",
"\n",
"i",
":=",
"0",
"\n",
"for",
"... | // topJobsFailed returns the top 'count' job names sorted by number of failing builds. | [
"topJobsFailed",
"returns",
"the",
"top",
"count",
"job",
"names",
"sorted",
"by",
"number",
"of",
"failing",
"builds",
"."
] | 8125fbda10178887be5dff9e901d6a0a519b67bc | https://github.com/kubernetes/test-infra/blob/8125fbda10178887be5dff9e901d6a0a519b67bc/robots/issue-creator/sources/triage-filer.go#L347-L361 | test |
kubernetes/test-infra | robots/issue-creator/sources/triage-filer.go | Title | func (c *Cluster) Title() string {
return fmt.Sprintf("Failure cluster [%s...] failed %d builds, %d jobs, and %d tests over %d days",
c.Identifier[0:6],
c.totalBuilds,
c.totalJobs,
c.totalTests,
c.filer.windowDays,
)
} | go | func (c *Cluster) Title() string {
return fmt.Sprintf("Failure cluster [%s...] failed %d builds, %d jobs, and %d tests over %d days",
c.Identifier[0:6],
c.totalBuilds,
c.totalJobs,
c.totalTests,
c.filer.windowDays,
)
} | [
"func",
"(",
"c",
"*",
"Cluster",
")",
"Title",
"(",
")",
"string",
"{",
"return",
"fmt",
".",
"Sprintf",
"(",
"\"Failure cluster [%s...] failed %d builds, %d jobs, and %d tests over %d days\"",
",",
"c",
".",
"Identifier",
"[",
"0",
":",
"6",
"]",
",",
"c",
"... | // Title is the string to use as the github issue title. | [
"Title",
"is",
"the",
"string",
"to",
"use",
"as",
"the",
"github",
"issue",
"title",
"."
] | 8125fbda10178887be5dff9e901d6a0a519b67bc | https://github.com/kubernetes/test-infra/blob/8125fbda10178887be5dff9e901d6a0a519b67bc/robots/issue-creator/sources/triage-filer.go#L364-L372 | test |
kubernetes/test-infra | robots/issue-creator/sources/triage-filer.go | Labels | func (c *Cluster) Labels() []string {
labels := []string{"kind/flake"}
topTests := make([]string, len(c.Tests))
for i, test := range c.topTestsFailed(len(c.Tests)) {
topTests[i] = test.Name
}
for sig := range c.filer.creator.TestsSIGs(topTests) {
labels = append(labels, "sig/"+sig)
}
return labels
} | go | func (c *Cluster) Labels() []string {
labels := []string{"kind/flake"}
topTests := make([]string, len(c.Tests))
for i, test := range c.topTestsFailed(len(c.Tests)) {
topTests[i] = test.Name
}
for sig := range c.filer.creator.TestsSIGs(topTests) {
labels = append(labels, "sig/"+sig)
}
return labels
} | [
"func",
"(",
"c",
"*",
"Cluster",
")",
"Labels",
"(",
")",
"[",
"]",
"string",
"{",
"labels",
":=",
"[",
"]",
"string",
"{",
"\"kind/flake\"",
"}",
"\n",
"topTests",
":=",
"make",
"(",
"[",
"]",
"string",
",",
"len",
"(",
"c",
".",
"Tests",
")",
... | // Labels returns the labels to apply to the issue created for this cluster on github. | [
"Labels",
"returns",
"the",
"labels",
"to",
"apply",
"to",
"the",
"issue",
"created",
"for",
"this",
"cluster",
"on",
"github",
"."
] | 8125fbda10178887be5dff9e901d6a0a519b67bc | https://github.com/kubernetes/test-infra/blob/8125fbda10178887be5dff9e901d6a0a519b67bc/robots/issue-creator/sources/triage-filer.go#L460-L472 | test |
kubernetes/test-infra | prow/cron/cron.go | New | func New() *Cron {
return &Cron{
cronAgent: cron.New(),
jobs: map[string]*jobStatus{},
logger: logrus.WithField("client", "cron"),
}
} | go | func New() *Cron {
return &Cron{
cronAgent: cron.New(),
jobs: map[string]*jobStatus{},
logger: logrus.WithField("client", "cron"),
}
} | [
"func",
"New",
"(",
")",
"*",
"Cron",
"{",
"return",
"&",
"Cron",
"{",
"cronAgent",
":",
"cron",
".",
"New",
"(",
")",
",",
"jobs",
":",
"map",
"[",
"string",
"]",
"*",
"jobStatus",
"{",
"}",
",",
"logger",
":",
"logrus",
".",
"WithField",
"(",
... | // New makes a new Cron object | [
"New",
"makes",
"a",
"new",
"Cron",
"object"
] | 8125fbda10178887be5dff9e901d6a0a519b67bc | https://github.com/kubernetes/test-infra/blob/8125fbda10178887be5dff9e901d6a0a519b67bc/prow/cron/cron.go#L53-L59 | test |
kubernetes/test-infra | prow/cron/cron.go | QueuedJobs | func (c *Cron) QueuedJobs() []string {
c.lock.Lock()
defer c.lock.Unlock()
res := []string{}
for k, v := range c.jobs {
if v.triggered {
res = append(res, k)
}
c.jobs[k].triggered = false
}
return res
} | go | func (c *Cron) QueuedJobs() []string {
c.lock.Lock()
defer c.lock.Unlock()
res := []string{}
for k, v := range c.jobs {
if v.triggered {
res = append(res, k)
}
c.jobs[k].triggered = false
}
return res
} | [
"func",
"(",
"c",
"*",
"Cron",
")",
"QueuedJobs",
"(",
")",
"[",
"]",
"string",
"{",
"c",
".",
"lock",
".",
"Lock",
"(",
")",
"\n",
"defer",
"c",
".",
"lock",
".",
"Unlock",
"(",
")",
"\n",
"res",
":=",
"[",
"]",
"string",
"{",
"}",
"\n",
"... | // QueuedJobs returns a list of jobs that need to be triggered
// and reset trigger in jobStatus | [
"QueuedJobs",
"returns",
"a",
"list",
"of",
"jobs",
"that",
"need",
"to",
"be",
"triggered",
"and",
"reset",
"trigger",
"in",
"jobStatus"
] | 8125fbda10178887be5dff9e901d6a0a519b67bc | https://github.com/kubernetes/test-infra/blob/8125fbda10178887be5dff9e901d6a0a519b67bc/prow/cron/cron.go#L73-L85 | test |
kubernetes/test-infra | prow/cron/cron.go | HasJob | func (c *Cron) HasJob(name string) bool {
c.lock.Lock()
defer c.lock.Unlock()
_, ok := c.jobs[name]
return ok
} | go | func (c *Cron) HasJob(name string) bool {
c.lock.Lock()
defer c.lock.Unlock()
_, ok := c.jobs[name]
return ok
} | [
"func",
"(",
"c",
"*",
"Cron",
")",
"HasJob",
"(",
"name",
"string",
")",
"bool",
"{",
"c",
".",
"lock",
".",
"Lock",
"(",
")",
"\n",
"defer",
"c",
".",
"lock",
".",
"Unlock",
"(",
")",
"\n",
"_",
",",
"ok",
":=",
"c",
".",
"jobs",
"[",
"na... | // HasJob returns if a job has been scheduled in cronAgent or not | [
"HasJob",
"returns",
"if",
"a",
"job",
"has",
"been",
"scheduled",
"in",
"cronAgent",
"or",
"not"
] | 8125fbda10178887be5dff9e901d6a0a519b67bc | https://github.com/kubernetes/test-infra/blob/8125fbda10178887be5dff9e901d6a0a519b67bc/prow/cron/cron.go#L120-L126 | test |
kubernetes/test-infra | prow/cron/cron.go | addJob | func (c *Cron) addJob(name, cron string) error {
id, err := c.cronAgent.AddFunc("TZ=UTC "+cron, func() {
c.lock.Lock()
defer c.lock.Unlock()
c.jobs[name].triggered = true
c.logger.Infof("Triggering cron job %s.", name)
})
if err != nil {
return fmt.Errorf("cronAgent fails to add job %s with cron %s: %v",... | go | func (c *Cron) addJob(name, cron string) error {
id, err := c.cronAgent.AddFunc("TZ=UTC "+cron, func() {
c.lock.Lock()
defer c.lock.Unlock()
c.jobs[name].triggered = true
c.logger.Infof("Triggering cron job %s.", name)
})
if err != nil {
return fmt.Errorf("cronAgent fails to add job %s with cron %s: %v",... | [
"func",
"(",
"c",
"*",
"Cron",
")",
"addJob",
"(",
"name",
",",
"cron",
"string",
")",
"error",
"{",
"id",
",",
"err",
":=",
"c",
".",
"cronAgent",
".",
"AddFunc",
"(",
"\"TZ=UTC \"",
"+",
"cron",
",",
"func",
"(",
")",
"{",
"c",
".",
"lock",
"... | // addJob adds a cron entry for a job to cronAgent | [
"addJob",
"adds",
"a",
"cron",
"entry",
"for",
"a",
"job",
"to",
"cronAgent"
] | 8125fbda10178887be5dff9e901d6a0a519b67bc | https://github.com/kubernetes/test-infra/blob/8125fbda10178887be5dff9e901d6a0a519b67bc/prow/cron/cron.go#L151-L173 | test |
kubernetes/test-infra | prow/cron/cron.go | removeJob | func (c *Cron) removeJob(name string) error {
job, ok := c.jobs[name]
if !ok {
return fmt.Errorf("job %s has not been added to cronAgent yet", name)
}
c.cronAgent.Remove(job.entryID)
delete(c.jobs, name)
c.logger.Infof("Removed previous cron job %s.", name)
return nil
} | go | func (c *Cron) removeJob(name string) error {
job, ok := c.jobs[name]
if !ok {
return fmt.Errorf("job %s has not been added to cronAgent yet", name)
}
c.cronAgent.Remove(job.entryID)
delete(c.jobs, name)
c.logger.Infof("Removed previous cron job %s.", name)
return nil
} | [
"func",
"(",
"c",
"*",
"Cron",
")",
"removeJob",
"(",
"name",
"string",
")",
"error",
"{",
"job",
",",
"ok",
":=",
"c",
".",
"jobs",
"[",
"name",
"]",
"\n",
"if",
"!",
"ok",
"{",
"return",
"fmt",
".",
"Errorf",
"(",
"\"job %s has not been added to cr... | // removeJob removes the job from cronAgent | [
"removeJob",
"removes",
"the",
"job",
"from",
"cronAgent"
] | 8125fbda10178887be5dff9e901d6a0a519b67bc | https://github.com/kubernetes/test-infra/blob/8125fbda10178887be5dff9e901d6a0a519b67bc/prow/cron/cron.go#L176-L185 | test |
kubernetes/test-infra | velodrome/fetcher/comments.go | UpdateComments | func UpdateComments(issueID int, pullRequest bool, db *gorm.DB, client ClientInterface) {
latest := findLatestCommentUpdate(issueID, db, client.RepositoryName())
updateIssueComments(issueID, latest, db, client)
if pullRequest {
updatePullComments(issueID, latest, db, client)
}
} | go | func UpdateComments(issueID int, pullRequest bool, db *gorm.DB, client ClientInterface) {
latest := findLatestCommentUpdate(issueID, db, client.RepositoryName())
updateIssueComments(issueID, latest, db, client)
if pullRequest {
updatePullComments(issueID, latest, db, client)
}
} | [
"func",
"UpdateComments",
"(",
"issueID",
"int",
",",
"pullRequest",
"bool",
",",
"db",
"*",
"gorm",
".",
"DB",
",",
"client",
"ClientInterface",
")",
"{",
"latest",
":=",
"findLatestCommentUpdate",
"(",
"issueID",
",",
"db",
",",
"client",
".",
"RepositoryN... | // UpdateComments downloads issue and pull-request comments and save in DB | [
"UpdateComments",
"downloads",
"issue",
"and",
"pull",
"-",
"request",
"comments",
"and",
"save",
"in",
"DB"
] | 8125fbda10178887be5dff9e901d6a0a519b67bc | https://github.com/kubernetes/test-infra/blob/8125fbda10178887be5dff9e901d6a0a519b67bc/velodrome/fetcher/comments.go#L80-L87 | test |
kubernetes/test-infra | prow/kube/metrics.go | GatherProwJobMetrics | func GatherProwJobMetrics(pjs []prowapi.ProwJob) {
// map of job to job type to state to count
metricMap := make(map[string]map[string]map[string]float64)
for _, pj := range pjs {
if metricMap[pj.Spec.Job] == nil {
metricMap[pj.Spec.Job] = make(map[string]map[string]float64)
}
if metricMap[pj.Spec.Job][str... | go | func GatherProwJobMetrics(pjs []prowapi.ProwJob) {
// map of job to job type to state to count
metricMap := make(map[string]map[string]map[string]float64)
for _, pj := range pjs {
if metricMap[pj.Spec.Job] == nil {
metricMap[pj.Spec.Job] = make(map[string]map[string]float64)
}
if metricMap[pj.Spec.Job][str... | [
"func",
"GatherProwJobMetrics",
"(",
"pjs",
"[",
"]",
"prowapi",
".",
"ProwJob",
")",
"{",
"metricMap",
":=",
"make",
"(",
"map",
"[",
"string",
"]",
"map",
"[",
"string",
"]",
"map",
"[",
"string",
"]",
"float64",
")",
"\n",
"for",
"_",
",",
"pj",
... | // GatherProwJobMetrics gathers prometheus metrics for prowjobs. | [
"GatherProwJobMetrics",
"gathers",
"prometheus",
"metrics",
"for",
"prowjobs",
"."
] | 8125fbda10178887be5dff9e901d6a0a519b67bc | https://github.com/kubernetes/test-infra/blob/8125fbda10178887be5dff9e901d6a0a519b67bc/prow/kube/metrics.go#L44-L69 | test |
kubernetes/test-infra | prow/entrypoint/run.go | optionOrDefault | func optionOrDefault(option, defaultValue time.Duration) time.Duration {
if option == 0 {
return defaultValue
}
return option
} | go | func optionOrDefault(option, defaultValue time.Duration) time.Duration {
if option == 0 {
return defaultValue
}
return option
} | [
"func",
"optionOrDefault",
"(",
"option",
",",
"defaultValue",
"time",
".",
"Duration",
")",
"time",
".",
"Duration",
"{",
"if",
"option",
"==",
"0",
"{",
"return",
"defaultValue",
"\n",
"}",
"\n",
"return",
"option",
"\n",
"}"
] | // optionOrDefault defaults to a value if option
// is the zero value | [
"optionOrDefault",
"defaults",
"to",
"a",
"value",
"if",
"option",
"is",
"the",
"zero",
"value"
] | 8125fbda10178887be5dff9e901d6a0a519b67bc | https://github.com/kubernetes/test-infra/blob/8125fbda10178887be5dff9e901d6a0a519b67bc/prow/entrypoint/run.go#L223-L229 | test |
kubernetes/test-infra | prow/spyglass/gcsartifact_fetcher.go | newGCSJobSource | func newGCSJobSource(src string) (*gcsJobSource, error) {
gcsURL, err := url.Parse(fmt.Sprintf("gs://%s", src))
if err != nil {
return &gcsJobSource{}, ErrCannotParseSource
}
gcsPath := &gcs.Path{}
err = gcsPath.SetURL(gcsURL)
if err != nil {
return &gcsJobSource{}, ErrCannotParseSource
}
tokens := strings... | go | func newGCSJobSource(src string) (*gcsJobSource, error) {
gcsURL, err := url.Parse(fmt.Sprintf("gs://%s", src))
if err != nil {
return &gcsJobSource{}, ErrCannotParseSource
}
gcsPath := &gcs.Path{}
err = gcsPath.SetURL(gcsURL)
if err != nil {
return &gcsJobSource{}, ErrCannotParseSource
}
tokens := strings... | [
"func",
"newGCSJobSource",
"(",
"src",
"string",
")",
"(",
"*",
"gcsJobSource",
",",
"error",
")",
"{",
"gcsURL",
",",
"err",
":=",
"url",
".",
"Parse",
"(",
"fmt",
".",
"Sprintf",
"(",
"\"gs://%s\"",
",",
"src",
")",
")",
"\n",
"if",
"err",
"!=",
... | // newGCSJobSource creates a new gcsJobSource from a given bucket and jobPrefix | [
"newGCSJobSource",
"creates",
"a",
"new",
"gcsJobSource",
"from",
"a",
"given",
"bucket",
"and",
"jobPrefix"
] | 8125fbda10178887be5dff9e901d6a0a519b67bc | https://github.com/kubernetes/test-infra/blob/8125fbda10178887be5dff9e901d6a0a519b67bc/prow/spyglass/gcsartifact_fetcher.go#L79-L104 | test |
kubernetes/test-infra | prow/spyglass/gcsartifact_fetcher.go | artifacts | func (af *GCSArtifactFetcher) artifacts(key string) ([]string, error) {
src, err := newGCSJobSource(key)
if err != nil {
return nil, fmt.Errorf("Failed to get GCS job source from %s: %v", key, err)
}
listStart := time.Now()
bucketName, prefix := extractBucketPrefixPair(src.jobPath())
artifacts := []string{}
b... | go | func (af *GCSArtifactFetcher) artifacts(key string) ([]string, error) {
src, err := newGCSJobSource(key)
if err != nil {
return nil, fmt.Errorf("Failed to get GCS job source from %s: %v", key, err)
}
listStart := time.Now()
bucketName, prefix := extractBucketPrefixPair(src.jobPath())
artifacts := []string{}
b... | [
"func",
"(",
"af",
"*",
"GCSArtifactFetcher",
")",
"artifacts",
"(",
"key",
"string",
")",
"(",
"[",
"]",
"string",
",",
"error",
")",
"{",
"src",
",",
"err",
":=",
"newGCSJobSource",
"(",
"key",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
... | // Artifacts lists all artifacts available for the given job source | [
"Artifacts",
"lists",
"all",
"artifacts",
"available",
"for",
"the",
"given",
"job",
"source"
] | 8125fbda10178887be5dff9e901d6a0a519b67bc | https://github.com/kubernetes/test-infra/blob/8125fbda10178887be5dff9e901d6a0a519b67bc/prow/spyglass/gcsartifact_fetcher.go#L107-L143 | test |
kubernetes/test-infra | prow/spyglass/gcsartifact_fetcher.go | canonicalLink | func (src *gcsJobSource) canonicalLink() string {
return path.Join(src.linkPrefix, src.bucket, src.jobPrefix)
} | go | func (src *gcsJobSource) canonicalLink() string {
return path.Join(src.linkPrefix, src.bucket, src.jobPrefix)
} | [
"func",
"(",
"src",
"*",
"gcsJobSource",
")",
"canonicalLink",
"(",
")",
"string",
"{",
"return",
"path",
".",
"Join",
"(",
"src",
".",
"linkPrefix",
",",
"src",
".",
"bucket",
",",
"src",
".",
"jobPrefix",
")",
"\n",
"}"
] | // CanonicalLink gets a link to the location of job-specific artifacts in GCS | [
"CanonicalLink",
"gets",
"a",
"link",
"to",
"the",
"location",
"of",
"job",
"-",
"specific",
"artifacts",
"in",
"GCS"
] | 8125fbda10178887be5dff9e901d6a0a519b67bc | https://github.com/kubernetes/test-infra/blob/8125fbda10178887be5dff9e901d6a0a519b67bc/prow/spyglass/gcsartifact_fetcher.go#L183-L185 | test |
kubernetes/test-infra | prow/spyglass/gcsartifact_fetcher.go | jobPath | func (src *gcsJobSource) jobPath() string {
return fmt.Sprintf("%s/%s", src.bucket, src.jobPrefix)
} | go | func (src *gcsJobSource) jobPath() string {
return fmt.Sprintf("%s/%s", src.bucket, src.jobPrefix)
} | [
"func",
"(",
"src",
"*",
"gcsJobSource",
")",
"jobPath",
"(",
")",
"string",
"{",
"return",
"fmt",
".",
"Sprintf",
"(",
"\"%s/%s\"",
",",
"src",
".",
"bucket",
",",
"src",
".",
"jobPrefix",
")",
"\n",
"}"
] | // JobPath gets the prefix to all artifacts in GCS in the job | [
"JobPath",
"gets",
"the",
"prefix",
"to",
"all",
"artifacts",
"in",
"GCS",
"in",
"the",
"job"
] | 8125fbda10178887be5dff9e901d6a0a519b67bc | https://github.com/kubernetes/test-infra/blob/8125fbda10178887be5dff9e901d6a0a519b67bc/prow/spyglass/gcsartifact_fetcher.go#L188-L190 | test |
kubernetes/test-infra | prow/tide/status.go | targetURL | func targetURL(c config.Getter, pr *PullRequest, log *logrus.Entry) string {
var link string
if tideURL := c().Tide.TargetURL; tideURL != "" {
link = tideURL
} else if baseURL := c().Tide.PRStatusBaseURL; baseURL != "" {
parseURL, err := url.Parse(baseURL)
if err != nil {
log.WithError(err).Error("Failed to... | go | func targetURL(c config.Getter, pr *PullRequest, log *logrus.Entry) string {
var link string
if tideURL := c().Tide.TargetURL; tideURL != "" {
link = tideURL
} else if baseURL := c().Tide.PRStatusBaseURL; baseURL != "" {
parseURL, err := url.Parse(baseURL)
if err != nil {
log.WithError(err).Error("Failed to... | [
"func",
"targetURL",
"(",
"c",
"config",
".",
"Getter",
",",
"pr",
"*",
"PullRequest",
",",
"log",
"*",
"logrus",
".",
"Entry",
")",
"string",
"{",
"var",
"link",
"string",
"\n",
"if",
"tideURL",
":=",
"c",
"(",
")",
".",
"Tide",
".",
"TargetURL",
... | // targetURL determines the URL used for more details in the status
// context on GitHub. If no PR dashboard is configured, we will use
// the administrative Prow overview. | [
"targetURL",
"determines",
"the",
"URL",
"used",
"for",
"more",
"details",
"in",
"the",
"status",
"context",
"on",
"GitHub",
".",
"If",
"no",
"PR",
"dashboard",
"is",
"configured",
"we",
"will",
"use",
"the",
"administrative",
"Prow",
"overview",
"."
] | 8125fbda10178887be5dff9e901d6a0a519b67bc | https://github.com/kubernetes/test-infra/blob/8125fbda10178887be5dff9e901d6a0a519b67bc/prow/tide/status.go#L242-L259 | test |
kubernetes/test-infra | prow/cmd/build/main.go | newBuildConfig | func newBuildConfig(cfg rest.Config, stop chan struct{}) (*buildConfig, error) {
bc, err := buildset.NewForConfig(&cfg)
if err != nil {
return nil, err
}
// Ensure the knative-build CRD is deployed
// TODO(fejta): probably a better way to do this
_, err = bc.BuildV1alpha1().Builds("").List(metav1.ListOptions{L... | go | func newBuildConfig(cfg rest.Config, stop chan struct{}) (*buildConfig, error) {
bc, err := buildset.NewForConfig(&cfg)
if err != nil {
return nil, err
}
// Ensure the knative-build CRD is deployed
// TODO(fejta): probably a better way to do this
_, err = bc.BuildV1alpha1().Builds("").List(metav1.ListOptions{L... | [
"func",
"newBuildConfig",
"(",
"cfg",
"rest",
".",
"Config",
",",
"stop",
"chan",
"struct",
"{",
"}",
")",
"(",
"*",
"buildConfig",
",",
"error",
")",
"{",
"bc",
",",
"err",
":=",
"buildset",
".",
"NewForConfig",
"(",
"&",
"cfg",
")",
"\n",
"if",
"... | // newBuildConfig returns a client and informer capable of mutating and monitoring the specified config. | [
"newBuildConfig",
"returns",
"a",
"client",
"and",
"informer",
"capable",
"of",
"mutating",
"and",
"monitoring",
"the",
"specified",
"config",
"."
] | 8125fbda10178887be5dff9e901d6a0a519b67bc | https://github.com/kubernetes/test-infra/blob/8125fbda10178887be5dff9e901d6a0a519b67bc/prow/cmd/build/main.go#L109-L129 | test |
kubernetes/test-infra | pkg/ghclient/core.go | NewClient | func NewClient(token string, dryRun bool) *Client {
httpClient := &http.Client{
Transport: &oauth2.Transport{
Base: http.DefaultTransport,
Source: oauth2.ReuseTokenSource(nil, oauth2.StaticTokenSource(&oauth2.Token{AccessToken: token})),
},
}
client := github.NewClient(httpClient)
return &Client{
issu... | go | func NewClient(token string, dryRun bool) *Client {
httpClient := &http.Client{
Transport: &oauth2.Transport{
Base: http.DefaultTransport,
Source: oauth2.ReuseTokenSource(nil, oauth2.StaticTokenSource(&oauth2.Token{AccessToken: token})),
},
}
client := github.NewClient(httpClient)
return &Client{
issu... | [
"func",
"NewClient",
"(",
"token",
"string",
",",
"dryRun",
"bool",
")",
"*",
"Client",
"{",
"httpClient",
":=",
"&",
"http",
".",
"Client",
"{",
"Transport",
":",
"&",
"oauth2",
".",
"Transport",
"{",
"Base",
":",
"http",
".",
"DefaultTransport",
",",
... | // NewClient makes a new Client with the specified token and dry-run status. | [
"NewClient",
"makes",
"a",
"new",
"Client",
"with",
"the",
"specified",
"token",
"and",
"dry",
"-",
"run",
"status",
"."
] | 8125fbda10178887be5dff9e901d6a0a519b67bc | https://github.com/kubernetes/test-infra/blob/8125fbda10178887be5dff9e901d6a0a519b67bc/pkg/ghclient/core.go#L49-L67 | test |
kubernetes/test-infra | pkg/ghclient/core.go | retry | func (c *Client) retry(action string, call func() (*github.Response, error)) (*github.Response, error) {
var err error
var resp *github.Response
for retryCount := 0; retryCount <= c.retries; retryCount++ {
if resp, err = call(); err == nil {
c.limitRate(&resp.Rate)
return resp, nil
}
switch err := err.(... | go | func (c *Client) retry(action string, call func() (*github.Response, error)) (*github.Response, error) {
var err error
var resp *github.Response
for retryCount := 0; retryCount <= c.retries; retryCount++ {
if resp, err = call(); err == nil {
c.limitRate(&resp.Rate)
return resp, nil
}
switch err := err.(... | [
"func",
"(",
"c",
"*",
"Client",
")",
"retry",
"(",
"action",
"string",
",",
"call",
"func",
"(",
")",
"(",
"*",
"github",
".",
"Response",
",",
"error",
")",
")",
"(",
"*",
"github",
".",
"Response",
",",
"error",
")",
"{",
"var",
"err",
"error"... | // retry handles rate limiting and retry logic for a github API call. | [
"retry",
"handles",
"rate",
"limiting",
"and",
"retry",
"logic",
"for",
"a",
"github",
"API",
"call",
"."
] | 8125fbda10178887be5dff9e901d6a0a519b67bc | https://github.com/kubernetes/test-infra/blob/8125fbda10178887be5dff9e901d6a0a519b67bc/pkg/ghclient/core.go#L95-L120 | test |
kubernetes/test-infra | pkg/ghclient/core.go | depaginate | func (c *Client) depaginate(action string, opts *github.ListOptions, call func() ([]interface{}, *github.Response, error)) ([]interface{}, error) {
var allItems []interface{}
wrapper := func() (*github.Response, error) {
items, resp, err := call()
if err == nil {
allItems = append(allItems, items...)
}
ret... | go | func (c *Client) depaginate(action string, opts *github.ListOptions, call func() ([]interface{}, *github.Response, error)) ([]interface{}, error) {
var allItems []interface{}
wrapper := func() (*github.Response, error) {
items, resp, err := call()
if err == nil {
allItems = append(allItems, items...)
}
ret... | [
"func",
"(",
"c",
"*",
"Client",
")",
"depaginate",
"(",
"action",
"string",
",",
"opts",
"*",
"github",
".",
"ListOptions",
",",
"call",
"func",
"(",
")",
"(",
"[",
"]",
"interface",
"{",
"}",
",",
"*",
"github",
".",
"Response",
",",
"error",
")"... | // depaginate adds depagination on top of the retry and rate limiting logic provided by retry. | [
"depaginate",
"adds",
"depagination",
"on",
"top",
"of",
"the",
"retry",
"and",
"rate",
"limiting",
"logic",
"provided",
"by",
"retry",
"."
] | 8125fbda10178887be5dff9e901d6a0a519b67bc | https://github.com/kubernetes/test-infra/blob/8125fbda10178887be5dff9e901d6a0a519b67bc/pkg/ghclient/core.go#L123-L146 | test |
kubernetes/test-infra | prow/pluginhelp/hook/hook.go | NewHelpAgent | func NewHelpAgent(pa pluginAgent, ghc githubClient) *HelpAgent {
l := logrus.WithField("client", "plugin-help")
return &HelpAgent{
log: l,
pa: pa,
oa: newOrgAgent(l, ghc, newRepoDetectionLimit),
}
} | go | func NewHelpAgent(pa pluginAgent, ghc githubClient) *HelpAgent {
l := logrus.WithField("client", "plugin-help")
return &HelpAgent{
log: l,
pa: pa,
oa: newOrgAgent(l, ghc, newRepoDetectionLimit),
}
} | [
"func",
"NewHelpAgent",
"(",
"pa",
"pluginAgent",
",",
"ghc",
"githubClient",
")",
"*",
"HelpAgent",
"{",
"l",
":=",
"logrus",
".",
"WithField",
"(",
"\"client\"",
",",
"\"plugin-help\"",
")",
"\n",
"return",
"&",
"HelpAgent",
"{",
"log",
":",
"l",
",",
... | // NewHelpAgent constructs a new HelpAgent. | [
"NewHelpAgent",
"constructs",
"a",
"new",
"HelpAgent",
"."
] | 8125fbda10178887be5dff9e901d6a0a519b67bc | https://github.com/kubernetes/test-infra/blob/8125fbda10178887be5dff9e901d6a0a519b67bc/prow/pluginhelp/hook/hook.go#L69-L76 | test |
kubernetes/test-infra | prow/pluginhelp/hook/hook.go | GeneratePluginHelp | func (ha *HelpAgent) GeneratePluginHelp() *pluginhelp.Help {
config := ha.pa.Config()
orgToRepos := ha.oa.orgToReposMap(config)
normalRevMap, externalRevMap := reversePluginMaps(config, orgToRepos)
allPlugins, pluginHelp := ha.generateNormalPluginHelp(config, normalRevMap)
allExternalPlugins, externalPluginHelp... | go | func (ha *HelpAgent) GeneratePluginHelp() *pluginhelp.Help {
config := ha.pa.Config()
orgToRepos := ha.oa.orgToReposMap(config)
normalRevMap, externalRevMap := reversePluginMaps(config, orgToRepos)
allPlugins, pluginHelp := ha.generateNormalPluginHelp(config, normalRevMap)
allExternalPlugins, externalPluginHelp... | [
"func",
"(",
"ha",
"*",
"HelpAgent",
")",
"GeneratePluginHelp",
"(",
")",
"*",
"pluginhelp",
".",
"Help",
"{",
"config",
":=",
"ha",
".",
"pa",
".",
"Config",
"(",
")",
"\n",
"orgToRepos",
":=",
"ha",
".",
"oa",
".",
"orgToReposMap",
"(",
"config",
"... | // GeneratePluginHelp compiles and returns the help information for all plugins. | [
"GeneratePluginHelp",
"compiles",
"and",
"returns",
"the",
"help",
"information",
"for",
"all",
"plugins",
"."
] | 8125fbda10178887be5dff9e901d6a0a519b67bc | https://github.com/kubernetes/test-infra/blob/8125fbda10178887be5dff9e901d6a0a519b67bc/prow/pluginhelp/hook/hook.go#L145-L178 | test |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.