aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--doc/forge.skb3
-rw-r--r--guix/forge/forge.scm31
2 files changed, 29 insertions, 5 deletions
diff --git a/doc/forge.skb b/doc/forge.skb
index 83b4100..99d1b86 100644
--- a/doc/forge.skb
+++ b/doc/forge.skb
@@ -555,6 +555,9 @@ jobs when a request is received on ,(samp "http://hostname:port/hooks/<name>") \
specified, a cron job triggers the CI jobs once a day.]))]
:default [,(code ['post-receive-hook]) for local repositories
and ,(code ['cron]) for remote repositories])
+ (record-field "parallel-ci-job-runs"
+ [Number of CI job runs of this project to run
+simultaneously])
(record-field "repository-branch"
[Main branch of the repository. This field is currently
unused unused, and may be deprecated in the future.]))
diff --git a/guix/forge/forge.scm b/guix/forge/forge.scm
index 7cf3ff3..6e24cbf 100644
--- a/guix/forge/forge.scm
+++ b/guix/forge/forge.scm
@@ -87,7 +87,9 @@
'post-receive-hook)
;; 'cron for remote repositories
(else 'cron)))
- (thunked)))
+ (thunked))
+ (parallel-ci-job-runs forge-project-parallel-ci-job-runs
+ (default 1)))
(define-record-type* <forge-configuration>
forge-configuration make-forge-configuration
@@ -407,7 +409,24 @@ When @var{verbose?} is #true, verbose build logs are shown."
(define (forge-ci-jobs config)
"Return list of CI jobs for forge configuraion @var{config}. Each
value of the returned list is a @code{<forge-laminar-job>} object."
- (append-map forge-project-ci-jobs
+ (append-map (lambda (project)
+ ;; Add project context to CI jobs.
+ (map (lambda (job)
+ (forge-laminar-job
+ (inherit job)
+ (contexts (cons (forge-project-name project)
+ (forge-laminar-job-contexts job)))))
+ (forge-project-ci-jobs project)))
+ (forge-configuration-projects config)))
+
+(define (forge-ci-job-contexts config)
+ "Return list of CI job contexts for forge configuration
+@var{config}. Each element of the returned list is a
+@code{<forge-laminar-context>} object."
+ (filter-map (lambda (project)
+ (forge-laminar-context
+ (name (forge-project-name project))
+ (executors (forge-project-parallel-ci-job-runs project))))
(forge-configuration-projects config)))
(define (forge-ci-job-groups config)
@@ -427,11 +446,13 @@ value of the returned list is a @code{<forge-laminar-job>} object."
")$"))))))
(forge-configuration-projects config)))
-(define (forge-ci-jobs-and-groups config)
+(define (forge-ci-jobs+contexts+groups config)
"Return list of CI jobs and job groups for forge configuration
@var{config}. Each element of the returned list is either a
-@code{<forge-laminar-job>} or a @code{<forge-laminar-group>} object."
+@code{<forge-laminar-job>}, @code{<forge-laminar-context>} or
+@code{<forge-laminar-group>} object."
(append (forge-ci-jobs config)
+ (forge-ci-job-contexts config)
(forge-ci-job-groups config)))
(define (forge-cron-jobs config)
@@ -475,7 +496,7 @@ value is a list of @code{<webhook-hook>} objects."
(extensions (list (service-extension activation-service-type
forge-activation)
(service-extension forge-laminar-service-type
- forge-ci-jobs-and-groups)
+ forge-ci-jobs+contexts+groups)
;; TODO: Run CI job only if there are new commits
;; in the remote repository.
(service-extension mcron-service-type