weldr/store/compose: store information exposed in the API

Use the exact same status strings as is used in the API,
making it clearer that they are the same (and avoiding any
translation). Remember the creation/start/finish timestamps.
And store the output type.

Signed-off-by: Tom Gundersen <teg@jklm.no>
This commit is contained in:
Tom Gundersen 2019-09-29 01:33:50 +02:00
parent 6c49acbd51
commit 96f3cbf655
4 changed files with 38 additions and 17 deletions

View file

@ -136,10 +136,10 @@ func (api *API) updateJobHandler(writer http.ResponseWriter, request *http.Reque
err = json.NewDecoder(request.Body).Decode(&body)
if err != nil {
statusResponseError(writer, http.StatusBadRequest, "invalid status: "+err.Error())
} else if body.Status == "running" {
} else if body.Status == "RUNNING" {
api.jobStatus <- job.Status{ComposeID: id, Status: body.Status}
statusResponseOK(writer)
} else if body.Status == "finished" {
} else if body.Status == "FINISHED" {
api.jobStore.DeleteJob(id)
statusResponseOK(writer)
} else {