2
0
Fork 0
mirror of git://git.savannah.gnu.org/guix/guix-cuirass.git synced 2023-12-14 06:03:04 +01:00
Commit graph

1031 commits

Author SHA1 Message Date
Ludovic Courtès
613188072c
templates: Avoid type error when displaying a jobset without evaluations.
Previously we’d pass #f to ‘eval-summary’ for jobsets that do not have
any successful evaluation.

* src/cuirass/templates.scm (specifications-table): Correctly handle
‘spec->latest-eval-ok’ returning #f.
2023-09-07 16:45:49 +02:00
Ludovic Courtès
647f13f0a9
http: /api/evaluations returns the full list of checkouts of each eval.
Previously it would only return checkouts changed compared to the
previous evaluation of that jobset.

* src/cuirass/http.scm (evaluation->json-object): Use ‘latest-checkouts’
instead of ‘evaluation-checkouts’.
* tests/http.scm (evaluations-query-result): Adjust accordingly.
2023-09-06 23:45:37 +02:00
Ludovic Courtès
a057228492
database: Document the pitfalls of ‘db-get-checkouts’.
* src/cuirass/base.scm (latest-checkouts): Improve docstring.
* src/cuirass/database.scm (db-get-checkouts): Add docstring.
2023-09-06 23:39:25 +02:00
Ludovic Courtès
7a9194b15e
http: Really fix /jobsets for non-trivial build types.
* src/cuirass/http.scm (specification->json-object): Fix the non-trivial
cases for ‘build’.
2023-09-06 14:46:30 +02:00
Ludovic Courtès
d4d0368cb8
http: /jobsets properly renders non-trivial build types.
Previously we’d get 500 for anything other than a symbol.

* src/cuirass/http.scm (specification->json-object): Handle build types
other than symbols describing a subset.
2023-09-06 12:33:35 +02:00
Ludovic Courtès
82c785d4f3
templates: Tolerate missing checkout info.
* src/cuirass/templates.scm (checkout-table): Tolerate CHECKOUT as #f.
2023-09-05 22:44:07 +02:00
Ludovic Courtès
64d7ad1109
database: ‘db-get-evaluations-absolute-summary’ returns a full summary.
* src/cuirass/database.scm (db-get-evaluations-absolute-summary): Extend
SQL query and fill out all the <evaluation-summary> fields.
* tests/database.scm ("db-get-evaluation-absolute-summary"): Check ‘status’.
("db-get-evaluations-absolute-summary"): Expect three results.
2023-09-05 16:04:03 +02:00
Ludovic Courtès
0930669024
templates: Fix broken evaluation display on the spec page.
Fixes a bug introduced in c445d2d642
whereby we’d call ‘evaluation-badges’ with #f as its first argument, due
to the last of a summary for LAST-EVAL.

* src/cuirass/templates.scm (specifications-table): When
LAST-EVAL-STATUS-OK? is false, call ‘broken-evaluation-badge’.
2023-09-05 15:08:49 +02:00
Ludovic Courtès
c74a2a1332
templates: Factorize badges for broken evaluations.
* src/cuirass/templates.scm (broken-evaluation-badge): New procedure…
(evaluation-badges): … extracted from here.  Use it.
2023-09-05 15:08:43 +02:00
Ludovic Courtès
2a63a01519
http: Update to use symbols, not keywords, as keys on search results.
Fixes a regression introduced in
77bf78ecf7.

* src/cuirass/http.scm (url-handler): In “/search/latest” and
“/search/latest/PRODUCT-TYPE”, use symbols instead of keywords as the
second argument to ‘assoc-ref’.
2023-09-03 16:54:51 +02:00
Ludovic Courtès
88b63e0f64
templates: Use record accessors in build detail page.
Fixes a regression introduced in
c445d2d642.

* src/cuirass/templates.scm (build-details): Use record accessors.
2023-09-03 16:46:39 +02:00
Ludovic Courtès
042efcdf7c
examples: random: Create jobs with dependencies.
* examples/random-manifest.scm (random-computed-file): Add ‘dependency’
parameter and honor it.
<top level>: Replace ‘unfold’ call with a loop; pass ‘dependency’
argument to ‘random-computed-file’.
2023-09-03 16:05:31 +02:00
Ludovic Courtès
951ce6c0c0
examples: random: Provide correct output in manifest.
* examples/random-manifest.scm (make-job): Add ‘output’ parameter.
<top level>: Pass third argument to ‘make-job’.
2023-09-03 15:54:09 +02:00
Ludovic Courtès
c91971a063
templates: Properly type the case where the last evaluation failed.
Fixes a bug introduced in c445d2d642.

