job

package
v0.7.0 Latest Latest
Warning

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

Go to latest
Published: Jul 24, 2014 License: MIT Imports: 17 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var TestMode bool

TestMode monkeys with certain things for tests so bad things don't happen

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) (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 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"`
	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:"-"`
	// 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) *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 {
	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(args ...interface{}) (*Spec, error)

NewSpec creates a new job spec based on the arguments that would be passed along from the job goworker picks up from Redis.

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