aboutsummaryrefslogtreecommitdiff
path: root/forge
diff options
context:
space:
mode:
authorArun Isaac2022-02-09 00:14:04 +0530
committerArun Isaac2022-02-09 15:15:21 +0530
commit4187ea8eaf5a5e3c7805f221a4f7fe92cc880106 (patch)
tree8708a7b63d6ad1d0d0a3935a115e9d9c1ec48edd /forge
parent8ff8e71eb1639e244ff003e379c4b19bc5db4ba9 (diff)
downloadguix-forge-4187ea8eaf5a5e3c7805f221a4f7fe92cc880106.tar.gz
guix-forge-4187ea8eaf5a5e3c7805f221a4f7fe92cc880106.tar.lz
guix-forge-4187ea8eaf5a5e3c7805f221a4f7fe92cc880106.zip
forge: Support triggering jobs with a webhook.
* forge/forge.scm: Import (forge webhook). (<forge-project-configuration>)[ci-jobs-trigger]: Allow 'webhook. (forge-service-type): Extend webhook-service-type.
Diffstat (limited to 'forge')
-rw-r--r--forge/forge.scm14
1 files changed, 13 insertions, 1 deletions
diff --git a/forge/forge.scm b/forge/forge.scm
index 1ff5f93..fbdce3b 100644
--- a/forge/forge.scm
+++ b/forge/forge.scm
@@ -33,6 +33,7 @@
#:use-module (guix records)
#:use-module (guix store)
#:use-module (forge laminar)
+ #:use-module (forge webhook)
#:export (forge-service-type
forge-configuration
forge-configuration-guix-daemon-uri
@@ -66,7 +67,7 @@
(default #f))
(ci-jobs forge-project-configuration-ci-jobs
(default '()))
- (ci-jobs-trigger forge-project-configuration-ci-jobs-trigger ; one of 'post-receive-hook, 'cron
+ (ci-jobs-trigger forge-project-configuration-ci-jobs-trigger ; one of 'post-receive-hook, 'cron, 'webhook
(default (cond
;; 'post-receive-hook for local repositories
((string-prefix? "/" (forge-project-configuration-repository this-record))
@@ -265,5 +266,16 @@ derivation to run."
(map forge-laminar-job-name
(forge-project-configuration-laminar-jobs project config))))
#:user "laminar")))
+ (forge-configuration-projects config))))
+ (service-extension webhook-service-type
+ (lambda (config)
+ (filter-map (lambda (project)
+ (and (eq? (forge-project-configuration-ci-jobs-trigger project)
+ 'webhook)
+ (webhook-hook
+ (id (forge-project-configuration-name project))
+ (run (ci-jobs-trigger-gexp
+ (map forge-laminar-job-name
+ (forge-project-configuration-laminar-jobs project config)))))))
(forge-configuration-projects config))))))
(default-value (forge-configuration))))