* src/cuirass/templates.scm (specifications-table)[eval-summary]:
Use the right record accessors.
Call ‘eval-summary’ on ‘last-eval’.
2023-09-03 15:29:31 +02:00
Ludovic Courtès
596b364f84
base: 'build-derivations&' UTF-8-encodes build logs.
* src/cuirass/base.scm (build-derivations&): Set the encoding and
conversion strategy of OUTPUT.
2023-09-01 18:04:38 +02:00
Ludovic Courtès
fda885b513
examples: random: Add non-ASCII UTF-8 string to the build log.
* examples/random-manifest.scm (random-computed-file): Print a lambda.
2023-09-01 17:47:40 +02:00
Ludovic Courtès
2ee6dc6947
base: 'create-build-outputs' catches 'register-gc-root' errors.
Commit 9e897d84ed would lead the
"set-build-successful!" test to fail when running in build environments:

  In procedure symlink: No such file or directory: "/var/guix/gcroots/profiles/per-user/nixbld/cuirass/source"

This fixes this regression.

* src/cuirass/base.scm (create-build-outputs): Wrap 'register-gc-root'
in 'catch'.
2023-09-01 17:03:48 +02:00
Ludovic Courtès
ea233c2ffd
tests: Reify exceptions instead of hanging.
Previously, exceptions raised in a test would lead Fibers to print
"Uncaught exception in task" and the test would then hang.  With this
change, tests actually fail.

* tests/database.scm (with-fibers): Wrap EXP... in
'with-exception-handler'.  When RESULT is an exception, rethrow it.
2023-09-01 16:06:18 +02:00
Ludovic Courtès
0571f954cb
Remove 'sexp->channel*'.
This procedure was introduced in
9e3e9b691c on the grounds that
'sexp->channel' in (guix channels) did not support the 'branch' field.
This was fixed in Guix commit
8f999e1ac26d939e1dfc8fbdfa9316fb412df21a (March 2021).

Furthermore, removing this procedure allows us to store channel
introductions in the database, which was not the case until now.

* src/cuirass/specification.scm (channel->sexp): Add comment.
(sexp->channel*): Remove.
* src/cuirass/database.scm (db-get-specifications): Use 'sexp->channel'.
2023-08-31 21:12:01 +02:00
Ludovic Courtès
9e897d84ed
'create-build-outputs' registers a GC root on build products.
Fixes <https://issues.guix.gnu.org/64317>.

* src/cuirass/base.scm (create-build-outputs): Add call to
'register-gc-root'.
2023-08-24 15:04:21 +02:00
Ludovic Courtès
103a6ec27b
http: Gracefully handle missing files in "/download".
Partly fixes <https://issues.guix.gnu.org/64317>.

* src/cuirass/http.scm (url-handler): Catch 'system-error around
'respond-file'; return 500 upon ENOENT.  Pass #:ttl to 'respond-file'.
2023-08-24 14:54:55 +02:00
Ludovic Courtès
5e3e49c351
http: "/download" returns 404 rather than 500 for "not found".
* src/cuirass/http.scm (url-handler): "/download" returns 404 when the
build product is not found.
2023-08-24 14:52:54 +02:00
Ludovic Courtès
b09737967b
remote-server: Specify 'system' in build request messages.
Currently 'remote-worker' doesn't actually use this information, but i
can't hurt.

* src/cuirass/scripts/remote-server.scm (read-worker-exp): Pass #:system
to 'build-request-message'.
* src/cuirass/scripts/remote-worker.scm (run-command): Display SYSTEM in
log message.
2023-08-24 10:54:14 +02:00
Ludovic Courtès
cdb7e66651
templates: Build search results actually show the evaluation name.
Fixes a regression introduced in
c445d2d642.

* src/cuirass/templates.scm (build-search-results-table): Show
evaluation name.
2023-08-24 10:47:26 +02:00
Ludovic Courtès
af9ef96524
templates: Remove "Log" column from build table.
* src/cuirass/templates.scm (build-eval-table): Remove "Log" column.
Link to build log from the status column.
(build-search-results-table): Likewise.
2023-08-24 10:47:26 +02:00
Ludovic Courtès
9a91a13201
database: Remove unused variable.
* src/cuirass/database.scm (db-update-build-status!)[status-names]:
Remove.
2023-08-24 10:47:26 +02:00
Ludovic Courtès
65535e3df0
tests: Relax 'db-get-build-percentages' test.
This goes back to how the test was expressed before commit
c445d2d642.  This is necessary because we
don't always get 60.

* tests/database.scm ("db-get-build-percentages"): Expect more than 50%
rather than exactly 60%.
2023-08-24 10:47:21 +02:00
Ludovic Courtès
aeec27aedc
evaluate: Print 'done only on actual success.
Previously, evaluation failure might result in an '&inferior-exception'
that would be swallowed by 'n-par-for-each'.  The results would be an
evaluation mark as succeeding, but with zero registered builds.

