* Makefile.am (EXTRA_DIST): Add ‘tests/common.scm’ and ‘tests/mail.sh’.
* tests/database.scm (mailer): Use ‘search-path’ to locate ‘mail.sh’
relative to $top_srcdir.
This is a followup to 1d49240cc1.
* src/cuirass/watchdog.scm: Remove.
* Makefile.am (dist_pkgmodule_DATA): Remove it.
* src/cuirass/scripts/register.scm (cuirass-register): Remove call to
'start-watchdog'.
* src/cuirass/scripts/web.scm (cuirass-web): Likewise.
Add support to deactivate specifications. This allows to keep specifications
and the associated builds around but without evaluating them.
Fixes: <https://issues.guix.gnu.org/51837> and
<https://issues.guix.gnu.org/52110>.
* src/sql/upgrade-15.sql: New file.
* Makefile.am (dist_sql_DATA): Add it.
* src/schema.sql (Specification)[is_active]: New field.
* src/cuirass/database.scm (db-deactivate-specification): New procedure.
(db-add-or-update-specification, db-get-specifications): Adapt them.
* src/cuirass/http.scm (url-handler): New
/admin/specifications/deactivate/spec route.
* src/cuirass/specification.scm (<specification>)[is-active?]: New field.
(specification->sexp, sexp->specification): Adapt them.
* src/cuirass/templates.scm (specifications-table): Replace "Delete" by
"Deactivate".
* tests/database.scm (db-add-or-update-specification 3): New test.
This decreases the query duration from ~20 seconds to ~35ms.
* src/sql/upgrade-14.sql: New file.
* Makefile.am (dist_sql_DATA): Add it.
* src/cuirass/database.scm (db-get-build-percentages): Optimize it.
* src/schema.sql (Builds_id_job_status_index): Add it.
* src/sql/upgrade-13.sql: New file.
* Makefile.am (dist_sql_DATA): Add it.
* src/schema.sql (pending_dependencies): Remove it.
* src/cuirass/database.scm (db-get-pending-build): New procedure.
(db-get-builds): Remove "no-dependencies" support.
* src/cuirass/scripts/remote-server.scm (pop-build): Adapt to use the new
procedure.
* tests/database.scm: Adapt it.
The build_dependencies trigger scales really poorly when there is a large
number of pending builds. Remove this trigger and replace it with a
periodical update thread.
* src/sql/upgrade-12.sql: New file.
* Makefile.am (dist_sql_DATA): Add it.
* src/schema.sql (update_build_dependencies, build_dependencies): Remove them.
* src/cuirass/database.scm (db-update-resumable-builds!): New procedure.
* src/cuirass/scripts/remote-server.scm (start-periodic-updates-thread): New
procedure.
(remote-server): Call it.
* src/static/images/badge-error.svg: New file.
* src/static/images/badge-per.svg: New file.
* src/static/images/badge-running.svg: New file.
* Makefile.am (dist_images_DATA): Add them.
* src/cuirass/templates.scm (badge-svg): New procedure.
* src/cuirass/http.scm (badge-string): New procedure.
(url-handler): Add a new "/jobset/spec/badge" route.
* doc/cuirass.texi (Badges): New section.
* src/schema.sql (BuildDependencies): New table.
* src/sql/upgrade-11.sql: New file.
* Makefile.am (dist_sql_DATA): Add it.
* src/cuirass/database.scm (db-add-build-dependencies,
db-get-build-dependencies,
db-update-failed-builds): New procedures.
* src/cuirass/http.scm (http-handler): Pass the build dependencies to the
build-details procedure.
* src/cuirass/scripts/remote-server.scm (pop-build): Select a build with no
dependencies.
(read-worker-exp): Remove the scheduled builds with failed dependencies.
* src/cuirass/templates.scm (build-details): Add a dependencies argument and
use it to display the build dependencies and their status.
* src/static/js/cuirass.js: Animate the dependencies collapse button.
* tests/database.scm ("db-add-build-dependencies",
"db-get-build-dependencies", "dependencies trigger"): New tests.
* src/sql/upgrade-10.sql: New file.
* Makefile.am (dist_sql_DATA): Update it.
* src/schema.sql (update_job_status): New function,
(build_status): new trigger.
* src/static/js/popper.min.js: New file.
* src/static/js/jquery-3.6.0.min.js: Remove it.
* src/static/js/jquery-3.3.1.min.js: New file.
* src/static/js/cuirass.js: New file.
* src/static/js/bootstrap.min.js: New file.
* src/static/css/bootstrap.css: Rename it ...
* src/static/css/bootstrap.min.css: ... into this new file.
* src/cuirass/templates.scm (html-page): Adapt it.
* Makefile.am (dist_css_DATA, dist_js_DATA): Adapt them.
This considerably speeds up cascade deleting.
* src/sql/upgrade-9.sql: New file.
* Makefile.am (dist_sql_DATA): Add it.
* src/schema.sql (Jobs_build, BuildProducts_build, Notifications_build): New
indexes.
* src/sql/upgrade-4.sql: New file.
* Makefile.am (dist_sql_DATA): Add it.
* src/schema.sql (Specifications)[period]: New field.
* src/cuirass/base.scm (process-specs): Honor the specification period.
* src/cuirass/database.scm (db-get-time-since-previous-build): Rename it into ...
(db-get-time-since-previous-eval): ... this new procedure.
* src/cuirass/specification.scm (<specification>)[period]: New field.
(specification->sexp, sexp->specification): Adapt accordingly.
* src/cuirass/templates.scm (specification-edit): Ditto.
* tests/database.scm ("db-get-time-since-previous-build"): Remame it into ...
("db-get-time-since-previous-eval"): ... this new procedure.
Join Build and Jobs tables using the build id instead of the build derivation
to speed queries.
* src/sql/upgrade-3.sql: New file.
* Makefile.am (dist_sql_DATA): Add it.
* src/schema.sql (Jobs)[derivation]: Replace it by ...
[build]: this new column.
* src/cuirass/database.scm (db-add-job, db-get-jobs): Adapt them.
* src/static/js/d3.v6.min.js: New file.
* Makefile.am (dist_js_DATA): Add it.
* src/cuirass/http.scm (%file-white-list): Add it.
* src/cuirass/templates.scm (html-page): Add it.
Each evaluation registration produces a list of new jobs. Until now, only the
jobs which build outputs were not stored in the "Outputs" table were added to
the "Builds" table.
It means that Cuirass looses track of the job list associated to a given
evaluation. This is problematic to provide the overall build status of an
evaluation or to find the evaluation providing the best build coverage.
Add a new "Jobs" table that stores the job list of each evaluation. Also add
a new "/api/jobs" API to consult it.
* src/sql/upgrade-2.sql: New file.
* Makefile.am (dist_sql_DATA): Add it.
* src/schema.sql (Jobs): New table.
* src/cuirass/database.scm (db-add-job, db-get-jobs): New procedures.
(db-register-builds): Call db-add-job.
* src/cuirass/http.scm (url-handler): New "/api/jobs" route.
* tests/database.scm ("db-get-jobs", "db-get-jobs names"): New tests.
* doc/cuirass.texi (Web API, Database): Document it.
* src/sql/upgrade-2.sql: Remove it.
* src/sql/upgrade-3.sql: Remove it.
* src/sql/upgrade-4.sql: Remove it.
* src/sql/upgrade-5.sql: Remove it.
* Makefile.am (dist_sql_DATA): Adapt it.