diff options
author | Christopher Baines <mail@cbaines.net> | 2020-04-16 21:42:26 +0100 |
---|---|---|
committer | Christopher Baines <mail@cbaines.net> | 2020-04-16 21:42:26 +0100 |
commit | 6ddf31cfbb963faa61f078538e5890d6cb656467 (patch) | |
tree | f849e8f8fe81a30b73c663321bd748b266e0a2a1 /guix-build-coordinator/agent-messaging | |
parent | e89225ea04c03020c03b0d3b20ddc201e593f8db (diff) | |
download | build-coordinator-6ddf31cfbb963faa61f078538e5890d6cb656467.tar build-coordinator-6ddf31cfbb963faa61f078538e5890d6cb656467.tar.gz |
Implement a couple of basic hooks
This allows configurable code to be executed when builds succeed or fail.
Diffstat (limited to 'guix-build-coordinator/agent-messaging')
-rw-r--r-- | guix-build-coordinator/agent-messaging/http.scm | 14 |
1 files changed, 10 insertions, 4 deletions
diff --git a/guix-build-coordinator/agent-messaging/http.scm b/guix-build-coordinator/agent-messaging/http.scm index 23c119c..9aa7f55 100644 --- a/guix-build-coordinator/agent-messaging/http.scm +++ b/guix-build-coordinator/agent-messaging/http.scm @@ -71,10 +71,13 @@ if there was no request body." fixed/read-request-body) (define (http-agent-messaging-start-server port host secret-key-base - datastore) + datastore hooks) (define build-allocator-channel (make-build-allocator-channel datastore)) + (define hook-channel + (make-hook-channel datastore hooks)) + (define (trigger-build-allocation) (put-message build-allocator-channel #t)) @@ -94,7 +97,8 @@ if there was no request body." body secret-key-base datastore - trigger-build-allocation))) + trigger-build-allocation + hook-channel))) 'http (list #:host host #:port port))) @@ -131,7 +135,8 @@ port. Also, the port used can be changed by passing the --port option.\n" body secret-key-base datastore - trigger-build-allocation) + trigger-build-allocation + hook-channel) (define (authenticated? uuid request) (let* ((authorization-base64 (match (assq-ref (request-headers request) @@ -183,7 +188,8 @@ port. Also, the port used can be changed by passing the --port option.\n" (datastore-agent-for-build datastore uuid))) (if (authenticated? agent-id-for-build request) (begin - (handle-build-result datastore agent-id-for-build uuid + (handle-build-result datastore hook-channel + agent-id-for-build uuid (json-string->scm (utf8->string body))) ;; Trigger build allocation, as the result of this build could ;; change the allocation |