This repository has been archived by the owner on Aug 2, 2021. It is now read-only.
forked from vmware-archive/atc
-
Notifications
You must be signed in to change notification settings - Fork 0
/
build.go
62 lines (52 loc) · 1.86 KB
/
build.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
package atc
type BuildStatus string
const (
StatusStarted BuildStatus = "started"
StatusPending BuildStatus = "pending"
StatusSucceeded BuildStatus = "succeeded"
StatusFailed BuildStatus = "failed"
StatusErrored BuildStatus = "errored"
StatusAborted BuildStatus = "aborted"
)
type Build struct {
ID int `json:"id"`
TeamName string `json:"team_name"`
Name string `json:"name"`
Status string `json:"status"`
JobName string `json:"job_name,omitempty"`
APIURL string `json:"api_url"`
PipelineName string `json:"pipeline_name,omitempty"`
StartTime int64 `json:"start_time,omitempty"`
EndTime int64 `json:"end_time,omitempty"`
ReapTime int64 `json:"reap_time,omitempty"`
}
func (b Build) IsRunning() bool {
switch BuildStatus(b.Status) {
case StatusPending, StatusStarted:
return true
default:
return false
}
}
func (b Build) Abortable() bool {
return b.IsRunning()
}
func (b Build) OneOff() bool {
return b.JobName == ""
}
type BuildPreparationStatus string
const (
BuildPreparationStatusUnknown BuildPreparationStatus = "unknown"
BuildPreparationStatusBlocking BuildPreparationStatus = "blocking"
BuildPreparationStatusNotBlocking BuildPreparationStatus = "not_blocking"
)
type MissingInputReasons map[string]string
type BuildPreparation struct {
BuildID int `json:"build_id"`
PausedPipeline BuildPreparationStatus `json:"paused_pipeline"`
PausedJob BuildPreparationStatus `json:"paused_job"`
MaxRunningBuilds BuildPreparationStatus `json:"max_running_builds"`
Inputs map[string]BuildPreparationStatus `json:"inputs"`
InputsSatisfied BuildPreparationStatus `json:"inputs_satisfied"`
MissingInputReasons MissingInputReasons `json:"missing_input_reasons"`
}