guix: ci: Add spec support to latest-evaluations.

* guix/ci.scm (latest-evaluations): Add spec parameter support.
This commit is contained in:
Mathieu Othacehe 2021-05-26 14:54:43 +02:00
parent a2155f41f5
commit 316d9e0817
No known key found for this signature in database
GPG key ID: 8354763531769CA6

View file

@ -154,14 +154,21 @@ (define (evaluation url evaluation)
(number->string evaluation)))))
(json->evaluation evaluation)))
(define* (latest-evaluations url #:optional (limit %query-limit))
"Return the latest evaluations performed by the CI server at URL."
(define* (latest-evaluations url
#:optional (limit %query-limit)
#:key spec)
"Return the latest evaluations performed by the CI server at URL. If SPEC
is passed, only consider the evaluations for the given SPEC specification."
(let ((spec (if spec
(format #f "&spec=~a" spec)
"")))
(map json->evaluation
(vector->list
(json->scm
(http-fetch (string-append url "/api/evaluations?nr="
(number->string limit)))))))
(http-fetch
(string-append url "/api/evaluations?nr="
(number->string limit)
spec)))))))
(define* (evaluations-for-commit url commit #:optional (limit %query-limit))
"Return the evaluations among the latest LIMIT evaluations that have COMMIT