jobs

package
v0.0.0-...-d7867ec Latest Latest
Warning

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

Go to latest
Published: Nov 30, 2018 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

View Source
var (
	ErrProwjobNotFound = errors.New("Prowjob not found")
)

Functions

This section is empty.

Types

type ConfigAgent

type ConfigAgent interface {
	Config() *config.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"`
}

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)
}

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