* src/cuirass/scripts/evaluate.scm (cuirass-evaluate): Use 'n-par-map'
instead of 'n-par-for-each' and keep the results.  Print 'done only when
the resulting list denotes success.
2023-08-23 23:05:37 +02:00
Ludovic Courtès
a3ea940eb8
templates: Total number of builds links to evaluation dashboard.
* src/cuirass/templates.scm (evaluation-badges)[dashboard-link]: New
procedure.
Use it as the link for absolute numbers.
2023-08-23 22:16:08 +02:00
Ludovic Courtès
2a019a661d
Update TODO. 2023-08-23 22:10:19 +02:00
Ludovic Courtès
9a9656b4f5
templates: Worker page colors progress bars as a function of the system.
The progress bar of an x86_64-linux build might be blue, that of an
i686-linux build green, and so on.

* src/cuirass/templates.scm (system->color-class): New procedure.
(workers-status): Use it to choose progress bar color class based on
system type.
2023-08-23 22:07:46 +02:00
Ludovic Courtès
03df248a34
templates: Unclutter evaluation build table.
* src/cuirass/templates.scm (evaluation-build-table): Display fewer words.
2023-08-23 21:50:24 +02:00
Ludovic Courtès
7758894355
templates: Remove "Specification" column from build tables.
This unclutters build tables.

* src/cuirass/templates.scm (build-eval-table): Remove "Specification"
column.
(evaluation-build-table): Add spec to the heading.
2023-08-23 21:50:24 +02:00
Ludovic Courtès
931597826a
utils: Remove now useless 'object->json-string' & co.
* src/cuirass/utils.scm (alist?, object->json-scm)
(object->json-string): Remove.
* tests/utils.scm: Remove.
* Makefile.am (TESTS): Remove it.
* tests/http.scm ("object->json-string"): Remove.
2023-08-23 21:50:24 +02:00
Ludovic Courtès
77bf78ecf7
http: Use Guile-JSON's 'scm->json-string' directly.
The intermediate representation with keywords instead of symbols in
alists turns out to be useless.

* src/cuirass/http.scm (build->hydra-build)
(evaluation->json-object, specification->json-object)
(jobs-history->json-object): Use symbols instead of keywords in the car
of alists.  Use 'scm->json-string' instead of 'object->json-string'.
* src/cuirass/http.scm (url-handler): Likewise.
* tests/http.scm (build-query-result, evaluations-query-result): Use
symbols instead of keywords.
("/build/1", "/api/latestbuilds?nr=1&jobset=guix")
("/api/evaluations?nr=1"): Use 'scm->json-string' instead of
'object->json-string'.
2023-08-23 21:50:24 +02:00
Ludovic Courtès
baf94beac8
Remove unused variables.
* src/cuirass/base.scm (build-derivation=?): Remove.
* src/cuirass/database.scm (%exec-query/bind)[string-literal?]: Remove.
* src/cuirass/rss.scm (build->rss-item): Remove 'id'.
* src/cuirass/templates.scm (specifications-table): Remove 'eval'.
(evaluation-info-table): Use 'dropdown-id', not 'id'.
2023-08-23 21:50:24 +02:00
Ludovic Courtès
c445d2d642
database: Use records instead of alists.
Instead of using alists, internal code now manipulates records.  Strong
typing makes the code easier to understand and to check for correctness.

