Commit Graph

180 Commits

Author SHA1 Message Date
Ludovic Courtès 6611151b7f
templates: Improve toggle button on evaluation and spec pages.
The contrast icon was arguably misleading.

* src/cuirass/templates.scm (specifications-table): Use ‘oi-dashboard’
rather than ‘oi-contrast’ for the toggle button; clarify ‘title’.
(evaluation-info-table): Likewise.
2023-10-29 17:20:42 +01:00
Ludovic Courtès dabc19e3f0
templates: Adjust styling for link to raw build log.
* src/cuirass/templates.scm (pretty-build-log): Add spacing after the
‘oi-external-link’ <span> tag.
2023-10-28 23:00:14 +02:00
Ludovic Courtès 57902ecb2d
templates: Clarify evaluation page for states other than ‘succeeded’.
* src/cuirass/templates.scm (evaluation-build-table): Special-case the
situation where EVALUATION is not in ‘succeeded’ state.  Do not emit
build table when BUILDS is empty and EVALUATION is not in ‘succeeded’
state.
2023-10-28 22:48:46 +02:00
Ludovic Courtès ba3278866f
templates: Link to /build/ID/log.
* src/cuirass/templates.scm (build-details): Add link to /build/ID/log.
(build-eval-table, build-search-results-table, running-builds-table):
Link to /build/ID/log.
2023-10-25 00:14:29 +02:00
Ludovic Courtès 2ab4df3fdd
templates: Add /build/ID/log, with client-side build log highlighting.
* src/static/js/build-log.js: New file.
* Makefile.am (dist_js_DATA): Add it.
* src/cuirass/http.scm (%file-white-list): Add it.
(url-handler): Add “/build/ID/log” handler.
* src/cuirass/templates.scm (pretty-build-log): New procedure.
2023-10-25 00:06:22 +02:00
Ludovic Courtès 18337a7608
templates: For new failures, link to a view of the commit range.
* src/cuirass/templates.scm (%vcs-web-commit-range-views): New variable.
(commit-range-hyperlink): New procedure.
(checkout-change-table): Use it.
2023-10-21 22:01:01 +02:00
Ludovic Courtès b5ea2cb620
templates: Show which checkouts have changed on evaluation pages.
* src/cuirass/http.scm (evaluation-html-page): Define ‘checkout-changes’
and pass it to ‘evaluation-build-table’.
* src/cuirass/templates.scm (checkout-table): Add #:changes parameter
and honor it.
(evaluation-build-table): Add #:checkout-changes parameter and pass it
on to ‘checkout-table.
(evaluation-dashboard): Define ‘checkout-changes’ and pass it to
‘checkout-table’.
2023-10-21 19:05:12 +02:00
Ludovic Courtès e9c27b7ce5
templates: Do not show “Weather” row when weather is unknown.
* src/cuirass/templates.scm (build-details): Do not emit “Weather” row
when WEATHER is unknown.
2023-10-18 16:03:07 +02:00
Ludovic Courtès df606ce452
templates: Provide hints for build failures.
The goal is to make it easier to find the origin of a build failure.

* src/cuirass/templates.scm (build-details): Add #:channels,
 #:checkouts, #:previous-checkouts, and #:first-failure.
[build-failure-info]: New procedure.
Use it.
(checkout-change-table): New procedure.
* src/cuirass/http.scm (url-handler): In “/build/ID/details”, pass extra
arguments to ‘build-details’.
* TODO: Update.
2023-10-18 15:03:27 +02:00
Ludovic Courtès 1db03a8c61
templates: Make “Build history” heading more visible.
* src/cuirass/templates.scm (build-details): Use ‘div’ instead of ‘h6’
for the “Build history” heading.
2023-10-18 15:03:27 +02:00
Ludovic Courtès cc31d28621
templates: ‘commit-hyperlink’ can display shortened commit IDs.
* src/cuirass/templates.scm (commit-hyperlink): Add #:shorten?
parameter, and honor it.
2023-10-18 15:03:27 +02:00
Ludovic Courtès be79b1e406
templates: Show build machine and/or worker on build page.
Fixes <https://issues.guix.gnu.org/66059>.

* src/cuirass/templates.scm (build-details): Show build machine.

Reported-by: Maxim Cournoyer <maxim.cournoyer@gmail.com>
2023-09-20 11:31:27 +02:00
Ludovic Courtès 6db8d6c5a9
templates: Show spec name on build page.
* src/cuirass/templates.scm (build-details): Show the spec name next to
the evaluation number.
2023-09-20 11:19:38 +02:00
Ludovic Courtès c20ca601c2
templates: Fix possible division by zero when rendering spec table.
Division by zero could happen in the unlikely case of a successful
evaluation containing zero jobs.

