This is a followup to 774113d13b.
* src/cuirass/templates.scm (specifications-table): Move
“text-secondary”/“text-primary” class to the ‘a’ tag instead of ‘td’.
* src/cuirass/forges/forgejo.scm (forgejo-pull-request->specification):
Add ‘properties’ field.
* tests/http.scm (forgejo-pull-request-json-open): Add “url”.
("/admin/forgejo/event creates a spec from a new pull request"): Test
properties.
* src/cuirass/forges/gitlab.scm (gitlab-merge-request->specification):
Add ‘properties’ field.
* tests/http.scm ("/admin/gitlab/event creates a spec from a new merge request"):
Check properties.
(gitlab-merge-request-json-open)
(gitlab-merge-request-json-close): Change “iid” value to a number.
This is the same schema and in fact the same thing.
* src/cuirass/forges/gitlab.scm (<gitlab-source>): Remove.
(<gitlab-project>)[home-page, repository-url]: New fields.
(gitlab-merge-request->specification): Adjust accordingly.
* tests/gitlab.scm (default-mr-json, custom-mr-json-name-prefix): Add
source “homepage” field.
* src/cuirass/forges.scm (%default-jobset-options-period,
%default-jobset-options-priority, %default-jobset-options-systems): New
variables.
* src/cuirass/forges/gitlab.scm (gitlab-merge-request->specification),
tests/gitlab.scm: Change hardcoded values to variables defined in the forges
module.
Signed-off-by: Ludovic Courtès <ludo@gnu.org>
Mitigates <https://issues.guix.gnu.org/73916>.
* src/cuirass/base.scm (delete-old-gc-roots): Add #:derivation-max-age
and honor it.
(spawn-gc-root-cleaner): Likewise.
* src/cuirass/scripts/register.scm (show-help, %options): Add
‘--derivation-ttl’.
(cuirass-register): Use it as #:derivation-max-age to
‘spawn-gc-root-cleaner’.
* doc/cuirass.texi (Invocation): Document ‘--derivation-ttl’.
Possibly fixes <https://issues.guix.gnu.org/73916>.
* src/cuirass/base.scm (derivation-queued?): Return true if DRV is
‘failed-dependency’ and there are pending builds in its evaluation.
This custom query is expected to perform better than the generic one in
‘db-get-builds’.
* src/cuirass/database.scm (db-get-build): Rewrite with a custom query.
This simplifies ‘db-get-builds’ and the underlying SQL query, hopefully
making it faster. The only uses of ‘build-products’ are in (cuirass
http) and they can cope with the extra SQL query.
* src/cuirass/database.scm (<build>)[products]: Remove.
(build-products): New procedure.
(db-get-builds)[format-build-products]: Remove.
Remove “INNER JOIN BuildProducts” and everything related to it.
This undoes 5e59127179 and
6cd1608e64.
That approach was bogus for two reasons: first because the logic in
‘db-update-build-status!’ was wrong since we cannot tell whether the
previous attempt of the *same* build failed. Second because the “update
status of dependent builds” operation is too expensive when the ‘Builds’
table has lots of rows.
* src/cuirass/database.scm (db-reschedule-dependent-builds): Remove.
(db-reschedule-builds-without-failed-dependencies): New procedure; this
is ‘db-update-resumable-builds!’ as it was removed in
6cd1608e64.
(db-update-build-status!): Remove call to
‘db-reschedule-dependent-builds’.
* src/cuirass/scripts/remote-server.scm (serve-build-requests): Send
'failed-dependency to BUILD-MAINTAINER.
* src/cuirass/base.scm (build-maintainer): Remove ‘&timeout’. Expect a
symbol on CHANNEL and honor it. Change default #:period to (* 10 60).
(spawn-build-maintainer): Change default #:period to (* 10 60).
* tests/database.scm ("status of dependent builds"): Add call to
‘db-reschedule-builds-without-failed-dependencies’.
This is a followup to e53d596ca2.
* src/cuirass/templates.scm (build-details): Add call ‘uri-encode’ for
jobset URL.
(evaluation-build-table): Likewise.
This undoes part of 5e59127179 and
6cd1608e64, motivated by the fact that
marking dependents as ‘failed-dependency’ is too expensive (when there
are many ‘Builds’ rows) to be done from ‘db-update-build-status!’.
* src/cuirass/base.scm (build-maintainer, spawn-build-maintainer): New
procedures.
* src/cuirass/database.scm (db-update-build-status!): Remove call to
‘db-mark-failed-dependency-builds’.
(spawn-periodic-updates-fiber): Remove.
* src/cuirass/scripts/remote-server.scm (serve-build-requests):
Add #:build-maintainer and honor it.
(cuirass-remote-server): Remove call to ‘spawn-periodic-updates-fiber’.
Add call to ‘spawn-build-maintainer’.
* tests/database.scm ("dependents marked as 'failed-dependency'")
("status of dependent builds"): Add calls to
‘db-mark-failed-dependency-builds’.
Previously, builds that were immediately marked as ‘failed-dependency’,
from the ‘db-add-build-dependencies’ call, would have their ‘starttime’
and ‘stoptime’ set to zero.
* src/cuirass/database.scm (db-mark-as-failed-if-dependencies-failed):
Set ‘starttime’ and ‘stoptime’.
Not all crawlers honor ‘robots.txt’ and some could end up restarting
random failed builds (not surprisingly, perhaps!).
* src/cuirass/http.scm (url-handler): Change /build/ID/restart to POST.
* src/cuirass/templates.scm (build-details): Change “Restart” drop-down
menu item to a POST form with a button.
* tests/http.scm ("/build/1/restart redirects to /admin")
("/build/3/restart is unprivileged (failed build)"): Adjust accordingly.
This query would be very slow:
LOG: duration: 10805.150 ms plan:
Query Text: SELECT stoptime, id FROM Builds
WHERE evaluation = $1 AND
(( $2 = 'pending' AND Builds.status < 0) OR
( $3 = 'succeeded' AND Builds.status = 0) OR
( $4 = 'failed' AND Builds.status > 0) OR
( $5 = 'newly-failed' AND Builds.status = $6
AND Builds.weather = $7 ) OR
$8 ::text IS NULL)
ORDER BY stoptime DESC, id DESC
LIMIT 1
Limit (cost=0.43..213.80 rows=1 width=8)
-> Index Scan using builds_stoptime_id on builds (cost=0.43..283141.54 rows=1327 width=8)
Filter: (evaluation = 242640)
Its plain direct counterpart appears to be more efficient:
cuirass=> explain analyze select stoptime,id from builds where evaluation = 242640 and builds.status = 0 order by stoptime desc, id desc limit 1;
QUERY PLAN
-----------------------------------------------------------------------------------------------------------------------
-----------------------
Limit (cost=0.43..464.06 rows=1 width=8) (actual time=6197.445..6197.447 rows=1 loops=1)
-> Index Scan using builds_stoptime_id on builds (cost=0.43..295794.55 rows=638 width=8) (actual time=6197.443..61
97.443 rows=1 loops=1)
Filter: ((evaluation = 242640) AND (status = 0))
Rows Removed by Filter: 4597414
Planning Time: 0.240 ms
Execution Time: 6197.527 ms
(6 rows)
Time: 6198.353 ms (00:06.198)
* src/cuirass/database.scm (db-get-builds-boundary): New procedure,
based on ‘db-get-builds-min’.
(db-get-builds-min, db-get-builds-max): Rewrite in terms of
‘db-get-builds-boundary’.