summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorArun Isaac2022-02-09 00:10:08 +0530
committerArun Isaac2022-02-09 11:37:01 +0530
commitd6724269380d6f57454c7807e9f7cae50ee71064 (patch)
tree5069e958ec32a524a4d16a7ed49baed588b31b37
parent2e72b4c4e1bee27b260d1a925b3c103e1e1a7cda (diff)
downloadguix-forge-d6724269380d6f57454c7807e9f7cae50ee71064.tar.gz
guix-forge-d6724269380d6f57454c7807e9f7cae50ee71064.tar.lz
guix-forge-d6724269380d6f57454c7807e9f7cae50ee71064.zip
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.
-rw-r--r--forge/forge.scm38
1 files 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 <forge-derivation-job> 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))))