aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChristopher Baines <christopher.baines@digital.cabinet-office.gov.uk>2019-09-29 19:13:02 +0100
committerChristopher Baines <christopher.baines@digital.cabinet-office.gov.uk>2019-10-02 08:16:54 +0100
commit9acb0aa55b5787edef885bb812e2ee66d4401e80 (patch)
tree74c44489f38b2dd2274acb7390205c13a0480fac
parentd27ff21e430cd38b02bd70a0dc8d60c9c2736f83 (diff)
downloadcuirass-9acb0aa55b5787edef885bb812e2ee66d4401e80.tar
cuirass-9acb0aa55b5787edef885bb812e2ee66d4401e80.tar.gz
http: Support fetching builds by derivation.
There's a one to one mapping of build id to derivation, so allow querying by derivation file name as well. I'm looking at this as I'm interested in getting build information in to the Guix Data Service. * src/cuirass/http.scm (url-handler): Support fetching builds by numeric id or the derivation file name.
-rw-r--r--src/cuirass/http.scm10
1 files changed, 7 insertions, 3 deletions
diff --git a/src/cuirass/http.scm b/src/cuirass/http.scm
index 2da3637..b6a4358 100644
--- a/src/cuirass/http.scm
+++ b/src/cuirass/http.scm
@@ -42,6 +42,7 @@
#:use-module (sxml simple)
#:use-module (cuirass templates)
#:use-module (guix utils)
+ #:use-module ((guix store) #:select (%store-prefix))
#:use-module (guix build union)
#:export (run-cuirass-server))
@@ -243,11 +244,14 @@ Hydra format."
(((or "jobsets" "specifications") . rest)
(respond-json (object->json-string
(list->vector (db-get-specifications)))))
- (("build" build-id)
- (let ((hydra-build (handle-build-request (string->number build-id))))
+ (("build" id)
+ (let ((hydra-build (handle-build-request
+ (if (string-suffix? ".drv" id)
+ (string-append (%store-prefix) "/" id)
+ (string->number id)))))
(if hydra-build
(respond-json (object->json-string hydra-build))
- (respond-build-not-found build-id))))
+ (respond-build-not-found id))))
(("build" build-id "details")
(let ((build (db-get-build (string->number build-id))))
(if build