repo stringlengths 5 67 | path stringlengths 4 218 | func_name stringlengths 0 151 | original_string stringlengths 52 373k | language stringclasses 6
values | code stringlengths 52 373k | code_tokens listlengths 10 512 | docstring stringlengths 3 47.2k | docstring_tokens listlengths 3 234 | sha stringlengths 40 40 | url stringlengths 85 339 | partition stringclasses 3
values |
|---|---|---|---|---|---|---|---|---|---|---|---|
kubernetes/test-infra | prow/jenkins/jenkins.go | JobParameterized | func (c *Client) JobParameterized(jobInfo *JobInfo) bool {
for _, prop := range jobInfo.Property {
if prop.ParameterDefinitions != nil && len(prop.ParameterDefinitions) > 0 {
return true
}
}
return false
} | go | func (c *Client) JobParameterized(jobInfo *JobInfo) bool {
for _, prop := range jobInfo.Property {
if prop.ParameterDefinitions != nil && len(prop.ParameterDefinitions) > 0 {
return true
}
}
return false
} | [
"func",
"(",
"c",
"*",
"Client",
")",
"JobParameterized",
"(",
"jobInfo",
"*",
"JobInfo",
")",
"bool",
"{",
"for",
"_",
",",
"prop",
":=",
"range",
"jobInfo",
".",
"Property",
"{",
"if",
"prop",
".",
"ParameterDefinitions",
"!=",
"nil",
"&&",
"len",
"(... | // JobParameterized tells us if the Jenkins job for this ProwJob is parameterized | [
"JobParameterized",
"tells",
"us",
"if",
"the",
"Jenkins",
"job",
"for",
"this",
"ProwJob",
"is",
"parameterized"
] | 8125fbda10178887be5dff9e901d6a0a519b67bc | https://github.com/kubernetes/test-infra/blob/8125fbda10178887be5dff9e901d6a0a519b67bc/prow/jenkins/jenkins.go#L483-L491 | test |
kubernetes/test-infra | prow/jenkins/jenkins.go | EnsureBuildableJob | func (c *Client) EnsureBuildableJob(spec *prowapi.ProwJobSpec) error {
var jobInfo *JobInfo
// wait at most 20 seconds for the job to appear
getJobInfoBackoff := wait.Backoff{
Duration: time.Duration(10) * time.Second,
Factor: 1,
Jitter: 0,
Steps: 2,
}
getJobErr := wait.ExponentialBackoff(getJobIn... | go | func (c *Client) EnsureBuildableJob(spec *prowapi.ProwJobSpec) error {
var jobInfo *JobInfo
// wait at most 20 seconds for the job to appear
getJobInfoBackoff := wait.Backoff{
Duration: time.Duration(10) * time.Second,
Factor: 1,
Jitter: 0,
Steps: 2,
}
getJobErr := wait.ExponentialBackoff(getJobIn... | [
"func",
"(",
"c",
"*",
"Client",
")",
"EnsureBuildableJob",
"(",
"spec",
"*",
"prowapi",
".",
"ProwJobSpec",
")",
"error",
"{",
"var",
"jobInfo",
"*",
"JobInfo",
"\n",
"getJobInfoBackoff",
":=",
"wait",
".",
"Backoff",
"{",
"Duration",
":",
"time",
".",
... | // EnsureBuildableJob attempts to detect a job that hasn't yet ran and populated
// its parameters. If detected, it tries to run a build until the job parameters
// are processed, then it aborts the build. | [
"EnsureBuildableJob",
"attempts",
"to",
"detect",
"a",
"job",
"that",
"hasn",
"t",
"yet",
"ran",
"and",
"populated",
"its",
"parameters",
".",
"If",
"detected",
"it",
"tries",
"to",
"run",
"a",
"build",
"until",
"the",
"job",
"parameters",
"are",
"processed"... | 8125fbda10178887be5dff9e901d6a0a519b67bc | https://github.com/kubernetes/test-infra/blob/8125fbda10178887be5dff9e901d6a0a519b67bc/prow/jenkins/jenkins.go#L496-L565 | test |
kubernetes/test-infra | prow/jenkins/jenkins.go | LaunchBuild | func (c *Client) LaunchBuild(spec *prowapi.ProwJobSpec, params url.Values) error {
var path string
if params != nil {
path = getBuildWithParametersPath(spec)
} else {
path = getBuildPath(spec)
}
c.logger.Debugf("getBuildPath/getBuildWithParametersPath: %s", path)
resp, err := c.request(http.MethodPost, pat... | go | func (c *Client) LaunchBuild(spec *prowapi.ProwJobSpec, params url.Values) error {
var path string
if params != nil {
path = getBuildWithParametersPath(spec)
} else {
path = getBuildPath(spec)
}
c.logger.Debugf("getBuildPath/getBuildWithParametersPath: %s", path)
resp, err := c.request(http.MethodPost, pat... | [
"func",
"(",
"c",
"*",
"Client",
")",
"LaunchBuild",
"(",
"spec",
"*",
"prowapi",
".",
"ProwJobSpec",
",",
"params",
"url",
".",
"Values",
")",
"error",
"{",
"var",
"path",
"string",
"\n",
"if",
"params",
"!=",
"nil",
"{",
"path",
"=",
"getBuildWithPar... | // LaunchBuild launches a regular or parameterized Jenkins build, depending on
// whether or not we have `params` to POST | [
"LaunchBuild",
"launches",
"a",
"regular",
"or",
"parameterized",
"Jenkins",
"build",
"depending",
"on",
"whether",
"or",
"not",
"we",
"have",
"params",
"to",
"POST"
] | 8125fbda10178887be5dff9e901d6a0a519b67bc | https://github.com/kubernetes/test-infra/blob/8125fbda10178887be5dff9e901d6a0a519b67bc/prow/jenkins/jenkins.go#L569-L593 | test |
kubernetes/test-infra | prow/jenkins/jenkins.go | Build | func (c *Client) Build(pj *prowapi.ProwJob, buildID string) error {
c.logger.WithFields(pjutil.ProwJobFields(pj)).Info("Build")
return c.BuildFromSpec(&pj.Spec, buildID, pj.ObjectMeta.Name)
} | go | func (c *Client) Build(pj *prowapi.ProwJob, buildID string) error {
c.logger.WithFields(pjutil.ProwJobFields(pj)).Info("Build")
return c.BuildFromSpec(&pj.Spec, buildID, pj.ObjectMeta.Name)
} | [
"func",
"(",
"c",
"*",
"Client",
")",
"Build",
"(",
"pj",
"*",
"prowapi",
".",
"ProwJob",
",",
"buildID",
"string",
")",
"error",
"{",
"c",
".",
"logger",
".",
"WithFields",
"(",
"pjutil",
".",
"ProwJobFields",
"(",
"pj",
")",
")",
".",
"Info",
"("... | // Build triggers a Jenkins build for the provided ProwJob. The name of
// the ProwJob is going to be used as the Prow Job ID parameter that will
// help us track the build before it's scheduled by Jenkins. | [
"Build",
"triggers",
"a",
"Jenkins",
"build",
"for",
"the",
"provided",
"ProwJob",
".",
"The",
"name",
"of",
"the",
"ProwJob",
"is",
"going",
"to",
"be",
"used",
"as",
"the",
"Prow",
"Job",
"ID",
"parameter",
"that",
"will",
"help",
"us",
"track",
"the",... | 8125fbda10178887be5dff9e901d6a0a519b67bc | https://github.com/kubernetes/test-infra/blob/8125fbda10178887be5dff9e901d6a0a519b67bc/prow/jenkins/jenkins.go#L598-L601 | test |
kubernetes/test-infra | prow/jenkins/jenkins.go | BuildFromSpec | func (c *Client) BuildFromSpec(spec *prowapi.ProwJobSpec, buildID, prowJobID string) error {
if c.dryRun {
return nil
}
env, err := downwardapi.EnvForSpec(downwardapi.NewJobSpec(*spec, buildID, prowJobID))
if err != nil {
return err
}
params := url.Values{}
for key, value := range env {
params.Set(key, val... | go | func (c *Client) BuildFromSpec(spec *prowapi.ProwJobSpec, buildID, prowJobID string) error {
if c.dryRun {
return nil
}
env, err := downwardapi.EnvForSpec(downwardapi.NewJobSpec(*spec, buildID, prowJobID))
if err != nil {
return err
}
params := url.Values{}
for key, value := range env {
params.Set(key, val... | [
"func",
"(",
"c",
"*",
"Client",
")",
"BuildFromSpec",
"(",
"spec",
"*",
"prowapi",
".",
"ProwJobSpec",
",",
"buildID",
",",
"prowJobID",
"string",
")",
"error",
"{",
"if",
"c",
".",
"dryRun",
"{",
"return",
"nil",
"\n",
"}",
"\n",
"env",
",",
"err",... | // BuildFromSpec triggers a Jenkins build for the provided ProwJobSpec.
// prowJobID helps us track the build before it's scheduled by Jenkins. | [
"BuildFromSpec",
"triggers",
"a",
"Jenkins",
"build",
"for",
"the",
"provided",
"ProwJobSpec",
".",
"prowJobID",
"helps",
"us",
"track",
"the",
"build",
"before",
"it",
"s",
"scheduled",
"by",
"Jenkins",
"."
] | 8125fbda10178887be5dff9e901d6a0a519b67bc | https://github.com/kubernetes/test-infra/blob/8125fbda10178887be5dff9e901d6a0a519b67bc/prow/jenkins/jenkins.go#L605-L623 | test |
kubernetes/test-infra | prow/jenkins/jenkins.go | GetEnqueuedBuilds | func (c *Client) GetEnqueuedBuilds(jobs []BuildQueryParams) (map[string]Build, error) {
c.logger.Debug("GetEnqueuedBuilds")
data, err := c.Get("/queue/api/json?tree=items[task[name],actions[parameters[name,value]]]")
if err != nil {
return nil, fmt.Errorf("cannot list builds from the queue: %v", err)
}
page := ... | go | func (c *Client) GetEnqueuedBuilds(jobs []BuildQueryParams) (map[string]Build, error) {
c.logger.Debug("GetEnqueuedBuilds")
data, err := c.Get("/queue/api/json?tree=items[task[name],actions[parameters[name,value]]]")
if err != nil {
return nil, fmt.Errorf("cannot list builds from the queue: %v", err)
}
page := ... | [
"func",
"(",
"c",
"*",
"Client",
")",
"GetEnqueuedBuilds",
"(",
"jobs",
"[",
"]",
"BuildQueryParams",
")",
"(",
"map",
"[",
"string",
"]",
"Build",
",",
"error",
")",
"{",
"c",
".",
"logger",
".",
"Debug",
"(",
"\"GetEnqueuedBuilds\"",
")",
"\n",
"data... | // GetEnqueuedBuilds lists all enqueued builds for the provided jobs. | [
"GetEnqueuedBuilds",
"lists",
"all",
"enqueued",
"builds",
"for",
"the",
"provided",
"jobs",
"."
] | 8125fbda10178887be5dff9e901d6a0a519b67bc | https://github.com/kubernetes/test-infra/blob/8125fbda10178887be5dff9e901d6a0a519b67bc/prow/jenkins/jenkins.go#L674-L709 | test |
kubernetes/test-infra | prow/jenkins/jenkins.go | Abort | func (c *Client) Abort(job string, build *Build) error {
c.logger.Debugf("Abort(%v %v)", job, build.Number)
if c.dryRun {
return nil
}
resp, err := c.request(http.MethodPost, fmt.Sprintf("/job/%s/%d/stop", job, build.Number), nil, false)
if err != nil {
return err
}
defer resp.Body.Close()
if resp.StatusCod... | go | func (c *Client) Abort(job string, build *Build) error {
c.logger.Debugf("Abort(%v %v)", job, build.Number)
if c.dryRun {
return nil
}
resp, err := c.request(http.MethodPost, fmt.Sprintf("/job/%s/%d/stop", job, build.Number), nil, false)
if err != nil {
return err
}
defer resp.Body.Close()
if resp.StatusCod... | [
"func",
"(",
"c",
"*",
"Client",
")",
"Abort",
"(",
"job",
"string",
",",
"build",
"*",
"Build",
")",
"error",
"{",
"c",
".",
"logger",
".",
"Debugf",
"(",
"\"Abort(%v %v)\"",
",",
"job",
",",
"build",
".",
"Number",
")",
"\n",
"if",
"c",
".",
"d... | // Abort aborts the provided Jenkins build for job. | [
"Abort",
"aborts",
"the",
"provided",
"Jenkins",
"build",
"for",
"job",
"."
] | 8125fbda10178887be5dff9e901d6a0a519b67bc | https://github.com/kubernetes/test-infra/blob/8125fbda10178887be5dff9e901d6a0a519b67bc/prow/jenkins/jenkins.go#L745-L759 | test |
kubernetes/test-infra | prow/pjutil/tot.go | PresubmitToJobSpec | func PresubmitToJobSpec(pre config.Presubmit) *downwardapi.JobSpec {
return &downwardapi.JobSpec{
Type: prowapi.PresubmitJob,
Job: pre.Name,
}
} | go | func PresubmitToJobSpec(pre config.Presubmit) *downwardapi.JobSpec {
return &downwardapi.JobSpec{
Type: prowapi.PresubmitJob,
Job: pre.Name,
}
} | [
"func",
"PresubmitToJobSpec",
"(",
"pre",
"config",
".",
"Presubmit",
")",
"*",
"downwardapi",
".",
"JobSpec",
"{",
"return",
"&",
"downwardapi",
".",
"JobSpec",
"{",
"Type",
":",
"prowapi",
".",
"PresubmitJob",
",",
"Job",
":",
"pre",
".",
"Name",
",",
... | // PresubmitToJobSpec generates a downwardapi.JobSpec out of a Presubmit.
// Useful for figuring out GCS paths when parsing jobs out
// of a prow config. | [
"PresubmitToJobSpec",
"generates",
"a",
"downwardapi",
".",
"JobSpec",
"out",
"of",
"a",
"Presubmit",
".",
"Useful",
"for",
"figuring",
"out",
"GCS",
"paths",
"when",
"parsing",
"jobs",
"out",
"of",
"a",
"prow",
"config",
"."
] | 8125fbda10178887be5dff9e901d6a0a519b67bc | https://github.com/kubernetes/test-infra/blob/8125fbda10178887be5dff9e901d6a0a519b67bc/prow/pjutil/tot.go#L51-L56 | test |
kubernetes/test-infra | prow/pjutil/tot.go | PostsubmitToJobSpec | func PostsubmitToJobSpec(post config.Postsubmit) *downwardapi.JobSpec {
return &downwardapi.JobSpec{
Type: prowapi.PostsubmitJob,
Job: post.Name,
}
} | go | func PostsubmitToJobSpec(post config.Postsubmit) *downwardapi.JobSpec {
return &downwardapi.JobSpec{
Type: prowapi.PostsubmitJob,
Job: post.Name,
}
} | [
"func",
"PostsubmitToJobSpec",
"(",
"post",
"config",
".",
"Postsubmit",
")",
"*",
"downwardapi",
".",
"JobSpec",
"{",
"return",
"&",
"downwardapi",
".",
"JobSpec",
"{",
"Type",
":",
"prowapi",
".",
"PostsubmitJob",
",",
"Job",
":",
"post",
".",
"Name",
",... | // PostsubmitToJobSpec generates a downwardapi.JobSpec out of a Postsubmit.
// Useful for figuring out GCS paths when parsing jobs out
// of a prow config. | [
"PostsubmitToJobSpec",
"generates",
"a",
"downwardapi",
".",
"JobSpec",
"out",
"of",
"a",
"Postsubmit",
".",
"Useful",
"for",
"figuring",
"out",
"GCS",
"paths",
"when",
"parsing",
"jobs",
"out",
"of",
"a",
"prow",
"config",
"."
] | 8125fbda10178887be5dff9e901d6a0a519b67bc | https://github.com/kubernetes/test-infra/blob/8125fbda10178887be5dff9e901d6a0a519b67bc/prow/pjutil/tot.go#L61-L66 | test |
kubernetes/test-infra | prow/pjutil/tot.go | PeriodicToJobSpec | func PeriodicToJobSpec(periodic config.Periodic) *downwardapi.JobSpec {
return &downwardapi.JobSpec{
Type: prowapi.PeriodicJob,
Job: periodic.Name,
}
} | go | func PeriodicToJobSpec(periodic config.Periodic) *downwardapi.JobSpec {
return &downwardapi.JobSpec{
Type: prowapi.PeriodicJob,
Job: periodic.Name,
}
} | [
"func",
"PeriodicToJobSpec",
"(",
"periodic",
"config",
".",
"Periodic",
")",
"*",
"downwardapi",
".",
"JobSpec",
"{",
"return",
"&",
"downwardapi",
".",
"JobSpec",
"{",
"Type",
":",
"prowapi",
".",
"PeriodicJob",
",",
"Job",
":",
"periodic",
".",
"Name",
... | // PeriodicToJobSpec generates a downwardapi.JobSpec out of a Periodic.
// Useful for figuring out GCS paths when parsing jobs out
// of a prow config. | [
"PeriodicToJobSpec",
"generates",
"a",
"downwardapi",
".",
"JobSpec",
"out",
"of",
"a",
"Periodic",
".",
"Useful",
"for",
"figuring",
"out",
"GCS",
"paths",
"when",
"parsing",
"jobs",
"out",
"of",
"a",
"prow",
"config",
"."
] | 8125fbda10178887be5dff9e901d6a0a519b67bc | https://github.com/kubernetes/test-infra/blob/8125fbda10178887be5dff9e901d6a0a519b67bc/prow/pjutil/tot.go#L71-L76 | test |
kubernetes/test-infra | prow/pjutil/tot.go | GetBuildID | func GetBuildID(name, totURL string) (string, error) {
if totURL == "" {
return node.Generate().String(), nil
}
var err error
url, err := url.Parse(totURL)
if err != nil {
return "", fmt.Errorf("invalid tot url: %v", err)
}
url.Path = path.Join(url.Path, "vend", name)
sleepDuration := 100 * time.Millisecond... | go | func GetBuildID(name, totURL string) (string, error) {
if totURL == "" {
return node.Generate().String(), nil
}
var err error
url, err := url.Parse(totURL)
if err != nil {
return "", fmt.Errorf("invalid tot url: %v", err)
}
url.Path = path.Join(url.Path, "vend", name)
sleepDuration := 100 * time.Millisecond... | [
"func",
"GetBuildID",
"(",
"name",
",",
"totURL",
"string",
")",
"(",
"string",
",",
"error",
")",
"{",
"if",
"totURL",
"==",
"\"\"",
"{",
"return",
"node",
".",
"Generate",
"(",
")",
".",
"String",
"(",
")",
",",
"nil",
"\n",
"}",
"\n",
"var",
"... | // GetBuildID calls out to `tot` in order
// to vend build identifier for the job | [
"GetBuildID",
"calls",
"out",
"to",
"tot",
"in",
"order",
"to",
"vend",
"build",
"identifier",
"for",
"the",
"job"
] | 8125fbda10178887be5dff9e901d6a0a519b67bc | https://github.com/kubernetes/test-infra/blob/8125fbda10178887be5dff9e901d6a0a519b67bc/prow/pjutil/tot.go#L80-L114 | test |
kubernetes/test-infra | robots/coverage/downloader/downloader.go | listGcsObjects | func listGcsObjects(ctx context.Context, client *storage.Client, bucketName, prefix, delim string) (
[]string, error) {
var objects []string
it := client.Bucket(bucketName).Objects(ctx, &storage.Query{
Prefix: prefix,
Delimiter: delim,
})
for {
attrs, err := it.Next()
if err == iterator.Done {
brea... | go | func listGcsObjects(ctx context.Context, client *storage.Client, bucketName, prefix, delim string) (
[]string, error) {
var objects []string
it := client.Bucket(bucketName).Objects(ctx, &storage.Query{
Prefix: prefix,
Delimiter: delim,
})
for {
attrs, err := it.Next()
if err == iterator.Done {
brea... | [
"func",
"listGcsObjects",
"(",
"ctx",
"context",
".",
"Context",
",",
"client",
"*",
"storage",
".",
"Client",
",",
"bucketName",
",",
"prefix",
",",
"delim",
"string",
")",
"(",
"[",
"]",
"string",
",",
"error",
")",
"{",
"var",
"objects",
"[",
"]",
... | //listGcsObjects get the slice of gcs objects under a given path | [
"listGcsObjects",
"get",
"the",
"slice",
"of",
"gcs",
"objects",
"under",
"a",
"given",
"path"
] | 8125fbda10178887be5dff9e901d6a0a519b67bc | https://github.com/kubernetes/test-infra/blob/8125fbda10178887be5dff9e901d6a0a519b67bc/robots/coverage/downloader/downloader.go#L41-L65 | test |
kubernetes/test-infra | robots/coverage/downloader/downloader.go | FindBaseProfile | func FindBaseProfile(ctx context.Context, client *storage.Client, bucket, prowJobName, artifactsDirName,
covProfileName string) ([]byte, error) {
dirOfJob := path.Join("logs", prowJobName)
strBuilds, err := listGcsObjects(ctx, client, bucket, dirOfJob+"/", "/")
if err != nil {
return nil, fmt.Errorf("error list... | go | func FindBaseProfile(ctx context.Context, client *storage.Client, bucket, prowJobName, artifactsDirName,
covProfileName string) ([]byte, error) {
dirOfJob := path.Join("logs", prowJobName)
strBuilds, err := listGcsObjects(ctx, client, bucket, dirOfJob+"/", "/")
if err != nil {
return nil, fmt.Errorf("error list... | [
"func",
"FindBaseProfile",
"(",
"ctx",
"context",
".",
"Context",
",",
"client",
"*",
"storage",
".",
"Client",
",",
"bucket",
",",
"prowJobName",
",",
"artifactsDirName",
",",
"covProfileName",
"string",
")",
"(",
"[",
"]",
"byte",
",",
"error",
")",
"{",... | // FindBaseProfile finds the coverage profile file from the latest healthy build
// stored in given gcs directory | [
"FindBaseProfile",
"finds",
"the",
"coverage",
"profile",
"file",
"from",
"the",
"latest",
"healthy",
"build",
"stored",
"in",
"given",
"gcs",
"directory"
] | 8125fbda10178887be5dff9e901d6a0a519b67bc | https://github.com/kubernetes/test-infra/blob/8125fbda10178887be5dff9e901d6a0a519b67bc/robots/coverage/downloader/downloader.go#L79-L108 | test |
kubernetes/test-infra | robots/coverage/downloader/downloader.go | sortBuilds | func sortBuilds(strBuilds []string) []int {
var res []int
for _, buildStr := range strBuilds {
num, err := strconv.Atoi(buildStr)
if err != nil {
logrus.Infof("Non-int build number found: '%s'", buildStr)
} else {
res = append(res, num)
}
}
sort.Sort(sort.Reverse(sort.IntSlice(res)))
return res
} | go | func sortBuilds(strBuilds []string) []int {
var res []int
for _, buildStr := range strBuilds {
num, err := strconv.Atoi(buildStr)
if err != nil {
logrus.Infof("Non-int build number found: '%s'", buildStr)
} else {
res = append(res, num)
}
}
sort.Sort(sort.Reverse(sort.IntSlice(res)))
return res
} | [
"func",
"sortBuilds",
"(",
"strBuilds",
"[",
"]",
"string",
")",
"[",
"]",
"int",
"{",
"var",
"res",
"[",
"]",
"int",
"\n",
"for",
"_",
",",
"buildStr",
":=",
"range",
"strBuilds",
"{",
"num",
",",
"err",
":=",
"strconv",
".",
"Atoi",
"(",
"buildSt... | // sortBuilds converts all build from str to int and sorts all builds in descending order and
// returns the sorted slice | [
"sortBuilds",
"converts",
"all",
"build",
"from",
"str",
"to",
"int",
"and",
"sorts",
"all",
"builds",
"in",
"descending",
"order",
"and",
"returns",
"the",
"sorted",
"slice"
] | 8125fbda10178887be5dff9e901d6a0a519b67bc | https://github.com/kubernetes/test-infra/blob/8125fbda10178887be5dff9e901d6a0a519b67bc/robots/coverage/downloader/downloader.go#L112-L124 | test |
kubernetes/test-infra | maintenance/aws-janitor/regions/regions.go | GetAll | func GetAll(sess *session.Session) ([]string, error) {
var regions []string
svc := ec2.New(sess, &aws.Config{Region: aws.String(Default)})
resp, err := svc.DescribeRegions(nil)
if err != nil {
return nil, err
}
for _, region := range resp.Regions {
regions = append(regions, *region.RegionName)
}
return regi... | go | func GetAll(sess *session.Session) ([]string, error) {
var regions []string
svc := ec2.New(sess, &aws.Config{Region: aws.String(Default)})
resp, err := svc.DescribeRegions(nil)
if err != nil {
return nil, err
}
for _, region := range resp.Regions {
regions = append(regions, *region.RegionName)
}
return regi... | [
"func",
"GetAll",
"(",
"sess",
"*",
"session",
".",
"Session",
")",
"(",
"[",
"]",
"string",
",",
"error",
")",
"{",
"var",
"regions",
"[",
"]",
"string",
"\n",
"svc",
":=",
"ec2",
".",
"New",
"(",
"sess",
",",
"&",
"aws",
".",
"Config",
"{",
"... | // GetAll retrieves all regions from the AWS API | [
"GetAll",
"retrieves",
"all",
"regions",
"from",
"the",
"AWS",
"API"
] | 8125fbda10178887be5dff9e901d6a0a519b67bc | https://github.com/kubernetes/test-infra/blob/8125fbda10178887be5dff9e901d6a0a519b67bc/maintenance/aws-janitor/regions/regions.go#L37-L48 | test |
kubernetes/test-infra | prow/commentpruner/commentpruner.go | NewEventClient | func NewEventClient(ghc githubClient, log *logrus.Entry, org, repo string, number int) *EventClient {
return &EventClient{
org: org,
repo: repo,
number: number,
ghc: ghc,
log: log,
}
} | go | func NewEventClient(ghc githubClient, log *logrus.Entry, org, repo string, number int) *EventClient {
return &EventClient{
org: org,
repo: repo,
number: number,
ghc: ghc,
log: log,
}
} | [
"func",
"NewEventClient",
"(",
"ghc",
"githubClient",
",",
"log",
"*",
"logrus",
".",
"Entry",
",",
"org",
",",
"repo",
"string",
",",
"number",
"int",
")",
"*",
"EventClient",
"{",
"return",
"&",
"EventClient",
"{",
"org",
":",
"org",
",",
"repo",
":"... | // NewEventClient creates an EventClient struct. This should be used once per webhook event. | [
"NewEventClient",
"creates",
"an",
"EventClient",
"struct",
".",
"This",
"should",
"be",
"used",
"once",
"per",
"webhook",
"event",
"."
] | 8125fbda10178887be5dff9e901d6a0a519b67bc | https://github.com/kubernetes/test-infra/blob/8125fbda10178887be5dff9e901d6a0a519b67bc/prow/commentpruner/commentpruner.go#L54-L63 | test |
kubernetes/test-infra | prow/commentpruner/commentpruner.go | PruneComments | func (c *EventClient) PruneComments(shouldPrune func(github.IssueComment) bool) {
c.once.Do(func() {
botName, err := c.ghc.BotName()
if err != nil {
c.log.WithError(err).Error("failed to get the bot's name. Pruning will consider all comments.")
}
comments, err := c.ghc.ListIssueComments(c.org, c.repo, c.num... | go | func (c *EventClient) PruneComments(shouldPrune func(github.IssueComment) bool) {
c.once.Do(func() {
botName, err := c.ghc.BotName()
if err != nil {
c.log.WithError(err).Error("failed to get the bot's name. Pruning will consider all comments.")
}
comments, err := c.ghc.ListIssueComments(c.org, c.repo, c.num... | [
"func",
"(",
"c",
"*",
"EventClient",
")",
"PruneComments",
"(",
"shouldPrune",
"func",
"(",
"github",
".",
"IssueComment",
")",
"bool",
")",
"{",
"c",
".",
"once",
".",
"Do",
"(",
"func",
"(",
")",
"{",
"botName",
",",
"err",
":=",
"c",
".",
"ghc"... | // PruneComments fetches issue comments if they have not yet been fetched for this webhook event
// and then deletes any bot comments indicated by the func 'shouldPrune'. | [
"PruneComments",
"fetches",
"issue",
"comments",
"if",
"they",
"have",
"not",
"yet",
"been",
"fetched",
"for",
"this",
"webhook",
"event",
"and",
"then",
"deletes",
"any",
"bot",
"comments",
"indicated",
"by",
"the",
"func",
"shouldPrune",
"."
] | 8125fbda10178887be5dff9e901d6a0a519b67bc | https://github.com/kubernetes/test-infra/blob/8125fbda10178887be5dff9e901d6a0a519b67bc/prow/commentpruner/commentpruner.go#L67-L104 | test |
kubernetes/test-infra | prow/plugins/respond.go | FormatResponse | func FormatResponse(to, message, reason string) string {
format := `@%s: %s
<details>
%s
%s
</details>`
return fmt.Sprintf(format, to, message, reason, AboutThisBotWithoutCommands)
} | go | func FormatResponse(to, message, reason string) string {
format := `@%s: %s
<details>
%s
%s
</details>`
return fmt.Sprintf(format, to, message, reason, AboutThisBotWithoutCommands)
} | [
"func",
"FormatResponse",
"(",
"to",
",",
"message",
",",
"reason",
"string",
")",
"string",
"{",
"format",
":=",
"`@%s: %s<details>%s%s</details>`",
"\n",
"return",
"fmt",
".",
"Sprintf",
"(",
"format",
",",
"to",
",",
"message",
",",
"reason",
",",
"AboutT... | // FormatResponse nicely formats a response to a generic reason. | [
"FormatResponse",
"nicely",
"formats",
"a",
"response",
"to",
"a",
"generic",
"reason",
"."
] | 8125fbda10178887be5dff9e901d6a0a519b67bc | https://github.com/kubernetes/test-infra/blob/8125fbda10178887be5dff9e901d6a0a519b67bc/prow/plugins/respond.go#L36-L47 | test |
kubernetes/test-infra | prow/plugins/respond.go | FormatSimpleResponse | func FormatSimpleResponse(to, message string) string {
format := `@%s: %s
<details>
%s
</details>`
return fmt.Sprintf(format, to, message, AboutThisBotWithoutCommands)
} | go | func FormatSimpleResponse(to, message string) string {
format := `@%s: %s
<details>
%s
</details>`
return fmt.Sprintf(format, to, message, AboutThisBotWithoutCommands)
} | [
"func",
"FormatSimpleResponse",
"(",
"to",
",",
"message",
"string",
")",
"string",
"{",
"format",
":=",
"`@%s: %s<details>%s</details>`",
"\n",
"return",
"fmt",
".",
"Sprintf",
"(",
"format",
",",
"to",
",",
"message",
",",
"AboutThisBotWithoutCommands",
")",
"... | // FormatSimpleResponse formats a response that does not warrant additional explanation in the
// details section. | [
"FormatSimpleResponse",
"formats",
"a",
"response",
"that",
"does",
"not",
"warrant",
"additional",
"explanation",
"in",
"the",
"details",
"section",
"."
] | 8125fbda10178887be5dff9e901d6a0a519b67bc | https://github.com/kubernetes/test-infra/blob/8125fbda10178887be5dff9e901d6a0a519b67bc/prow/plugins/respond.go#L51-L60 | test |
kubernetes/test-infra | prow/plugins/respond.go | FormatICResponse | func FormatICResponse(ic github.IssueComment, s string) string {
return FormatResponseRaw(ic.Body, ic.HTMLURL, ic.User.Login, s)
} | go | func FormatICResponse(ic github.IssueComment, s string) string {
return FormatResponseRaw(ic.Body, ic.HTMLURL, ic.User.Login, s)
} | [
"func",
"FormatICResponse",
"(",
"ic",
"github",
".",
"IssueComment",
",",
"s",
"string",
")",
"string",
"{",
"return",
"FormatResponseRaw",
"(",
"ic",
".",
"Body",
",",
"ic",
".",
"HTMLURL",
",",
"ic",
".",
"User",
".",
"Login",
",",
"s",
")",
"\n",
... | // FormatICResponse nicely formats a response to an issue comment. | [
"FormatICResponse",
"nicely",
"formats",
"a",
"response",
"to",
"an",
"issue",
"comment",
"."
] | 8125fbda10178887be5dff9e901d6a0a519b67bc | https://github.com/kubernetes/test-infra/blob/8125fbda10178887be5dff9e901d6a0a519b67bc/prow/plugins/respond.go#L63-L65 | test |
kubernetes/test-infra | prow/plugins/respond.go | FormatResponseRaw | func FormatResponseRaw(body, bodyURL, login, reply string) string {
format := `In response to [this](%s):
%s
`
// Quote the user's comment by prepending ">" to each line.
var quoted []string
for _, l := range strings.Split(body, "\n") {
quoted = append(quoted, ">"+l)
}
return FormatResponse(login, reply, fmt.S... | go | func FormatResponseRaw(body, bodyURL, login, reply string) string {
format := `In response to [this](%s):
%s
`
// Quote the user's comment by prepending ">" to each line.
var quoted []string
for _, l := range strings.Split(body, "\n") {
quoted = append(quoted, ">"+l)
}
return FormatResponse(login, reply, fmt.S... | [
"func",
"FormatResponseRaw",
"(",
"body",
",",
"bodyURL",
",",
"login",
",",
"reply",
"string",
")",
"string",
"{",
"format",
":=",
"`In response to [this](%s):%s`",
"\n",
"var",
"quoted",
"[",
"]",
"string",
"\n",
"for",
"_",
",",
"l",
":=",
"range",
"str... | // FormatResponseRaw nicely formats a response for one does not have an issue comment | [
"FormatResponseRaw",
"nicely",
"formats",
"a",
"response",
"for",
"one",
"does",
"not",
"have",
"an",
"issue",
"comment"
] | 8125fbda10178887be5dff9e901d6a0a519b67bc | https://github.com/kubernetes/test-infra/blob/8125fbda10178887be5dff9e901d6a0a519b67bc/prow/plugins/respond.go#L68-L79 | test |
kubernetes/test-infra | prow/gcsupload/options.go | Validate | func (o *Options) Validate() error {
if o.gcsPath.String() != "" {
o.Bucket = o.gcsPath.Bucket()
o.PathPrefix = o.gcsPath.Object()
}
if !o.DryRun {
if o.Bucket == "" {
return errors.New("GCS upload was requested no GCS bucket was provided")
}
if o.GcsCredentialsFile == "" {
return errors.New("GCS u... | go | func (o *Options) Validate() error {
if o.gcsPath.String() != "" {
o.Bucket = o.gcsPath.Bucket()
o.PathPrefix = o.gcsPath.Object()
}
if !o.DryRun {
if o.Bucket == "" {
return errors.New("GCS upload was requested no GCS bucket was provided")
}
if o.GcsCredentialsFile == "" {
return errors.New("GCS u... | [
"func",
"(",
"o",
"*",
"Options",
")",
"Validate",
"(",
")",
"error",
"{",
"if",
"o",
".",
"gcsPath",
".",
"String",
"(",
")",
"!=",
"\"\"",
"{",
"o",
".",
"Bucket",
"=",
"o",
".",
"gcsPath",
".",
"Bucket",
"(",
")",
"\n",
"o",
".",
"PathPrefix... | // Validate ensures that the set of options are
// self-consistent and valid. | [
"Validate",
"ensures",
"that",
"the",
"set",
"of",
"options",
"are",
"self",
"-",
"consistent",
"and",
"valid",
"."
] | 8125fbda10178887be5dff9e901d6a0a519b67bc | https://github.com/kubernetes/test-infra/blob/8125fbda10178887be5dff9e901d6a0a519b67bc/prow/gcsupload/options.go#L59-L76 | test |
kubernetes/test-infra | prow/gcsupload/options.go | Encode | func Encode(options Options) (string, error) {
encoded, err := json.Marshal(options)
return string(encoded), err
} | go | func Encode(options Options) (string, error) {
encoded, err := json.Marshal(options)
return string(encoded), err
} | [
"func",
"Encode",
"(",
"options",
"Options",
")",
"(",
"string",
",",
"error",
")",
"{",
"encoded",
",",
"err",
":=",
"json",
".",
"Marshal",
"(",
"options",
")",
"\n",
"return",
"string",
"(",
"encoded",
")",
",",
"err",
"\n",
"}"
] | // Encode will encode the set of options in the format that
// is expected for the configuration environment variable. | [
"Encode",
"will",
"encode",
"the",
"set",
"of",
"options",
"in",
"the",
"format",
"that",
"is",
"expected",
"for",
"the",
"configuration",
"environment",
"variable",
"."
] | 8125fbda10178887be5dff9e901d6a0a519b67bc | https://github.com/kubernetes/test-infra/blob/8125fbda10178887be5dff9e901d6a0a519b67bc/prow/gcsupload/options.go#L117-L120 | test |
kubernetes/test-infra | prow/plugins/plugins.go | RegisterIssueHandler | func RegisterIssueHandler(name string, fn IssueHandler, help HelpProvider) {
pluginHelp[name] = help
issueHandlers[name] = fn
} | go | func RegisterIssueHandler(name string, fn IssueHandler, help HelpProvider) {
pluginHelp[name] = help
issueHandlers[name] = fn
} | [
"func",
"RegisterIssueHandler",
"(",
"name",
"string",
",",
"fn",
"IssueHandler",
",",
"help",
"HelpProvider",
")",
"{",
"pluginHelp",
"[",
"name",
"]",
"=",
"help",
"\n",
"issueHandlers",
"[",
"name",
"]",
"=",
"fn",
"\n",
"}"
] | // RegisterIssueHandler registers a plugin's github.IssueEvent handler. | [
"RegisterIssueHandler",
"registers",
"a",
"plugin",
"s",
"github",
".",
"IssueEvent",
"handler",
"."
] | 8125fbda10178887be5dff9e901d6a0a519b67bc | https://github.com/kubernetes/test-infra/blob/8125fbda10178887be5dff9e901d6a0a519b67bc/prow/plugins/plugins.go#L65-L68 | test |
kubernetes/test-infra | prow/plugins/plugins.go | RegisterIssueCommentHandler | func RegisterIssueCommentHandler(name string, fn IssueCommentHandler, help HelpProvider) {
pluginHelp[name] = help
issueCommentHandlers[name] = fn
} | go | func RegisterIssueCommentHandler(name string, fn IssueCommentHandler, help HelpProvider) {
pluginHelp[name] = help
issueCommentHandlers[name] = fn
} | [
"func",
"RegisterIssueCommentHandler",
"(",
"name",
"string",
",",
"fn",
"IssueCommentHandler",
",",
"help",
"HelpProvider",
")",
"{",
"pluginHelp",
"[",
"name",
"]",
"=",
"help",
"\n",
"issueCommentHandlers",
"[",
"name",
"]",
"=",
"fn",
"\n",
"}"
] | // RegisterIssueCommentHandler registers a plugin's github.IssueCommentEvent handler. | [
"RegisterIssueCommentHandler",
"registers",
"a",
"plugin",
"s",
"github",
".",
"IssueCommentEvent",
"handler",
"."
] | 8125fbda10178887be5dff9e901d6a0a519b67bc | https://github.com/kubernetes/test-infra/blob/8125fbda10178887be5dff9e901d6a0a519b67bc/prow/plugins/plugins.go#L74-L77 | test |
kubernetes/test-infra | prow/plugins/plugins.go | RegisterPullRequestHandler | func RegisterPullRequestHandler(name string, fn PullRequestHandler, help HelpProvider) {
pluginHelp[name] = help
pullRequestHandlers[name] = fn
} | go | func RegisterPullRequestHandler(name string, fn PullRequestHandler, help HelpProvider) {
pluginHelp[name] = help
pullRequestHandlers[name] = fn
} | [
"func",
"RegisterPullRequestHandler",
"(",
"name",
"string",
",",
"fn",
"PullRequestHandler",
",",
"help",
"HelpProvider",
")",
"{",
"pluginHelp",
"[",
"name",
"]",
"=",
"help",
"\n",
"pullRequestHandlers",
"[",
"name",
"]",
"=",
"fn",
"\n",
"}"
] | // RegisterPullRequestHandler registers a plugin's github.PullRequestEvent handler. | [
"RegisterPullRequestHandler",
"registers",
"a",
"plugin",
"s",
"github",
".",
"PullRequestEvent",
"handler",
"."
] | 8125fbda10178887be5dff9e901d6a0a519b67bc | https://github.com/kubernetes/test-infra/blob/8125fbda10178887be5dff9e901d6a0a519b67bc/prow/plugins/plugins.go#L83-L86 | test |
kubernetes/test-infra | prow/plugins/plugins.go | RegisterStatusEventHandler | func RegisterStatusEventHandler(name string, fn StatusEventHandler, help HelpProvider) {
pluginHelp[name] = help
statusEventHandlers[name] = fn
} | go | func RegisterStatusEventHandler(name string, fn StatusEventHandler, help HelpProvider) {
pluginHelp[name] = help
statusEventHandlers[name] = fn
} | [
"func",
"RegisterStatusEventHandler",
"(",
"name",
"string",
",",
"fn",
"StatusEventHandler",
",",
"help",
"HelpProvider",
")",
"{",
"pluginHelp",
"[",
"name",
"]",
"=",
"help",
"\n",
"statusEventHandlers",
"[",
"name",
"]",
"=",
"fn",
"\n",
"}"
] | // RegisterStatusEventHandler registers a plugin's github.StatusEvent handler. | [
"RegisterStatusEventHandler",
"registers",
"a",
"plugin",
"s",
"github",
".",
"StatusEvent",
"handler",
"."
] | 8125fbda10178887be5dff9e901d6a0a519b67bc | https://github.com/kubernetes/test-infra/blob/8125fbda10178887be5dff9e901d6a0a519b67bc/prow/plugins/plugins.go#L92-L95 | test |
kubernetes/test-infra | prow/plugins/plugins.go | RegisterPushEventHandler | func RegisterPushEventHandler(name string, fn PushEventHandler, help HelpProvider) {
pluginHelp[name] = help
pushEventHandlers[name] = fn
} | go | func RegisterPushEventHandler(name string, fn PushEventHandler, help HelpProvider) {
pluginHelp[name] = help
pushEventHandlers[name] = fn
} | [
"func",
"RegisterPushEventHandler",
"(",
"name",
"string",
",",
"fn",
"PushEventHandler",
",",
"help",
"HelpProvider",
")",
"{",
"pluginHelp",
"[",
"name",
"]",
"=",
"help",
"\n",
"pushEventHandlers",
"[",
"name",
"]",
"=",
"fn",
"\n",
"}"
] | // RegisterPushEventHandler registers a plugin's github.PushEvent handler. | [
"RegisterPushEventHandler",
"registers",
"a",
"plugin",
"s",
"github",
".",
"PushEvent",
"handler",
"."
] | 8125fbda10178887be5dff9e901d6a0a519b67bc | https://github.com/kubernetes/test-infra/blob/8125fbda10178887be5dff9e901d6a0a519b67bc/prow/plugins/plugins.go#L101-L104 | test |
kubernetes/test-infra | prow/plugins/plugins.go | RegisterReviewEventHandler | func RegisterReviewEventHandler(name string, fn ReviewEventHandler, help HelpProvider) {
pluginHelp[name] = help
reviewEventHandlers[name] = fn
} | go | func RegisterReviewEventHandler(name string, fn ReviewEventHandler, help HelpProvider) {
pluginHelp[name] = help
reviewEventHandlers[name] = fn
} | [
"func",
"RegisterReviewEventHandler",
"(",
"name",
"string",
",",
"fn",
"ReviewEventHandler",
",",
"help",
"HelpProvider",
")",
"{",
"pluginHelp",
"[",
"name",
"]",
"=",
"help",
"\n",
"reviewEventHandlers",
"[",
"name",
"]",
"=",
"fn",
"\n",
"}"
] | // RegisterReviewEventHandler registers a plugin's github.ReviewEvent handler. | [
"RegisterReviewEventHandler",
"registers",
"a",
"plugin",
"s",
"github",
".",
"ReviewEvent",
"handler",
"."
] | 8125fbda10178887be5dff9e901d6a0a519b67bc | https://github.com/kubernetes/test-infra/blob/8125fbda10178887be5dff9e901d6a0a519b67bc/prow/plugins/plugins.go#L110-L113 | test |
kubernetes/test-infra | prow/plugins/plugins.go | RegisterReviewCommentEventHandler | func RegisterReviewCommentEventHandler(name string, fn ReviewCommentEventHandler, help HelpProvider) {
pluginHelp[name] = help
reviewCommentEventHandlers[name] = fn
} | go | func RegisterReviewCommentEventHandler(name string, fn ReviewCommentEventHandler, help HelpProvider) {
pluginHelp[name] = help
reviewCommentEventHandlers[name] = fn
} | [
"func",
"RegisterReviewCommentEventHandler",
"(",
"name",
"string",
",",
"fn",
"ReviewCommentEventHandler",
",",
"help",
"HelpProvider",
")",
"{",
"pluginHelp",
"[",
"name",
"]",
"=",
"help",
"\n",
"reviewCommentEventHandlers",
"[",
"name",
"]",
"=",
"fn",
"\n",
... | // RegisterReviewCommentEventHandler registers a plugin's github.ReviewCommentEvent handler. | [
"RegisterReviewCommentEventHandler",
"registers",
"a",
"plugin",
"s",
"github",
".",
"ReviewCommentEvent",
"handler",
"."
] | 8125fbda10178887be5dff9e901d6a0a519b67bc | https://github.com/kubernetes/test-infra/blob/8125fbda10178887be5dff9e901d6a0a519b67bc/prow/plugins/plugins.go#L119-L122 | test |
kubernetes/test-infra | prow/plugins/plugins.go | RegisterGenericCommentHandler | func RegisterGenericCommentHandler(name string, fn GenericCommentHandler, help HelpProvider) {
pluginHelp[name] = help
genericCommentHandlers[name] = fn
} | go | func RegisterGenericCommentHandler(name string, fn GenericCommentHandler, help HelpProvider) {
pluginHelp[name] = help
genericCommentHandlers[name] = fn
} | [
"func",
"RegisterGenericCommentHandler",
"(",
"name",
"string",
",",
"fn",
"GenericCommentHandler",
",",
"help",
"HelpProvider",
")",
"{",
"pluginHelp",
"[",
"name",
"]",
"=",
"help",
"\n",
"genericCommentHandlers",
"[",
"name",
"]",
"=",
"fn",
"\n",
"}"
] | // RegisterGenericCommentHandler registers a plugin's github.GenericCommentEvent handler. | [
"RegisterGenericCommentHandler",
"registers",
"a",
"plugin",
"s",
"github",
".",
"GenericCommentEvent",
"handler",
"."
] | 8125fbda10178887be5dff9e901d6a0a519b67bc | https://github.com/kubernetes/test-infra/blob/8125fbda10178887be5dff9e901d6a0a519b67bc/prow/plugins/plugins.go#L128-L131 | test |
kubernetes/test-infra | prow/plugins/plugins.go | NewAgent | func NewAgent(configAgent *config.Agent, pluginConfigAgent *ConfigAgent, clientAgent *ClientAgent, logger *logrus.Entry) Agent {
prowConfig := configAgent.Config()
pluginConfig := pluginConfigAgent.Config()
return Agent{
GitHubClient: clientAgent.GitHubClient,
KubernetesClient: clientAgent.KubernetesClient,
... | go | func NewAgent(configAgent *config.Agent, pluginConfigAgent *ConfigAgent, clientAgent *ClientAgent, logger *logrus.Entry) Agent {
prowConfig := configAgent.Config()
pluginConfig := pluginConfigAgent.Config()
return Agent{
GitHubClient: clientAgent.GitHubClient,
KubernetesClient: clientAgent.KubernetesClient,
... | [
"func",
"NewAgent",
"(",
"configAgent",
"*",
"config",
".",
"Agent",
",",
"pluginConfigAgent",
"*",
"ConfigAgent",
",",
"clientAgent",
"*",
"ClientAgent",
",",
"logger",
"*",
"logrus",
".",
"Entry",
")",
"Agent",
"{",
"prowConfig",
":=",
"configAgent",
".",
... | // NewAgent bootstraps a new config.Agent struct from the passed dependencies. | [
"NewAgent",
"bootstraps",
"a",
"new",
"config",
".",
"Agent",
"struct",
"from",
"the",
"passed",
"dependencies",
"."
] | 8125fbda10178887be5dff9e901d6a0a519b67bc | https://github.com/kubernetes/test-infra/blob/8125fbda10178887be5dff9e901d6a0a519b67bc/prow/plugins/plugins.go#L156-L170 | test |
kubernetes/test-infra | prow/plugins/plugins.go | InitializeCommentPruner | func (a *Agent) InitializeCommentPruner(org, repo string, pr int) {
a.commentPruner = commentpruner.NewEventClient(
a.GitHubClient, a.Logger.WithField("client", "commentpruner"),
org, repo, pr,
)
} | go | func (a *Agent) InitializeCommentPruner(org, repo string, pr int) {
a.commentPruner = commentpruner.NewEventClient(
a.GitHubClient, a.Logger.WithField("client", "commentpruner"),
org, repo, pr,
)
} | [
"func",
"(",
"a",
"*",
"Agent",
")",
"InitializeCommentPruner",
"(",
"org",
",",
"repo",
"string",
",",
"pr",
"int",
")",
"{",
"a",
".",
"commentPruner",
"=",
"commentpruner",
".",
"NewEventClient",
"(",
"a",
".",
"GitHubClient",
",",
"a",
".",
"Logger",... | // InitializeCommentPruner attaches a commentpruner.EventClient to the agent to handle
// pruning comments. | [
"InitializeCommentPruner",
"attaches",
"a",
"commentpruner",
".",
"EventClient",
"to",
"the",
"agent",
"to",
"handle",
"pruning",
"comments",
"."
] | 8125fbda10178887be5dff9e901d6a0a519b67bc | https://github.com/kubernetes/test-infra/blob/8125fbda10178887be5dff9e901d6a0a519b67bc/prow/plugins/plugins.go#L174-L179 | test |
kubernetes/test-infra | prow/plugins/plugins.go | CommentPruner | func (a *Agent) CommentPruner() (*commentpruner.EventClient, error) {
if a.commentPruner == nil {
return nil, errors.New("comment pruner client never initialized")
}
return a.commentPruner, nil
} | go | func (a *Agent) CommentPruner() (*commentpruner.EventClient, error) {
if a.commentPruner == nil {
return nil, errors.New("comment pruner client never initialized")
}
return a.commentPruner, nil
} | [
"func",
"(",
"a",
"*",
"Agent",
")",
"CommentPruner",
"(",
")",
"(",
"*",
"commentpruner",
".",
"EventClient",
",",
"error",
")",
"{",
"if",
"a",
".",
"commentPruner",
"==",
"nil",
"{",
"return",
"nil",
",",
"errors",
".",
"New",
"(",
"\"comment pruner... | // CommentPruner will return the commentpruner.EventClient attached to the agent or an error
// if one is not attached. | [
"CommentPruner",
"will",
"return",
"the",
"commentpruner",
".",
"EventClient",
"attached",
"to",
"the",
"agent",
"or",
"an",
"error",
"if",
"one",
"is",
"not",
"attached",
"."
] | 8125fbda10178887be5dff9e901d6a0a519b67bc | https://github.com/kubernetes/test-infra/blob/8125fbda10178887be5dff9e901d6a0a519b67bc/prow/plugins/plugins.go#L183-L188 | test |
kubernetes/test-infra | prow/plugins/plugins.go | Load | func (pa *ConfigAgent) Load(path string) error {
b, err := ioutil.ReadFile(path)
if err != nil {
return err
}
np := &Configuration{}
if err := yaml.Unmarshal(b, np); err != nil {
return err
}
if err := np.Validate(); err != nil {
return err
}
pa.Set(np)
return nil
} | go | func (pa *ConfigAgent) Load(path string) error {
b, err := ioutil.ReadFile(path)
if err != nil {
return err
}
np := &Configuration{}
if err := yaml.Unmarshal(b, np); err != nil {
return err
}
if err := np.Validate(); err != nil {
return err
}
pa.Set(np)
return nil
} | [
"func",
"(",
"pa",
"*",
"ConfigAgent",
")",
"Load",
"(",
"path",
"string",
")",
"error",
"{",
"b",
",",
"err",
":=",
"ioutil",
".",
"ReadFile",
"(",
"path",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"err",
"\n",
"}",
"\n",
"np",
":=",
... | // Load attempts to load config from the path. It returns an error if either
// the file can't be read or the configuration is invalid. | [
"Load",
"attempts",
"to",
"load",
"config",
"from",
"the",
"path",
".",
"It",
"returns",
"an",
"error",
"if",
"either",
"the",
"file",
"can",
"t",
"be",
"read",
"or",
"the",
"configuration",
"is",
"invalid",
"."
] | 8125fbda10178887be5dff9e901d6a0a519b67bc | https://github.com/kubernetes/test-infra/blob/8125fbda10178887be5dff9e901d6a0a519b67bc/prow/plugins/plugins.go#L208-L223 | test |
kubernetes/test-infra | prow/plugins/plugins.go | Config | func (pa *ConfigAgent) Config() *Configuration {
pa.mut.Lock()
defer pa.mut.Unlock()
return pa.configuration
} | go | func (pa *ConfigAgent) Config() *Configuration {
pa.mut.Lock()
defer pa.mut.Unlock()
return pa.configuration
} | [
"func",
"(",
"pa",
"*",
"ConfigAgent",
")",
"Config",
"(",
")",
"*",
"Configuration",
"{",
"pa",
".",
"mut",
".",
"Lock",
"(",
")",
"\n",
"defer",
"pa",
".",
"mut",
".",
"Unlock",
"(",
")",
"\n",
"return",
"pa",
".",
"configuration",
"\n",
"}"
] | // Config returns the agent current Configuration. | [
"Config",
"returns",
"the",
"agent",
"current",
"Configuration",
"."
] | 8125fbda10178887be5dff9e901d6a0a519b67bc | https://github.com/kubernetes/test-infra/blob/8125fbda10178887be5dff9e901d6a0a519b67bc/prow/plugins/plugins.go#L226-L230 | test |
kubernetes/test-infra | prow/plugins/plugins.go | Set | func (pa *ConfigAgent) Set(pc *Configuration) {
pa.mut.Lock()
defer pa.mut.Unlock()
pa.configuration = pc
} | go | func (pa *ConfigAgent) Set(pc *Configuration) {
pa.mut.Lock()
defer pa.mut.Unlock()
pa.configuration = pc
} | [
"func",
"(",
"pa",
"*",
"ConfigAgent",
")",
"Set",
"(",
"pc",
"*",
"Configuration",
")",
"{",
"pa",
".",
"mut",
".",
"Lock",
"(",
")",
"\n",
"defer",
"pa",
".",
"mut",
".",
"Unlock",
"(",
")",
"\n",
"pa",
".",
"configuration",
"=",
"pc",
"\n",
... | // Set attempts to set the plugins that are enabled on repos. Plugins are listed
// as a map from repositories to the list of plugins that are enabled on them.
// Specifying simply an org name will also work, and will enable the plugin on
// all repos in the org. | [
"Set",
"attempts",
"to",
"set",
"the",
"plugins",
"that",
"are",
"enabled",
"on",
"repos",
".",
"Plugins",
"are",
"listed",
"as",
"a",
"map",
"from",
"repositories",
"to",
"the",
"list",
"of",
"plugins",
"that",
"are",
"enabled",
"on",
"them",
".",
"Spec... | 8125fbda10178887be5dff9e901d6a0a519b67bc | https://github.com/kubernetes/test-infra/blob/8125fbda10178887be5dff9e901d6a0a519b67bc/prow/plugins/plugins.go#L236-L240 | test |
kubernetes/test-infra | prow/plugins/plugins.go | Start | func (pa *ConfigAgent) Start(path string) error {
if err := pa.Load(path); err != nil {
return err
}
ticker := time.Tick(1 * time.Minute)
go func() {
for range ticker {
if err := pa.Load(path); err != nil {
logrus.WithField("path", path).WithError(err).Error("Error loading plugin config.")
}
}
}()
... | go | func (pa *ConfigAgent) Start(path string) error {
if err := pa.Load(path); err != nil {
return err
}
ticker := time.Tick(1 * time.Minute)
go func() {
for range ticker {
if err := pa.Load(path); err != nil {
logrus.WithField("path", path).WithError(err).Error("Error loading plugin config.")
}
}
}()
... | [
"func",
"(",
"pa",
"*",
"ConfigAgent",
")",
"Start",
"(",
"path",
"string",
")",
"error",
"{",
"if",
"err",
":=",
"pa",
".",
"Load",
"(",
"path",
")",
";",
"err",
"!=",
"nil",
"{",
"return",
"err",
"\n",
"}",
"\n",
"ticker",
":=",
"time",
".",
... | // Start starts polling path for plugin config. If the first attempt fails,
// then start returns the error. Future errors will halt updates but not stop. | [
"Start",
"starts",
"polling",
"path",
"for",
"plugin",
"config",
".",
"If",
"the",
"first",
"attempt",
"fails",
"then",
"start",
"returns",
"the",
"error",
".",
"Future",
"errors",
"will",
"halt",
"updates",
"but",
"not",
"stop",
"."
] | 8125fbda10178887be5dff9e901d6a0a519b67bc | https://github.com/kubernetes/test-infra/blob/8125fbda10178887be5dff9e901d6a0a519b67bc/prow/plugins/plugins.go#L244-L257 | test |
kubernetes/test-infra | prow/plugins/plugins.go | GenericCommentHandlers | func (pa *ConfigAgent) GenericCommentHandlers(owner, repo string) map[string]GenericCommentHandler {
pa.mut.Lock()
defer pa.mut.Unlock()
hs := map[string]GenericCommentHandler{}
for _, p := range pa.getPlugins(owner, repo) {
if h, ok := genericCommentHandlers[p]; ok {
hs[p] = h
}
}
return hs
} | go | func (pa *ConfigAgent) GenericCommentHandlers(owner, repo string) map[string]GenericCommentHandler {
pa.mut.Lock()
defer pa.mut.Unlock()
hs := map[string]GenericCommentHandler{}
for _, p := range pa.getPlugins(owner, repo) {
if h, ok := genericCommentHandlers[p]; ok {
hs[p] = h
}
}
return hs
} | [
"func",
"(",
"pa",
"*",
"ConfigAgent",
")",
"GenericCommentHandlers",
"(",
"owner",
",",
"repo",
"string",
")",
"map",
"[",
"string",
"]",
"GenericCommentHandler",
"{",
"pa",
".",
"mut",
".",
"Lock",
"(",
")",
"\n",
"defer",
"pa",
".",
"mut",
".",
"Unl... | // GenericCommentHandlers returns a map of plugin names to handlers for the repo. | [
"GenericCommentHandlers",
"returns",
"a",
"map",
"of",
"plugin",
"names",
"to",
"handlers",
"for",
"the",
"repo",
"."
] | 8125fbda10178887be5dff9e901d6a0a519b67bc | https://github.com/kubernetes/test-infra/blob/8125fbda10178887be5dff9e901d6a0a519b67bc/prow/plugins/plugins.go#L260-L271 | test |
kubernetes/test-infra | prow/plugins/plugins.go | IssueHandlers | func (pa *ConfigAgent) IssueHandlers(owner, repo string) map[string]IssueHandler {
pa.mut.Lock()
defer pa.mut.Unlock()
hs := map[string]IssueHandler{}
for _, p := range pa.getPlugins(owner, repo) {
if h, ok := issueHandlers[p]; ok {
hs[p] = h
}
}
return hs
} | go | func (pa *ConfigAgent) IssueHandlers(owner, repo string) map[string]IssueHandler {
pa.mut.Lock()
defer pa.mut.Unlock()
hs := map[string]IssueHandler{}
for _, p := range pa.getPlugins(owner, repo) {
if h, ok := issueHandlers[p]; ok {
hs[p] = h
}
}
return hs
} | [
"func",
"(",
"pa",
"*",
"ConfigAgent",
")",
"IssueHandlers",
"(",
"owner",
",",
"repo",
"string",
")",
"map",
"[",
"string",
"]",
"IssueHandler",
"{",
"pa",
".",
"mut",
".",
"Lock",
"(",
")",
"\n",
"defer",
"pa",
".",
"mut",
".",
"Unlock",
"(",
")"... | // IssueHandlers returns a map of plugin names to handlers for the repo. | [
"IssueHandlers",
"returns",
"a",
"map",
"of",
"plugin",
"names",
"to",
"handlers",
"for",
"the",
"repo",
"."
] | 8125fbda10178887be5dff9e901d6a0a519b67bc | https://github.com/kubernetes/test-infra/blob/8125fbda10178887be5dff9e901d6a0a519b67bc/prow/plugins/plugins.go#L274-L285 | test |
kubernetes/test-infra | prow/plugins/plugins.go | IssueCommentHandlers | func (pa *ConfigAgent) IssueCommentHandlers(owner, repo string) map[string]IssueCommentHandler {
pa.mut.Lock()
defer pa.mut.Unlock()
hs := map[string]IssueCommentHandler{}
for _, p := range pa.getPlugins(owner, repo) {
if h, ok := issueCommentHandlers[p]; ok {
hs[p] = h
}
}
return hs
} | go | func (pa *ConfigAgent) IssueCommentHandlers(owner, repo string) map[string]IssueCommentHandler {
pa.mut.Lock()
defer pa.mut.Unlock()
hs := map[string]IssueCommentHandler{}
for _, p := range pa.getPlugins(owner, repo) {
if h, ok := issueCommentHandlers[p]; ok {
hs[p] = h
}
}
return hs
} | [
"func",
"(",
"pa",
"*",
"ConfigAgent",
")",
"IssueCommentHandlers",
"(",
"owner",
",",
"repo",
"string",
")",
"map",
"[",
"string",
"]",
"IssueCommentHandler",
"{",
"pa",
".",
"mut",
".",
"Lock",
"(",
")",
"\n",
"defer",
"pa",
".",
"mut",
".",
"Unlock"... | // IssueCommentHandlers returns a map of plugin names to handlers for the repo. | [
"IssueCommentHandlers",
"returns",
"a",
"map",
"of",
"plugin",
"names",
"to",
"handlers",
"for",
"the",
"repo",
"."
] | 8125fbda10178887be5dff9e901d6a0a519b67bc | https://github.com/kubernetes/test-infra/blob/8125fbda10178887be5dff9e901d6a0a519b67bc/prow/plugins/plugins.go#L288-L300 | test |
kubernetes/test-infra | prow/plugins/plugins.go | PullRequestHandlers | func (pa *ConfigAgent) PullRequestHandlers(owner, repo string) map[string]PullRequestHandler {
pa.mut.Lock()
defer pa.mut.Unlock()
hs := map[string]PullRequestHandler{}
for _, p := range pa.getPlugins(owner, repo) {
if h, ok := pullRequestHandlers[p]; ok {
hs[p] = h
}
}
return hs
} | go | func (pa *ConfigAgent) PullRequestHandlers(owner, repo string) map[string]PullRequestHandler {
pa.mut.Lock()
defer pa.mut.Unlock()
hs := map[string]PullRequestHandler{}
for _, p := range pa.getPlugins(owner, repo) {
if h, ok := pullRequestHandlers[p]; ok {
hs[p] = h
}
}
return hs
} | [
"func",
"(",
"pa",
"*",
"ConfigAgent",
")",
"PullRequestHandlers",
"(",
"owner",
",",
"repo",
"string",
")",
"map",
"[",
"string",
"]",
"PullRequestHandler",
"{",
"pa",
".",
"mut",
".",
"Lock",
"(",
")",
"\n",
"defer",
"pa",
".",
"mut",
".",
"Unlock",
... | // PullRequestHandlers returns a map of plugin names to handlers for the repo. | [
"PullRequestHandlers",
"returns",
"a",
"map",
"of",
"plugin",
"names",
"to",
"handlers",
"for",
"the",
"repo",
"."
] | 8125fbda10178887be5dff9e901d6a0a519b67bc | https://github.com/kubernetes/test-infra/blob/8125fbda10178887be5dff9e901d6a0a519b67bc/prow/plugins/plugins.go#L303-L315 | test |
kubernetes/test-infra | prow/plugins/plugins.go | ReviewEventHandlers | func (pa *ConfigAgent) ReviewEventHandlers(owner, repo string) map[string]ReviewEventHandler {
pa.mut.Lock()
defer pa.mut.Unlock()
hs := map[string]ReviewEventHandler{}
for _, p := range pa.getPlugins(owner, repo) {
if h, ok := reviewEventHandlers[p]; ok {
hs[p] = h
}
}
return hs
} | go | func (pa *ConfigAgent) ReviewEventHandlers(owner, repo string) map[string]ReviewEventHandler {
pa.mut.Lock()
defer pa.mut.Unlock()
hs := map[string]ReviewEventHandler{}
for _, p := range pa.getPlugins(owner, repo) {
if h, ok := reviewEventHandlers[p]; ok {
hs[p] = h
}
}
return hs
} | [
"func",
"(",
"pa",
"*",
"ConfigAgent",
")",
"ReviewEventHandlers",
"(",
"owner",
",",
"repo",
"string",
")",
"map",
"[",
"string",
"]",
"ReviewEventHandler",
"{",
"pa",
".",
"mut",
".",
"Lock",
"(",
")",
"\n",
"defer",
"pa",
".",
"mut",
".",
"Unlock",
... | // ReviewEventHandlers returns a map of plugin names to handlers for the repo. | [
"ReviewEventHandlers",
"returns",
"a",
"map",
"of",
"plugin",
"names",
"to",
"handlers",
"for",
"the",
"repo",
"."
] | 8125fbda10178887be5dff9e901d6a0a519b67bc | https://github.com/kubernetes/test-infra/blob/8125fbda10178887be5dff9e901d6a0a519b67bc/prow/plugins/plugins.go#L318-L330 | test |
kubernetes/test-infra | prow/plugins/plugins.go | ReviewCommentEventHandlers | func (pa *ConfigAgent) ReviewCommentEventHandlers(owner, repo string) map[string]ReviewCommentEventHandler {
pa.mut.Lock()
defer pa.mut.Unlock()
hs := map[string]ReviewCommentEventHandler{}
for _, p := range pa.getPlugins(owner, repo) {
if h, ok := reviewCommentEventHandlers[p]; ok {
hs[p] = h
}
}
return... | go | func (pa *ConfigAgent) ReviewCommentEventHandlers(owner, repo string) map[string]ReviewCommentEventHandler {
pa.mut.Lock()
defer pa.mut.Unlock()
hs := map[string]ReviewCommentEventHandler{}
for _, p := range pa.getPlugins(owner, repo) {
if h, ok := reviewCommentEventHandlers[p]; ok {
hs[p] = h
}
}
return... | [
"func",
"(",
"pa",
"*",
"ConfigAgent",
")",
"ReviewCommentEventHandlers",
"(",
"owner",
",",
"repo",
"string",
")",
"map",
"[",
"string",
"]",
"ReviewCommentEventHandler",
"{",
"pa",
".",
"mut",
".",
"Lock",
"(",
")",
"\n",
"defer",
"pa",
".",
"mut",
"."... | // ReviewCommentEventHandlers returns a map of plugin names to handlers for the repo. | [
"ReviewCommentEventHandlers",
"returns",
"a",
"map",
"of",
"plugin",
"names",
"to",
"handlers",
"for",
"the",
"repo",
"."
] | 8125fbda10178887be5dff9e901d6a0a519b67bc | https://github.com/kubernetes/test-infra/blob/8125fbda10178887be5dff9e901d6a0a519b67bc/prow/plugins/plugins.go#L333-L345 | test |
kubernetes/test-infra | prow/plugins/plugins.go | StatusEventHandlers | func (pa *ConfigAgent) StatusEventHandlers(owner, repo string) map[string]StatusEventHandler {
pa.mut.Lock()
defer pa.mut.Unlock()
hs := map[string]StatusEventHandler{}
for _, p := range pa.getPlugins(owner, repo) {
if h, ok := statusEventHandlers[p]; ok {
hs[p] = h
}
}
return hs
} | go | func (pa *ConfigAgent) StatusEventHandlers(owner, repo string) map[string]StatusEventHandler {
pa.mut.Lock()
defer pa.mut.Unlock()
hs := map[string]StatusEventHandler{}
for _, p := range pa.getPlugins(owner, repo) {
if h, ok := statusEventHandlers[p]; ok {
hs[p] = h
}
}
return hs
} | [
"func",
"(",
"pa",
"*",
"ConfigAgent",
")",
"StatusEventHandlers",
"(",
"owner",
",",
"repo",
"string",
")",
"map",
"[",
"string",
"]",
"StatusEventHandler",
"{",
"pa",
".",
"mut",
".",
"Lock",
"(",
")",
"\n",
"defer",
"pa",
".",
"mut",
".",
"Unlock",
... | // StatusEventHandlers returns a map of plugin names to handlers for the repo. | [
"StatusEventHandlers",
"returns",
"a",
"map",
"of",
"plugin",
"names",
"to",
"handlers",
"for",
"the",
"repo",
"."
] | 8125fbda10178887be5dff9e901d6a0a519b67bc | https://github.com/kubernetes/test-infra/blob/8125fbda10178887be5dff9e901d6a0a519b67bc/prow/plugins/plugins.go#L348-L360 | test |
kubernetes/test-infra | prow/plugins/plugins.go | PushEventHandlers | func (pa *ConfigAgent) PushEventHandlers(owner, repo string) map[string]PushEventHandler {
pa.mut.Lock()
defer pa.mut.Unlock()
hs := map[string]PushEventHandler{}
for _, p := range pa.getPlugins(owner, repo) {
if h, ok := pushEventHandlers[p]; ok {
hs[p] = h
}
}
return hs
} | go | func (pa *ConfigAgent) PushEventHandlers(owner, repo string) map[string]PushEventHandler {
pa.mut.Lock()
defer pa.mut.Unlock()
hs := map[string]PushEventHandler{}
for _, p := range pa.getPlugins(owner, repo) {
if h, ok := pushEventHandlers[p]; ok {
hs[p] = h
}
}
return hs
} | [
"func",
"(",
"pa",
"*",
"ConfigAgent",
")",
"PushEventHandlers",
"(",
"owner",
",",
"repo",
"string",
")",
"map",
"[",
"string",
"]",
"PushEventHandler",
"{",
"pa",
".",
"mut",
".",
"Lock",
"(",
")",
"\n",
"defer",
"pa",
".",
"mut",
".",
"Unlock",
"(... | // PushEventHandlers returns a map of plugin names to handlers for the repo. | [
"PushEventHandlers",
"returns",
"a",
"map",
"of",
"plugin",
"names",
"to",
"handlers",
"for",
"the",
"repo",
"."
] | 8125fbda10178887be5dff9e901d6a0a519b67bc | https://github.com/kubernetes/test-infra/blob/8125fbda10178887be5dff9e901d6a0a519b67bc/prow/plugins/plugins.go#L363-L375 | test |
kubernetes/test-infra | prow/plugins/plugins.go | EventsForPlugin | func EventsForPlugin(name string) []string {
var events []string
if _, ok := issueHandlers[name]; ok {
events = append(events, "issue")
}
if _, ok := issueCommentHandlers[name]; ok {
events = append(events, "issue_comment")
}
if _, ok := pullRequestHandlers[name]; ok {
events = append(events, "pull_request"... | go | func EventsForPlugin(name string) []string {
var events []string
if _, ok := issueHandlers[name]; ok {
events = append(events, "issue")
}
if _, ok := issueCommentHandlers[name]; ok {
events = append(events, "issue_comment")
}
if _, ok := pullRequestHandlers[name]; ok {
events = append(events, "pull_request"... | [
"func",
"EventsForPlugin",
"(",
"name",
"string",
")",
"[",
"]",
"string",
"{",
"var",
"events",
"[",
"]",
"string",
"\n",
"if",
"_",
",",
"ok",
":=",
"issueHandlers",
"[",
"name",
"]",
";",
"ok",
"{",
"events",
"=",
"append",
"(",
"events",
",",
"... | // EventsForPlugin returns the registered events for the passed plugin. | [
"EventsForPlugin",
"returns",
"the",
"registered",
"events",
"for",
"the",
"passed",
"plugin",
"."
] | 8125fbda10178887be5dff9e901d6a0a519b67bc | https://github.com/kubernetes/test-infra/blob/8125fbda10178887be5dff9e901d6a0a519b67bc/prow/plugins/plugins.go#L389-L416 | test |
kubernetes/test-infra | experiment/resultstore/main.go | insertLink | func insertLink(started *gcs.Started, viewURL string) (bool, error) {
if started.Metadata == nil {
started.Metadata = metadata.Metadata{}
}
meta := started.Metadata
var changed bool
top, present := meta.String(resultstoreKey)
if !present || top == nil || *top != viewURL {
changed = true
meta[resultstoreKey]... | go | func insertLink(started *gcs.Started, viewURL string) (bool, error) {
if started.Metadata == nil {
started.Metadata = metadata.Metadata{}
}
meta := started.Metadata
var changed bool
top, present := meta.String(resultstoreKey)
if !present || top == nil || *top != viewURL {
changed = true
meta[resultstoreKey]... | [
"func",
"insertLink",
"(",
"started",
"*",
"gcs",
".",
"Started",
",",
"viewURL",
"string",
")",
"(",
"bool",
",",
"error",
")",
"{",
"if",
"started",
".",
"Metadata",
"==",
"nil",
"{",
"started",
".",
"Metadata",
"=",
"metadata",
".",
"Metadata",
"{",... | // insertLink attempts to set metadata.links.resultstore.url to viewURL.
//
// returns true if started metadata was updated. | [
"insertLink",
"attempts",
"to",
"set",
"metadata",
".",
"links",
".",
"resultstore",
".",
"url",
"to",
"viewURL",
".",
"returns",
"true",
"if",
"started",
"metadata",
"was",
"updated",
"."
] | 8125fbda10178887be5dff9e901d6a0a519b67bc | https://github.com/kubernetes/test-infra/blob/8125fbda10178887be5dff9e901d6a0a519b67bc/experiment/resultstore/main.go#L487-L526 | test |
kubernetes/test-infra | prow/external-plugins/cherrypicker/server.go | HelpProvider | func HelpProvider(enabledRepos []string) (*pluginhelp.PluginHelp, error) {
pluginHelp := &pluginhelp.PluginHelp{
Description: `The cherrypick plugin is used for cherrypicking PRs across branches. For every successful cherrypick invocation a new PR is opened against the target branch and assigned to the requester. If... | go | func HelpProvider(enabledRepos []string) (*pluginhelp.PluginHelp, error) {
pluginHelp := &pluginhelp.PluginHelp{
Description: `The cherrypick plugin is used for cherrypicking PRs across branches. For every successful cherrypick invocation a new PR is opened against the target branch and assigned to the requester. If... | [
"func",
"HelpProvider",
"(",
"enabledRepos",
"[",
"]",
"string",
")",
"(",
"*",
"pluginhelp",
".",
"PluginHelp",
",",
"error",
")",
"{",
"pluginHelp",
":=",
"&",
"pluginhelp",
".",
"PluginHelp",
"{",
"Description",
":",
"`The cherrypick plugin is used for cherrypi... | // HelpProvider construct the pluginhelp.PluginHelp for this plugin. | [
"HelpProvider",
"construct",
"the",
"pluginhelp",
".",
"PluginHelp",
"for",
"this",
"plugin",
"."
] | 8125fbda10178887be5dff9e901d6a0a519b67bc | https://github.com/kubernetes/test-infra/blob/8125fbda10178887be5dff9e901d6a0a519b67bc/prow/external-plugins/cherrypicker/server.go#L58-L71 | test |
kubernetes/test-infra | prow/external-plugins/cherrypicker/server.go | getPatch | func (s *Server) getPatch(org, repo, targetBranch string, num int) (string, error) {
patch, err := s.ghc.GetPullRequestPatch(org, repo, num)
if err != nil {
return "", err
}
localPath := fmt.Sprintf("/tmp/%s_%s_%d_%s.patch", org, repo, num, normalize(targetBranch))
out, err := os.Create(localPath)
if err != nil... | go | func (s *Server) getPatch(org, repo, targetBranch string, num int) (string, error) {
patch, err := s.ghc.GetPullRequestPatch(org, repo, num)
if err != nil {
return "", err
}
localPath := fmt.Sprintf("/tmp/%s_%s_%d_%s.patch", org, repo, num, normalize(targetBranch))
out, err := os.Create(localPath)
if err != nil... | [
"func",
"(",
"s",
"*",
"Server",
")",
"getPatch",
"(",
"org",
",",
"repo",
",",
"targetBranch",
"string",
",",
"num",
"int",
")",
"(",
"string",
",",
"error",
")",
"{",
"patch",
",",
"err",
":=",
"s",
".",
"ghc",
".",
"GetPullRequestPatch",
"(",
"o... | // getPatch gets the patch for the provided PR and creates a local
// copy of it. It returns its location in the filesystem and any
// encountered error. | [
"getPatch",
"gets",
"the",
"patch",
"for",
"the",
"provided",
"PR",
"and",
"creates",
"a",
"local",
"copy",
"of",
"it",
".",
"It",
"returns",
"its",
"location",
"in",
"the",
"filesystem",
"and",
"any",
"encountered",
"error",
"."
] | 8125fbda10178887be5dff9e901d6a0a519b67bc | https://github.com/kubernetes/test-infra/blob/8125fbda10178887be5dff9e901d6a0a519b67bc/prow/external-plugins/cherrypicker/server.go#L484-L499 | test |
kubernetes/test-infra | prow/external-plugins/cherrypicker/server.go | releaseNoteFromParentPR | func releaseNoteFromParentPR(body string) string {
potentialMatch := releaseNoteRe.FindStringSubmatch(body)
if potentialMatch == nil {
return ""
}
return fmt.Sprintf("```release-note\n%s\n```", strings.TrimSpace(potentialMatch[1]))
} | go | func releaseNoteFromParentPR(body string) string {
potentialMatch := releaseNoteRe.FindStringSubmatch(body)
if potentialMatch == nil {
return ""
}
return fmt.Sprintf("```release-note\n%s\n```", strings.TrimSpace(potentialMatch[1]))
} | [
"func",
"releaseNoteFromParentPR",
"(",
"body",
"string",
")",
"string",
"{",
"potentialMatch",
":=",
"releaseNoteRe",
".",
"FindStringSubmatch",
"(",
"body",
")",
"\n",
"if",
"potentialMatch",
"==",
"nil",
"{",
"return",
"\"\"",
"\n",
"}",
"\n",
"return",
"fm... | // releaseNoteNoteFromParentPR gets the release note from the
// parent PR and formats it as per the PR template so that
// it can be copied to the cherry-pick PR. | [
"releaseNoteNoteFromParentPR",
"gets",
"the",
"release",
"note",
"from",
"the",
"parent",
"PR",
"and",
"formats",
"it",
"as",
"per",
"the",
"PR",
"template",
"so",
"that",
"it",
"can",
"be",
"copied",
"to",
"the",
"cherry",
"-",
"pick",
"PR",
"."
] | 8125fbda10178887be5dff9e901d6a0a519b67bc | https://github.com/kubernetes/test-infra/blob/8125fbda10178887be5dff9e901d6a0a519b67bc/prow/external-plugins/cherrypicker/server.go#L508-L514 | test |
kubernetes/test-infra | prow/github/hmac.go | ValidatePayload | func ValidatePayload(payload []byte, sig string, key []byte) bool {
if !strings.HasPrefix(sig, "sha1=") {
return false
}
sig = sig[5:]
sb, err := hex.DecodeString(sig)
if err != nil {
return false
}
mac := hmac.New(sha1.New, key)
mac.Write(payload)
expected := mac.Sum(nil)
return hmac.Equal(sb, expected)
... | go | func ValidatePayload(payload []byte, sig string, key []byte) bool {
if !strings.HasPrefix(sig, "sha1=") {
return false
}
sig = sig[5:]
sb, err := hex.DecodeString(sig)
if err != nil {
return false
}
mac := hmac.New(sha1.New, key)
mac.Write(payload)
expected := mac.Sum(nil)
return hmac.Equal(sb, expected)
... | [
"func",
"ValidatePayload",
"(",
"payload",
"[",
"]",
"byte",
",",
"sig",
"string",
",",
"key",
"[",
"]",
"byte",
")",
"bool",
"{",
"if",
"!",
"strings",
".",
"HasPrefix",
"(",
"sig",
",",
"\"sha1=\"",
")",
"{",
"return",
"false",
"\n",
"}",
"\n",
"... | // ValidatePayload ensures that the request payload signature matches the key. | [
"ValidatePayload",
"ensures",
"that",
"the",
"request",
"payload",
"signature",
"matches",
"the",
"key",
"."
] | 8125fbda10178887be5dff9e901d6a0a519b67bc | https://github.com/kubernetes/test-infra/blob/8125fbda10178887be5dff9e901d6a0a519b67bc/prow/github/hmac.go#L27-L40 | test |
kubernetes/test-infra | prow/github/hmac.go | PayloadSignature | func PayloadSignature(payload []byte, key []byte) string {
mac := hmac.New(sha1.New, key)
mac.Write(payload)
sum := mac.Sum(nil)
return "sha1=" + hex.EncodeToString(sum)
} | go | func PayloadSignature(payload []byte, key []byte) string {
mac := hmac.New(sha1.New, key)
mac.Write(payload)
sum := mac.Sum(nil)
return "sha1=" + hex.EncodeToString(sum)
} | [
"func",
"PayloadSignature",
"(",
"payload",
"[",
"]",
"byte",
",",
"key",
"[",
"]",
"byte",
")",
"string",
"{",
"mac",
":=",
"hmac",
".",
"New",
"(",
"sha1",
".",
"New",
",",
"key",
")",
"\n",
"mac",
".",
"Write",
"(",
"payload",
")",
"\n",
"sum"... | // PayloadSignature returns the signature that matches the payload. | [
"PayloadSignature",
"returns",
"the",
"signature",
"that",
"matches",
"the",
"payload",
"."
] | 8125fbda10178887be5dff9e901d6a0a519b67bc | https://github.com/kubernetes/test-infra/blob/8125fbda10178887be5dff9e901d6a0a519b67bc/prow/github/hmac.go#L43-L48 | test |
kubernetes/test-infra | prow/cmd/peribolos/main.go | updateString | func updateString(have, want *string) bool {
switch {
case have == nil:
panic("have must be non-nil")
case want == nil:
return false // do not care what we have
case *have == *want:
return false // already have it
}
*have = *want // update value
return true
} | go | func updateString(have, want *string) bool {
switch {
case have == nil:
panic("have must be non-nil")
case want == nil:
return false // do not care what we have
case *have == *want:
return false // already have it
}
*have = *want // update value
return true
} | [
"func",
"updateString",
"(",
"have",
",",
"want",
"*",
"string",
")",
"bool",
"{",
"switch",
"{",
"case",
"have",
"==",
"nil",
":",
"panic",
"(",
"\"have must be non-nil\"",
")",
"\n",
"case",
"want",
"==",
"nil",
":",
"return",
"false",
"\n",
"case",
... | // updateString will return true and set have to want iff they are set and different. | [
"updateString",
"will",
"return",
"true",
"and",
"set",
"have",
"to",
"want",
"iff",
"they",
"are",
"set",
"and",
"different",
"."
] | 8125fbda10178887be5dff9e901d6a0a519b67bc | https://github.com/kubernetes/test-infra/blob/8125fbda10178887be5dff9e901d6a0a519b67bc/prow/cmd/peribolos/main.go#L686-L697 | test |
kubernetes/test-infra | prow/cmd/peribolos/main.go | updateBool | func updateBool(have, want *bool) bool {
switch {
case have == nil:
panic("have must not be nil")
case want == nil:
return false // do not care what we have
case *have == *want:
return false //already have it
}
*have = *want // update value
return true
} | go | func updateBool(have, want *bool) bool {
switch {
case have == nil:
panic("have must not be nil")
case want == nil:
return false // do not care what we have
case *have == *want:
return false //already have it
}
*have = *want // update value
return true
} | [
"func",
"updateBool",
"(",
"have",
",",
"want",
"*",
"bool",
")",
"bool",
"{",
"switch",
"{",
"case",
"have",
"==",
"nil",
":",
"panic",
"(",
"\"have must not be nil\"",
")",
"\n",
"case",
"want",
"==",
"nil",
":",
"return",
"false",
"\n",
"case",
"*",... | // updateBool will return true and set have to want iff they are set and different. | [
"updateBool",
"will",
"return",
"true",
"and",
"set",
"have",
"to",
"want",
"iff",
"they",
"are",
"set",
"and",
"different",
"."
] | 8125fbda10178887be5dff9e901d6a0a519b67bc | https://github.com/kubernetes/test-infra/blob/8125fbda10178887be5dff9e901d6a0a519b67bc/prow/cmd/peribolos/main.go#L700-L711 | test |
kubernetes/test-infra | prow/cmd/peribolos/main.go | configureOrgMeta | func configureOrgMeta(client orgMetadataClient, orgName string, want org.Metadata) error {
cur, err := client.GetOrg(orgName)
if err != nil {
return fmt.Errorf("failed to get %s metadata: %v", orgName, err)
}
change := false
change = updateString(&cur.BillingEmail, want.BillingEmail) || change
change = updateSt... | go | func configureOrgMeta(client orgMetadataClient, orgName string, want org.Metadata) error {
cur, err := client.GetOrg(orgName)
if err != nil {
return fmt.Errorf("failed to get %s metadata: %v", orgName, err)
}
change := false
change = updateString(&cur.BillingEmail, want.BillingEmail) || change
change = updateSt... | [
"func",
"configureOrgMeta",
"(",
"client",
"orgMetadataClient",
",",
"orgName",
"string",
",",
"want",
"org",
".",
"Metadata",
")",
"error",
"{",
"cur",
",",
"err",
":=",
"client",
".",
"GetOrg",
"(",
"orgName",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
... | // configureOrgMeta will update github to have the non-nil wanted metadata values. | [
"configureOrgMeta",
"will",
"update",
"github",
"to",
"have",
"the",
"non",
"-",
"nil",
"wanted",
"metadata",
"values",
"."
] | 8125fbda10178887be5dff9e901d6a0a519b67bc | https://github.com/kubernetes/test-infra/blob/8125fbda10178887be5dff9e901d6a0a519b67bc/prow/cmd/peribolos/main.go#L719-L744 | test |
kubernetes/test-infra | prow/cmd/peribolos/main.go | configureTeamRepos | func configureTeamRepos(client teamRepoClient, githubTeams map[string]github.Team, name, orgName string, team org.Team) error {
gt, ok := githubTeams[name]
if !ok { // configureTeams is buggy if this is the case
return fmt.Errorf("%s not found in id list", name)
}
want := team.Repos
have := map[string]github.Re... | go | func configureTeamRepos(client teamRepoClient, githubTeams map[string]github.Team, name, orgName string, team org.Team) error {
gt, ok := githubTeams[name]
if !ok { // configureTeams is buggy if this is the case
return fmt.Errorf("%s not found in id list", name)
}
want := team.Repos
have := map[string]github.Re... | [
"func",
"configureTeamRepos",
"(",
"client",
"teamRepoClient",
",",
"githubTeams",
"map",
"[",
"string",
"]",
"github",
".",
"Team",
",",
"name",
",",
"orgName",
"string",
",",
"team",
"org",
".",
"Team",
")",
"error",
"{",
"gt",
",",
"ok",
":=",
"github... | // configureTeamRepos updates the list of repos that the team has permissions for when necessary | [
"configureTeamRepos",
"updates",
"the",
"list",
"of",
"repos",
"that",
"the",
"team",
"has",
"permissions",
"for",
"when",
"necessary"
] | 8125fbda10178887be5dff9e901d6a0a519b67bc | https://github.com/kubernetes/test-infra/blob/8125fbda10178887be5dff9e901d6a0a519b67bc/prow/cmd/peribolos/main.go#L904-L951 | test |
kubernetes/test-infra | prow/pubsub/reporter/reporter.go | ShouldReport | func (c *Client) ShouldReport(pj *prowapi.ProwJob) bool {
pubSubMap := findLabels(pj, PubSubProjectLabel, PubSubTopicLabel)
return pubSubMap[PubSubProjectLabel] != "" && pubSubMap[PubSubTopicLabel] != ""
} | go | func (c *Client) ShouldReport(pj *prowapi.ProwJob) bool {
pubSubMap := findLabels(pj, PubSubProjectLabel, PubSubTopicLabel)
return pubSubMap[PubSubProjectLabel] != "" && pubSubMap[PubSubTopicLabel] != ""
} | [
"func",
"(",
"c",
"*",
"Client",
")",
"ShouldReport",
"(",
"pj",
"*",
"prowapi",
".",
"ProwJob",
")",
"bool",
"{",
"pubSubMap",
":=",
"findLabels",
"(",
"pj",
",",
"PubSubProjectLabel",
",",
"PubSubTopicLabel",
")",
"\n",
"return",
"pubSubMap",
"[",
"PubSu... | // ShouldReport tells if a prowjob should be reported by this reporter | [
"ShouldReport",
"tells",
"if",
"a",
"prowjob",
"should",
"be",
"reported",
"by",
"this",
"reporter"
] | 8125fbda10178887be5dff9e901d6a0a519b67bc | https://github.com/kubernetes/test-infra/blob/8125fbda10178887be5dff9e901d6a0a519b67bc/prow/pubsub/reporter/reporter.go#L85-L88 | test |
kubernetes/test-infra | prow/gcsupload/run.go | Run | func (o Options) Run(spec *downwardapi.JobSpec, extra map[string]gcs.UploadFunc) error {
uploadTargets := o.assembleTargets(spec, extra)
if !o.DryRun {
ctx := context.Background()
gcsClient, err := storage.NewClient(ctx, option.WithCredentialsFile(o.GcsCredentialsFile))
if err != nil {
return fmt.Errorf("co... | go | func (o Options) Run(spec *downwardapi.JobSpec, extra map[string]gcs.UploadFunc) error {
uploadTargets := o.assembleTargets(spec, extra)
if !o.DryRun {
ctx := context.Background()
gcsClient, err := storage.NewClient(ctx, option.WithCredentialsFile(o.GcsCredentialsFile))
if err != nil {
return fmt.Errorf("co... | [
"func",
"(",
"o",
"Options",
")",
"Run",
"(",
"spec",
"*",
"downwardapi",
".",
"JobSpec",
",",
"extra",
"map",
"[",
"string",
"]",
"gcs",
".",
"UploadFunc",
")",
"error",
"{",
"uploadTargets",
":=",
"o",
".",
"assembleTargets",
"(",
"spec",
",",
"extra... | // Run will upload files to GCS as prescribed by
// the options. Any extra files can be passed as
// a parameter and will have the prefix prepended
// to their destination in GCS, so the caller can
// operate relative to the base of the GCS dir. | [
"Run",
"will",
"upload",
"files",
"to",
"GCS",
"as",
"prescribed",
"by",
"the",
"options",
".",
"Any",
"extra",
"files",
"can",
"be",
"passed",
"as",
"a",
"parameter",
"and",
"will",
"have",
"the",
"prefix",
"prepended",
"to",
"their",
"destination",
"in",... | 8125fbda10178887be5dff9e901d6a0a519b67bc | https://github.com/kubernetes/test-infra/blob/8125fbda10178887be5dff9e901d6a0a519b67bc/prow/gcsupload/run.go#L41-L62 | test |
kubernetes/test-infra | prow/logrusutil/logrusutil.go | Format | func (d *DefaultFieldsFormatter) Format(entry *logrus.Entry) ([]byte, error) {
data := make(logrus.Fields, len(entry.Data)+len(d.DefaultFields))
for k, v := range d.DefaultFields {
data[k] = v
}
for k, v := range entry.Data {
data[k] = v
}
return d.WrappedFormatter.Format(&logrus.Entry{
Logger: entry.Logge... | go | func (d *DefaultFieldsFormatter) Format(entry *logrus.Entry) ([]byte, error) {
data := make(logrus.Fields, len(entry.Data)+len(d.DefaultFields))
for k, v := range d.DefaultFields {
data[k] = v
}
for k, v := range entry.Data {
data[k] = v
}
return d.WrappedFormatter.Format(&logrus.Entry{
Logger: entry.Logge... | [
"func",
"(",
"d",
"*",
"DefaultFieldsFormatter",
")",
"Format",
"(",
"entry",
"*",
"logrus",
".",
"Entry",
")",
"(",
"[",
"]",
"byte",
",",
"error",
")",
"{",
"data",
":=",
"make",
"(",
"logrus",
".",
"Fields",
",",
"len",
"(",
"entry",
".",
"Data"... | // Format implements logrus.Formatter's Format. We allocate a new Fields
// map in order to not modify the caller's Entry, as that is not a thread
// safe operation. | [
"Format",
"implements",
"logrus",
".",
"Formatter",
"s",
"Format",
".",
"We",
"allocate",
"a",
"new",
"Fields",
"map",
"in",
"order",
"to",
"not",
"modify",
"the",
"caller",
"s",
"Entry",
"as",
"that",
"is",
"not",
"a",
"thread",
"safe",
"operation",
"."... | 8125fbda10178887be5dff9e901d6a0a519b67bc | https://github.com/kubernetes/test-infra/blob/8125fbda10178887be5dff9e901d6a0a519b67bc/prow/logrusutil/logrusutil.go#L50-L65 | test |
kubernetes/test-infra | velodrome/sql/model.go | FindLabels | func (issue *Issue) FindLabels(regex *regexp.Regexp) []Label {
labels := []Label{}
for _, label := range issue.Labels {
if regex.MatchString(label.Name) {
labels = append(labels, label)
}
}
return labels
} | go | func (issue *Issue) FindLabels(regex *regexp.Regexp) []Label {
labels := []Label{}
for _, label := range issue.Labels {
if regex.MatchString(label.Name) {
labels = append(labels, label)
}
}
return labels
} | [
"func",
"(",
"issue",
"*",
"Issue",
")",
"FindLabels",
"(",
"regex",
"*",
"regexp",
".",
"Regexp",
")",
"[",
"]",
"Label",
"{",
"labels",
":=",
"[",
"]",
"Label",
"{",
"}",
"\n",
"for",
"_",
",",
"label",
":=",
"range",
"issue",
".",
"Labels",
"{... | // FindLabels returns the list of labels matching the regex | [
"FindLabels",
"returns",
"the",
"list",
"of",
"labels",
"matching",
"the",
"regex"
] | 8125fbda10178887be5dff9e901d6a0a519b67bc | https://github.com/kubernetes/test-infra/blob/8125fbda10178887be5dff9e901d6a0a519b67bc/velodrome/sql/model.go#L42-L52 | test |
kubernetes/test-infra | prow/initupload/options.go | AddFlags | func (o *Options) AddFlags(flags *flag.FlagSet) {
flags.StringVar(&o.Log, "clone-log", "", "Path to the clone records log")
o.Options.AddFlags(flags)
} | go | func (o *Options) AddFlags(flags *flag.FlagSet) {
flags.StringVar(&o.Log, "clone-log", "", "Path to the clone records log")
o.Options.AddFlags(flags)
} | [
"func",
"(",
"o",
"*",
"Options",
")",
"AddFlags",
"(",
"flags",
"*",
"flag",
".",
"FlagSet",
")",
"{",
"flags",
".",
"StringVar",
"(",
"&",
"o",
".",
"Log",
",",
"\"clone-log\"",
",",
"\"\"",
",",
"\"Path to the clone records log\"",
")",
"\n",
"o",
"... | // AddFlags binds flags to options. | [
"AddFlags",
"binds",
"flags",
"to",
"options",
"."
] | 8125fbda10178887be5dff9e901d6a0a519b67bc | https://github.com/kubernetes/test-infra/blob/8125fbda10178887be5dff9e901d6a0a519b67bc/prow/initupload/options.go#L59-L62 | test |
kubernetes/test-infra | prow/githuboauth/githuboauth.go | NewAgent | func NewAgent(config *config.GitHubOAuthConfig, logger *logrus.Entry) *Agent {
return &Agent{
gc: config,
logger: logger,
}
} | go | func NewAgent(config *config.GitHubOAuthConfig, logger *logrus.Entry) *Agent {
return &Agent{
gc: config,
logger: logger,
}
} | [
"func",
"NewAgent",
"(",
"config",
"*",
"config",
".",
"GitHubOAuthConfig",
",",
"logger",
"*",
"logrus",
".",
"Entry",
")",
"*",
"Agent",
"{",
"return",
"&",
"Agent",
"{",
"gc",
":",
"config",
",",
"logger",
":",
"logger",
",",
"}",
"\n",
"}"
] | // NewAgent returns a new GitHub OAuth Agent. | [
"NewAgent",
"returns",
"a",
"new",
"GitHub",
"OAuth",
"Agent",
"."
] | 8125fbda10178887be5dff9e901d6a0a519b67bc | https://github.com/kubernetes/test-infra/blob/8125fbda10178887be5dff9e901d6a0a519b67bc/prow/githuboauth/githuboauth.go#L84-L89 | test |
kubernetes/test-infra | prow/githuboauth/githuboauth.go | HandleLogin | func (ga *Agent) HandleLogin(client OAuthClient) http.HandlerFunc {
return func(w http.ResponseWriter, r *http.Request) {
stateToken := xsrftoken.Generate(ga.gc.ClientSecret, "", "")
state := hex.EncodeToString([]byte(stateToken))
oauthSession, err := ga.gc.CookieStore.New(r, oauthSessionCookie)
oauthSession.O... | go | func (ga *Agent) HandleLogin(client OAuthClient) http.HandlerFunc {
return func(w http.ResponseWriter, r *http.Request) {
stateToken := xsrftoken.Generate(ga.gc.ClientSecret, "", "")
state := hex.EncodeToString([]byte(stateToken))
oauthSession, err := ga.gc.CookieStore.New(r, oauthSessionCookie)
oauthSession.O... | [
"func",
"(",
"ga",
"*",
"Agent",
")",
"HandleLogin",
"(",
"client",
"OAuthClient",
")",
"http",
".",
"HandlerFunc",
"{",
"return",
"func",
"(",
"w",
"http",
".",
"ResponseWriter",
",",
"r",
"*",
"http",
".",
"Request",
")",
"{",
"stateToken",
":=",
"xs... | // HandleLogin handles GitHub login request from front-end. It starts a new git oauth session and
// redirect user to GitHub OAuth end-point for authentication. | [
"HandleLogin",
"handles",
"GitHub",
"login",
"request",
"from",
"front",
"-",
"end",
".",
"It",
"starts",
"a",
"new",
"git",
"oauth",
"session",
"and",
"redirect",
"user",
"to",
"GitHub",
"OAuth",
"end",
"-",
"point",
"for",
"authentication",
"."
] | 8125fbda10178887be5dff9e901d6a0a519b67bc | https://github.com/kubernetes/test-infra/blob/8125fbda10178887be5dff9e901d6a0a519b67bc/prow/githuboauth/githuboauth.go#L93-L115 | test |
kubernetes/test-infra | prow/githuboauth/githuboauth.go | HandleLogout | func (ga *Agent) HandleLogout(client OAuthClient) http.HandlerFunc {
return func(w http.ResponseWriter, r *http.Request) {
accessTokenSession, err := ga.gc.CookieStore.Get(r, tokenSession)
if err != nil {
ga.serverError(w, "get cookie", err)
return
}
// Clear session
accessTokenSession.Options.MaxAge =... | go | func (ga *Agent) HandleLogout(client OAuthClient) http.HandlerFunc {
return func(w http.ResponseWriter, r *http.Request) {
accessTokenSession, err := ga.gc.CookieStore.Get(r, tokenSession)
if err != nil {
ga.serverError(w, "get cookie", err)
return
}
// Clear session
accessTokenSession.Options.MaxAge =... | [
"func",
"(",
"ga",
"*",
"Agent",
")",
"HandleLogout",
"(",
"client",
"OAuthClient",
")",
"http",
".",
"HandlerFunc",
"{",
"return",
"func",
"(",
"w",
"http",
".",
"ResponseWriter",
",",
"r",
"*",
"http",
".",
"Request",
")",
"{",
"accessTokenSession",
",... | // HandleLogout handles GitHub logout request from front-end. It invalidates cookie sessions and
// redirect back to the front page. | [
"HandleLogout",
"handles",
"GitHub",
"logout",
"request",
"from",
"front",
"-",
"end",
".",
"It",
"invalidates",
"cookie",
"sessions",
"and",
"redirect",
"back",
"to",
"the",
"front",
"page",
"."
] | 8125fbda10178887be5dff9e901d6a0a519b67bc | https://github.com/kubernetes/test-infra/blob/8125fbda10178887be5dff9e901d6a0a519b67bc/prow/githuboauth/githuboauth.go#L119-L140 | test |
kubernetes/test-infra | prow/githuboauth/githuboauth.go | serverError | func (ga *Agent) serverError(w http.ResponseWriter, action string, err error) {
ga.logger.WithError(err).Errorf("Error %s.", action)
msg := fmt.Sprintf("500 Internal server error %s: %v", action, err)
http.Error(w, msg, http.StatusInternalServerError)
} | go | func (ga *Agent) serverError(w http.ResponseWriter, action string, err error) {
ga.logger.WithError(err).Errorf("Error %s.", action)
msg := fmt.Sprintf("500 Internal server error %s: %v", action, err)
http.Error(w, msg, http.StatusInternalServerError)
} | [
"func",
"(",
"ga",
"*",
"Agent",
")",
"serverError",
"(",
"w",
"http",
".",
"ResponseWriter",
",",
"action",
"string",
",",
"err",
"error",
")",
"{",
"ga",
".",
"logger",
".",
"WithError",
"(",
"err",
")",
".",
"Errorf",
"(",
"\"Error %s.\"",
",",
"a... | // Handles server errors. | [
"Handles",
"server",
"errors",
"."
] | 8125fbda10178887be5dff9e901d6a0a519b67bc | https://github.com/kubernetes/test-infra/blob/8125fbda10178887be5dff9e901d6a0a519b67bc/prow/githuboauth/githuboauth.go#L227-L231 | test |
kubernetes/test-infra | boskos/crds/resources_config_crd.go | FromItem | func (in *ResourcesConfigObject) FromItem(i common.Item) {
c, err := common.ItemToResourcesConfig(i)
if err == nil {
in.fromConfig(c)
}
} | go | func (in *ResourcesConfigObject) FromItem(i common.Item) {
c, err := common.ItemToResourcesConfig(i)
if err == nil {
in.fromConfig(c)
}
} | [
"func",
"(",
"in",
"*",
"ResourcesConfigObject",
")",
"FromItem",
"(",
"i",
"common",
".",
"Item",
")",
"{",
"c",
",",
"err",
":=",
"common",
".",
"ItemToResourcesConfig",
"(",
"i",
")",
"\n",
"if",
"err",
"==",
"nil",
"{",
"in",
".",
"fromConfig",
"... | // FromItem implements the Object interface | [
"FromItem",
"implements",
"the",
"Object",
"interface"
] | 8125fbda10178887be5dff9e901d6a0a519b67bc | https://github.com/kubernetes/test-infra/blob/8125fbda10178887be5dff9e901d6a0a519b67bc/boskos/crds/resources_config_crd.go#L116-L121 | test |
kubernetes/test-infra | boskos/crds/resources_config_crd.go | GetItems | func (in *ResourcesConfigCollection) GetItems() []Object {
var items []Object
for _, i := range in.Items {
items = append(items, i)
}
return items
} | go | func (in *ResourcesConfigCollection) GetItems() []Object {
var items []Object
for _, i := range in.Items {
items = append(items, i)
}
return items
} | [
"func",
"(",
"in",
"*",
"ResourcesConfigCollection",
")",
"GetItems",
"(",
")",
"[",
"]",
"Object",
"{",
"var",
"items",
"[",
"]",
"Object",
"\n",
"for",
"_",
",",
"i",
":=",
"range",
"in",
".",
"Items",
"{",
"items",
"=",
"append",
"(",
"items",
"... | // GetItems implements the Collection interface | [
"GetItems",
"implements",
"the",
"Collection",
"interface"
] | 8125fbda10178887be5dff9e901d6a0a519b67bc | https://github.com/kubernetes/test-infra/blob/8125fbda10178887be5dff9e901d6a0a519b67bc/boskos/crds/resources_config_crd.go#L124-L130 | test |
kubernetes/test-infra | boskos/crds/resources_config_crd.go | SetItems | func (in *ResourcesConfigCollection) SetItems(objects []Object) {
var items []*ResourcesConfigObject
for _, b := range objects {
items = append(items, b.(*ResourcesConfigObject))
}
in.Items = items
} | go | func (in *ResourcesConfigCollection) SetItems(objects []Object) {
var items []*ResourcesConfigObject
for _, b := range objects {
items = append(items, b.(*ResourcesConfigObject))
}
in.Items = items
} | [
"func",
"(",
"in",
"*",
"ResourcesConfigCollection",
")",
"SetItems",
"(",
"objects",
"[",
"]",
"Object",
")",
"{",
"var",
"items",
"[",
"]",
"*",
"ResourcesConfigObject",
"\n",
"for",
"_",
",",
"b",
":=",
"range",
"objects",
"{",
"items",
"=",
"append",... | // SetItems implements the Collection interface | [
"SetItems",
"implements",
"the",
"Collection",
"interface"
] | 8125fbda10178887be5dff9e901d6a0a519b67bc | https://github.com/kubernetes/test-infra/blob/8125fbda10178887be5dff9e901d6a0a519b67bc/boskos/crds/resources_config_crd.go#L133-L139 | test |
kubernetes/test-infra | prow/github/types.go | UnmarshalText | func (l *RepoPermissionLevel) UnmarshalText(text []byte) error {
v := RepoPermissionLevel(text)
if _, ok := repoPermissionLevels[v]; !ok {
return fmt.Errorf("bad repo permission: %s not in %v", v, repoPermissionLevels)
}
*l = v
return nil
} | go | func (l *RepoPermissionLevel) UnmarshalText(text []byte) error {
v := RepoPermissionLevel(text)
if _, ok := repoPermissionLevels[v]; !ok {
return fmt.Errorf("bad repo permission: %s not in %v", v, repoPermissionLevels)
}
*l = v
return nil
} | [
"func",
"(",
"l",
"*",
"RepoPermissionLevel",
")",
"UnmarshalText",
"(",
"text",
"[",
"]",
"byte",
")",
"error",
"{",
"v",
":=",
"RepoPermissionLevel",
"(",
"text",
")",
"\n",
"if",
"_",
",",
"ok",
":=",
"repoPermissionLevels",
"[",
"v",
"]",
";",
"!",... | // UnmarshalText validates the text is a valid string | [
"UnmarshalText",
"validates",
"the",
"text",
"is",
"a",
"valid",
"string"
] | 8125fbda10178887be5dff9e901d6a0a519b67bc | https://github.com/kubernetes/test-infra/blob/8125fbda10178887be5dff9e901d6a0a519b67bc/prow/github/types.go#L342-L349 | test |
kubernetes/test-infra | prow/github/types.go | IsAssignee | func (i Issue) IsAssignee(login string) bool {
for _, assignee := range i.Assignees {
if NormLogin(login) == NormLogin(assignee.Login) {
return true
}
}
return false
} | go | func (i Issue) IsAssignee(login string) bool {
for _, assignee := range i.Assignees {
if NormLogin(login) == NormLogin(assignee.Login) {
return true
}
}
return false
} | [
"func",
"(",
"i",
"Issue",
")",
"IsAssignee",
"(",
"login",
"string",
")",
"bool",
"{",
"for",
"_",
",",
"assignee",
":=",
"range",
"i",
".",
"Assignees",
"{",
"if",
"NormLogin",
"(",
"login",
")",
"==",
"NormLogin",
"(",
"assignee",
".",
"Login",
")... | // IsAssignee checks if a user is assigned to the issue. | [
"IsAssignee",
"checks",
"if",
"a",
"user",
"is",
"assigned",
"to",
"the",
"issue",
"."
] | 8125fbda10178887be5dff9e901d6a0a519b67bc | https://github.com/kubernetes/test-infra/blob/8125fbda10178887be5dff9e901d6a0a519b67bc/prow/github/types.go#L529-L536 | test |
kubernetes/test-infra | prow/github/types.go | IsAuthor | func (i Issue) IsAuthor(login string) bool {
return NormLogin(i.User.Login) == NormLogin(login)
} | go | func (i Issue) IsAuthor(login string) bool {
return NormLogin(i.User.Login) == NormLogin(login)
} | [
"func",
"(",
"i",
"Issue",
")",
"IsAuthor",
"(",
"login",
"string",
")",
"bool",
"{",
"return",
"NormLogin",
"(",
"i",
".",
"User",
".",
"Login",
")",
"==",
"NormLogin",
"(",
"login",
")",
"\n",
"}"
] | // IsAuthor checks if a user is the author of the issue. | [
"IsAuthor",
"checks",
"if",
"a",
"user",
"is",
"the",
"author",
"of",
"the",
"issue",
"."
] | 8125fbda10178887be5dff9e901d6a0a519b67bc | https://github.com/kubernetes/test-infra/blob/8125fbda10178887be5dff9e901d6a0a519b67bc/prow/github/types.go#L539-L541 | test |
kubernetes/test-infra | prow/github/types.go | HasLabel | func (i Issue) HasLabel(labelToFind string) bool {
for _, label := range i.Labels {
if strings.ToLower(label.Name) == strings.ToLower(labelToFind) {
return true
}
}
return false
} | go | func (i Issue) HasLabel(labelToFind string) bool {
for _, label := range i.Labels {
if strings.ToLower(label.Name) == strings.ToLower(labelToFind) {
return true
}
}
return false
} | [
"func",
"(",
"i",
"Issue",
")",
"HasLabel",
"(",
"labelToFind",
"string",
")",
"bool",
"{",
"for",
"_",
",",
"label",
":=",
"range",
"i",
".",
"Labels",
"{",
"if",
"strings",
".",
"ToLower",
"(",
"label",
".",
"Name",
")",
"==",
"strings",
".",
"To... | // HasLabel checks if an issue has a given label. | [
"HasLabel",
"checks",
"if",
"an",
"issue",
"has",
"a",
"given",
"label",
"."
] | 8125fbda10178887be5dff9e901d6a0a519b67bc | https://github.com/kubernetes/test-infra/blob/8125fbda10178887be5dff9e901d6a0a519b67bc/prow/github/types.go#L549-L556 | test |
kubernetes/test-infra | prow/github/types.go | Branch | func (pe PushEvent) Branch() string {
ref := strings.TrimPrefix(pe.Ref, "refs/heads/") // if Ref is a branch
ref = strings.TrimPrefix(ref, "refs/tags/") // if Ref is a tag
return ref
} | go | func (pe PushEvent) Branch() string {
ref := strings.TrimPrefix(pe.Ref, "refs/heads/") // if Ref is a branch
ref = strings.TrimPrefix(ref, "refs/tags/") // if Ref is a tag
return ref
} | [
"func",
"(",
"pe",
"PushEvent",
")",
"Branch",
"(",
")",
"string",
"{",
"ref",
":=",
"strings",
".",
"TrimPrefix",
"(",
"pe",
".",
"Ref",
",",
"\"refs/heads/\"",
")",
"\n",
"ref",
"=",
"strings",
".",
"TrimPrefix",
"(",
"ref",
",",
"\"refs/tags/\"",
")... | // Branch returns the name of the branch to which the user pushed. | [
"Branch",
"returns",
"the",
"name",
"of",
"the",
"branch",
"to",
"which",
"the",
"user",
"pushed",
"."
] | 8125fbda10178887be5dff9e901d6a0a519b67bc | https://github.com/kubernetes/test-infra/blob/8125fbda10178887be5dff9e901d6a0a519b67bc/prow/github/types.go#L613-L617 | test |
kubernetes/test-infra | prow/github/report/report.go | truncate | func truncate(in string) string {
const (
half = (maxLen - len(elide)) / 2
)
if len(in) <= maxLen {
return in
}
return in[:half] + elide + in[len(in)-half:]
} | go | func truncate(in string) string {
const (
half = (maxLen - len(elide)) / 2
)
if len(in) <= maxLen {
return in
}
return in[:half] + elide + in[len(in)-half:]
} | [
"func",
"truncate",
"(",
"in",
"string",
")",
"string",
"{",
"const",
"(",
"half",
"=",
"(",
"maxLen",
"-",
"len",
"(",
"elide",
")",
")",
"/",
"2",
"\n",
")",
"\n",
"if",
"len",
"(",
"in",
")",
"<=",
"maxLen",
"{",
"return",
"in",
"\n",
"}",
... | // truncate converts "really long messages" into "really ... messages". | [
"truncate",
"converts",
"really",
"long",
"messages",
"into",
"really",
"...",
"messages",
"."
] | 8125fbda10178887be5dff9e901d6a0a519b67bc | https://github.com/kubernetes/test-infra/blob/8125fbda10178887be5dff9e901d6a0a519b67bc/prow/github/report/report.go#L74-L82 | test |
kubernetes/test-infra | prow/github/report/report.go | reportStatus | func reportStatus(ghc GitHubClient, pj prowapi.ProwJob) error {
refs := pj.Spec.Refs
if pj.Spec.Report {
contextState, err := prowjobStateToGitHubStatus(pj.Status.State)
if err != nil {
return err
}
sha := refs.BaseSHA
if len(refs.Pulls) > 0 {
sha = refs.Pulls[0].SHA
}
if err := ghc.CreateStatus(r... | go | func reportStatus(ghc GitHubClient, pj prowapi.ProwJob) error {
refs := pj.Spec.Refs
if pj.Spec.Report {
contextState, err := prowjobStateToGitHubStatus(pj.Status.State)
if err != nil {
return err
}
sha := refs.BaseSHA
if len(refs.Pulls) > 0 {
sha = refs.Pulls[0].SHA
}
if err := ghc.CreateStatus(r... | [
"func",
"reportStatus",
"(",
"ghc",
"GitHubClient",
",",
"pj",
"prowapi",
".",
"ProwJob",
")",
"error",
"{",
"refs",
":=",
"pj",
".",
"Spec",
".",
"Refs",
"\n",
"if",
"pj",
".",
"Spec",
".",
"Report",
"{",
"contextState",
",",
"err",
":=",
"prowjobStat... | // reportStatus should be called on any prowjob status changes | [
"reportStatus",
"should",
"be",
"called",
"on",
"any",
"prowjob",
"status",
"changes"
] | 8125fbda10178887be5dff9e901d6a0a519b67bc | https://github.com/kubernetes/test-infra/blob/8125fbda10178887be5dff9e901d6a0a519b67bc/prow/github/report/report.go#L85-L106 | test |
kubernetes/test-infra | prow/github/report/report.go | parseIssueComments | func parseIssueComments(pj prowapi.ProwJob, botName string, ics []github.IssueComment) ([]int, []string, int) {
var delete []int
var previousComments []int
var latestComment int
var entries []string
// First accumulate result entries and comment IDs
for _, ic := range ics {
if ic.User.Login != botName {
cont... | go | func parseIssueComments(pj prowapi.ProwJob, botName string, ics []github.IssueComment) ([]int, []string, int) {
var delete []int
var previousComments []int
var latestComment int
var entries []string
// First accumulate result entries and comment IDs
for _, ic := range ics {
if ic.User.Login != botName {
cont... | [
"func",
"parseIssueComments",
"(",
"pj",
"prowapi",
".",
"ProwJob",
",",
"botName",
"string",
",",
"ics",
"[",
"]",
"github",
".",
"IssueComment",
")",
"(",
"[",
"]",
"int",
",",
"[",
"]",
"string",
",",
"int",
")",
"{",
"var",
"delete",
"[",
"]",
... | // parseIssueComments returns a list of comments to delete, a list of table
// entries, and the ID of the comment to update. If there are no table entries
// then don't make a new comment. Otherwise, if the comment to update is 0,
// create a new comment. | [
"parseIssueComments",
"returns",
"a",
"list",
"of",
"comments",
"to",
"delete",
"a",
"list",
"of",
"table",
"entries",
"and",
"the",
"ID",
"of",
"the",
"comment",
"to",
"update",
".",
"If",
"there",
"are",
"no",
"table",
"entries",
"then",
"don",
"t",
"m... | 8125fbda10178887be5dff9e901d6a0a519b67bc | https://github.com/kubernetes/test-infra/blob/8125fbda10178887be5dff9e901d6a0a519b67bc/prow/github/report/report.go#L196-L264 | test |
kubernetes/test-infra | prow/github/report/report.go | createComment | func createComment(reportTemplate *template.Template, pj prowapi.ProwJob, entries []string) (string, error) {
plural := ""
if len(entries) > 1 {
plural = "s"
}
var b bytes.Buffer
if reportTemplate != nil {
if err := reportTemplate.Execute(&b, &pj); err != nil {
return "", err
}
}
lines := []string{
fm... | go | func createComment(reportTemplate *template.Template, pj prowapi.ProwJob, entries []string) (string, error) {
plural := ""
if len(entries) > 1 {
plural = "s"
}
var b bytes.Buffer
if reportTemplate != nil {
if err := reportTemplate.Execute(&b, &pj); err != nil {
return "", err
}
}
lines := []string{
fm... | [
"func",
"createComment",
"(",
"reportTemplate",
"*",
"template",
".",
"Template",
",",
"pj",
"prowapi",
".",
"ProwJob",
",",
"entries",
"[",
"]",
"string",
")",
"(",
"string",
",",
"error",
")",
"{",
"plural",
":=",
"\"\"",
"\n",
"if",
"len",
"(",
"ent... | // createComment take a ProwJob and a list of entries generated with
// createEntry and returns a nicely formatted comment. It may fail if template
// execution fails. | [
"createComment",
"take",
"a",
"ProwJob",
"and",
"a",
"list",
"of",
"entries",
"generated",
"with",
"createEntry",
"and",
"returns",
"a",
"nicely",
"formatted",
"comment",
".",
"It",
"may",
"fail",
"if",
"template",
"execution",
"fails",
"."
] | 8125fbda10178887be5dff9e901d6a0a519b67bc | https://github.com/kubernetes/test-infra/blob/8125fbda10178887be5dff9e901d6a0a519b67bc/prow/github/report/report.go#L278-L308 | test |
kubernetes/test-infra | prow/spyglass/lenses/junit/lens.go | Config | func (lens Lens) Config() lenses.LensConfig {
return lenses.LensConfig{
Name: name,
Title: title,
Priority: priority,
}
} | go | func (lens Lens) Config() lenses.LensConfig {
return lenses.LensConfig{
Name: name,
Title: title,
Priority: priority,
}
} | [
"func",
"(",
"lens",
"Lens",
")",
"Config",
"(",
")",
"lenses",
".",
"LensConfig",
"{",
"return",
"lenses",
".",
"LensConfig",
"{",
"Name",
":",
"name",
",",
"Title",
":",
"title",
",",
"Priority",
":",
"priority",
",",
"}",
"\n",
"}"
] | // Config returns the lens's configuration. | [
"Config",
"returns",
"the",
"lens",
"s",
"configuration",
"."
] | 8125fbda10178887be5dff9e901d6a0a519b67bc | https://github.com/kubernetes/test-infra/blob/8125fbda10178887be5dff9e901d6a0a519b67bc/prow/spyglass/lenses/junit/lens.go#L48-L54 | test |
kubernetes/test-infra | prow/spyglass/lenses/junit/lens.go | Callback | func (lens Lens) Callback(artifacts []lenses.Artifact, resourceDir string, data string) string {
return ""
} | go | func (lens Lens) Callback(artifacts []lenses.Artifact, resourceDir string, data string) string {
return ""
} | [
"func",
"(",
"lens",
"Lens",
")",
"Callback",
"(",
"artifacts",
"[",
"]",
"lenses",
".",
"Artifact",
",",
"resourceDir",
"string",
",",
"data",
"string",
")",
"string",
"{",
"return",
"\"\"",
"\n",
"}"
] | // Callback does nothing. | [
"Callback",
"does",
"nothing",
"."
] | 8125fbda10178887be5dff9e901d6a0a519b67bc | https://github.com/kubernetes/test-infra/blob/8125fbda10178887be5dff9e901d6a0a519b67bc/prow/spyglass/lenses/junit/lens.go#L70-L72 | test |
kubernetes/test-infra | prow/pod-utils/clone/format.go | FormatRecord | func FormatRecord(record Record) string {
output := bytes.Buffer{}
if record.Failed {
fmt.Fprintln(&output, "# FAILED!")
}
fmt.Fprintf(&output, "# Cloning %s/%s at %s", record.Refs.Org, record.Refs.Repo, record.Refs.BaseRef)
if record.Refs.BaseSHA != "" {
fmt.Fprintf(&output, "(%s)", record.Refs.BaseSHA)
}
o... | go | func FormatRecord(record Record) string {
output := bytes.Buffer{}
if record.Failed {
fmt.Fprintln(&output, "# FAILED!")
}
fmt.Fprintf(&output, "# Cloning %s/%s at %s", record.Refs.Org, record.Refs.Repo, record.Refs.BaseRef)
if record.Refs.BaseSHA != "" {
fmt.Fprintf(&output, "(%s)", record.Refs.BaseSHA)
}
o... | [
"func",
"FormatRecord",
"(",
"record",
"Record",
")",
"string",
"{",
"output",
":=",
"bytes",
".",
"Buffer",
"{",
"}",
"\n",
"if",
"record",
".",
"Failed",
"{",
"fmt",
".",
"Fprintln",
"(",
"&",
"output",
",",
"\"# FAILED!\"",
")",
"\n",
"}",
"\n",
"... | // FormatRecord describes the record in a human-readable
// manner for inclusion into build logs | [
"FormatRecord",
"describes",
"the",
"record",
"in",
"a",
"human",
"-",
"readable",
"manner",
"for",
"inclusion",
"into",
"build",
"logs"
] | 8125fbda10178887be5dff9e901d6a0a519b67bc | https://github.com/kubernetes/test-infra/blob/8125fbda10178887be5dff9e901d6a0a519b67bc/prow/pod-utils/clone/format.go#L26-L55 | test |
kubernetes/test-infra | prow/kube/client.go | Namespace | func (c *Client) Namespace(ns string) *Client {
nc := *c
nc.namespace = ns
return &nc
} | go | func (c *Client) Namespace(ns string) *Client {
nc := *c
nc.namespace = ns
return &nc
} | [
"func",
"(",
"c",
"*",
"Client",
")",
"Namespace",
"(",
"ns",
"string",
")",
"*",
"Client",
"{",
"nc",
":=",
"*",
"c",
"\n",
"nc",
".",
"namespace",
"=",
"ns",
"\n",
"return",
"&",
"nc",
"\n",
"}"
] | // Namespace returns a copy of the client pointing at the specified namespace. | [
"Namespace",
"returns",
"a",
"copy",
"of",
"the",
"client",
"pointing",
"at",
"the",
"specified",
"namespace",
"."
] | 8125fbda10178887be5dff9e901d6a0a519b67bc | https://github.com/kubernetes/test-infra/blob/8125fbda10178887be5dff9e901d6a0a519b67bc/prow/kube/client.go#L79-L83 | test |
kubernetes/test-infra | prow/kube/client.go | NewFakeClient | func NewFakeClient(deckURL string) *Client {
return &Client{
namespace: "default",
deckURL: deckURL,
client: &http.Client{},
fake: true,
}
} | go | func NewFakeClient(deckURL string) *Client {
return &Client{
namespace: "default",
deckURL: deckURL,
client: &http.Client{},
fake: true,
}
} | [
"func",
"NewFakeClient",
"(",
"deckURL",
"string",
")",
"*",
"Client",
"{",
"return",
"&",
"Client",
"{",
"namespace",
":",
"\"default\"",
",",
"deckURL",
":",
"deckURL",
",",
"client",
":",
"&",
"http",
".",
"Client",
"{",
"}",
",",
"fake",
":",
"true... | // NewFakeClient creates a client that doesn't do anything. If you provide a
// deck URL then the client will hit that for the supported calls. | [
"NewFakeClient",
"creates",
"a",
"client",
"that",
"doesn",
"t",
"do",
"anything",
".",
"If",
"you",
"provide",
"a",
"deck",
"URL",
"then",
"the",
"client",
"will",
"hit",
"that",
"for",
"the",
"supported",
"calls",
"."
] | 8125fbda10178887be5dff9e901d6a0a519b67bc | https://github.com/kubernetes/test-infra/blob/8125fbda10178887be5dff9e901d6a0a519b67bc/prow/kube/client.go#L261-L268 | test |
kubernetes/test-infra | prow/kube/client.go | NewClientInCluster | func NewClientInCluster(namespace string) (*Client, error) {
tokenFile := "/var/run/secrets/kubernetes.io/serviceaccount/token"
token, err := ioutil.ReadFile(tokenFile)
if err != nil {
return nil, err
}
rootCAFile := "/var/run/secrets/kubernetes.io/serviceaccount/ca.crt"
certData, err := ioutil.ReadFile(rootCA... | go | func NewClientInCluster(namespace string) (*Client, error) {
tokenFile := "/var/run/secrets/kubernetes.io/serviceaccount/token"
token, err := ioutil.ReadFile(tokenFile)
if err != nil {
return nil, err
}
rootCAFile := "/var/run/secrets/kubernetes.io/serviceaccount/ca.crt"
certData, err := ioutil.ReadFile(rootCA... | [
"func",
"NewClientInCluster",
"(",
"namespace",
"string",
")",
"(",
"*",
"Client",
",",
"error",
")",
"{",
"tokenFile",
":=",
"\"/var/run/secrets/kubernetes.io/serviceaccount/token\"",
"\n",
"token",
",",
"err",
":=",
"ioutil",
".",
"ReadFile",
"(",
"tokenFile",
"... | // NewClientInCluster creates a Client that works from within a pod. | [
"NewClientInCluster",
"creates",
"a",
"Client",
"that",
"works",
"from",
"within",
"a",
"pod",
"."
] | 8125fbda10178887be5dff9e901d6a0a519b67bc | https://github.com/kubernetes/test-infra/blob/8125fbda10178887be5dff9e901d6a0a519b67bc/prow/kube/client.go#L271-L300 | test |
kubernetes/test-infra | prow/kube/client.go | NewClientFromFile | func NewClientFromFile(clusterPath, namespace string) (*Client, error) {
data, err := ioutil.ReadFile(clusterPath)
if err != nil {
return nil, err
}
var c Cluster
if err := yaml.Unmarshal(data, &c); err != nil {
return nil, err
}
return NewClient(&c, namespace)
} | go | func NewClientFromFile(clusterPath, namespace string) (*Client, error) {
data, err := ioutil.ReadFile(clusterPath)
if err != nil {
return nil, err
}
var c Cluster
if err := yaml.Unmarshal(data, &c); err != nil {
return nil, err
}
return NewClient(&c, namespace)
} | [
"func",
"NewClientFromFile",
"(",
"clusterPath",
",",
"namespace",
"string",
")",
"(",
"*",
"Client",
",",
"error",
")",
"{",
"data",
",",
"err",
":=",
"ioutil",
".",
"ReadFile",
"(",
"clusterPath",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"... | // NewClientFromFile reads a Cluster object at clusterPath and returns an
// authenticated client using the keys within. | [
"NewClientFromFile",
"reads",
"a",
"Cluster",
"object",
"at",
"clusterPath",
"and",
"returns",
"an",
"authenticated",
"client",
"using",
"the",
"keys",
"within",
"."
] | 8125fbda10178887be5dff9e901d6a0a519b67bc | https://github.com/kubernetes/test-infra/blob/8125fbda10178887be5dff9e901d6a0a519b67bc/prow/kube/client.go#L321-L331 | test |
kubernetes/test-infra | prow/kube/client.go | NewClient | func NewClient(c *Cluster, namespace string) (*Client, error) {
// Relies on json encoding/decoding []byte as base64
// https://golang.org/pkg/encoding/json/#Marshal
cc := c.ClientCertificate
ck := c.ClientKey
ca := c.ClusterCACertificate
cert, err := tls.X509KeyPair(cc, ck)
if err != nil {
return nil, err
}... | go | func NewClient(c *Cluster, namespace string) (*Client, error) {
// Relies on json encoding/decoding []byte as base64
// https://golang.org/pkg/encoding/json/#Marshal
cc := c.ClientCertificate
ck := c.ClientKey
ca := c.ClusterCACertificate
cert, err := tls.X509KeyPair(cc, ck)
if err != nil {
return nil, err
}... | [
"func",
"NewClient",
"(",
"c",
"*",
"Cluster",
",",
"namespace",
"string",
")",
"(",
"*",
"Client",
",",
"error",
")",
"{",
"cc",
":=",
"c",
".",
"ClientCertificate",
"\n",
"ck",
":=",
"c",
".",
"ClientKey",
"\n",
"ca",
":=",
"c",
".",
"ClusterCACert... | // NewClient returns an authenticated Client using the keys in the Cluster. | [
"NewClient",
"returns",
"an",
"authenticated",
"Client",
"using",
"the",
"keys",
"in",
"the",
"Cluster",
"."
] | 8125fbda10178887be5dff9e901d6a0a519b67bc | https://github.com/kubernetes/test-infra/blob/8125fbda10178887be5dff9e901d6a0a519b67bc/prow/kube/client.go#L385-L413 | test |
kubernetes/test-infra | prow/kube/client.go | ReplaceConfigMap | func (c *Client) ReplaceConfigMap(name string, config ConfigMap) (ConfigMap, error) {
c.log("ReplaceConfigMap", name)
namespace := c.namespace
if config.Namespace != "" {
namespace = config.Namespace
}
var retConfigMap ConfigMap
err := c.request(&request{
method: http.MethodPut,
path: fmt.Sprint... | go | func (c *Client) ReplaceConfigMap(name string, config ConfigMap) (ConfigMap, error) {
c.log("ReplaceConfigMap", name)
namespace := c.namespace
if config.Namespace != "" {
namespace = config.Namespace
}
var retConfigMap ConfigMap
err := c.request(&request{
method: http.MethodPut,
path: fmt.Sprint... | [
"func",
"(",
"c",
"*",
"Client",
")",
"ReplaceConfigMap",
"(",
"name",
"string",
",",
"config",
"ConfigMap",
")",
"(",
"ConfigMap",
",",
"error",
")",
"{",
"c",
".",
"log",
"(",
"\"ReplaceConfigMap\"",
",",
"name",
")",
"\n",
"namespace",
":=",
"c",
".... | // ReplaceConfigMap puts the configmap into name.
//
// Analogous to kubectl replace configmap
//
// If config.Namespace is empty, the client's specified namespace is used.
// Returns the content returned by the apiserver | [
"ReplaceConfigMap",
"puts",
"the",
"configmap",
"into",
"name",
".",
"Analogous",
"to",
"kubectl",
"replace",
"configmap",
"If",
"config",
".",
"Namespace",
"is",
"empty",
"the",
"client",
"s",
"specified",
"namespace",
"is",
"used",
".",
"Returns",
"the",
"co... | 8125fbda10178887be5dff9e901d6a0a519b67bc | https://github.com/kubernetes/test-infra/blob/8125fbda10178887be5dff9e901d6a0a519b67bc/prow/kube/client.go#L617-L631 | test |
kubernetes/test-infra | greenhouse/diskutil/diskutil.go | GetDiskUsage | func GetDiskUsage(path string) (percentBlocksFree float64, bytesFree, bytesUsed uint64, err error) {
var stat syscall.Statfs_t
err = syscall.Statfs(path, &stat)
if err != nil {
return 0, 0, 0, err
}
percentBlocksFree = float64(stat.Bfree) / float64(stat.Blocks) * 100
bytesFree = stat.Bfree * uint64(stat.Bsize)
... | go | func GetDiskUsage(path string) (percentBlocksFree float64, bytesFree, bytesUsed uint64, err error) {
var stat syscall.Statfs_t
err = syscall.Statfs(path, &stat)
if err != nil {
return 0, 0, 0, err
}
percentBlocksFree = float64(stat.Bfree) / float64(stat.Blocks) * 100
bytesFree = stat.Bfree * uint64(stat.Bsize)
... | [
"func",
"GetDiskUsage",
"(",
"path",
"string",
")",
"(",
"percentBlocksFree",
"float64",
",",
"bytesFree",
",",
"bytesUsed",
"uint64",
",",
"err",
"error",
")",
"{",
"var",
"stat",
"syscall",
".",
"Statfs_t",
"\n",
"err",
"=",
"syscall",
".",
"Statfs",
"("... | // GetDiskUsage wraps syscall.Statfs for usage in GCing the disk | [
"GetDiskUsage",
"wraps",
"syscall",
".",
"Statfs",
"for",
"usage",
"in",
"GCing",
"the",
"disk"
] | 8125fbda10178887be5dff9e901d6a0a519b67bc | https://github.com/kubernetes/test-infra/blob/8125fbda10178887be5dff9e901d6a0a519b67bc/greenhouse/diskutil/diskutil.go#L29-L39 | test |
kubernetes/test-infra | greenhouse/diskutil/diskutil.go | GetATime | func GetATime(path string, defaultTime time.Time) time.Time {
at, err := atime.Stat(path)
if err != nil {
log.WithError(err).Errorf("Could not get atime for %s", path)
return defaultTime
}
return at
} | go | func GetATime(path string, defaultTime time.Time) time.Time {
at, err := atime.Stat(path)
if err != nil {
log.WithError(err).Errorf("Could not get atime for %s", path)
return defaultTime
}
return at
} | [
"func",
"GetATime",
"(",
"path",
"string",
",",
"defaultTime",
"time",
".",
"Time",
")",
"time",
".",
"Time",
"{",
"at",
",",
"err",
":=",
"atime",
".",
"Stat",
"(",
"path",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"log",
".",
"WithError",
"(",
... | // GetATime the atime for a file, logging errors instead of failing
// and returning defaultTime instead | [
"GetATime",
"the",
"atime",
"for",
"a",
"file",
"logging",
"errors",
"instead",
"of",
"failing",
"and",
"returning",
"defaultTime",
"instead"
] | 8125fbda10178887be5dff9e901d6a0a519b67bc | https://github.com/kubernetes/test-infra/blob/8125fbda10178887be5dff9e901d6a0a519b67bc/greenhouse/diskutil/diskutil.go#L43-L50 | test |
kubernetes/test-infra | prow/spyglass/lenses/lenses.go | RegisterLens | func RegisterLens(lens Lens) error {
config := lens.Config()
_, ok := lensReg[config.Name]
if ok {
return fmt.Errorf("viewer already registered with name %s", config.Name)
}
if config.Title == "" {
return errors.New("empty title field in view metadata")
}
if config.Priority < 0 {
return errors.New("priori... | go | func RegisterLens(lens Lens) error {
config := lens.Config()
_, ok := lensReg[config.Name]
if ok {
return fmt.Errorf("viewer already registered with name %s", config.Name)
}
if config.Title == "" {
return errors.New("empty title field in view metadata")
}
if config.Priority < 0 {
return errors.New("priori... | [
"func",
"RegisterLens",
"(",
"lens",
"Lens",
")",
"error",
"{",
"config",
":=",
"lens",
".",
"Config",
"(",
")",
"\n",
"_",
",",
"ok",
":=",
"lensReg",
"[",
"config",
".",
"Name",
"]",
"\n",
"if",
"ok",
"{",
"return",
"fmt",
".",
"Errorf",
"(",
"... | // RegisterLens registers new viewers | [
"RegisterLens",
"registers",
"new",
"viewers"
] | 8125fbda10178887be5dff9e901d6a0a519b67bc | https://github.com/kubernetes/test-infra/blob/8125fbda10178887be5dff9e901d6a0a519b67bc/prow/spyglass/lenses/lenses.go#L96-L112 | test |
kubernetes/test-infra | prow/spyglass/lenses/lenses.go | GetLens | func GetLens(name string) (Lens, error) {
lens, ok := lensReg[name]
if !ok {
return nil, ErrInvalidLensName
}
return lens, nil
} | go | func GetLens(name string) (Lens, error) {
lens, ok := lensReg[name]
if !ok {
return nil, ErrInvalidLensName
}
return lens, nil
} | [
"func",
"GetLens",
"(",
"name",
"string",
")",
"(",
"Lens",
",",
"error",
")",
"{",
"lens",
",",
"ok",
":=",
"lensReg",
"[",
"name",
"]",
"\n",
"if",
"!",
"ok",
"{",
"return",
"nil",
",",
"ErrInvalidLensName",
"\n",
"}",
"\n",
"return",
"lens",
","... | // GetLens returns a Lens by name, if it exists; otherwise it returns an error. | [
"GetLens",
"returns",
"a",
"Lens",
"by",
"name",
"if",
"it",
"exists",
";",
"otherwise",
"it",
"returns",
"an",
"error",
"."
] | 8125fbda10178887be5dff9e901d6a0a519b67bc | https://github.com/kubernetes/test-infra/blob/8125fbda10178887be5dff9e901d6a0a519b67bc/prow/spyglass/lenses/lenses.go#L115-L121 | test |
kubernetes/test-infra | prow/spyglass/lenses/lenses.go | LastNLines | func LastNLines(a Artifact, n int64) ([]string, error) {
// 300B, a reasonable log line length, probably a bit more scalable than a hard-coded value
return LastNLinesChunked(a, n, 300*n+1)
} | go | func LastNLines(a Artifact, n int64) ([]string, error) {
// 300B, a reasonable log line length, probably a bit more scalable than a hard-coded value
return LastNLinesChunked(a, n, 300*n+1)
} | [
"func",
"LastNLines",
"(",
"a",
"Artifact",
",",
"n",
"int64",
")",
"(",
"[",
"]",
"string",
",",
"error",
")",
"{",
"return",
"LastNLinesChunked",
"(",
"a",
",",
"n",
",",
"300",
"*",
"n",
"+",
"1",
")",
"\n",
"}"
] | // LastNLines reads the last n lines from an artifact. | [
"LastNLines",
"reads",
"the",
"last",
"n",
"lines",
"from",
"an",
"artifact",
"."
] | 8125fbda10178887be5dff9e901d6a0a519b67bc | https://github.com/kubernetes/test-infra/blob/8125fbda10178887be5dff9e901d6a0a519b67bc/prow/spyglass/lenses/lenses.go#L130-L133 | test |
kubernetes/test-infra | prow/slack/client.go | NewClient | func NewClient(tokenGenerator func() []byte) *Client {
return &Client{
logger: logrus.WithField("client", "slack"),
tokenGenerator: tokenGenerator,
}
} | go | func NewClient(tokenGenerator func() []byte) *Client {
return &Client{
logger: logrus.WithField("client", "slack"),
tokenGenerator: tokenGenerator,
}
} | [
"func",
"NewClient",
"(",
"tokenGenerator",
"func",
"(",
")",
"[",
"]",
"byte",
")",
"*",
"Client",
"{",
"return",
"&",
"Client",
"{",
"logger",
":",
"logrus",
".",
"WithField",
"(",
"\"client\"",
",",
"\"slack\"",
")",
",",
"tokenGenerator",
":",
"token... | // NewClient creates a slack client with an API token. | [
"NewClient",
"creates",
"a",
"slack",
"client",
"with",
"an",
"API",
"token",
"."
] | 8125fbda10178887be5dff9e901d6a0a519b67bc | https://github.com/kubernetes/test-infra/blob/8125fbda10178887be5dff9e901d6a0a519b67bc/prow/slack/client.go#L53-L58 | test |
kubernetes/test-infra | prow/slack/client.go | WriteMessage | func (sl *Client) WriteMessage(text, channel string) error {
sl.log("WriteMessage", text, channel)
if sl.fake {
return nil
}
var uv = sl.urlValues()
uv.Add("channel", channel)
uv.Add("text", text)
_, err := sl.postMessage(chatPostMessage, uv)
return err
} | go | func (sl *Client) WriteMessage(text, channel string) error {
sl.log("WriteMessage", text, channel)
if sl.fake {
return nil
}
var uv = sl.urlValues()
uv.Add("channel", channel)
uv.Add("text", text)
_, err := sl.postMessage(chatPostMessage, uv)
return err
} | [
"func",
"(",
"sl",
"*",
"Client",
")",
"WriteMessage",
"(",
"text",
",",
"channel",
"string",
")",
"error",
"{",
"sl",
".",
"log",
"(",
"\"WriteMessage\"",
",",
"text",
",",
"channel",
")",
"\n",
"if",
"sl",
".",
"fake",
"{",
"return",
"nil",
"\n",
... | // WriteMessage adds text to channel | [
"WriteMessage",
"adds",
"text",
"to",
"channel"
] | 8125fbda10178887be5dff9e901d6a0a519b67bc | https://github.com/kubernetes/test-infra/blob/8125fbda10178887be5dff9e901d6a0a519b67bc/prow/slack/client.go#L102-L114 | test |
kubernetes/test-infra | maintenance/aws-janitor/resources/nat_gateway.go | MarkAndSweep | func (NATGateway) MarkAndSweep(sess *session.Session, acct string, region string, set *Set) error {
svc := ec2.New(sess, &aws.Config{Region: aws.String(region)})
inp := &ec2.DescribeNatGatewaysInput{}
if err := svc.DescribeNatGatewaysPages(inp, func(page *ec2.DescribeNatGatewaysOutput, _ bool) bool {
for _, gw :=... | go | func (NATGateway) MarkAndSweep(sess *session.Session, acct string, region string, set *Set) error {
svc := ec2.New(sess, &aws.Config{Region: aws.String(region)})
inp := &ec2.DescribeNatGatewaysInput{}
if err := svc.DescribeNatGatewaysPages(inp, func(page *ec2.DescribeNatGatewaysOutput, _ bool) bool {
for _, gw :=... | [
"func",
"(",
"NATGateway",
")",
"MarkAndSweep",
"(",
"sess",
"*",
"session",
".",
"Session",
",",
"acct",
"string",
",",
"region",
"string",
",",
"set",
"*",
"Set",
")",
"error",
"{",
"svc",
":=",
"ec2",
".",
"New",
"(",
"sess",
",",
"&",
"aws",
".... | // MarkAndSweep looks at the provided set, and removes resources older than its TTL that have been previously tagged. | [
"MarkAndSweep",
"looks",
"at",
"the",
"provided",
"set",
"and",
"removes",
"resources",
"older",
"than",
"its",
"TTL",
"that",
"have",
"been",
"previously",
"tagged",
"."
] | 8125fbda10178887be5dff9e901d6a0a519b67bc | https://github.com/kubernetes/test-infra/blob/8125fbda10178887be5dff9e901d6a0a519b67bc/maintenance/aws-janitor/resources/nat_gateway.go#L36-L61 | test |
kubernetes/test-infra | maintenance/aws-janitor/resources/nat_gateway.go | ListAll | func (NATGateway) ListAll(sess *session.Session, acct, region string) (*Set, error) {
svc := ec2.New(sess, &aws.Config{Region: aws.String(region)})
set := NewSet(0)
inp := &ec2.DescribeNatGatewaysInput{}
err := svc.DescribeNatGatewaysPages(inp, func(page *ec2.DescribeNatGatewaysOutput, _ bool) bool {
for _, gw :... | go | func (NATGateway) ListAll(sess *session.Session, acct, region string) (*Set, error) {
svc := ec2.New(sess, &aws.Config{Region: aws.String(region)})
set := NewSet(0)
inp := &ec2.DescribeNatGatewaysInput{}
err := svc.DescribeNatGatewaysPages(inp, func(page *ec2.DescribeNatGatewaysOutput, _ bool) bool {
for _, gw :... | [
"func",
"(",
"NATGateway",
")",
"ListAll",
"(",
"sess",
"*",
"session",
".",
"Session",
",",
"acct",
",",
"region",
"string",
")",
"(",
"*",
"Set",
",",
"error",
")",
"{",
"svc",
":=",
"ec2",
".",
"New",
"(",
"sess",
",",
"&",
"aws",
".",
"Config... | // ListAll populates a set will all available NATGateway resources. | [
"ListAll",
"populates",
"a",
"set",
"will",
"all",
"available",
"NATGateway",
"resources",
"."
] | 8125fbda10178887be5dff9e901d6a0a519b67bc | https://github.com/kubernetes/test-infra/blob/8125fbda10178887be5dff9e901d6a0a519b67bc/maintenance/aws-janitor/resources/nat_gateway.go#L64-L85 | test |
kubernetes/test-infra | boskos/client/client.go | NewClient | func NewClient(owner string, url string) *Client {
client := &Client{
url: url,
owner: owner,
storage: storage.NewMemoryStorage(),
}
// Configure the dialer to attempt three additional times to establish
// a connection after a failed dial attempt. The dialer should wait 10
// seconds between each at... | go | func NewClient(owner string, url string) *Client {
client := &Client{
url: url,
owner: owner,
storage: storage.NewMemoryStorage(),
}
// Configure the dialer to attempt three additional times to establish
// a connection after a failed dial attempt. The dialer should wait 10
// seconds between each at... | [
"func",
"NewClient",
"(",
"owner",
"string",
",",
"url",
"string",
")",
"*",
"Client",
"{",
"client",
":=",
"&",
"Client",
"{",
"url",
":",
"url",
",",
"owner",
":",
"owner",
",",
"storage",
":",
"storage",
".",
"NewMemoryStorage",
"(",
")",
",",
"}"... | // NewClient creates a Boskos client for the specified URL and resource owner.
//
// Clients created with this function default to retrying failed connection
// attempts three times with a ten second pause between each attempt. | [
"NewClient",
"creates",
"a",
"Boskos",
"client",
"for",
"the",
"specified",
"URL",
"and",
"resource",
"owner",
".",
"Clients",
"created",
"with",
"this",
"function",
"default",
"to",
"retrying",
"failed",
"connection",
"attempts",
"three",
"times",
"with",
"a",
... | 8125fbda10178887be5dff9e901d6a0a519b67bc | https://github.com/kubernetes/test-infra/blob/8125fbda10178887be5dff9e901d6a0a519b67bc/boskos/client/client.go#L72-L106 | test |
kubernetes/test-infra | boskos/client/client.go | Acquire | func (c *Client) Acquire(rtype, state, dest string) (*common.Resource, error) {
r, err := c.acquire(rtype, state, dest)
if err != nil {
return nil, err
}
c.lock.Lock()
defer c.lock.Unlock()
if r != nil {
c.storage.Add(*r)
}
return r, nil
} | go | func (c *Client) Acquire(rtype, state, dest string) (*common.Resource, error) {
r, err := c.acquire(rtype, state, dest)
if err != nil {
return nil, err
}
c.lock.Lock()
defer c.lock.Unlock()
if r != nil {
c.storage.Add(*r)
}
return r, nil
} | [
"func",
"(",
"c",
"*",
"Client",
")",
"Acquire",
"(",
"rtype",
",",
"state",
",",
"dest",
"string",
")",
"(",
"*",
"common",
".",
"Resource",
",",
"error",
")",
"{",
"r",
",",
"err",
":=",
"c",
".",
"acquire",
"(",
"rtype",
",",
"state",
",",
"... | // public method
// Acquire asks boskos for a resource of certain type in certain state, and set the resource to dest state.
// Returns the resource on success. | [
"public",
"method",
"Acquire",
"asks",
"boskos",
"for",
"a",
"resource",
"of",
"certain",
"type",
"in",
"certain",
"state",
"and",
"set",
"the",
"resource",
"to",
"dest",
"state",
".",
"Returns",
"the",
"resource",
"on",
"success",
"."
] | 8125fbda10178887be5dff9e901d6a0a519b67bc | https://github.com/kubernetes/test-infra/blob/8125fbda10178887be5dff9e901d6a0a519b67bc/boskos/client/client.go#L112-L124 | test |
kubernetes/test-infra | boskos/client/client.go | AcquireWait | func (c *Client) AcquireWait(ctx context.Context, rtype, state, dest string) (*common.Resource, error) {
if ctx == nil {
return nil, ErrContextRequired
}
// Try to acquire the resource until available or the context is
// cancelled or its deadline exceeded.
for {
r, err := c.Acquire(rtype, state, dest)
if er... | go | func (c *Client) AcquireWait(ctx context.Context, rtype, state, dest string) (*common.Resource, error) {
if ctx == nil {
return nil, ErrContextRequired
}
// Try to acquire the resource until available or the context is
// cancelled or its deadline exceeded.
for {
r, err := c.Acquire(rtype, state, dest)
if er... | [
"func",
"(",
"c",
"*",
"Client",
")",
"AcquireWait",
"(",
"ctx",
"context",
".",
"Context",
",",
"rtype",
",",
"state",
",",
"dest",
"string",
")",
"(",
"*",
"common",
".",
"Resource",
",",
"error",
")",
"{",
"if",
"ctx",
"==",
"nil",
"{",
"return"... | // AcquireWait blocks until Acquire returns the specified resource or the
// provided context is cancelled or its deadline exceeded. | [
"AcquireWait",
"blocks",
"until",
"Acquire",
"returns",
"the",
"specified",
"resource",
"or",
"the",
"provided",
"context",
"is",
"cancelled",
"or",
"its",
"deadline",
"exceeded",
"."
] | 8125fbda10178887be5dff9e901d6a0a519b67bc | https://github.com/kubernetes/test-infra/blob/8125fbda10178887be5dff9e901d6a0a519b67bc/boskos/client/client.go#L128-L149 | test |
kubernetes/test-infra | boskos/client/client.go | AcquireByState | func (c *Client) AcquireByState(state, dest string, names []string) ([]common.Resource, error) {
resources, err := c.acquireByState(state, dest, names)
if err != nil {
return nil, err
}
c.lock.Lock()
defer c.lock.Unlock()
for _, r := range resources {
c.storage.Add(r)
}
return resources, nil
} | go | func (c *Client) AcquireByState(state, dest string, names []string) ([]common.Resource, error) {
resources, err := c.acquireByState(state, dest, names)
if err != nil {
return nil, err
}
c.lock.Lock()
defer c.lock.Unlock()
for _, r := range resources {
c.storage.Add(r)
}
return resources, nil
} | [
"func",
"(",
"c",
"*",
"Client",
")",
"AcquireByState",
"(",
"state",
",",
"dest",
"string",
",",
"names",
"[",
"]",
"string",
")",
"(",
"[",
"]",
"common",
".",
"Resource",
",",
"error",
")",
"{",
"resources",
",",
"err",
":=",
"c",
".",
"acquireB... | // AcquireByState asks boskos for a resources of certain type, and set the resource to dest state.
// Returns a list of resources on success. | [
"AcquireByState",
"asks",
"boskos",
"for",
"a",
"resources",
"of",
"certain",
"type",
"and",
"set",
"the",
"resource",
"to",
"dest",
"state",
".",
"Returns",
"a",
"list",
"of",
"resources",
"on",
"success",
"."
] | 8125fbda10178887be5dff9e901d6a0a519b67bc | https://github.com/kubernetes/test-infra/blob/8125fbda10178887be5dff9e901d6a0a519b67bc/boskos/client/client.go#L153-L164 | test |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.