cbaines pushed a commit to branch master in repository maintenance. commit 8be72be27d12e7935fc687d9c0ddd76ebeaefe80 Author: Christopher Baines <m...@cbaines.net> AuthorDate: Wed Jun 5 11:57:51 2024 +0100
hydra: bayfront: Rework the build success hook. Publish to a temporary directory, then import the narinfos and nars with the nar-herder. This avoids parallel hooks from conflicting. * hydra/bayfront.scm (%guix-build-coordinator-configuration): Rework the build success hook. --- hydra/bayfront.scm | 25 +++++++++++++++++++------ 1 file changed, 19 insertions(+), 6 deletions(-) diff --git a/hydra/bayfront.scm b/hydra/bayfront.scm index b97c1c6d..500538f1 100644 --- a/hydra/bayfront.scm +++ b/hydra/bayfront.scm @@ -1151,15 +1151,24 @@ proxy_set_header Via $via;" 'build-started-send-event-to-guix-data-service-hook))) (build-success . ,#~(lambda args - (use-modules (gcrypt pk-crypto) ; for read-file-sexp + (use-modules (srfi srfi-1) + (guix build utils) + (gcrypt pk-crypto) ; for read-file-sexp (web uri) (web client) (web response)) #$recompress-log-file-hook + + (define temporary-publish-directory + (string-append "/tmp/bordeaux-nars/" (second args))) + (mkdir-p temporary-publish-directory) (apply ((@ (guix-build-coordinator hooks) build-success-publish-hook) - #$publish-directory + ;; Use a temporary directory unique to the + ;; build here to avoid different builds for + ;; the same outputs conflicting + temporary-publish-directory ;; These should be the same as ;; /etc/guix/... but are copied here so that ;; they can be read by the Guix Build @@ -1180,15 +1189,18 @@ proxy_set_header Via $via;" "http://localhost:8734/" narinfo-filename)))))) #:combined-post-publish-hook - (lambda (directory narinfos-and-nars) + (lambda (directory narinfos) (let* ((narinfos (map (lambda (narinfo-filename) (string-append directory "/" narinfo-filename)) - (map car narinfos-and-nars))) + narinfos)) (command - (cons* #$(file-append nar-herder "/bin/nar-herder") + (cons* #$(file-append my-nar-herder "/bin/nar-herder") "import" + ;; Set --storage so the + ;; nar-herder moves the nars + "--storage=/var/lib/nars" "--tag=unknown-if-for-master=true" ;; "--ensure-references-exist" "--database=/var/lib/nar-herder/nar_herder.db" @@ -1209,7 +1221,8 @@ proxy_set_header Via $via;" "deleting ~A\n" narinfo) (delete-file narinfo)) - narinfos))) + narinfos) + (delete-file-recursively temporary-publish-directory))) #:derivation-substitute-urls '("https://data.guix.gnu.org" "https://data.qa.guix.gnu.org")) args)