worker: remove State from JobStatus
This state is specific to weldr. Previous commits removed it from the other APIs, because they use different values. Move the conversion into the weldr API.
This commit is contained in:
parent
7441012e62
commit
669b612d96
2 changed files with 21 additions and 15 deletions
|
|
@ -44,7 +44,6 @@ type Server struct {
|
|||
}
|
||||
|
||||
type JobStatus struct {
|
||||
State common.ComposeState
|
||||
Queued time.Time
|
||||
Started time.Time
|
||||
Finished time.Time
|
||||
|
|
@ -105,21 +104,8 @@ func (s *Server) JobStatus(id uuid.UUID) (*JobStatus, error) {
|
|||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
state := common.CWaiting
|
||||
if canceled {
|
||||
state = common.CFailed
|
||||
} else if !finished.IsZero() {
|
||||
if result.OSBuildOutput != nil && result.OSBuildOutput.Success {
|
||||
state = common.CFinished
|
||||
} else {
|
||||
state = common.CFailed
|
||||
}
|
||||
} else if !started.IsZero() {
|
||||
state = common.CRunning
|
||||
}
|
||||
|
||||
return &JobStatus{
|
||||
State: state,
|
||||
Queued: queued,
|
||||
Started: started,
|
||||
Finished: finished,
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue