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:
Lars Karlitski 2020-10-24 11:57:02 +02:00
parent 7441012e62
commit 669b612d96
2 changed files with 21 additions and 15 deletions

View file

@ -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,