job

package
v0.6.2 Latest Latest
Warning

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

Go to latest
Published: Jul 7, 2014 License: MIT Imports: 16 Imported by: 2

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 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:"clond_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 *JobConfig, spec *JobSpec) *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 JobConfig

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

JobConfig contains global configuration options for jobs

type JobSpec

type JobSpec 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"`
}

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

func NewJobSpec

func NewJobSpec(args ...interface{}) (*JobSpec, error)

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

func (*JobSpec) Validate

func (spec *JobSpec) 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