aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorYuchen Pei <hi@ypei.me>2023-03-30 00:55:55 +1100
committerYuchen Pei <hi@ypei.me>2023-03-30 00:55:55 +1100
commitf5a35a82a62612fa8f6537b4da6ebdea8192a196 (patch)
tree3da25efacb1a76100eff668d0a7b39a9a14310eb
parentf5b97b439a2a1a7d13c60f1b711edf704542a038 (diff)
started working on builder view
-rw-r--r--buildbot-client.el18
-rw-r--r--buildbot-view.el9
2 files changed, 27 insertions, 0 deletions
diff --git a/buildbot-client.el b/buildbot-client.el
index 64c308f..ecc5757 100644
--- a/buildbot-client.el
+++ b/buildbot-client.el
@@ -46,6 +46,12 @@
"%s/api/v2/builders"
buildbot-host)))
+(defun buildbot-api-builders-builds (builder-id attr)
+ (buildbot-url-fetch-json
+ (format
+ "%s/api/v2/builders/%d/builds?%s"
+ buildbot-host builder-id (buildbot-format-attr attr))))
+
(defun buildbot-api-build (attr)
(buildbot-url-fetch-json
(format
@@ -62,6 +68,12 @@
(buildbot-url-fetch-raw
(format "%s/api/v2/logs/%d/raw" buildbot-host logid)))
+(defun buildbot-get-recent-builds-by-builder (builder-id limit)
+ (alist-get 'builds
+ (buildbot-api-builders-builds
+ builder-id
+ `((limit . ,limit) (order . "-number") (property . "revision")))))
+
(defun buildbot-get-recent-changes (limit)
(buildbot-api-change (list (cons 'order "-changeid") (cons 'limit limit))))
@@ -74,6 +86,12 @@
(= (alist-get 'builderid builder) builderid))
buildbot-builders))
+(defun buildbot-builder-by-name (name)
+ (cl-find-if
+ (lambda (builder)
+ (equal (alist-get 'name builder) name))
+ buildbot-builders))
+
(defun buildbot-get-logs-by-stepid (stepid)
(alist-get 'logs (buildbot-api-logs stepid)))
diff --git a/buildbot-view.el b/buildbot-view.el
index 8e3590d..ebeef70 100644
--- a/buildbot-view.el
+++ b/buildbot-view.el
@@ -229,6 +229,15 @@
(interactive "sBranch name: ")
(buildbot-view-open 'branch `((branch . ,branch))))
+;;;###autoload
+(defun buildbot-builder-open (builder-name)
+ (interactive (list (completing-read
+ "Builder name: "
+ (mapcar
+ (lambda (builder) (alist-get 'name builder))
+ buildbot-builders))))
+ (buildbot-view-open 'builder `((builder . ,builder))))
+
(defun buildbot-view-update ()
(unless (derived-mode-p 'buildbot-view-mode)
(error "Not in buildbot view mode"))