diff options
author | Christopher Baines <mail@cbaines.net> | 2023-06-02 16:29:34 +0100 |
---|---|---|
committer | Christopher Baines <mail@cbaines.net> | 2023-06-02 17:08:25 +0100 |
commit | 3913d7a6ab722abb1dadb62d60a50b495f0e5eba (patch) | |
tree | 22d1f43cc8870961264542cd6871b0fdc5d00135 /bffe.scm | |
parent | 39c271ae30cbf7c23cd44f0baf75a3d16752995f (diff) | |
download | bffe-3913d7a6ab722abb1dadb62d60a50b495f0e5eba.tar bffe-3913d7a6ab722abb1dadb62d60a50b495f0e5eba.tar.gz |
Add initial support for submitting builds
This provides similar functionality as provided by the
guix-build-coordinator-queue-builds-from-guix-data-service script, but I think
this is a better place for it.
Currently submitting builds isn't possible from the command line options, but
that could be supported in the future.
Diffstat (limited to 'bffe.scm')
-rw-r--r-- | bffe.scm | 56 |
1 files changed, 56 insertions, 0 deletions
diff --git a/bffe.scm b/bffe.scm new file mode 100644 index 0000000..7f605d7 --- /dev/null +++ b/bffe.scm @@ -0,0 +1,56 @@ +;;; Build Farm Front-End +;;; +;;; Copyright © 2023 Christopher Baines <mail@cbaines.net> +;;; +;;; This program is free software: you can redistribute it and/or +;;; modify it under the terms of the GNU Affero General Public License +;;; as published by the Free Software Foundation, either version 3 of +;;; the License, or (at your option) any later version. +;;; +;;; This program is distributed in the hope that it will be useful, +;;; but WITHOUT ANY WARRANTY; without even the implied warranty of +;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +;;; Affero General Public License for more details. +;;; +;;; You should have received a copy of the GNU Affero General Public +;;; License along with this program. If not, see +;;; <http://www.gnu.org/licenses/>. + +(define-module (bffe) + #:use-module (ice-9 format) + #:use-module (oop goops) + #:use-module (prometheus) + #:use-module (logging logger) + #:use-module (logging port-log) + #:use-module (bffe server) + #:use-module (bffe manage-builds) + #:export (run-bffe-service)) + +(define* (run-bffe-service + #:key + (metrics-registry + (make-metrics-registry + #:namespace + "bffe")) + (build '()) + web-server-args) + (let ((lgr (make <logger>)) + (port-log (make <port-log> + #:port (current-output-port) + #:formatter + (lambda (lvl time str) + (format #f "~a (~5a): ~a~%" + (strftime "%F %H:%M:%S" (localtime time)) + lvl + str))))) + + (add-handler! lgr port-log) + (open-log! lgr) + (set-default-logger! lgr) + + (for-each start-submit-builds-thread + build) + + (apply start-bffe-web-server + `(,@web-server-args + #:metrics-registry ,metrics-registry)))) |