Documentation ¶
Overview ¶
Package jobs controls the execution and error handling of a job
Index ¶
- Variables
- func Debounce(hook webhooks.Ref)
- func Promote(msg webhooks.Ref, promoteTo string)
- func Remove(gitID webhooks.URLSafeRefID)
- func Run(runOpts *options.ServerConfig)
- func SetReport(urlRefID webhooks.URLSafeRefID, result *Result) error
- func Start(runOpts *options.ServerConfig)
- func Stop()
- type Job
- type Log
- type Promotion
- type Result
Constants ¶
This section is empty.
Variables ¶
View Source
var Actives sync.Map
Actives is the map of jobs map[webhooks.RefID]*Job
View Source
var Pending sync.Map
Pending is the map of backlog jobs map[webhooks.RefID]*webhooks.GitRef
View Source
var Promotions = make(chan Promotion)
Promotions channel
View Source
var Recents sync.Map
Recents are jobs that are dead, but recent map[webhooks.RevID]*Job
Functions ¶
func Run ¶
func Run(runOpts *options.ServerConfig)
Run starts the job loop and waits for it to be stopped
func SetReport ¶
func SetReport(urlRefID webhooks.URLSafeRefID, result *Result) error
SetReport will update jobs' logs
func Start ¶
func Start(runOpts *options.ServerConfig)
Start starts the job loop, channels, and cleanup routines
Types ¶
type Job ¶
type Job struct { // normal json StartedAt *time.Time `json:"started_at,omitempty"` // empty when pending ID string `json:"id"` // could be URLSafeRefID or URLSafeRevID GitRef *webhooks.Ref `json:"ref"` // always present PromoteTo string `json:"promote_to,omitempty"` // empty when deploy and test Promote bool `json:"promote,omitempty"` // empty when deploy and test EndedAt *time.Time `json:"ended_at,omitempty"` // empty when running ExitCode *int `json:"exit_code,omitempty"` // empty when running // full json Logs []Log `json:"logs,omitempty"` // exist when requested Report *Result `json:"report,omitempty"` // empty unless given // contains filtered or unexported fields }
Job represents a job started by the git webhook and also the JSON we send back through the API about jobs
func LoadLogs ¶
func LoadLogs(runOpts *options.ServerConfig, safeID webhooks.URLSafeGitID) (*Job, error)
LoadLogs will log logs for a job
type Log ¶
type Log struct { Timestamp time.Time `json:"timestamp"` Stderr bool `json:"stderr"` Text string `json:"text"` }
Log is a log message
Click to show internal directories.
Click to hide internal directories.