aboutsummaryrefslogtreecommitdiff
path: root/scripts
diff options
context:
space:
mode:
authorChristopher Baines <mail@cbaines.net>2020-09-27 17:07:34 +0100
committerChristopher Baines <mail@cbaines.net>2020-09-27 17:07:34 +0100
commitebfb487d9230be509bad31cb41d84dc8200565bc (patch)
tree5fa49095a0ec45384fac5edb0f76627e885bc4d4 /scripts
parent1f43eb264a64b6c399b67a8835dab2062a20797e (diff)
downloadbuild-coordinator-ebfb487d9230be509bad31cb41d84dc8200565bc.tar
build-coordinator-ebfb487d9230be509bad31cb41d84dc8200565bc.tar.gz
Remove some hardcoding in the queue builds script
Diffstat (limited to 'scripts')
-rw-r--r--scripts/guix-build-coordinator-queue-builds-from-guix-data-service.in58
1 files changed, 46 insertions, 12 deletions
diff --git a/scripts/guix-build-coordinator-queue-builds-from-guix-data-service.in b/scripts/guix-build-coordinator-queue-builds-from-guix-data-service.in
index 4eac711..69e320d 100644
--- a/scripts/guix-build-coordinator-queue-builds-from-guix-data-service.in
+++ b/scripts/guix-build-coordinator-queue-builds-from-guix-data-service.in
@@ -66,9 +66,33 @@
#:times 6
#:delay 30))
-(define (unseen-revisions guix-data-service)
+(define (all-repository-ids guix-data-service)
(let ((data (guix-data-service-request guix-data-service
- "/repository/1/branch/master.json")))
+ "/repositories.json")))
+ (map (lambda (entry)
+ (assoc-ref entry "id"))
+ (vector->list
+ (assoc-ref data "repositories")))))
+
+(define (all-repository-branches guix-data-service repository-id)
+ (let ((data (guix-data-service-request guix-data-service
+ (string-append
+ "/repository/"
+ (number->string repository-id)
+ ".json"))))
+ (map (lambda (entry)
+ (assoc-ref entry "name"))
+ (vector->list
+ (assoc-ref data "branches")))))
+
+(define (unseen-revisions guix-data-service repository-id branch)
+ (let ((data (guix-data-service-request guix-data-service
+ (string-append
+ "/repository/"
+ (number->string repository-id)
+ "/branch/"
+ branch
+ ".json"))))
(filter-map (lambda (entry)
(let ((commit (assoc-ref entry "commit-hash")))
(and (not (hash-ref processed-commits-hash
@@ -281,16 +305,26 @@
commits)))))
(while #t
- (for-each (lambda (commit)
- (submit-builds-for-revision
- (assq-ref opts 'coordinator)
- guix-data-service
- commit
- systems-and-targets
- #:submit-builds-for-channel-instances?
- (assq-ref opts 'fetch-channel-instance-derivations))
- (record-revision-as-processed processed-commits-file commit))
- (unseen-revisions guix-data-service))
+ (for-each
+ (lambda (repository-id)
+ (for-each
+ (lambda (branch)
+ (for-each
+ (lambda (commit)
+ (submit-builds-for-revision
+ (assq-ref opts 'coordinator)
+ guix-data-service
+ commit
+ systems-and-targets
+ #:submit-builds-for-channel-instances?
+ (assq-ref opts 'fetch-channel-instance-derivations))
+ (record-revision-as-processed processed-commits-file commit))
+ (unseen-revisions guix-data-service
+ repository-id
+ branch)))
+ (all-repository-branches guix-data-service
+ repository-id)))
+ (all-repository-ids guix-data-service))
(simple-format #t "waiting before checking for new revisions...\n")
(sleep 60))))