diff options
author | Christopher Baines <mail@cbaines.net> | 2020-04-26 17:30:39 +0100 |
---|---|---|
committer | Christopher Baines <mail@cbaines.net> | 2020-04-26 17:43:41 +0100 |
commit | c6c86965a8f193a27b4632d33d3d631375a06e09 (patch) | |
tree | 465dbdb9c26b6c5b0e6507dcc1ca5427015c83e2 /guix-build-coordinator/agent-messaging | |
parent | cd98c437221ebfe03c0f49ef0f2483c06d68c9dc (diff) | |
download | build-coordinator-c6c86965a8f193a27b4632d33d3d631375a06e09.tar build-coordinator-c6c86965a8f193a27b4632d33d3d631375a06e09.tar.gz |
Ensure that successful builds have the outputs and log file
Present on the coordinator.
Diffstat (limited to 'guix-build-coordinator/agent-messaging')
-rw-r--r-- | guix-build-coordinator/agent-messaging/http.scm | 39 |
1 files changed, 29 insertions, 10 deletions
diff --git a/guix-build-coordinator/agent-messaging/http.scm b/guix-build-coordinator/agent-messaging/http.scm index 7d96054..7d61ab4 100644 --- a/guix-build-coordinator/agent-messaging/http.scm +++ b/guix-build-coordinator/agent-messaging/http.scm @@ -22,6 +22,7 @@ #:use-module (srfi srfi-11) #:use-module (ice-9 match) #:use-module (ice-9 format) + #:use-module (ice-9 exceptions) #:use-module (ice-9 textual-ports) #:use-module (ice-9 binary-ports) #:use-module (system repl error-handling) @@ -205,15 +206,29 @@ port. Also, the port used can be changed by passing the --port option.\n" (let ((agent-id-for-build (datastore-agent-for-build datastore uuid))) (if (authenticated? agent-id-for-build request) - (begin - (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 - (trigger-build-allocation) - (render-json - "message received")) + (with-exception-handler + (lambda (exn) + (simple-format (current-error-port) + "exception: ~A\n" + exn) + (render-json + `((error . ,(exception-message exn))) + #:code 500)) ; TODO better code + (lambda () + (with-exception-handler + (lambda (exn) + (backtrace) + (raise-exception exn)) + (lambda () + (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 + (trigger-build-allocation) + (render-json + "message received")))) + #:unwind? #t) (render-json "access denied" #:code 403)))) @@ -415,7 +430,11 @@ port. Also, the port used can be changed by passing the --port option.\n" #:body (scm->json-string result) #:headers `((Authorization . ,auth-value))))) - (json-string->scm (utf8->string body)))) + (let ((message + (json-string->scm (utf8->string body)))) + (if (>= (response-code response) 400) + (error message) + message)))) (define (report-setup-failure coordinator-uri agent-uuid password build-id report) |