diff options
-rw-r--r-- | doc/forge.skb | 5 | ||||
-rw-r--r-- | guix/forge/laminar.scm | 32 |
2 files changed, 25 insertions, 12 deletions
diff --git a/doc/forge.skb b/doc/forge.skb index 98ae9db..83b4100 100644 --- a/doc/forge.skb +++ b/doc/forge.skb @@ -567,7 +567,10 @@ unused unused, and may be deprecated in the future.])) [G-expression to be run after the main job script]) (record-field "trigger?" [If ,(code [#t]), this job is run on every commit. Else, it -must be manually set up to run some other way.])) +must be manually set up to run some other way.]) + (record-field "contexts" + [List of names of contexts (strings) associated with this +job])) (record-documentation "guix/forge/socket.scm" '<forge-host-socket> (record-field "hostname" [Name of the host]) diff --git a/guix/forge/laminar.scm b/guix/forge/laminar.scm index cc6b260..16f5de7 100644 --- a/guix/forge/laminar.scm +++ b/guix/forge/laminar.scm @@ -23,6 +23,7 @@ #:use-module (gnu packages ci) #:use-module (gnu services ci) #:use-module (guix records) + #:use-module (ice-9 match) #:export (forge-laminar-service-type forge-laminar-configuration forge-laminar-configuration? @@ -37,6 +38,7 @@ forge-laminar-job-run forge-laminar-job-after forge-laminar-job-trigger? + forge-laminar-job-contexts forge-laminar-context forge-laminar-context? forge-laminar-context-name @@ -67,7 +69,9 @@ (after forge-laminar-job-after (default #f)) (trigger? forge-laminar-job-trigger? - (default #t))) + (default #t)) + (contexts forge-laminar-job-contexts + (default '()))) (define-record-type* <forge-laminar-context> forge-laminar-context make-forge-laminar-context @@ -112,17 +116,23 @@ list of @var{<forge-laminar-context>} objects." of @var{<forge-laminar-job>} objects." (file-union "laminar-jobs" (append-map (lambda (job) - (let ((name (forge-laminar-job-name job)) - (run (forge-laminar-job-run job)) - (after (forge-laminar-job-after job))) - (cons (let ((run-name (string-append name ".run"))) - (list run-name - (program-file run-name run))) + (let ((name (forge-laminar-job-name job))) + `(,(let ((run-name (string-append name ".run"))) + `(,run-name ,(program-file run-name + (forge-laminar-job-run job)))) + ,@(let ((after (forge-laminar-job-after job)) + (after-name (string-append name ".after"))) (if after - (list (let ((after-name (string-append name ".after"))) - (list after-name - (program-file after-name after)))) - (list))))) + `((,after-name ,(program-file after-name after))) + '())) + ,@(match (forge-laminar-job-contexts job) + (() '()) + (contexts + (let ((conf-name (string-append name ".conf"))) + `((,conf-name ,(mixed-text-file conf-name + "CONTEXTS=" + (string-join contexts ",") + "\n"))))))))) jobs))) (define (forge-laminar-activation config) |