prow

package
v0.0.0-...-9196d9a Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Apr 9, 2024 License: Apache-2.0 Imports: 36 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrSkip = fmt.Errorf("skip index data")
	ErrStop = fmt.Errorf("stop index scan")
)

Functions

func Days

func Days(days int) time.Duration

func NewInformer

func NewInformer(interval, resyncInterval, maxAge time.Duration, initialLister JobLister, listers ...JobLister) cache.SharedIndexInformer

func ReadBuild

func ReadBuild(inputBuild Build, acc Accumulator) error

ReadBuild asynchronously downloads the files in build from gcs and convert them into a build.

Types

type Accumulator

type Accumulator interface {
	Artifacts(context.Context, <-chan *storage.ObjectAttrs, chan<- *storage.ObjectAttrs) error
	AddSuites(context.Context, junit.Suites)
	AddMetadata(context.Context, *gcs.Started, *gcs.Finished) (ok bool, err error)
	Finished(context.Context)

	Started() int64
	// LastUpdate is the finished or started date.
	LastUpdate() int64
}

type Build

type Build = gcs.Build

Build holds data to builds stored in GCS.

type Builds

type Builds = gcs.Builds

Builds holds a slice of builds, which will sort naturally (aka 2 < 10).

type CachingLister

type CachingLister struct {
	Lister JobLister
	// contains filtered or unexported fields
}

func (*CachingLister) ListJobs

func (l *CachingLister) ListJobs(ctx context.Context) ([]*Job, error)

type Client

type Client struct {
	Base    url.URL
	Client  *http.Client
	Retries int
}

func NewClient

func NewClient(base url.URL) *Client

func (*Client) ListJobs

func (c *Client) ListJobs(ctx context.Context) ([]*Job, error)

type DiskStore

type DiskStore struct {
	// contains filtered or unexported fields
}

func NewDiskStore

func NewDiskStore(client *storage.Client, path string, maxAge time.Duration) *DiskStore

func (*DiskStore) Handler

func (s *DiskStore) Handler() cache.ResourceEventHandler

func (*DiskStore) QueueLen

func (s *DiskStore) QueueLen() int

func (*DiskStore) Run

func (s *DiskStore) Run(ctx context.Context, accessor JobAccessor, notifier PathNotifier, disableWrite bool, workers int)

func (*DiskStore) Sync

func (s *DiskStore) Sync() error

type Index

type Index struct {
	Bucket    string
	IndexName string

	FromKey string
	ToKey   string
}

func (*Index) EachJob

func (i *Index) EachJob(ctx context.Context, client *storage.Client, limit int64, statusURL url.URL, fn func(partialJob Job, attr *storage.ObjectAttrs) error) error

func (*Index) FromTime

func (i *Index) FromTime(t time.Time)

func (*Index) Scan

func (i *Index) Scan(ctx context.Context, client *storage.Client, limit int64, fn func(attr *storage.ObjectAttrs) error) error

func (*Index) ToTime

func (i *Index) ToTime(t time.Time)

type Job

type Job struct {
	metav1.TypeMeta
	metav1.ObjectMeta `json:"metadata"`

	Spec   JobSpec   `json:"spec"`
	Status JobStatus `json:"status"`
}

func ReadFromIndex

func ReadFromIndex(ctx context.Context, client *storage.Client, bucket, indexName string, maxAge time.Duration, statusURL url.URL) ([]*Job, error)

ReadFromIndex reads jobs from the named GCS bucket index (managed by a cloud function that watches for finished jobs) and returns them. Jobs older than maxAge are not loaded. statusURL will form the status URL for a given job if the job's link attribute in the index can be parsed.

func (Job) DeepCopyObject

func (j Job) DeepCopyObject() runtime.Object

type JobAccessor

type JobAccessor interface {
	Get(name string) (*Job, error)
	List(labels.Selector) ([]*Job, error)
	JobStats(name string, names sets.String, from, to time.Time) JobStats
}
var Empty JobAccessor = emptyJobAccessor{}

type JobList

type JobList struct {
	metav1.TypeMeta
	metav1.ListMeta

	Items []*Job `json:"items"`
}

func (*JobList) DeepCopyObject

func (j *JobList) DeepCopyObject() runtime.Object

type JobLister

type JobLister interface {
	ListJobs(ctx context.Context) ([]*Job, error)
}

type JobSpec

type JobSpec struct {
	Type string `json:"type"`
	Job  string `json:"job"`
}

type JobStats

type JobStats struct {
	Jobs     int
	Count    int
	Failures int
}

type JobStatus

type JobStatus struct {
	// Valid states are "aborted", "error", "failure", "success"
	State          string      `json:"state"`
	StartTime      metav1.Time `json:"startTime"`
	CompletionTime metav1.Time `json:"completionTime"`
	URL            string      `json:"url"`
	BuildID        string      `json:"build_id"`
}

type ListWatcher

type ListWatcher struct {
	// contains filtered or unexported fields
}

func (*ListWatcher) List

func (lw *ListWatcher) List(options metav1.ListOptions) (runtime.Object, error)

func (*ListWatcher) Watch

func (lw *ListWatcher) Watch(options metav1.ListOptions) (watch.Interface, error)

type Lister

type Lister struct {
	// contains filtered or unexported fields
}

func NewLister

func NewLister(indexer cache.Indexer) *Lister

NewLister lists jobs out of a cache.

func (*Lister) Get

func (s *Lister) Get(name string) (*Job, error)

func (*Lister) JobStats

func (s *Lister) JobStats(name string, names sets.String, from, to time.Time) JobStats

func (*Lister) List

func (s *Lister) List(selector labels.Selector) (ret []*Job, err error)

type ListerFunc

type ListerFunc func(ctx context.Context) ([]*Job, error)

func (ListerFunc) ListJobs

func (l ListerFunc) ListJobs(ctx context.Context) ([]*Job, error)

type LogAccumulator

type LogAccumulator struct {
	// contains filtered or unexported fields
}

func NewAccumulator

func NewAccumulator(base string, build *gcs.Build, modifiedBefore time.Time) (*LogAccumulator, bool)

func (*LogAccumulator) AddMetadata

func (a *LogAccumulator) AddMetadata(ctx context.Context, started *gcs.Started, finished *gcs.Finished) (ok bool, err error)

func (*LogAccumulator) AddSuites

func (a *LogAccumulator) AddSuites(ctx context.Context, suites junit.Suites)

func (*LogAccumulator) Artifacts

func (a *LogAccumulator) Artifacts(ctx context.Context, artifacts <-chan *storage.ObjectAttrs, unprocessedArtifacts chan<- *storage.ObjectAttrs) error

func (*LogAccumulator) Finished

func (a *LogAccumulator) Finished(ctx context.Context)

func (*LogAccumulator) LastUpdate

func (a *LogAccumulator) LastUpdate() int64

func (*LogAccumulator) MarkCompleted

func (a *LogAccumulator) MarkCompleted(at time.Time) error

func (*LogAccumulator) Started

func (a *LogAccumulator) Started() int64

type PathNotifier

type PathNotifier interface {
	Notify(paths []string)
}

type Summarizer

type Summarizer interface {
	New(*gcs.Build) Accumulator
}

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL