[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
02/02: hydra: bayfront: Delete narinfo files after importing them.
From: |
Christopher Baines |
Subject: |
02/02: hydra: bayfront: Delete narinfo files after importing them. |
Date: |
Fri, 4 Feb 2022 05:51:00 -0500 (EST) |
cbaines pushed a commit to branch master
in repository maintenance.
commit c56678cf1a3f2e5b823dde34818c393c541999ef
Author: Christopher Baines <mail@cbaines.net>
AuthorDate: Fri Feb 4 10:48:33 2022 +0000
hydra: bayfront: Delete narinfo files after importing them.
In to the nar-herder database. This means that duplicating the
narinfo files between the filesystem and the nar-herder database can
be avoided.
* hydra/bayfront.scm <services>: Have the guix-build-coordinator
build-success hook check for the presence of the narinfo in the
nar-herder database, and delete the narinfo files after importing.
---
hydra/bayfront.scm | 32 +++++++++++++++++++++++++-------
1 file changed, 25 insertions(+), 7 deletions(-)
diff --git a/hydra/bayfront.scm b/hydra/bayfront.scm
index 0e2b28a..b7e96ac 100644
--- a/hydra/bayfront.scm
+++ b/hydra/bayfront.scm
@@ -731,7 +731,10 @@ access_log /var/log/nginx/bordeaux.access.log;"))
'build-started-send-event-to-guix-data-service-hook)))
(build-success
. ,#~(lambda args
- (use-modules (gcrypt pk-crypto)) ; for read-file-sexp
+ (use-modules (gcrypt pk-crypto) ; for read-file-sexp
+ (web uri)
+ (web client)
+ (web response))
#$recompress-log-file-hook
(apply ((@ (guix-build-coordinator hooks)
@@ -747,13 +750,24 @@ access_log /var/log/nginx/bordeaux.access.log;"))
#:private-key
(read-file-sexp
"/etc/guix-build-coordinator/signing-key.sec")
+ #:skip-publishing-proc
+ (lambda (narinfo-filename _)
+ (eq? 200
+ ((@ (web response) response-code)
+ (http-get
+ (string->uri
+ (string-append
+ "http://localhost:8734/"
+ narinfo-filename))))))
#:post-publish-hook
(lambda (directory narinfo-filename nar-filename)
- (let ((command
- (list #$(file-append nar-herder
"/bin/nar-herder")
- "import"
-
"--database=/var/lib/nar-herder/nar_herder.db"
- (string-append directory "/"
narinfo-filename))))
+ (let* ((narinfo
+ (string-append directory "/"
narinfo-filename))
+ (command
+ (list #$(file-append nar-herder
"/bin/nar-herder")
+ "import"
+
"--database=/var/lib/nar-herder/nar_herder.db"
+ narinfo)))
(let ((exit-code
(status:exit-val
(apply system* command))))
@@ -763,7 +777,11 @@ access_log /var/log/nginx/bordeaux.access.log;"))
#f
"error: command failed (~A): ~A\n"
exit-code
- command)))))))
+ command))))
+ (simple-format (current-error-port)
+ "deleting ~A\n"
+ narinfo)
+ (delete-file narinfo))))
args)
#$(send-guix-data-service-event
'build-success-send-event-to-guix-data-service-hook)