Add a lookup_builds field to the build_servers table
This is to allow for build servers where only the substitutes should be queried, and it shouldn't be assumed that they're running Cuirass.
This commit is contained in:
parent
f11421824d
commit
b6754c8a4c
|
@ -135,11 +135,11 @@ initial connection on which HTTP requests are sent."
|
||||||
(let ((build-servers (select-build-servers conn)))
|
(let ((build-servers (select-build-servers conn)))
|
||||||
(for-each
|
(for-each
|
||||||
(match-lambda
|
(match-lambda
|
||||||
((id url lookup-all-derivations?)
|
((id url lookup-all-derivations? lookup-builds?)
|
||||||
(when (or (or (not build-servers)
|
(when (or (or (not build-servers)
|
||||||
(not build-server-ids))
|
(not build-server-ids))
|
||||||
(member id build-server-ids))
|
(member id build-server-ids))
|
||||||
(when lookup-all-derivations?
|
(when lookup-builds?
|
||||||
(simple-format #t "\nQuerying ~A\n" url)
|
(simple-format #t "\nQuerying ~A\n" url)
|
||||||
(catch #t
|
(catch #t
|
||||||
(lambda ()
|
(lambda ()
|
||||||
|
|
|
@ -19,21 +19,23 @@
|
||||||
#:use-module (ice-9 match)
|
#:use-module (ice-9 match)
|
||||||
#:use-module (squee)
|
#:use-module (squee)
|
||||||
#:export (select-build-servers
|
#:export (select-build-servers
|
||||||
select-build-server))
|
select-build-server
|
||||||
|
select-build-server-urls-by-id))
|
||||||
|
|
||||||
(define (select-build-servers conn)
|
(define (select-build-servers conn)
|
||||||
(define query
|
(define query
|
||||||
"
|
"
|
||||||
SELECT id, url, lookup_all_derivations
|
SELECT id, url, lookup_all_derivations, lookup_builds
|
||||||
FROM build_servers
|
FROM build_servers
|
||||||
ORDER BY id")
|
ORDER BY id")
|
||||||
|
|
||||||
(map
|
(map
|
||||||
(match-lambda
|
(match-lambda
|
||||||
((id url lookup-all-derivations)
|
((id url lookup-all-derivations lookup-builds)
|
||||||
(list (string->number id)
|
(list (string->number id)
|
||||||
url
|
url
|
||||||
(string=? lookup-all-derivations "t"))))
|
(string=? lookup-all-derivations "t")
|
||||||
|
(string=? lookup-builds))))
|
||||||
(exec-query conn query)))
|
(exec-query conn query)))
|
||||||
|
|
||||||
(define (select-build-server conn id)
|
(define (select-build-server conn id)
|
||||||
|
@ -46,6 +48,13 @@ WHERE id = $1")
|
||||||
(match (exec-query conn query (list (number->string id)))
|
(match (exec-query conn query (list (number->string id)))
|
||||||
(()
|
(()
|
||||||
#f)
|
#f)
|
||||||
(((url lookup_all_derivations))
|
(((url lookup_all_derivations lookup_builds))
|
||||||
(list url
|
(list url
|
||||||
(string=? lookup_all_derivations "t")))))
|
(string=? lookup_all_derivations "t")
|
||||||
|
(string=? lookup_builds "t")))))
|
||||||
|
|
||||||
|
(define (select-build-server-urls-by-id conn)
|
||||||
|
(map (match-lambda
|
||||||
|
((id url lookup-all-derivations? lookup-builds?)
|
||||||
|
(cons id url)))
|
||||||
|
(select-build-servers conn)))
|
||||||
|
|
|
@ -35,7 +35,7 @@
|
||||||
(let ((build-servers (select-build-servers conn)))
|
(let ((build-servers (select-build-servers conn)))
|
||||||
(for-each
|
(for-each
|
||||||
(match-lambda
|
(match-lambda
|
||||||
((id url lookup-all-derivations?)
|
((id url lookup-all-derivations? lookup-builds?)
|
||||||
(when (or (or (not build-servers)
|
(when (or (or (not build-servers)
|
||||||
(not build-server-ids))
|
(not build-server-ids))
|
||||||
(member id build-server-ids))
|
(member id build-server-ids))
|
||||||
|
|
|
@ -103,7 +103,7 @@
|
||||||
(h2 "Build servers")
|
(h2 "Build servers")
|
||||||
,@(map
|
,@(map
|
||||||
(match-lambda
|
(match-lambda
|
||||||
((id url lookup-all-derivations?)
|
((id url lookup-all-derivations? lookup-builds?)
|
||||||
`(dl
|
`(dl
|
||||||
(@ (class "dl-horizontal"))
|
(@ (class "dl-horizontal"))
|
||||||
(dt "URL")
|
(dt "URL")
|
||||||
|
@ -111,6 +111,10 @@
|
||||||
,url))
|
,url))
|
||||||
(dt "Lookup all " (br) "derivations?")
|
(dt "Lookup all " (br) "derivations?")
|
||||||
(dd ,(if lookup-all-derivations?
|
(dd ,(if lookup-all-derivations?
|
||||||
|
"Yes"
|
||||||
|
"No"))
|
||||||
|
(dt "Lookup " (br) "builds?")
|
||||||
|
(dd ,(if lookup-builds?
|
||||||
"Yes"
|
"Yes"
|
||||||
"No")))))
|
"No")))))
|
||||||
build-servers)))))))
|
build-servers)))))))
|
||||||
|
|
|
@ -38,7 +38,7 @@
|
||||||
(lambda (v)
|
(lambda (v)
|
||||||
(let ((build-servers (select-build-servers conn)))
|
(let ((build-servers (select-build-servers conn)))
|
||||||
(or (any (match-lambda
|
(or (any (match-lambda
|
||||||
((id url lookup-all-derivations?)
|
((id url lookup-all-derivations? lookup-builds?)
|
||||||
(if (eq? (string->number v)
|
(if (eq? (string->number v)
|
||||||
id)
|
id)
|
||||||
id
|
id
|
||||||
|
|
|
@ -295,11 +295,7 @@
|
||||||
target
|
target
|
||||||
package-name))
|
package-name))
|
||||||
(build-server-urls
|
(build-server-urls
|
||||||
(group-to-alist
|
(select-build-server-urls-by-id conn)))
|
||||||
(match-lambda
|
|
||||||
((id url lookup-all-derivations)
|
|
||||||
(cons id url)))
|
|
||||||
(select-build-servers conn))))
|
|
||||||
(case (most-appropriate-mime-type
|
(case (most-appropriate-mime-type
|
||||||
'(application/json text/html)
|
'(application/json text/html)
|
||||||
mime-types)
|
mime-types)
|
||||||
|
@ -364,11 +360,7 @@
|
||||||
package-name
|
package-name
|
||||||
output-name))
|
output-name))
|
||||||
(build-server-urls
|
(build-server-urls
|
||||||
(group-to-alist
|
(select-build-server-urls-by-id conn)))
|
||||||
(match-lambda
|
|
||||||
((id url lookup-all-derivations)
|
|
||||||
(cons id url)))
|
|
||||||
(select-build-servers conn))))
|
|
||||||
(case (most-appropriate-mime-type
|
(case (most-appropriate-mime-type
|
||||||
'(application/json text/html)
|
'(application/json text/html)
|
||||||
mime-types)
|
mime-types)
|
||||||
|
|
|
@ -77,7 +77,7 @@
|
||||||
(lambda (v)
|
(lambda (v)
|
||||||
(let ((build-servers (select-build-servers conn)))
|
(let ((build-servers (select-build-servers conn)))
|
||||||
(or (any (match-lambda
|
(or (any (match-lambda
|
||||||
((id url lookup-all-derivations?)
|
((id url lookup-all-derivations? lookup-builds?)
|
||||||
(if (eq? (string->number v)
|
(if (eq? (string->number v)
|
||||||
id)
|
id)
|
||||||
id
|
id
|
||||||
|
@ -454,11 +454,7 @@
|
||||||
(let ((substitute-availability
|
(let ((substitute-availability
|
||||||
(select-package-output-availability-for-revision conn commit-hash))
|
(select-package-output-availability-for-revision conn commit-hash))
|
||||||
(build-server-urls
|
(build-server-urls
|
||||||
(group-to-alist
|
(select-build-server-urls-by-id conn)))
|
||||||
(match-lambda
|
|
||||||
((id url lookup-all-derivations)
|
|
||||||
(cons id url)))
|
|
||||||
(select-build-servers conn))))
|
|
||||||
(case (most-appropriate-mime-type
|
(case (most-appropriate-mime-type
|
||||||
'(application/json text/html)
|
'(application/json text/html)
|
||||||
mime-types)
|
mime-types)
|
||||||
|
@ -796,11 +792,7 @@
|
||||||
#:after-name (assq-ref query-parameters 'after_name)
|
#:after-name (assq-ref query-parameters 'after_name)
|
||||||
#:include-builds? (member "builds" fields))))
|
#:include-builds? (member "builds" fields))))
|
||||||
(build-server-urls
|
(build-server-urls
|
||||||
(group-to-alist
|
(select-build-server-urls-by-id conn))
|
||||||
(match-lambda
|
|
||||||
((id url lookup-all-derivations)
|
|
||||||
(cons id url)))
|
|
||||||
(select-build-servers conn)))
|
|
||||||
(show-next-page?
|
(show-next-page?
|
||||||
(if all-results
|
(if all-results
|
||||||
#f
|
#f
|
||||||
|
@ -898,11 +890,7 @@
|
||||||
#:limit-results limit-results
|
#:limit-results limit-results
|
||||||
#:after-path (assq-ref query-parameters 'after_path)))
|
#:after-path (assq-ref query-parameters 'after_path)))
|
||||||
(build-server-urls
|
(build-server-urls
|
||||||
(group-to-alist
|
(select-build-server-urls-by-id conn))
|
||||||
(match-lambda
|
|
||||||
((id url lookup-all-derivations)
|
|
||||||
(cons id url)))
|
|
||||||
(select-build-servers conn)))
|
|
||||||
(show-next-page?
|
(show-next-page?
|
||||||
(if all-results
|
(if all-results
|
||||||
#f
|
#f
|
||||||
|
@ -960,7 +948,8 @@
|
||||||
(valid-targets->options
|
(valid-targets->options
|
||||||
(valid-targets conn))
|
(valid-targets conn))
|
||||||
(map (match-lambda
|
(map (match-lambda
|
||||||
((id url lookup-all-derivations)
|
((id url lookup-all-derivations
|
||||||
|
lookup-builds)
|
||||||
(cons url id)))
|
(cons url id)))
|
||||||
(select-build-servers conn))
|
(select-build-servers conn))
|
||||||
(select-build-stats
|
(select-build-stats
|
||||||
|
|
|
@ -54,7 +54,7 @@
|
||||||
(lambda (conn)
|
(lambda (conn)
|
||||||
(for-each
|
(for-each
|
||||||
(match-lambda
|
(match-lambda
|
||||||
((id url lookup-all-derivations?)
|
((id url lookup-all-derivations? lookup-builds?)
|
||||||
(simple-format #t "\nBuild server: ~A (id: ~A)\n"
|
(simple-format #t "\nBuild server: ~A (id: ~A)\n"
|
||||||
url
|
url
|
||||||
id)
|
id)
|
||||||
|
|
|
@ -0,0 +1,7 @@
|
||||||
|
-- Deploy guix-data-service:build_servers_lookup_builds to pg
|
||||||
|
|
||||||
|
BEGIN;
|
||||||
|
|
||||||
|
ALTER TABLE build_servers ADD COLUMN lookup_builds boolean NOT NULL DEFAULT TRUE;
|
||||||
|
|
||||||
|
COMMIT;
|
|
@ -0,0 +1,7 @@
|
||||||
|
-- Revert guix-data-service:build_servers_lookup_builds from pg
|
||||||
|
|
||||||
|
BEGIN;
|
||||||
|
|
||||||
|
-- XXX Add DDLs here.
|
||||||
|
|
||||||
|
COMMIT;
|
|
@ -57,3 +57,4 @@ drop_package_versions_by_guix_revision_range 2020-03-24T20:40:38Z Christopher Ba
|
||||||
create_narinfo_fetch_records_index 2020-03-25T19:07:28Z Christopher Baines <mail@cbaines.net> # Create an index on narinfo_fetch_records
|
create_narinfo_fetch_records_index 2020-03-25T19:07:28Z Christopher Baines <mail@cbaines.net> # Create an index on narinfo_fetch_records
|
||||||
load_new_guix_revision_jobs_make_commits_unique 2020-03-27T21:38:42Z Christopher Baines <mail@cbaines.net> # Make load_new_guix_revision_jobs commits unique
|
load_new_guix_revision_jobs_make_commits_unique 2020-03-27T21:38:42Z Christopher Baines <mail@cbaines.net> # Make load_new_guix_revision_jobs commits unique
|
||||||
remove_odd_package_derivations 2020-04-24T20:36:06Z Christopher Baines <mail@cbaines.net> # Remove odd package derivations
|
remove_odd_package_derivations 2020-04-24T20:36:06Z Christopher Baines <mail@cbaines.net> # Remove odd package derivations
|
||||||
|
build_servers_lookup_builds 2020-05-24T15:18:09Z Christopher Baines <mail@cbaines.net> # Add build_servers.lookup_builds
|
||||||
|
|
|
@ -0,0 +1,7 @@
|
||||||
|
-- Verify guix-data-service:build_servers_lookup_builds on pg
|
||||||
|
|
||||||
|
BEGIN;
|
||||||
|
|
||||||
|
-- XXX Add verifications here.
|
||||||
|
|
||||||
|
ROLLBACK;
|
Loading…
Reference in New Issue