summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorArun Isaac2022-02-09 16:35:40 +0530
committerArun Isaac2022-02-09 16:35:40 +0530
commit383ae7103bdc01967af62190d17740aa07cb9a91 (patch)
tree18a48cab6c0168acdfb8ca11927b458d7375f716
parentaeb0c6115019e9faa8ece8c8a4937426b2470d36 (diff)
downloadguix-forge-383ae7103bdc01967af62190d17740aa07cb9a91.tar.gz
guix-forge-383ae7103bdc01967af62190d17740aa07cb9a91.tar.lz
guix-forge-383ae7103bdc01967af62190d17740aa07cb9a91.zip
forge: Set LAMINAR_REASON.
* forge/forge.scm (ci-jobs-trigger-gexp): Accept #:reason keyword argument and set LAMINAR_REASON. (forge-activation, forge-service-type): Pass #:reason keyword argument.
-rw-r--r--forge/forge.scm13
1 files changed, 9 insertions, 4 deletions
diff --git a/forge/forge.scm b/forge/forge.scm
index 526cc43..4c9fb41 100644
--- a/forge/forge.scm
+++ b/forge/forge.scm
@@ -115,7 +115,7 @@ described by <forge-derivation-job> objects, transform them to
job))
(forge-project-configuration-ci-jobs project)))
-(define (ci-jobs-trigger-gexp ci-jobs)
+(define* (ci-jobs-trigger-gexp ci-jobs #:key reason)
"Return a G-expression that triggers CI-JOBS. CI-JOBS is a list of
<forge-laminar-job> objects."
(with-imported-modules '((guix build utils))
@@ -124,6 +124,8 @@ described by <forge-derivation-job> objects, transform them to
;; TODO: Only trigger on updates to the main/master branch.
(display "Triggering continuous integration jobs..." (current-error-port))
(newline (current-error-port))
+ (when reason
+ (setenv "LAMINAR_REASON" reason))
(apply invoke
#$(file-append laminar "/bin/laminarc")
"queue" '#$(map forge-laminar-job-name ci-jobs)))))
@@ -138,7 +140,8 @@ described by <forge-derivation-job> objects, transform them to
(program-file
(forge-project-configuration-name project)
(ci-jobs-trigger-gexp
- (forge-project-configuration-laminar-jobs project config)))
+ (forge-project-configuration-laminar-jobs project config)
+ #:reason "post-receive hook"))
(forge-project-configuration-ci-jobs-trigger project)))
(forge-configuration-projects config))))
#~(begin
@@ -263,7 +266,8 @@ derivation to run."
#$(program-file
(forge-project-configuration-name project)
(ci-jobs-trigger-gexp
- (forge-project-configuration-laminar-jobs project config)))
+ (forge-project-configuration-laminar-jobs project config)
+ #:reason "Cron job"))
#:user "laminar")))
(forge-configuration-projects config))))
(service-extension webhook-service-type
@@ -274,6 +278,7 @@ derivation to run."
(webhook-hook
(id (forge-project-configuration-name project))
(run (ci-jobs-trigger-gexp
- (forge-project-configuration-laminar-jobs project config))))))
+ (forge-project-configuration-laminar-jobs project config)
+ #:reason "Webhook")))))
(forge-configuration-projects config))))))
(default-value (forge-configuration))))