aboutsummaryrefslogtreecommitdiff
path: root/buildbot-client.el
diff options
context:
space:
mode:
authorYuchen Pei <id@ypei.org>2023-07-10 22:10:59 +1000
committerYuchen Pei <id@ypei.org>2023-07-10 22:10:59 +1000
commit071ba8408abf2d13c914a331c719779d7696d1dd (patch)
treed18cde559cec2773ccabde42c47506e197c08393 /buildbot-client.el
parent8c151a133ffcc3bb1d4e8e23bc071d32785185c2 (diff)
Fixing flymake complaints.
There are still some weird "Foo should be imperative" complaints, but they do not seem to be important.
Diffstat (limited to 'buildbot-client.el')
-rw-r--r--buildbot-client.el24
1 files changed, 22 insertions, 2 deletions
diff --git a/buildbot-client.el b/buildbot-client.el
index a681583..06e43d6 100644
--- a/buildbot-client.el
+++ b/buildbot-client.el
@@ -25,95 +25,115 @@
;;; Code:
(require 'buildbot-utils)
+(require 'cl-seq)
-(defvar buildbot-host nil "Buildbot instance host")
+(defvar buildbot-host nil "Buildbot instance host.")
(defvar buildbot-builders nil
- "Buildbot builders. Can be generated with (buildbot-get-all-builders)")
+ "Buildbot builders. Can be generated with `(buildbot-get-all-builders)'.")
(defun buildbot-api-change (attr)
+ "Call the Changes API with ATTR."
(buildbot-url-fetch-json
(format
"%s/api/v2/changes?%s"
buildbot-host (buildbot-format-attr attr))))
(defun buildbot-api-logs (stepid)
+ "Call the Logs API with STEPID."
(buildbot-url-fetch-json
(format
"%s/api/v2/steps/%d/logs"
buildbot-host stepid)))
(defun buildbot-api-builders ()
+ "Call the Builders API to get all builders."
(buildbot-url-fetch-json
(format
"%s/api/v2/builders"
buildbot-host)))
(defun buildbot-api-builders-builds (builder-id attr)
+ "Call the Builds API with BUILDER-ID and 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)
+ "Call the Builds API with ATTR."
(buildbot-url-fetch-json
(format
"%s/api/v2/builds?%s"
buildbot-host (buildbot-format-attr attr))))
(defun buildbot-api-step (buildid)
+ "Call the Steps API with BUILDID."
(buildbot-url-fetch-json
(format
"%s/api/v2/builds/%s/steps"
buildbot-host buildid)))
(defun buildbot-api-log-raw (logid)
+ "Call the raw logs API with LOGID."
(buildbot-url-fetch-raw
(format "%s/api/v2/logs/%d/raw" buildbot-host logid)))
(defun buildbot-get-recent-builds-by-builder (builder-id limit)
+ "Get LIMIT number of recent builds with BUILDER-ID."
(alist-get 'builds
(buildbot-api-builders-builds
builder-id
`((limit . ,limit) (order . "-number") (property . "revision")))))
(defun buildbot-get-recent-changes (limit)
+ "Get LIMIT number of recent changes."
(buildbot-api-change (list (cons 'order "-changeid") (cons 'limit limit))))
(defun buildbot-get-all-builders ()
+ "Get all builders."
(alist-get 'builders (buildbot-api-builders)))
(defun buildbot-builder-by-id (builderid)
+ "Get a builder by its BUILDERID."
(cl-find-if
(lambda (builder)
(= (alist-get 'builderid builder) builderid))
buildbot-builders))
(defun buildbot-builder-by-name (name)
+ "Get a builder by its NAME."
(cl-find-if
(lambda (builder)
(equal (alist-get 'name builder) name))
buildbot-builders))
(defun buildbot-get-logs-by-stepid (stepid)
+ "Get logs of a step with STEPID."
(alist-get 'logs (buildbot-api-logs stepid)))
(defun buildbot-get-builder-name-by-id (id)
+ "Get a builder name with ID."
(alist-get 'name (buildbot-builder-by-id id)))
(defun buildbot-get-changes-by-revision (revision)
+ "Get the changes from a REVISION."
(alist-get 'changes
(buildbot-api-change (list (cons 'revision revision)))))
(defun buildbot-get-build-by-buildid (buildid)
+ "Get a build with BUILDID."
(buildbot-api-build (list (cons 'buildid buildid))))
(defun buildbot-get-steps-by-buildid (buildid)
+ "Get the steps of a build with BUILDID."
(alist-get 'steps (buildbot-api-step buildid)))
(defun buildbot-get-changes-by-branch (branch-name limit)
+ "Get LIMIT number of changes of a branch with BRANCH-NAME."
(alist-get 'changes
(buildbot-api-change
(cons `(branch . ,branch-name)
(when limit `((limit . ,limit)))))))
(provide 'buildbot-client)
+;;; buildbot-client.el ends here