branch: main
commit 90d536b69b7fc401546f16d503f0f6464f5fc96a
Author: Romain GARBAGE <romain.garb...@inria.fr>
AuthorDate: Wed May 7 11:18:25 2025 +0200

    http: Implement spec update for /admin/gitlab/event endpoint.
    
    * src/cuirass/http.scm (url-handler): Update specification when receiving an
    "update" Gitlab merge request event.
    
    Signed-off-by: Ludovic Courtès <l...@gnu.org>
---
 src/cuirass/http.scm | 12 +++++-------
 1 file changed, 5 insertions(+), 7 deletions(-)

diff --git a/src/cuirass/http.scm b/src/cuirass/http.scm
index 46bcd7e..61636bd 100644
--- a/src/cuirass/http.scm
+++ b/src/cuirass/http.scm
@@ -767,22 +767,20 @@ return DEFAULT."
                          (begin
                            (log-warning "cannot find jobset '~a'" spec-name)
                            (respond-json-with-error 404 "Jobset not 
found.")))))
-                  ;; A lot of things can trigger an "update" action. For now 
they are all
-                  ;; treated the same way: the jobset is reevaluated.
                   ;; XXX: Copied and adapted from 
"/jobset/<spec>/hook/evaluate.
                   ("update"
                    (let ((spec-name (specification-name spec)))
                      (if (db-get-specification spec-name)
-                         (if (call-bridge `(trigger-jobset 
,(specification-name spec))
+                         (if (call-bridge `(update-jobset ,(specification-name 
spec))
                                           bridge)
                              (respond-json (scm->json-string `((jobset . 
,spec-name))))
                              (begin
-                               (log-warning "evaluation hook disabled")
-                               (respond-json-with-error 400 "Evaluation hook 
disabled.")))
+                               (log-error "unable to update specification ~a" 
spec-name)
+                               (respond-json-with-error 400 "Unable to update 
specification")))
                          (respond-json-with-error 404 "Jobset not found."))))
                   (action (log-warning
-                         "Handling of action '~a' not implemented"
-                         action)))))
+                           "Handling of action '~a' not implemented"
+                           action)))))
              (event-type (respond-json-with-error 400 (format #f "Event type 
\"~a\" not supported." event-type))))
            (respond-json-with-error 400 "This API only supports JSON."))))
 

Reply via email to