job

package
v0.9.0 Latest Latest
Warning

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

Go to latest
Published: Oct 28, 2014 License: MIT Imports: 18 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	// TestMode monkeys with certain things for tests so bad things don't happen
	TestMode bool
)

Functions

func Get added in v0.6.0

func Get(params martini.Params, req *http.Request) (int, string)

Get gets the requested job as JSON.

func GetAll added in v0.6.0

func GetAll(params martini.Params, req *http.Request) (int, string)

GetAll gets all of the jobs as JSON.

func Logger added in v0.6.0

func Logger(l *logrus.Logger)

Logger sets the (global) logger for the server package

func TailN added in v0.6.0

func TailN(params martini.Params, req *http.Request) (int, string)

TailN is the handler function for the job log tailing route.

Types

type ByCreatedDescending added in v0.8.0

type ByCreatedDescending []*Job

ByCreatedDescending is a type for sorting an array of jobs by created date, descending

func (ByCreatedDescending) Len added in v0.8.0

func (l ByCreatedDescending) Len() int

func (ByCreatedDescending) Less added in v0.8.0

func (l ByCreatedDescending) Less(i, j int) bool

func (ByCreatedDescending) Swap added in v0.8.0

func (l ByCreatedDescending) Swap(i, j int)

type Config added in v0.7.0

type Config struct {
	Workdir        string
	Logger         *logrus.Logger
	GitHubAPIToken string
}

Config contains global configuration options for jobs

type Job added in v0.6.0

type Job struct {
	Account        string         `json:"account,omitempty"`
	Bobfile        string         `json:"bobfile,omitempty"`
	Completed      time.Time      `json:"completed,omitempty"`
	Created        time.Time      `json:"created"`
	Error          error          `json:"error,omitempty"`
	GitCloneDepth  string         `json:"clone_depth,omitempty"`
	GitHubAPIToken string         `json:"-"`
	ID             string         `json:"id,omitempty"`
	LogRoute       string         `json:"log_route,omitempty"`
	Logger         *logrus.Logger `json:"-"`
	Ref            string         `json:"ref,omitempty"`
	Repo           string         `json:"repo,omitempty"`
	Status         string         `json:"status"`
	Workdir        string         `json:"-"`
	InfoRoute      string         `json:"info_route,omitempty"`
	// contains filtered or unexported fields
}

Job is the struct representation of a build job. Intended to be created with NewJob, but exported so it can be used for tests.

func NewJob

func NewJob(cfg *Config, spec *Spec, req *http.Request) *Job

NewJob creates a new job from the config as well as a job spec. After creating the job, calling job.Process() will actually perform the work.

func (*Job) Process added in v0.6.0

func (job *Job) Process() error

Process does the actual job processing work, including:

  1. clone the repo
  2. build from the Bobfile at the top level
  3. clean up the cloned repo

type Spec added in v0.7.0

type Spec struct {
	Bobfile        string `json:"bobfile"`
	RepoOwner      string `json:"account"`
	RepoName       string `json:"repo"`
	GitRef         string `json:"ref"`
	GitHubAPIToken string `json:"api_token"`
	Depth          string `json:"depth"`
	Sync           bool   `json:"sync"`
}

Spec contains the specs for a job, retrieved from parsed JSON

func NewSpec added in v0.7.0

func NewSpec(raw []byte) (*Spec, error)

NewSpec creates a new job spec from raw json data

func (*Spec) Validate added in v0.7.0

func (spec *Spec) Validate() error

Validate checks that required fields are present in the spec.

Jump to

Keyboard shortcuts

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