* src/cuirass/templates.scm (specifications-table)[summary->percentage]:
Check whether TOTAL is zero before dividing.
2023-09-12 10:40:13 +02:00
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 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 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 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 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 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 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 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 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 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 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
Ludovic Courtès cafe905b01
templates: Gracefully handle local file names as channel URLs.
* src/cuirass/templates.scm (commit-hyperlink): Gracefully handle local
file names where 'string->uri' returns #f.
2023-07-14 15:05:49 +02:00
Ludovic Courtès b724dfa322
http: Evaluation dashboard shows the full list of channels.
This is a followup to c7db7f88a2, which
would only show, say, 'guix-past' and not 'guix' (the latter being a
dependency of the former).

* src/cuirass/http.scm (dashboard-page): Call 'latest-checkouts' and
pass #:checkouts to 'evaluation-dashboard'.
* src/cuirass/templates.scm (evaluation-dashboard): Add #:checkouts and
honor it.
2023-06-18 15:14:38 +02:00
Ludovic Courtès c7db7f88a2
templates: Evaluation dashboard shows completion time and commits.
* src/cuirass/templates.scm (evaluation-dashboard): Rename 'evaluation'
to 'evaluation-id'.  Add #:channels.  Add 'details' block showing
completion time and checkouts.
2023-06-12 23:28:28 +02:00
Ludovic Courtès 8a4cb66123
templates: Factorize 'checkout-table'.
* src/cuirass/templates.scm (checkout-table): New procedure.
(evaluation-build-table): Use it.
2023-06-12 23:28:12 +02:00
Ludovic Courtès 7d9d7c843d
templates: Evaluation dashboard links to evaluation page.
* src/cuirass/templates.scm (evaluation-dashboard): Link to evaluation
page.
2023-06-12 23:28:11 +02:00
Ludovic Courtès d0b08b0d40
http: Add /eval/latest/dashboard endpoint.
* src/cuirass/http.scm (url-handler)[redirect]: New procedure.
Add clause for /eval/latest/dashboard.
* src/cuirass/templates.scm (specifications-table): Link to it.
2023-06-02 00:28:22 +02:00
Ludovic Courtès febb1bd870
templates: Update copyright line in footer.
* src/cuirass/templates.scm (html-page): Update copyright line.
2023-05-09 17:16:17 +02:00
Tobias Geerinckx-Rice 4745c81875
templates: Warn of the perils of stateful changes.
* src/cuirass/templates.scm (specification-edit): Add a warning
explaining that such changes might be overwritten.
2022-10-23 02:00:00 +02:00
Mathieu Othacehe 51748d7d52
templates: Forbid '/' character in specification name.
* src/cuirass/templates.scm (specification-edit): Forbid it.

Signed-off-by: Mathieu Othacehe <othacehe@gnu.org>
2022-04-26 10:18:54 +02:00
Mathieu Othacehe 1174185377
templates: Update copyright.
* src/cuirass/templates.scm (html-page): Update it.
2022-01-20 15:30:01 +01:00
Mathieu Othacehe d9a4ea25e4
templates: Display the build weather text.
Fixes: <https://issues.guix.gnu.org/52840>.

* src/cuirass/templates.scm (build-details): Display it.
2021-12-28 10:18:27 +01:00
Mathieu Othacehe 5314c5dc4b
templates: Factorize completed? procedures.
Also distinguish between a build that is completed from a build that is
completed with some available logs.

* src/cuirass/templates.scm (completed?, completed-with-logs?): New
procedures.
2021-12-17 15:54:23 +01:00
Leo Famulari d6a186ca18
templates: Suggest a specification example that works on ci.guix.gnu.org
The specification used to build our master branch was renamed from
"guix-master" to "master".

* doc/cuirass.texi (API description): Change "guix-master" to "master".
* src/cuirass/templates.scm: Change "guix-master" to "master".
2021-12-14 08:26:43 +01:00
Mathieu Othacehe 39b851bfe7
templates: Handle specifications with no evaluations.
* src/cuirass/templates.scm (specifications-table): Handle specifications with
no evaluations.
2021-12-02 10:55:23 +01:00
Mathieu Othacehe 8726ef9c65
templates: Add javascript licenses page.
Fixes: <https://issues.guix.gnu.org/51145>.

* src/cuirass/templates.scm (javascript-licenses): New procedure.
* src/cuirass/http.scm (url-handler): New /static/about/javascript route.
2021-12-02 10:53:52 +01:00
Mathieu Othacehe 73ba694a14
templates: Add dashboard filter support.
* src/cuirass/templates.scm (evaluation-dashboard): Add filter support.
* src/static/js/cuirass.js: Add dashboard filter support.
2021-12-01 19:09:02 +01:00
Mathieu Othacehe 2d76216af7
Display failing specification in the main page.
* src/cuirass/database.scm (db-get-latest-evaluations): Add a status
parameter.
* src/cuirass/templates.scm (specifications-table): Add a latest-evaluations
parameter.
* src/cuirass/http.scm (url-handler): Adapt it.
* tests/database.scm (db-get-latest-evaluations 2): New test.
2021-12-01 12:55:18 +01:00