Documentation ¶
Overview ¶
Package spyglass creates views for Prow job artifacts.
Index ¶
- Variables
- type ExtraLink
- type LensConfig
- type LensRequest
- type PodLogArtifact
- func (a *PodLogArtifact) CanonicalLink() string
- func (a *PodLogArtifact) JobPath() string
- func (a *PodLogArtifact) Metadata() (map[string]string, error)
- func (a *PodLogArtifact) ReadAll() ([]byte, error)
- func (a *PodLogArtifact) ReadAt(p []byte, off int64) (n int, err error)
- func (a *PodLogArtifact) ReadAtMost(n int64) ([]byte, error)
- func (a *PodLogArtifact) ReadTail(n int64) ([]byte, error)
- func (a *PodLogArtifact) Size() (int64, error)
- func (a *PodLogArtifact) UpdateMetadata(meta map[string]string) error
- type PodLogArtifactFetcher
- type Spyglass
- func (sg *Spyglass) ExtraLinks(ctx context.Context, src string) ([]ExtraLink, error)
- func (s *Spyglass) FetchArtifacts(ctx context.Context, src string, podName string, sizeLimit int64, ...) ([]api.Artifact, error)
- func (sg *Spyglass) JobPath(src string) (string, error)
- func (sg *Spyglass) Lenses(lensConfigIndexes []int) (orderedIndexes []int, lensMap map[int]LensConfig)
- func (s *Spyglass) ListArtifacts(ctx context.Context, src string) ([]string, error)
- func (sg *Spyglass) ProwJob(src string) (string, string, prowapi.ProwJobState, error)
- func (sg *Spyglass) ResolveSymlink(src string) (string, error)
- func (sg *Spyglass) RunPath(src string) (string, error)
- func (sg *Spyglass) RunToPR(src string) (string, string, int, error)
- func (sg *Spyglass) Start()
- func (sg *Spyglass) TestGridLink(src string) (string, error)
- type StorageArtifact
- func (a *StorageArtifact) CanonicalLink() string
- func (a *StorageArtifact) JobPath() string
- func (a *StorageArtifact) Metadata() (map[string]string, error)
- func (a *StorageArtifact) ReadAll() ([]byte, error)
- func (a *StorageArtifact) ReadAt(p []byte, off int64) (n int, err error)
- func (a *StorageArtifact) ReadAtMost(n int64) ([]byte, error)
- func (a *StorageArtifact) ReadTail(n int64) ([]byte, error)
- func (a *StorageArtifact) Size() (int64, error)
- func (a *StorageArtifact) UpdateMetadata(meta map[string]string) error
- type StorageArtifactFetcher
- type TestGrid
Constants ¶
This section is empty.
Variables ¶
var ( // ErrCannotParseSource is returned by newStorageJobSource when an incorrectly formatted source string is passed ErrCannotParseSource = errors.New("could not create job source from provided source") )
Functions ¶
This section is empty.
Types ¶
type LensConfig ¶
type LensConfig interface {
Config() lenses.LensConfig
}
type LensRequest ¶
type LensRequest struct { Source string `json:"src"` Index int `json:"index"` Artifacts []string `json:"artifacts"` }
LensRequest holds data sent by a view
type PodLogArtifact ¶
type PodLogArtifact struct {
// contains filtered or unexported fields
}
PodLogArtifact holds data for reading from a specific pod log
func NewPodLogArtifact ¶
func NewPodLogArtifact(jobName string, buildID string, artifactName string, container string, sizeLimit int64, ja jobAgent) (*PodLogArtifact, error)
NewPodLogArtifact creates a new PodLogArtifact
func (*PodLogArtifact) CanonicalLink ¶
func (a *PodLogArtifact) CanonicalLink() string
CanonicalLink returns a link to where pod logs are streamed
func (*PodLogArtifact) JobPath ¶
func (a *PodLogArtifact) JobPath() string
JobPath gets the path within the job for the pod log. Always returns build-log.txt if we have only 1 test container in the ProwJob. Returns <containerName>-build-log.txt if we have multiple containers in the ProwJob. This is because the pod log becomes the build log after the job artifact uploads are complete, which should be used instead of the pod log.
func (*PodLogArtifact) ReadAll ¶
func (a *PodLogArtifact) ReadAll() ([]byte, error)
ReadAll reads all available pod logs, failing if they are too large
func (*PodLogArtifact) ReadAt ¶
func (a *PodLogArtifact) ReadAt(p []byte, off int64) (n int, err error)
ReadAt implements reading a range of bytes from the pod logs endpoint
func (*PodLogArtifact) ReadAtMost ¶
func (a *PodLogArtifact) ReadAtMost(n int64) ([]byte, error)
ReadAtMost reads at most n bytes
func (*PodLogArtifact) ReadTail ¶
func (a *PodLogArtifact) ReadTail(n int64) ([]byte, error)
ReadTail reads the last n bytes of the pod log
func (*PodLogArtifact) Size ¶
func (a *PodLogArtifact) Size() (int64, error)
Size gets the size of the pod log. Note: this function makes the same network call as reading the entire file.
func (*PodLogArtifact) UpdateMetadata ¶
func (a *PodLogArtifact) UpdateMetadata(meta map[string]string) error
type PodLogArtifactFetcher ¶
type PodLogArtifactFetcher struct {
// contains filtered or unexported fields
}
PodLogArtifactFetcher is used to fetch artifacts from k8s apiserver
func NewPodLogArtifactFetcher ¶
func NewPodLogArtifactFetcher(ja jobAgent) *PodLogArtifactFetcher
NewPodLogArtifactFetcher returns a PodLogArtifactFetcher using the given job agent as storage
type Spyglass ¶
type Spyglass struct { // JobAgent contains information about the current jobs in deck JobAgent *jobs.JobAgent *StorageArtifactFetcher *PodLogArtifactFetcher // contains filtered or unexported fields }
Spyglass records which sets of artifacts need views for a Prow job. The metaphor can be understood as follows: A spyglass receives light from a source through an eyepiece, which has a lens that ultimately presents a view of the light source to the observer. Spyglass receives light (artifacts) via a source (src) through the eyepiece (Eyepiece) and presents the view (what you see in your browser) via a lens (Lens).
func New ¶
func New(ctx context.Context, ja *jobs.JobAgent, cfg config.Getter, opener pkgio.Opener, useCookieAuth bool) *Spyglass
New constructs a Spyglass object from a JobAgent, a config.Agent, and a storage Client.
func (*Spyglass) ExtraLinks ¶
ExtraLinks fetches started.json and extracts links from metadata.links.
func (*Spyglass) FetchArtifacts ¶
func (s *Spyglass) FetchArtifacts(ctx context.Context, src string, podName string, sizeLimit int64, artifactNames []string) ([]api.Artifact, error)
FetchArtifacts constructs and returns Artifact objects for each artifact name in the list. This includes getting any handles needed for read write operations, direct artifact links, etc.
func (*Spyglass) Lenses ¶
func (sg *Spyglass) Lenses(lensConfigIndexes []int) (orderedIndexes []int, lensMap map[int]LensConfig)
Lenses gets all views of all artifact files matching each regexp with a registered lens
func (*Spyglass) ListArtifacts ¶
ListArtifacts gets the names of all artifacts available from the given source
func (*Spyglass) ProwJob ¶
ProwJob returns a link and state to the YAML for the job specified in src. If no job is found, it returns empty strings and nil error.
func (*Spyglass) RunPath ¶
RunPath returns the path to the directory for the job run specified in src.
type StorageArtifact ¶
type StorageArtifact struct {
// contains filtered or unexported fields
}
StorageArtifact represents some output of a prow job stored in GCS
func NewStorageArtifact ¶
func NewStorageArtifact(ctx context.Context, handle artifactHandle, link string, path string, sizeLimit int64) *StorageArtifact
NewStorageArtifact returns a new StorageArtifact with a given handle, canonical link, and path within the job
func (*StorageArtifact) CanonicalLink ¶
func (a *StorageArtifact) CanonicalLink() string
CanonicalLink gets the GCS web address of the artifact
func (*StorageArtifact) JobPath ¶
func (a *StorageArtifact) JobPath() string
JobPath gets the GCS path of the artifact within the current job
func (*StorageArtifact) ReadAll ¶
func (a *StorageArtifact) ReadAll() ([]byte, error)
ReadAll will either read the entire file or throw an error if file size is too big
func (*StorageArtifact) ReadAt ¶
func (a *StorageArtifact) ReadAt(p []byte, off int64) (n int, err error)
ReadAt reads len(p) bytes from a file in GCS at offset off
func (*StorageArtifact) ReadAtMost ¶
func (a *StorageArtifact) ReadAtMost(n int64) ([]byte, error)
ReadAtMost reads at most n bytes from a file in GCS. If the file is compressed (gzip) in GCS, n bytes of gzipped content will be downloaded and decompressed into potentially GREATER than n bytes of content.
func (*StorageArtifact) ReadTail ¶
func (a *StorageArtifact) ReadTail(n int64) ([]byte, error)
ReadTail reads the last n bytes from a file in GCS
func (*StorageArtifact) Size ¶
func (a *StorageArtifact) Size() (int64, error)
Size returns the size of the artifact in GCS
func (*StorageArtifact) UpdateMetadata ¶
func (a *StorageArtifact) UpdateMetadata(meta map[string]string) error
type StorageArtifactFetcher ¶
type StorageArtifactFetcher struct {
// contains filtered or unexported fields
}
StorageArtifactFetcher contains information used for fetching artifacts from GCS
func NewStorageArtifactFetcher ¶
func NewStorageArtifactFetcher(opener pkgio.Opener, cfg config.Getter, useCookieAuth bool) *StorageArtifactFetcher
NewStorageArtifactFetcher creates a new ArtifactFetcher with a real GCS Client
func (*StorageArtifactFetcher) Artifact ¶
func (af *StorageArtifactFetcher) Artifact(ctx context.Context, key string, artifactName string, sizeLimit int64) (api.Artifact, error)
Artifact constructs a GCS artifact from the given GCS bucket and key. Uses the golang GCS library to get read handles. If the artifactName is not a valid key in the bucket a handle will still be constructed and returned, but all read operations will fail (dictated by behavior of golang GCS lib). If no scheme is given we assume GS, e.g.: * test-bucket/logs/sig-flexing/example-ci-run/403 or * gs://test-bucket/logs/sig-flexing/example-ci-run/403
type TestGrid ¶
type TestGrid struct {
// contains filtered or unexported fields
}
TestGrid manages a TestGrid configuration, and handles lookups of TestGrid configuration.
func (*TestGrid) FindQuery ¶
FindPath returns a 'query' for a job name, e.g. 'sig-testing-misc#bazel' for ci-test-infra-bazel. This is based on the same logic Gubernator uses: find the dashboard with the fewest tabs, where our tab doesn't have any BaseOptions.
Source Files ¶
Directories ¶
Path | Synopsis |
---|---|
Package lenses provides interfaces and methods necessary for implementing custom artifact viewers
|
Package lenses provides interfaces and methods necessary for implementing custom artifact viewers |
buildlog
Package buildlog provides a build log viewer for Spyglass
|
Package buildlog provides a build log viewer for Spyglass |
coverage
Package coverage provides a coverage viewer for Spyglass
|
Package coverage provides a coverage viewer for Spyglass |
junit
Package junit provides a junit viewer for Spyglass
|
Package junit provides a junit viewer for Spyglass |
metadata
Package metadata provides a metadata viewer for Spyglass
|
Package metadata provides a metadata viewer for Spyglass |
podinfo
Package podinfo provides a coverage viewer for Spyglass
|
Package podinfo provides a coverage viewer for Spyglass |