jobs

package
v0.0.0-...-ce3d181 Latest Latest
Warning

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

Go to latest
Published: Jan 8, 2019 License: Apache-2.0 Imports: 13 Imported by: 0

Documentation

Overview

Package jobs implements methods on job information used by Prow component deck

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type ConfigAgent

type ConfigAgent interface {
	Config() *config.Config
}

ConfigAgent is an interface to get the agent Config.

type Finished

type Finished struct {
	Timestamp  int64  `json:"timestamp"`
	Version    string `json:"version"`
	JobVersion string `json:"job-version"`
	Passed     bool   `json:"passed"`
	Result     string `json:"result"`
	Metadata   `json:"metadata"`
}

Finished is used to mirror the finished.json artifact.

type Job

type Job struct {
	Type        string            `json:"type"`
	Repo        string            `json:"repo"`
	Refs        string            `json:"refs"`
	BaseRef     string            `json:"base_ref"`
	BaseSHA     string            `json:"base_sha"`
	PullSHA     string            `json:"pull_sha"`
	Number      int               `json:"number"`
	Author      string            `json:"author"`
	Job         string            `json:"job"`
	BuildID     string            `json:"build_id"`
	Context     string            `json:"context"`
	Started     string            `json:"started"`
	Finished    string            `json:"finished"`
	Duration    string            `json:"duration"`
	State       string            `json:"state"`
	Description string            `json:"description"`
	URL         string            `json:"url"`
	PodName     string            `json:"pod_name"`
	Agent       kube.ProwJobAgent `json:"agent"`
	ProwJob     string            `json:"prow_job"`
	// contains filtered or unexported fields
}

Job holds information about a job prow is running/has run. TODO(#5216): Remove this, and all associated machinery.

type JobAgent

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

JobAgent creates lists of jobs, updates their status and returns their run logs.

func NewJobAgent

func NewJobAgent(kc serviceClusterClient, plClients map[string]PodLogClient, ca ConfigAgent) *JobAgent

NewJobAgent is a JobAgent constructor.

func (*JobAgent) GetJobLog

func (ja *JobAgent) GetJobLog(job, id string) ([]byte, error)

GetJobLog returns the job logs, works for both kubernetes and jenkins agent types.

func (*JobAgent) GetJobLogTail

func (ja *JobAgent) GetJobLogTail(job, id string, n int64) ([]byte, error)

GetJobLogTail returns the last n bytes of the job logs, works for both kubernetes and jenkins agent types.

func (*JobAgent) GetProwJob

func (ja *JobAgent) GetProwJob(job, id string) (kube.ProwJob, error)

GetProwJob finds the corresponding Prowjob resource from the provided job name and build ID

func (*JobAgent) Jobs

func (ja *JobAgent) Jobs() []Job

Jobs returns a thread-safe snapshot of the current job state.

func (*JobAgent) ProwJobs

func (ja *JobAgent) ProwJobs() []kube.ProwJob

ProwJobs returns a thread-safe snapshot of the current prow jobs.

func (*JobAgent) Start

func (ja *JobAgent) Start()

Start will start the job and periodically update it.

type Metadata

type Metadata struct {
	InfraCommit string            `json:"infra-commit"`
	Pod         string            `json:"pod"`
	Repo        string            `json:"repo"`
	RepoCommit  string            `json:"repo-commit"`
	Repos       map[string]string `json:"repos"`
}

Metadata is used to mirror the metadata in the finished.json artifact.

type PodLogClient

type PodLogClient interface {
	// GetContainerLog returns the pod log of the specified container
	GetContainerLog(pod, container string) ([]byte, error)
	// GetLogTail returns the last n bytes of the pod log of the specified container
	GetLogTail(pod, container string, n int64) ([]byte, error)
}

PodLogClient is an interface for interacting with the pod logs.

type Started

type Started struct {
	Timestamp int64             `json:"timestamp"`
	Node      string            `json:"node"`
	Repos     map[string]string `json:"repos"`
	Pull      string            `json:"pull"`
}

Started is used to mirror the started.json artifact.

Jump to

Keyboard shortcuts

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