Subject: [PATCH v2 2/3] services: cuirass: Add new configuration options.

From: Ahmad Draidi <[email-masked]>
Date: Thu, 2 May 2024 05:37:48 +0400

* gnu/services/cuirass.scm (<cuirass-configuration>): Add ttl and threads
fields.
(cuirass-shepherd-service): Handle the new options.
* doc/guix.texi (Continuous Integration): Document them.

Change-Id: I4387fbd7bf6766f4a54801f35c7ed82ce4eb9645
---
v2 changes: Switch ttl field to seconds integer

 doc/guix.texi            |  6 ++++++
 gnu/services/cuirass.scm | 17 +++++++++++++++++
 2 files changed, 23 insertions(+)

diff --git a/doc/guix.texi b/doc/guix.texi
index f93fe7e474..1f97a2796e 100644
--- a/doc/guix.texi
+++ b/doc/guix.texi
@@ -34427,6 +34427,12 @@ Continuous Integration
 Number of seconds between the poll of the repositories followed by the
 Cuirass jobs.
 
+@item @code{ttl} (default: @code{2592000})
+Duration to keep build results' GC roots alive, in seconds.
+
+@item @code{threads} (default: @code{#f})
+Number of kernel threads to use for Cuirass. The default value should be appropriate for most cases.
+
 @item @code{parameters} (default: @code{#f})
 Read parameters from the given @var{parameters} file.  The supported
 parameters are described here (@pxref{Parameters,,, cuirass, Cuirass}).
diff --git a/gnu/services/cuirass.scm b/gnu/services/cuirass.scm
index b09d5601d4..f430c38a69 100644
--- a/gnu/services/cuirass.scm
+++ b/gnu/services/cuirass.scm
@@ -101,6 +101,10 @@ (define-record-type* <cuirass-configuration>
                     (default "cuirass"))
   (interval         cuirass-configuration-interval ;integer (seconds)
                     (default 60))
+  (ttl              cuirass-configuration-ttl ;integer
+                    (default 2592000))
+  (threads          cuirass-configuration-threads ;integer
+                    (default #f))
   (parameters       cuirass-configuration-parameters ;string
                     (default #f))
   (remote-server    cuirass-configuration-remote-server
@@ -133,6 +137,8 @@ (define (cuirass-shepherd-service config)
         (user             (cuirass-configuration-user config))
         (group            (cuirass-configuration-group config))
         (interval         (cuirass-configuration-interval config))
+        (ttl              (cuirass-configuration-ttl config))
+        (threads          (cuirass-configuration-threads config))
         (parameters       (cuirass-configuration-parameters config))
         (remote-server    (cuirass-configuration-remote-server config))
         (database         (cuirass-configuration-database config))
@@ -159,6 +165,17 @@ (define (cuirass-shepherd-service config)
                         "--specifications" #$config-file
                         "--database" #$database
                         "--interval" #$(number->string interval)
+                        #$@(if ttl
+                               (list (string-append
+                                      "--ttl="
+                                      (number->string ttl)
+                                                 "s"))
+                               '())
+                        #$@(if threads
+                               (list (string-append
+                                      "--threads="
+                                      (number->string threads)))
+                               '())
                         #$@(if parameters
                                (list (string-append
                                       "--parameters="
-- 
2.41.0