From d6724269380d6f57454c7807e9f7cae50ee71064 Mon Sep 17 00:00:00 2001 From: Arun Isaac Date: Wed, 9 Feb 2022 00:10:08 +0530 Subject: forge: Return ci-jobs-trigger as G-expression. G-expressions are more versatile than file-like objects and compose cleanly under different circumstances. * forge/forge.scm (ci-jobs-trigger-script): Rename to ci-jobs-trigger-gexp and return a G-expression. (forge-activation, forge-service-type): Invoke ci-jobs-trigger-gexp instead of ci-jobs-trigger-script and pass its output to program-file. --- forge/forge.scm | 38 +++++++++++++++++++------------------- 1 file changed, 19 insertions(+), 19 deletions(-) diff --git a/forge/forge.scm b/forge/forge.scm index 9a617f1..1ff5f93 100644 --- a/forge/forge.scm +++ b/forge/forge.scm @@ -114,19 +114,17 @@ described by objects, transform them to job)) (forge-project-configuration-ci-jobs project))) -(define (ci-jobs-trigger-script project-name ci-jobs) - "Return a script, a file-like object, that triggers CI-JOBS of -PROJECT-NAME." - (program-file (string-append project-name "-ci-jobs-trigger") - (with-imported-modules '((guix build utils)) - #~(begin - (use-modules (guix build utils)) - ;; TODO: Only trigger on updates to the main/master branch. - (display "Triggering continuous integration jobs..." (current-error-port)) - (newline (current-error-port)) - (apply invoke - #$(file-append laminar "/bin/laminarc") - "queue" '#$ci-jobs))))) +(define (ci-jobs-trigger-gexp ci-jobs) + "Return a G-expression that triggers CI-JOBS." + (with-imported-modules '((guix build utils)) + #~(begin + (use-modules (guix build utils)) + ;; TODO: Only trigger on updates to the main/master branch. + (display "Triggering continuous integration jobs..." (current-error-port)) + (newline (current-error-port)) + (apply invoke + #$(file-append laminar "/bin/laminarc") + "queue" '#$ci-jobs)))) (define (forge-activation config) (let ((projects @@ -135,10 +133,11 @@ PROJECT-NAME." (forge-project-configuration-repository project) (forge-project-configuration-description project) (forge-project-configuration-website-directory project) - (ci-jobs-trigger-script + (program-file (forge-project-configuration-name project) - (map forge-laminar-job-name - (forge-project-configuration-laminar-jobs project config))) + (ci-jobs-trigger-gexp + (map forge-laminar-job-name + (forge-project-configuration-laminar-jobs project config)))) (forge-project-configuration-ci-jobs-trigger project))) (forge-configuration-projects config)))) #~(begin @@ -260,10 +259,11 @@ derivation to run." (and (eq? (forge-project-configuration-ci-jobs-trigger project) 'cron) #~(job '(next-day) - #$(ci-jobs-trigger-script + #$(program-file (forge-project-configuration-name project) - (map forge-laminar-job-name - (forge-project-configuration-laminar-jobs project config))) + (ci-jobs-trigger-gexp + (map forge-laminar-job-name + (forge-project-configuration-laminar-jobs project config)))) #:user "laminar"))) (forge-configuration-projects config)))))) (default-value (forge-configuration)))) -- cgit v1.2.3