2
0
Fork 0
mirror of git://git.savannah.gnu.org/guix/guix-cuirass.git synced 2023-12-14 06:03:04 +01:00

http: /api/latestbuilds only returns finished builds.

* src/cuirass/database.scm (db-get-builds)[format-where-clause]:
Honor (status done) filter.
* src/cuirass/http.scm (url-handler): Always add (status done)
to the filters passed to 'handle-builds-request'.
This commit is contained in:
Ludovic Courtès 2018-01-23 22:54:01 +01:00
parent 6fb7118839
commit 06b8af00fb
2 changed files with 7 additions and 2 deletions

View file

@ -303,7 +303,7 @@ INNER JOIN Specifications ON Evaluations.specification = Specifications.repo_nam
(define (db-get-builds db filters) (define (db-get-builds db filters)
"Retrieve all builds in database DB which are matched by given FILTERS. "Retrieve all builds in database DB which are matched by given FILTERS.
FILTERS is an assoc list which possible keys are 'project | 'jobset | 'job | FILTERS is an assoc list which possible keys are 'project | 'jobset | 'job |
'system | 'nr | 'order." 'system | 'nr | 'order | 'status."
(define (format-where-clause filters) (define (format-where-clause filters)
(let ((where-clause (let ((where-clause
@ -318,6 +318,8 @@ FILTERS is an assoc list which possible keys are 'project | 'jobset | 'job |
(format #f "Derivations.job_name='~A'" job)) (format #f "Derivations.job_name='~A'" job))
(('system system) (('system system)
(format #f "Derivations.system='~A'" system)) (format #f "Derivations.system='~A'" system))
(('status 'done)
"Builds.status >= 0")
(_ #f))) (_ #f)))
filters))) filters)))
(if (> (length where-clause) 0) (if (> (length where-clause) 0)

View file

@ -149,8 +149,11 @@
;; 'nr parameter is mandatory to limit query size. ;; 'nr parameter is mandatory to limit query size.
(valid-params? (assq-ref params 'nr))) (valid-params? (assq-ref params 'nr)))
(if valid-params? (if valid-params?
;; Limit results to builds that are "done".
(respond-json (object->json-string (respond-json (object->json-string
(handle-builds-request db params))) (handle-builds-request db
`((status done)
,@params))))
(respond-json-with-error 500 "Parameter not defined!")))) (respond-json-with-error 500 "Parameter not defined!"))))
(_ (_
(respond (build-response #:code 404) (respond (build-response #:code 404)