guix-patches
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[bug#47929] [PATCH 3/5] ci: Add dashboard procedures.


From: Mathieu Othacehe
Subject: [bug#47929] [PATCH 3/5] ci: Add dashboard procedures.
Date: Wed, 21 Apr 2021 14:21:06 +0200

* guix/ci.scm (dashboard-url, dashboard-register): New procedures.
---
 guix/ci.scm | 22 ++++++++++++++++++++++
 1 file changed, 22 insertions(+)

diff --git a/guix/ci.scm b/guix/ci.scm
index 780e90ef32..78ab739340 100644
--- a/guix/ci.scm
+++ b/guix/ci.scm
@@ -65,6 +65,8 @@
             evaluations-for-commit
 
             manifest->jobs
+            dashboard-url
+            dashboard-register
             channel-with-substitutes-available))
 
 ;;; Commentary:
@@ -282,6 +284,26 @@ evaluation with the higher successful jobs count."
            (package->job-name (package-name package)))
          packages)))
 
+(define (dashboard-url url id)
+  "Return the url of the dashboard with the given ID on the CI server at URL."
+  (format #f "~a/dashboard/~a" url id))
+
+(define* (dashboard-register url packages
+                             #:key
+                             (specification "master"))
+  "Register a dashboard for the packages jobs of the given SPECIFICATION using
+the CI server at URL.  Returns the newly created dashboard id or false if it
+could not be created."
+  (let* ((jobs (manifest->jobs
+                (packages->manifest packages)))
+         (names (string-join jobs ","))
+         (id (json->scm
+              (http-fetch
+               (format #f "~a/api/dashboard/register?spec=~a&names=~a"
+                       url specification names)))))
+    (and id
+         (assoc-ref id "id"))))
+
 (define* (latest-checkouts-with-substitutes url jobs)
   "Return a list of latest checkouts, sorted by descending substitutes
 coverage of the given JOBS list on the CI server at URL. Only evaluations for
-- 
2.31.1






reply via email to

[Prev in Thread] Current Thread [Next in Thread]