aboutsummaryrefslogtreecommitdiff
path: root/buildbot-client.el
diff options
context:
space:
mode:
authorYuchen Pei <id@ypei.org>2023-07-15 16:30:54 +1000
committerYuchen Pei <id@ypei.org>2023-07-15 16:30:54 +1000
commit6583303218c19c394eac34a792e4a326e1c19b0d (patch)
treec33e31d1cc2494f2be372fad923a8afd94866990 /buildbot-client.el
parent69a087571aa807008ba2f792926a2bda29d524bb (diff)
Adding support for more instances
- Pass buildbot-host between buffers - Set buildbot-builders automatically - When the Changes API does not return builds, fetch the builds in a separate call This last change allows `buildbot-revision-open' to work with more instances, including python and buildbot. Also updated README with these changes, as well as ELPA installation info.
Diffstat (limited to 'buildbot-client.el')
-rw-r--r--buildbot-client.el28
1 files changed, 25 insertions, 3 deletions
diff --git a/buildbot-client.el b/buildbot-client.el
index 0d4cf41..1aaf55f 100644
--- a/buildbot-client.el
+++ b/buildbot-client.el
@@ -30,7 +30,12 @@
(defvar-local buildbot-host nil "Buildbot instance host.")
(defvar-local buildbot-builders nil
"Buildbot builders.
-Can be generated with `(buildbot-get-all-builders)'.")
+Can be generated with `buildbot-get-all-builders'.")
+(defgroup buildbot () "A Buildbot client." :group 'web)
+(defcustom buildbot-default-host nil
+ "The default Buildbot instance host."
+ :group 'buildbot
+ :type 'string)
(defun buildbot-api-change (attr)
"Call the Changes API with ATTR."
@@ -39,6 +44,13 @@ Can be generated with `(buildbot-get-all-builders)'.")
"%s/api/v2/changes?%s"
buildbot-host (buildbot-format-attr attr))))
+(defun buildbot-api-change-builds (change-id)
+ "Call the Changes API with CHANGE-ID to get all builds."
+ (buildbot-url-fetch-json
+ (format
+ "%s/api/v2/changes/%s/builds"
+ buildbot-host change-id)))
+
(defun buildbot-api-log (stepid)
"Call the Logs API with STEPID."
(buildbot-url-fetch-json
@@ -120,8 +132,18 @@ Can be generated with `(buildbot-get-all-builders)'.")
(defun buildbot-get-changes-by-revision (revision)
"Get the changes from a REVISION."
- (alist-get 'changes
- (buildbot-api-change `((revision . ,revision)))))
+ (let ((changes
+ (alist-get 'changes
+ (buildbot-api-change `((revision . ,revision))))))
+ (mapcar
+ (lambda (change)
+ (if (assq 'builds change)
+ change
+ (cons
+ (assq 'builds (buildbot-api-change-builds
+ (alist-get 'changeid change)))
+ change)))
+ changes)))
(defun buildbot-get-build-by-buildid (buildid)
"Get a build with BUILDID."