From f5a35a82a62612fa8f6537b4da6ebdea8192a196 Mon Sep 17 00:00:00 2001 From: Yuchen Pei Date: Thu, 30 Mar 2023 00:55:55 +1100 Subject: started working on builder view --- buildbot-client.el | 18 ++++++++++++++++++ buildbot-view.el | 9 +++++++++ 2 files changed, 27 insertions(+) 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")) -- cgit v1.2.3