summaryrefslogtreecommitdiff
path: root/guix/ci.scm
diff options
context:
space:
mode:
authorLudovic Courtès <ludo@gnu.org>2021-09-07 11:04:44 +0200
committerLudovic Courtès <ludo@gnu.org>2021-09-07 14:19:08 +0200
commitd9dfbf886ddbb92dfdaa118bb9765e78aad5c53a (patch)
tree2732020de20a38c09b66a60b0cb36022799f7c2e /guix/ci.scm
parentb949f34f31a045eb0fb242b81a223178fb6994d3 (diff)
parent49922efb11da0f0e9d4f5979d081de5ea8c99d25 (diff)
Merge branch 'master' into core-updates-frozen
Diffstat (limited to 'guix/ci.scm')
-rw-r--r--guix/ci.scm34
1 files changed, 32 insertions, 2 deletions
diff --git a/guix/ci.scm b/guix/ci.scm
index 6a3af8b42c..01b493b3af 100644
--- a/guix/ci.scm
+++ b/guix/ci.scm
@@ -59,6 +59,11 @@
job-status
job-name
+ history?
+ history-evaluation
+ history-checkouts
+ history-jobs
+
%query-limit
queued-builds
latest-builds
@@ -66,6 +71,7 @@
evaluation-jobs
build
job-build
+ jobs-history
latest-evaluations
evaluations-for-commit
@@ -127,6 +133,18 @@
integer->build-status)
(name job-name)) ;string
+(define-json-mapping <history> make-history history?
+ json->history
+ (evaluation history-evaluation) ;integer
+ (checkouts history-checkouts "checkouts" ;<checkout>*
+ (lambda (checkouts)
+ (map json->checkout
+ (vector->list checkouts))))
+ (jobs history-jobs "jobs"
+ (lambda (jobs)
+ (map json->job
+ (vector->list jobs)))))
+
(define-json-mapping <checkout> make-checkout checkout?
json->checkout
(commit checkout-commit) ;string (SHA1)
@@ -247,8 +265,20 @@ found (404)."
"Return the build associated with JOB."
(build url (job-build-id job)))
-;; TODO: job history:
-;; https://ci.guix.gnu.org/api/jobs/history?spec=master&names=coreutils.x86_64-linux&nr=10
+(define* (jobs-history url jobs
+ #:key
+ (specification "master")
+ (limit 20))
+ "Return the job history for the SPECIFICATION jobs which names are part of
+the JOBS list, from the CI server at URL. Limit the history to the latest
+LIMIT evaluations. "
+ (let ((names (string-join jobs ",")))
+ (map json->history
+ (vector->list
+ (json->scm
+ (http-fetch
+ (format #f "~a/api/jobs/history?spec=~a&names=~a&nr=~a"
+ url specification names (number->string limit))))))))
(define (find-latest-commit-with-substitutes url)
"Return the latest commit with available substitutes for the Guix package