github.com/chenbh/concourse/v6@v6.4.2/atc/build.go (about) 1 package atc 2 3 type BuildStatus string 4 5 const ( 6 StatusStarted BuildStatus = "started" 7 StatusPending BuildStatus = "pending" 8 StatusSucceeded BuildStatus = "succeeded" 9 StatusFailed BuildStatus = "failed" 10 StatusErrored BuildStatus = "errored" 11 StatusAborted BuildStatus = "aborted" 12 ) 13 14 type Build struct { 15 ID int `json:"id"` 16 TeamName string `json:"team_name"` 17 Name string `json:"name"` 18 Status string `json:"status"` 19 JobName string `json:"job_name,omitempty"` 20 APIURL string `json:"api_url"` 21 PipelineName string `json:"pipeline_name,omitempty"` 22 StartTime int64 `json:"start_time,omitempty"` 23 EndTime int64 `json:"end_time,omitempty"` 24 ReapTime int64 `json:"reap_time,omitempty"` 25 RerunNumber int `json:"rerun_number,omitempty"` 26 RerunOf *RerunOfBuild `json:"rerun_of,omitempty"` 27 } 28 29 type RerunOfBuild struct { 30 ID int `json:"id,omitempty"` 31 Name string `json:"name,omitempty"` 32 } 33 34 func (b Build) IsRunning() bool { 35 switch BuildStatus(b.Status) { 36 case StatusPending, StatusStarted: 37 return true 38 default: 39 return false 40 } 41 } 42 43 func (b Build) Abortable() bool { 44 return b.IsRunning() 45 } 46 47 func (b Build) OneOff() bool { 48 return b.JobName == "" 49 } 50 51 type BuildPreparationStatus string 52 53 const ( 54 BuildPreparationStatusUnknown BuildPreparationStatus = "unknown" 55 BuildPreparationStatusBlocking BuildPreparationStatus = "blocking" 56 BuildPreparationStatusNotBlocking BuildPreparationStatus = "not_blocking" 57 ) 58 59 type MissingInputReasons map[string]string 60 61 type BuildPreparation struct { 62 BuildID int `json:"build_id"` 63 PausedPipeline BuildPreparationStatus `json:"paused_pipeline"` 64 PausedJob BuildPreparationStatus `json:"paused_job"` 65 MaxRunningBuilds BuildPreparationStatus `json:"max_running_builds"` 66 Inputs map[string]BuildPreparationStatus `json:"inputs"` 67 InputsSatisfied BuildPreparationStatus `json:"inputs_satisfied"` 68 MissingInputReasons MissingInputReasons `json:"missing_input_reasons"` 69 }