* src/cuirass/database.scm (<build>, <build-product>, <job>)
(<output>): New record types.
(db-add-output): Keep a single argument, expect an <output> record.
(db-add-build-product): Expect a <build> record and return its ID on
success.
(db-add-build-product, db-get-output, db-get-outputs)
(db-get-build-percentages): Use record accessors and constructors.
(db-add-job): Rename to...
(db-add-job-for-build): ... this.  Expect records.
(db-get-jobs): Likewise.  Augment query to include 'evaluation'.
(<evaluation>): New record type.
(db-get-build-dependencies/derivation, build-dependencies/id): New
procedures.
(db-register-builds): Change signature and adjust for records.
(db-get-last-status): Produce records.
(db-get-builds-by-search, db-get-builds): Likewise.
(<checkout>): New record type.
(db-get-checkouts, db-get-latest-checkout): Produce them.
(parse-evaluation): Likewise.
(<build-summary>, <evaluation-summary>): New record types.
(db-get-latest-evaluations, db-get-evaluation-summary): Produce them.
(db-get-evaluations-absolute-summary): Adjust for records.
(<dashboard>): New record type.
(db-get-dashboard): Produce it.
* src/cuirass/http.scm (build->hydra-build): Expect records.
(evaluation->json-object): Likewise.
(evaluation-html-page): Likewise.
(url-handler): Likewise.
* src/cuirass/notification.scm (build-weather-text)
(build-details-url, notification-subject, notification-text): Likewise.
* src/cuirass/rss.scm (build-details-url, build->rss-item): Likewise.
* src/cuirass/scripts/evaluate.scm (checkouts->channel-instances):
Likewise.
(user-alists->builds): New procedure.
(inferior-evaluation): Use it.
* src/cuirass/templates.scm (specifications-table, build-details)
(input-changes, evaluation-badges, evaluation-info-table)
(build-eval-table, evaluation-build-table, running-builds-table): Adjust
for records.
(workers-status): Likewise, and add 'percentages' parameter.
(machine-status, evaluation-dashboard): Adjust for records.
* src/cuirass/base.scm (set-build-successful!, build-derivation=?)
(create-build-outputs, build-packages): Likewise.
* tests/database.scm (make-dummy-build): Likewsise.
All tests use and expect records.
* tests/remote.scm: Likewise.
* tests/http.scm: Likewise.
2023-08-23 21:50:24 +02:00
Ludovic Courtès
ecc1a1adaf
examples: random: Add multiple-output derivations.
* examples/random-manifest.scm (random-computed-file): Add
'multiple-outputs?' parameter and honor it.
(unfold): Produce 15 entries; pass 'multiple-outputs?'.
2023-08-23 21:50:23 +02:00
Ludovic Courtès
dfd1ff4582
remote-worker: Sleep after reporting low disk space.
Fixes a regression introduced in
0dbd460cf1 whereby 'cuirass remote-worker'
would keep spinning and displaying "warning: low disk space" when that
condition is met.

* src/cuirass/scripts/remote-worker.scm (start-worker): Call 'sleep' on
low disk space.
2023-08-23 12:57:23 +02:00
Ludovic Courtès
bb659b02ad
remote-worker: Browse Avahi services in a separate thread.
Fixes a regression introduced in
de8586080e, whereby 'cuirass
remote-worker' would block forever in 'avahi-browse-service-thread'
because nobody would get the message on MANAGEMENT-CHANNEL.

* src/cuirass/scripts/remote-worker.scm (cuirass-remote-worker): Wrap
'avahi-browse-service-thread' in 'call-with-new-thread'.
2023-08-22 22:26:43 +02:00
Ludovic Courtès
95ca6edca5
build: Enable more compiler warnings.
* Makefile.am (GUILE_WARNINGS): New variable.
(.scm.go): Use it.
2023-08-15 16:20:31 +02:00
Ludovic Courtès
7416bb9163
http: Adjust for unused response procedures.
* src/cuirass/http.scm (url-handler)[respond-build-not-found]: Remove.
<"dashboard">: Use 'respond-dashboard-not-found' rather than
'respond-html-eval-not-found'.
2023-08-11 10:58:25 +02:00
Ludovic Courtès
c8e1bc0173
css: Increase 'badge-counter' width.
* src/static/css/cuirass.css (.badge-counter): Increase width.
2023-08-08 14:22:21 +02:00
Ludovic Courtès
bed5fa5ac0
register: Reduce preemption tick rate.
* src/cuirass/scripts/register.scm (cuirass-register): Change #:hz value.
2023-08-07 16:49:47 +02:00
Ludovic Courtès
ee0e45e12e
templates: Fix possible wrong-type-arg error in 'checkout-table'.
* src/cuirass/templates.scm (checkout-table): Move 'channel-url' call
after checking whether CHANNEL is true.  Move 'commit' as well.
2023-08-07 16:48:10 +02:00
Ludovic Courtès
6f047c64e5
Update 'TODO'. 2023-07-15 19:41:12 +02:00
Ludovic Courtès
550c2c2d31
templates: Clarify build column header on evaluation table.
* src/cuirass/templates.scm (evaluation-info-table): Clarify column
header.
2023-07-15 19:41:11 +02:00
Ludovic Courtès
160df0e6e9
templates: Hide badges that are zero.
This avoids cluttering evaluation tables with zeros (zero scheduled
builds, zero failures, etc.).

* src/cuirass/templates.scm (build-counter-badge): Add the "hidden"
class when VALUE is 0.
* src/static/css/cuirass.css (.hidden): New class.
2023-07-15 19:41:11 +02:00
Ludovic Courtès
2ddf82d65b
templates: Factorize build counter badges.
* src/cuirass/templates.scm (build-counter-badge)
(successful-build-badge, failed-build-badge, scheduled-build-badge): New
procedures.
(specifications-table, evaluation-badges): Use them rather than inline
code.
2023-07-15 19:41:08 +02:00
Ludovic Courtès
52dee198c6
templates: Tweak rendering of succeeded/failed/scheduled badges.
* src/cuirass/templates.scm (specifications-table, evaluation-badges):
Use "badge-counter" CSS class.
* src/static/css/cuirass.css (.badge-counter): New class.
2023-07-15 19:07:16 +02:00