api/weldr: propagate the ComposeResult to ComposeStatus

When a job doesn't exist for a compose, just return an empty result.
In the future this will cause logs disappear from jobs created before the
store-jobqueue split but we decided we can live with that, they are still
in /var for those who really want them.
This commit is contained in:
Ondřej Budai 2020-05-15 12:02:22 +02:00 committed by Lars Karlitski
parent 78d5109c81
commit 3b6bc69c37

View file

@ -147,6 +147,7 @@ type composeStatus struct {
Queued time.Time
Started time.Time
Finished time.Time
Result *common.ComposeResult
}
// Returns the state of the image in `compose` and the times the job was
@ -175,6 +176,7 @@ func (api *API) getComposeStatus(compose store.Compose) *composeStatus {
Queued: compose.ImageBuild.JobCreated,
Started: compose.ImageBuild.JobStarted,
Finished: compose.ImageBuild.JobFinished,
Result: &common.ComposeResult{},
}
}
@ -185,6 +187,7 @@ func (api *API) getComposeStatus(compose store.Compose) *composeStatus {
Queued: jobStatus.Queued,
Started: jobStatus.Started,
Finished: jobStatus.Finished,
Result: jobStatus.Result.OSBuildOutput,
}
}