id stringlengths 2 7 | text stringlengths 17 51.2k | title stringclasses 1 value |
|---|---|---|
c176400 | rec := &dir.Contents[i]
name := strings.TrimPrefix(rec.Name, object)
if name == "" {
selfIndex = i
continue
}
rec.Name = name
if strings.HasSuffix(name, "/") {
rec.isDir = true
}
}
for i := range dir.CommonPrefixes {
cp := &dir.CommonPrefixes[i]
cp.Prefix = strings.TrimPrefix(cp.Prefix, object)
}
if !isDir {
return nil, nil
}
if selfIndex >= 0 {
// Strip out the record that indicates this object.
dir.Contents = append(dir.Contents[:selfIndex], dir.Contents[selfIndex+1:]...)
}
return dir, nil
} | |
c176401 | inPath)
}
for i := range dir.Contents {
dir.Contents[i].Render(out, inPath)
}
if dir.NextMarker != "" {
htmlNextButton(out, gcsPath+inPath, dir.NextMarker)
}
htmlContentFooter(out)
htmlPageFooter(out)
} | |
c176402 | 15:04:05")
}
var url, size string
if rec.isDir {
url = gcsPath + inPath + rec.Name
size = "-"
} else {
url = gcsBaseURL + inPath + rec.Name
size = fmt.Sprintf("%v", rec.Size)
}
htmlGridItem(out, iconFile, url, rec.Name, size, mtime)
} | |
c176403 |
htmlGridItem(out, iconDir, url, pfx.Prefix, "-", "-")
} | |
c176404 | args...)
log.Printf("[txn-%s] "+fmt, args...)
} | |
c176405 | projects: instances[instance],
authService: gc.Authentication,
accountService: gc.Accounts,
changeService: gc.Changes,
projectService: gc.Projects,
}
}
return c, nil
} | |
c176406 | Message: message,
Labels: labels,
}); err != nil {
return fmt.Errorf("cannot comment to gerrit: %v", err)
}
return nil
} | |
c176407 | fmt.Errorf("not activated gerrit instance: %s", instance)
}
res, _, err := h.projectService.GetBranch(project, branch)
if err != nil {
return "", err
}
return res.Revision, nil
} | |
c176408 | from one project, log & continue
logrus.WithError(err).Errorf("fail to query changes for project %s", project)
continue
}
result = append(result, changes...)
}
return result
} | |
c176409 |
plugin: plugin,
pass: map[string]bool{},
}
} | |
c176410 |
cmd.Flags().BoolVar(&t.issues, "no-issues", false, "Ignore issues")
} | |
c176411 | "you can't ignore both pull-requests and issues")
}
return nil
} | |
c176412 | to the kubeConfig file")
fs.BoolVar(&o.inMemory, "in_memory", false, "Use in memory client instead of CRD")
} | |
c176413 | os.Stat(o.kubeConfig); err != nil {
return err
}
}
return nil
} | |
c176414 | newDummyClient(t), nil
}
return o.newCRDClient(t)
} | |
c176415 | var restClient *rest.RESTClient
restClient, err = rest.RESTClientFor(config)
if err != nil {
return nil, err
}
rc := Client{cl: restClient, ns: o.namespace, t: t,
codec: runtime.NewParameterCodec(scheme)}
return &rc, nil
} | |
c176416 |
config.GroupVersion = &version
config.APIPath = "/apis"
config.ContentType = runtime.ContentTypeJSON
types = runtime.NewScheme()
schemeBuilder := runtime.NewSchemeBuilder(
func(scheme *runtime.Scheme) error {
scheme.AddKnownTypes(version, t.Object, t.Collection)
v1.AddToGroupVersion(scheme, version)
return nil
})
err = schemeBuilder.AddToScheme(types)
config.NegotiatedSerializer = serializer.DirectCodecFactory{CodecFactory: serializer.NewCodecFactory(types)}
return
} | |
c176417 | t.Plural,
Kind: t.Kind,
ListKind: t.ListKind,
},
},
}
if _, err := c.ApiextensionsV1beta1().CustomResourceDefinitions().Create(crd); err != nil && !apierrors.IsAlreadyExists(err) {
return err
}
return nil
} | |
c176418 | t,
objects: make(map[string]Object),
}
return c
} | |
c176419 | find object %s", obj.GetName())
}
c.objects[obj.GetName()] = obj
return obj, nil
} | |
c176420 | Then check if PR has ok-to-test label
if l == nil {
var err error
l, err = ghc.GetIssueLabels(org, repo, num)
if err != nil {
return l, false, err
}
}
return l, github.HasLabel(labels.OkToTest, l), nil
} | |
c176421 | changes, branch, c.Config.Presubmits[pr.Base.Repo.FullName], c.Logger)
if err != nil {
return err
}
toSkip := determineSkippedPresubmits(toTest, toSkipSuperset, c.Logger)
return runAndSkipJobs(c, pr, toTest, toSkip, eventGUID, elideSkippedContexts)
} | |
c176422 | June 2019")
}
entries := o.entries()
passed, aborted, failures := wait(ctx, entries)
cancel()
// If we are being asked to terminate by the kubelet but we have
// seen the test process exit cleanly, we need a chance to upload
// artifacts to GCS. The only valid way for this program to exit
// after a SIGINT or SIGTERM in this situation is to finish
// uploading, so we ignore the signals.
signal.Ignore(os.Interrupt, syscall.SIGTERM)
buildLog := logReader(entries)
metadata := combineMetadata(entries)
return failures, o.doUpload(spec, passed, aborted, metadata, buildLog)
} | |
c176423 | error {
return s.configs.Add(conf)
} | |
c176424 | return s.configs.Delete(name)
} | |
c176425 | error {
return s.configs.Update(conf)
} | |
c176426 | conf, err = common.ItemToResourcesConfig(i)
if err != nil {
return common.ResourcesConfig{}, err
}
return conf, nil
} | |
c176427 | common.ResourcesConfig
conf, err = common.ItemToResourcesConfig(i)
if err != nil {
return nil, err
}
configs = append(configs, conf)
}
return configs, nil
} | |
c176428 |
for _, n := range toAdd.ToSlice() {
rc := configs[n.(string)]
logrus.Infof("Adding config %s", n.(string))
if err := s.AddConfig(rc); err != nil {
logrus.WithError(err).Errorf("failed to create resources %s", n)
finalError = multierror.Append(finalError, err)
}
}
for _, n := range toUpdate.ToSlice() {
rc := configs[n.(string)]
logrus.Infof("Updating config %s", n.(string))
if err := s.UpdateConfig(rc); err != nil {
logrus.WithError(err).Errorf("failed to update resources %s", n)
finalError = multierror.Append(finalError, err)
}
}
return finalError
} | |
c176429 | metav1.AddToGroupVersion(scheme, SchemeGroupVersion)
return nil
} | |
c176430 | prowJobTriggerer: &kubeProwJobTriggerer{
prowJobClient: prowJobClient,
githubClient: githubClient,
configAgent: configAgent,
},
githubClient: githubClient,
statusMigrator: &gitHubMigrator{
githubClient: githubClient,
continueOnError: continueOnError,
},
trustedChecker: &githubTrustedChecker{
githubClient: githubClient,
pluginAgent: pluginAgent,
},
}
} | |
c176431 | logrus.WithField("duration", fmt.Sprintf("%v", time.Since(start))).Info("Statuses reconciled")
case <-stop:
logrus.Info("status-reconciler is shutting down...")
return
}
}
} | |
c176432 | "name": oldPresubmit.Name,
}).Debug("Identified a blocking presubmit running over a different set of files.")
}
found = true
break
}
}
if !found {
added[repo] = append(added[repo], newPresubmit)
logrus.WithFields(logrus.Fields{
"repo": repo,
"name": newPresubmit.Name,
}).Debug("Identified an added blocking presubmit.")
}
}
}
var numAdded int
for _, presubmits := range added {
numAdded += len(presubmits)
}
logrus.Infof("Identified %d added blocking presubmits.", numAdded)
return added
} | |
c176433 | {
if oldPresubmit.Name == newPresubmit.Name {
found = true
break
}
}
if !found {
removed[repo] = append(removed[repo], oldPresubmit)
logrus.WithFields(logrus.Fields{
"repo": repo,
"name": oldPresubmit.Name,
}).Debug("Identified a removed blocking presubmit.")
}
}
}
var numRemoved int
for _, presubmits := range removed {
numRemoved += len(presubmits)
}
logrus.Infof("Identified %d removed blocking presubmits.", numRemoved)
return removed
} | |
c176434 | "name": oldPresubmit.Name,
"from": oldPresubmit.Context,
"to": newPresubmit.Context,
}).Debug("Identified a migrated blocking presubmit.")
}
}
}
}
var numMigrated int
for _, presubmits := range migrated {
numMigrated += len(presubmits)
}
logrus.Infof("Identified %d migrated blocking presubmits.", numMigrated)
return migrated
} | |
c176435 | return nil
}
fs := flag.NewFlagSet(os.Args[0], flag.ExitOnError)
loader.AddFlags(fs)
fs.Parse(os.Args[1:])
loader.Complete(fs.Args())
return nil
} | |
c176436 | := c.pendingJobs[pj.Spec.Job]
if numPending >= pj.Spec.MaxConcurrency {
c.log.WithFields(pjutil.ProwJobFields(pj)).Debugf("Not starting another instance of %s, already %d running.", pj.Spec.Job, numPending)
return false
}
c.pendingJobs[pj.Spec.Job]++
return true
} | |
c176437 | append(jenkinsJobs, BuildQueryParams{
JobName: getJobName(&pj.Spec),
ProwJobID: pj.Name,
})
}
return jenkinsJobs
} | |
c176438 | err := c.jc.Abort(getJobName(&toCancel.Spec), &build); err != nil {
c.log.WithError(err).WithFields(pjutil.ProwJobFields(&toCancel)).Warn("Cannot cancel Jenkins build")
}
}
}
toCancel.SetComplete()
prevState := toCancel.Status.State
toCancel.Status.State = prowapi.AbortedState
c.log.WithFields(pjutil.ProwJobFields(&toCancel)).
WithField("from", prevState).
WithField("to", toCancel.Status.State).Info("Transitioning states.")
npj, err := c.prowJobClient.Update(&toCancel)
if err != nil {
return err
}
pjs[cancelIndex] = *npj
}
return nil
} | |
c176439 |
}
return
}
rate := time.Hour / time.Duration(hourlyTokens)
ticker := time.NewTicker(rate)
throttle := make(chan time.Time, burst)
for i := 0; i < burst; i++ { // Fill up the channel
throttle <- time.Now()
}
go func() {
// Refill the channel
for t := range ticker.C {
select {
case throttle <- t:
default:
}
}
}()
if !previouslyThrottled { // Wrap clients if we haven't already
c.throttle.http = c.client
c.throttle.graph = c.gqlc
c.client = &c.throttle
c.gqlc = &c.throttle
}
c.throttle.ticker = ticker
c.throttle.throttle = throttle
} | |
c176440 | maxRequestTime,
Transport: &oauth2.Transport{Source: newReloadingTokenSource(getToken)},
}),
client: &http.Client{Timeout: maxRequestTime},
bases: bases,
getToken: getToken,
dry: false,
}
} | |
c176441 | NewClientWithFields(logrus.Fields{}, getToken, graphqlEndpoint, bases...)
} | |
c176442 | return NewDryRunClientWithFields(logrus.Fields{}, getToken, graphqlEndpoint, bases...)
} | |
c176443 | &standardTime{},
fake: true,
dry: true,
}
} | |
c176444 | if err := json.Unmarshal(b, ret); err != nil {
return statusCode, err
}
}
return statusCode, nil
} | |
c176445 | okCode = true
break
}
}
if !okCode {
clientError := unmarshalClientError(b)
err = requestError{
ClientError: clientError,
ErrorString: fmt.Sprintf("status code %d not one of %v, body: %s", resp.StatusCode, r.exitCodes, string(b)),
}
}
return resp.StatusCode, b, err
} | |
c176446 | if err != nil {
return err
}
c.botName = u.Login
// email needs to be publicly accessible via the profile
// of the current account. Read below for more info
// https://developer.github.com/v3/users/#get-a-single-user
c.email = u.Email
return nil
} | |
c176447 | < 200 || resp.StatusCode > 299 {
return fmt.Errorf("return code not 2XX: %s", resp.Status)
}
b, err := ioutil.ReadAll(resp.Body)
if err != nil {
return err
}
obj := newObj()
if err := json.Unmarshal(b, obj); err != nil {
return err
}
accumulate(obj)
link := parseLinks(resp.Header.Get("Link"))["next"]
if link == "" {
break
}
u, err := url.Parse(link)
if err != nil {
return fmt.Errorf("failed to parse 'next' link: %v", err)
}
pagedPath = u.RequestURI()
}
return nil
} | |
c176448 | op := "open"
data.State = &op
} else if open != nil {
cl := "clossed"
data.State = &cl
}
_, err := c.request(&request{
// allow the description and draft fields
// https://developer.github.com/changes/2018-02-22-label-description-search-preview/
// https://developer.github.com/changes/2019-02-14-draft-pull-requests/
accept: "application/vnd.github.symmetra-preview+json, application/vnd.github.shadow-cat-preview",
method: http.MethodPatch,
path: fmt.Sprintf("/repos/%s/%s/pulls/%d", org, repo, number),
requestBody: &data,
exitCodes: []int{200},
}, nil)
return err
} | |
c176449 | allow the description field -- https://developer.github.com/changes/2018-02-22-label-description-search-preview/
func() interface{} {
return &[]Label{}
},
func(obj interface{}) {
labels = append(labels, *(obj.(*[]Label))...)
},
)
if err != nil {
return nil, err
}
return labels, nil
} | |
c176450 | requestErr.ErrorMessages() {
if strings.Contains(errorMsg, stateCannotBeChangedMessagePrefix) {
return StateCannotBeChanged{
Message: errorMsg,
}
}
}
}
return err
} | |
c176451 |
if pr.Mergable != nil {
return *pr.Mergable, nil
}
if try+1 < maxTries {
c.time.Sleep(backoff)
backoff *= 2
}
}
return false, fmt.Errorf("reached maximum number of retries (%d) checking mergeability", maxTries)
} | |
c176452 | error) {
return &oauth2.Token{
AccessToken: string(s.getToken()),
}, nil
} | |
c176453 | err := s.GCSArtifactFetcher.artifacts(gcsKey)
logFound := false
for _, name := range artifactNames {
if name == "build-log.txt" {
logFound = true
break
}
}
if err != nil || !logFound {
artifactNames = append(artifactNames, "build-log.txt")
}
return artifactNames, nil
} | |
c176454 | in %q", src)
}
jobName = parsed[len(parsed)-2]
buildID = parsed[len(parsed)-1]
return jobName, buildID, nil
} | |
c176455 | {
return "", fmt.Errorf("Failed to get prow job from src %q: %v", prowKey, err)
}
url := job.Status.URL
prefix := s.config().Plank.GetJobURLPrefix(job.Spec.Refs)
if !strings.HasPrefix(url, prefix) {
return "", fmt.Errorf("unexpected job URL %q when finding GCS path: expected something starting with %q", url, prefix)
}
return url[len(prefix):], nil
} | |
c176456 | the extra network I/O should not be too problematic).
_, err = art.Size()
}
if err != nil {
if name == "build-log.txt" {
podLogNeeded = true
}
continue
}
arts = append(arts, art)
}
if podLogNeeded {
art, err := s.PodLogArtifactFetcher.artifact(jobName, buildID, sizeLimit)
if err != nil {
logrus.Errorf("Failed to fetch pod log: %v", err)
} else {
arts = append(arts, art)
}
}
logrus.WithField("duration", time.Since(artStart)).Infof("Retrieved artifacts for %v", src)
return arts, nil
} | |
c176457 | }
out := new(DecorationConfig)
in.DeepCopyInto(out)
return out
} | |
c176458 | }
out := new(GCSConfiguration)
in.DeepCopyInto(out)
return out
} | |
c176459 | out := new(JenkinsSpec)
in.DeepCopyInto(out)
return out
} | |
c176460 | := new(ProwJob)
in.DeepCopyInto(out)
return out
} | |
c176461 | out := new(ProwJobList)
in.DeepCopyInto(out)
return out
} | |
c176462 | out := new(ProwJobSpec)
in.DeepCopyInto(out)
return out
} | |
c176463 |
out := new(ProwJobStatus)
in.DeepCopyInto(out)
return out
} | |
c176464 | := new(Pull)
in.DeepCopyInto(out)
return out
} | |
c176465 | := new(Refs)
in.DeepCopyInto(out)
return out
} | |
c176466 |
out := new(UtilityImages)
in.DeepCopyInto(out)
return out
} | |
c176467 | configuration: %v", err)
}
ctName, err := rsClient.ConfiguredTargets(targetName, configID).Create(test.Action)
if err != nil {
return url, fmt.Errorf("create configured target: %v", err)
}
_, err = rsClient.Actions(ctName).Create("primary", test)
if err != nil {
return url, fmt.Errorf("create action: %v", err)
}
return url, nil
} | |
c176468 | = def.GCSCredentialsSecret
}
if len(merged.SSHKeySecrets) == 0 {
merged.SSHKeySecrets = def.SSHKeySecrets
}
if len(merged.SSHHostFingerprints) == 0 {
merged.SSHHostFingerprints = def.SSHHostFingerprints
}
if merged.SkipCloning == nil {
merged.SkipCloning = def.SkipCloning
}
if merged.CookiefileSecret == "" {
merged.CookiefileSecret = def.CookiefileSecret
}
return &merged
} | |
c176469 | missing)
}
if d.GCSConfiguration == nil {
return errors.New("GCS upload configuration is not specified")
}
if d.GCSCredentialsSecret == "" {
return errors.New("GCS upload credential secret is not specified")
}
if err := d.GCSConfiguration.Validate(); err != nil {
return fmt.Errorf("GCS configuration is invalid: %v", err)
}
return nil
} | |
c176470 | = def.InitUpload
}
if merged.Entrypoint == "" {
merged.Entrypoint = def.Entrypoint
}
if merged.Sidecar == "" {
merged.Sidecar = def.Sidecar
}
return &merged
} | |
c176471 |
merged.PathStrategy = def.PathStrategy
}
if merged.DefaultOrg == "" {
merged.DefaultOrg = def.DefaultOrg
}
if merged.DefaultRepo == "" {
merged.DefaultRepo = def.DefaultRepo
}
return &merged
} | |
c176472 | && (g.DefaultOrg == "" || g.DefaultRepo == "") {
return fmt.Errorf("default org and repo must be provided for GCS strategy %q", g.PathStrategy)
}
return nil
} | |
c176473 | return DefaultClusterAlias
}
return j.Spec.Cluster
} | |
c176474 | Name: name,
Type: rtype,
State: state,
Owner: owner,
LastUpdate: t,
UserData: &UserData{},
}
} | |
c176475 | append(resources, NewResource(name, e.Type, e.State, "", time.Time{}))
}
return resources
} | |
c176476 | m {
ud.Store(k, v)
}
return ud
} | |
c176477 | := range strings.Split(value, ",") {
*r = append(*r, rtype)
}
return nil
} | |
c176478 |
if err := json.Unmarshal(data, &tmpMap); err != nil {
return err
}
ud.FromMap(tmpMap)
return nil
} | |
c176479 | &UserDataNotFound{id}
}
return yaml.Unmarshal([]byte(content.(string)), out)
} | |
c176480 | return err
}
ud.Store(id, string(b))
return nil
} | |
c176481 | "" {
ud.Store(key, value)
} else {
ud.Delete(key)
}
return true
})
} | |
c176482 |
m[key.(string)] = value.(string)
return true
})
return m
} | |
c176483 | {
for key, value := range m {
ud.Store(key, value)
}
} | |
c176484 | !ok {
return Resource{}, fmt.Errorf("cannot construct Resource from received object %v", i)
}
return res, nil
} | |
c176485 | for ref := range input {
output <- cloneFunc(ref, o.SrcRoot, o.GitUserName, o.GitUserEmail, o.CookiePath, env)
}
}()
}
for _, ref := range o.GitRefs {
input <- ref
}
close(input)
wg.Wait()
close(output)
var results []clone.Record
for record := range output {
results = append(results, record)
}
logData, err := json.Marshal(results)
if err != nil {
return fmt.Errorf("failed to marshal clone records: %v", err)
}
if err := ioutil.WriteFile(o.Log, logData, 0755); err != nil {
return fmt.Errorf("failed to write clone records: %v", err)
}
return nil
} | |
c176486 | // should not look be looking into for keys
if info.IsDir() {
return filepath.SkipDir
}
return nil
}
if info.IsDir() {
return nil
}
cmd := exec.Command("ssh-add", path)
cmd.Env = append(cmd.Env, env...)
if output, err := cmd.CombinedOutput(); err != nil {
return fmt.Errorf("failed to add ssh key at %s: %v: %s", path, err, output)
}
logrus.Infof("Added SSH key at %s", path)
return nil
}); err != nil {
return env, fmt.Errorf("error walking path %q: %v", keyPath, err)
}
}
return env, nil
} | |
c176487 | := topClusters(clusters, f.topClustersCount)
issues := make([]creator.Issue, 0, len(topclusters))
for _, clust := range topclusters {
issues = append(issues, clust)
}
return issues, nil
} | |
c176488 | break
}
}
if !found {
clust.jobs[job.Name] = append(clust.jobs[job.Name], buildnum)
}
}
}
}
clust.totalJobs = len(clust.jobs)
clust.totalTests = len(clust.Tests)
clust.totalBuilds = 0
for _, builds := range clust.jobs {
clust.totalBuilds += len(builds)
}
}
return f.data.Clustered, nil
} | |
c176489 | clustered key")
}
// Populate 'Jobs' with the BuildIndexer for each job.
data.Builds.Jobs = make(map[string]BuildIndexer)
for jobID, mapper := range data.Builds.JobsRaw {
switch mapper := mapper.(type) {
case []interface{}:
// In this case mapper is a 3 member array. 0:first buildnum, 1:number of builds, 2:start index.
data.Builds.Jobs[jobID] = ContigIndexer{
startBuild: int(mapper[0].(float64)),
count: int(mapper[1].(float64)),
startRow: int(mapper[2].(float64)),
}
case map[string]interface{}:
// In this case mapper is a dictionary.
data.Builds.Jobs[jobID] = DictIndexer(mapper)
default:
return nil, fmt.Errorf("the build number to row index mapping for job '%s' is not an accepted type. Type is: %v", jobID, reflect.TypeOf(mapper))
}
}
return &data, nil
} | |
c176490 | > clusters[j].totalBuilds }
sort.SliceStable(clusters, less)
if len(clusters) < count {
count = len(clusters)
}
return clusters[0:count]
} | |
c176491 | > len(slice[j].Builds) }
sort.SliceStable(slice, less)
if len(slice) < count {
count = len(slice)
}
return slice[0:count]
} | |
c176492 | c.Identifier[0:6],
c.totalBuilds,
c.totalJobs,
c.totalTests,
c.filer.windowDays,
)
} | |
c176493 | range c.topTestsFailed(len(c.Tests)) {
topTests[i] = test.Name
}
for sig := range c.filer.creator.TestsSIGs(topTests) {
labels = append(labels, "sig/"+sig)
}
return labels
} | |
c176494 | logger: logrus.WithField("client", "cron"),
}
} | |
c176495 | append(res, k)
}
c.jobs[k].triggered = false
}
return res
} | |
c176496 |
_, ok := c.jobs[name]
return ok
} | |
c176497 |
// try to kick of a periodic trigger right away
triggered: strings.HasPrefix(cron, "@every"),
}
c.logger.Infof("Added new cron job %s with trigger %s.", name, cron)
return nil
} | |
c176498 |
c.cronAgent.Remove(job.entryID)
delete(c.jobs, name)
c.logger.Infof("Removed previous cron job %s.", name)
return nil
} | |
c176499 | updateIssueComments(issueID, latest, db, client)
if pullRequest {
updatePullComments(issueID, latest, db, client)
}
} |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.