summaryrefslogtreecommitdiff
path: root/src/cuirass/http.scm
Commit message (Collapse)AuthorAge
* cuirass: Display builds in separate tabs.Ricardo Wurmus2019-06-19
| | | | | | * src/cuirass/http.scm (url-handler): Split result for "eval" page in tabs. * src/cuirass/templates.scm (build-eval-table): Remove border from table head; Remove lead paragraph.
* http: Fix navigation URL for build details page.Ricardo Wurmus2019-06-19
| | | | * src/cuirass/http.scm (url-handler): Use "jobset" instead of "spec".
* http: Handle /build/<id>/details URL.Ricardo Wurmus2019-06-18
| | | | | * src/cuirass/http.scm (url-handler): Add handler for /build/<id>/details. * src/cuirass/templates.scm (build-details): New procedure.
* http: Gracefully handle missing query.Ricardo Wurmus2019-05-21
| | | | | * src/cuirass/http.scm (url-handler): Skip computation of builds-id-min and builds-id-max when query is missing.
* cuirass: Add search for builds.Ricardo Wurmus2019-05-17
| | | | | | | | | | * src/cuirass/database.scm (db-get-builds-by-search, db-get-builds-query-min, db-get-builds-query-max): New procedures. * src/cuirass/http.scm (handle-builds-search-request): New procedure. (url-handler): Handle "search" route. * src/cuirass/templates.scm (search-form): New variable. (html-page): Use it. (build-search-results-table): New procedure.
* http: Remove useless lambda expression.Clément Lassieur2018-11-07
| | | | * src/cuirass/http.scm (run-cuirass-server): Remove useless lambda expression.
* templates: Add title to the evaluations table.TSholokhova2018-09-30
| | | | | | | * src/cuirass/http.scm (url-handler): Pass the ID argument to BUILD-EVAL-TABLE. * src/cuirass/templates.scm (build-eval-table): Add an EVAL-ID argument, add title.
* templates: Add a navigation bar.TSholokhova2018-09-30
| | | | | | | | | | | | | * src/cuirass/database.scm (db-get-evaluation-specification): New exported procedure. * src/cuirass/http.scm (respond-html): Allow to pass CODE as argument. (respond-html-eval-not-found): New procedure. (url-handler): Fill navigation arguments. Handle the case where the evaluation doesn't exist. * src/cuirass/templates.scm (navigation-items): New procedure. (html-page): Add navigation bar. Co-authored-by: Clément Lassieur <clement@lassieur.org>
* templates: Allow to filter builds by status.TSholokhova2018-09-30
| | | | | | | | | | | | | * src/cuirass/database.scm (db-get-builds): Add 'succeeded' and 'failed' status filters. (db-get-builds-min, db-get-builds-max): Add support for a new 'status' argument. * src/cuirass/http.scm (url-handler): Add a status argument for the '/eval/id' endpoint. * src/cuirass/templates.scm (evaluation-badges): Add links to the buttons. (build-eval-table): Add a 'status' argument. Co-authored-by: Clément Lassieur <clement@lassieur.org>
* database: Serialize all database accesses in a thread.Clément Lassieur2018-08-16
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Fixes <https://bugs.gnu.org/32234>. * bin/cuirass.in (main): Keep only one WITH-DATABASE call around all fibers. Remove all DB arguments. * src/cuirass/base.scm (evaluate, update-build-statuses!, spawn-builds, handle-build-event, build-packages): Remove all DB arguments. (clear-build-queue, cancel-old-builds): Wrap in WITH-DB-CRITICAL-SECTION, remove all DB arguments. (restart-builds): Remove the NON-BLOCKING call, remove all DB arguments. (process-specs): Remove all DB arguments, remove the WITH-DATABASE call. * src/cuirass/database.scm (%db-channel): New parameter. (with-db-critical-section): New macro. (db-add-input, db-add-specification, db-get-inputs, db-get-specifications, db-add-evaluation, db-add-build, db-update-build-status!, db-get-outputs, db-get-builds, db-get-build, db-get-pending-derivations, db-get-stamp, db-add-stamp, db-get-evaluations, db-get-evaluations-build-summary, db-get-evaluations-id-min, db-get-evaluations-id-max, db-get-builds-min, db-get-builds-max): Wrap in WITH-DB-CRITICAL-SECTION, remove all DB arguments. (with-database): Wrap BODY in PARAMETERIZE form that sets %DB-CHANNEL to the channel returned by MAKE-CRITICAL-SECTION. * src/cuirass/http.scm (handle-build-request, handle-builds-request): Remove all DB arguments. (url-handler): Remove all DB arguments, remove the DB-CHANNEL state, remove the WITH-CRITICAL-SECTION calls. (run-cuirass-server): Remove the DB arguments, remove the MAKE-CRITICAL-SECTION call. * src/cuirass/utils.scm (make-critical-section): Replace SPAWN-FIBER with CALL-WITH-NEW-THREAD. Wrap body in PARAMETERIZE form that clears CURRENT-FIBER. * tests/database.scm (with-temporary-database, "db-add-specification", "db-add-build", "db-update-build-status!", "db-get-builds", "db-get-pending-derivations"): Remove the DB arguments. ("db-init"): Set the %DB-CHANNEL parameter to the channel returned by MAKE-CRITICAL-SECTION, and return #t. ("database"): Set %DB-CHANNEL to #f during cleanup. * tests/http.scm ("db-init"): Set the %DB-CHANNEL parameter to the channel returned by MAKE-CRITICAL-SECTION, and return #t. ("cuirass-run", "fill-db"): Remove the DB arguments. ("http"): Set %DB-CHANNEL to #f during cleanup.
* Rename 'repo-name' to 'specification'.Clément Lassieur2018-08-04
| | | | | | * src/cuirass/database.scm (db-get-builds): Rename 'repo-name' to 'specification'. * src/cuirass/http.scm (build->hydra-build): Idem.
* http: Change the paramater format from two-elements lists to pairs.Clément Lassieur2018-07-30
| | | | | | | | | * src/cuirass/database.scm (assqx-ref): Remove exported procedure. (db-get-builds, db-get-build): Adapt to new format. * src/cuirass/http.scm (request-parameters): Use (cons key param) instead of (list key param). (url-handler): Adapt to new format. * tests/database.scm ("db-get-builds"): Idem.
* Add a web interface.TSholokhova2018-07-29
| | | | | | | | | | | | | | | | | | | | | | | | * Makefile.am (dist_sql_DATA): Add static files. * src/cuirass/database.scm (assqx-ref): Export it. (db-get-builds): Add 'evaluation' filter and filters for pagination. (db-get-evaluations-build-summary, db-get-evaluations-id-min, db-get-evaluations-id-max, db-get-builds-min, db-get-builds-max): New exported procedures. * src/cuirass/http.scm (%static-directory): New parameter. (%page-size, %file-mime-types, %file-white-list): New variables. (handle-build-request, handle-builds-request): Move the WITH-CRITICAL-SECTION call out. (url-handler): Add RESPOND-HTML, RESPOND-STATIC-FILE and RESPOND-NOT-FOUND procedures. Call WITH-CRITICAL-SECTION sooner for the '/build', '/api/latestbuilds' and '/api/queue' routes. Add '/', '/jobset/<name>', '/eval/<id>', '/static/<path>' routes. Use RESPOND-NOT-FOUND when the route isn't found. * src/cuirass/templates.scm: New file. (html-page, specifications-table, evaluation-info-table, build-eval-table): New exported procedures. (pagination): New procedure. Signed-off-by: Clément Lassieur <clement@lassieur.org>
* database: Call a specification 'jobset' instead of 'project'.Clément Lassieur2018-07-14
| | | | | | | | | | | | | | | | | This removes the possibility to filter specifications by branch, because branches were previously called 'jobset'. But it doesn't matter because later on, specifications will have as many branches as inputs. And people should filter by specification name instead. * doc/cuirass.texi (Build Information, Latest builds): Remove 'jobset', replace 'project' with 'jobset'. * src/cuirass/http.scm (build->hydra-build): Idem. * tests/database.scm (db-get-builds): Idem. * tests/http.scm (build-query-result, /api/latestbuilds?nr=1&jobset=guix, /api/latestbuilds?nr=1&jobset=gnu): Idem. * src/cuirass/database.scm (db-format-build, db-get-builds): Don't associate builds with branches (which were called 'jobset' afterwards). (db-get-builds): Remove the #:project filter.
* http: Add /api/evaluations route.Mathieu Othacehe2018-04-19
| | | | | | * src/cuirass/database.scm (db-get-evaluations): New exported procedure. * src/cuirass/http.scm (url-handler): Add /api/evaluations route. * tests/http.scm ("http"): Add /api/evaluations test route.
* utils: Add critical sections.Ludovic Courtès2018-04-02
| | | | | | | | | | | * src/cuirass/utils.scm (make-critical-section) (call-with-critical-section): New procedures. (with-critical-section): New macro. * src/cuirass/http.scm (with-database-access): Remove. (handle-build-request, handle-builds-request, url-handler): Use 'with-critical-section' instead of 'with-database-access'. (run-cuirass-server): Remove 'spawn-fiber' call. Use 'make-critical-section' instead.
* http: Process client connections really concurrently, again.Ludovic Courtès2018-03-28
| | | | | | | | | | | | | | | | This reinstates c47dfdf82b4be62501a7932eaec4c124566a1829 and fixes the issues that led to the revert in b71f0cdca5aeb82e5eb24f54b32e3f09fee22bad. Before that, 'run-server' would force sequential processing of client requests one after another. * src/cuirass/http.scm (run-cuirass-server): Rewrite to use its own loop instead of 'run-server'. Spawn a database fiber. (with-database-access): New macro. (handle-build-request): Expect 'db-channel' and use 'with-database-access'. (handle-builds-request): Likewise. (url-handler): Likewise.
* http: Correctly set #:timestamp for non-finished builds.Ludovic Courtès2018-03-18
| | | | | | | | | Fixes a regression introduced in f083282fd3bf813fda0b54ed33278d2d5325dfa1, whereby we'd return 0 as the timestamp for everything in /api/queue. * src/cuirass/http.scm (build->hydra-build): Make 'finished?' a Boolean. Move 'bool->int' call in #:finished definition.
* http: Return build completion time as #:timestamp when completed.Ludovic Courtès2018-03-01
| | | | | * src/cuirass/http.scm (build->hydra-build): Set #:timestamp to #:stoptime when BUILD is finished.
* http: 'request-parameters' always returns a list.Ludovic Courtès2018-03-01
| | | | | * src/cuirass/http.scm (request-parameters): Return the empty list when QUERY is #f.
* http: Fix interpretation of non-numerical parameters.Ludovic Courtès2018-03-01
| | | | | | | | | | Fixes a regression introduced in 593cb7be108ed97bca5371aad2e53fa8ce4817ba. * src/cuirass/http.scm (request-parameters): Fix fallback case in 'match' form. Previously it would return a procedure in this case, as returned by (const param), leading to a failure down the road in 'sqlite-bind-arguments' as could be seen by running tests/http.scm.
* http: Interpret id and nr request-parameters as numbers.Danny Milosavljevic2018-02-19
| | | | | * src/cuirass/http.scm (request-parameters): Interpret id and nr parameters as numbers.
* http: Convert build-id URL part to number.Danny Milosavljevic2018-02-19
| | | | * src/cuirass/http.scm (url-handler): Convert build-id URL part to number.
* Revert "http: Process client connections really concurrently."Ludovic Courtès2018-02-14
| | | | | | | | This reverts commit c47dfdf82b4be62501a7932eaec4c124566a1829. Processing connections concurrently would require having separate database handles. See <https://lists.gnu.org/archive/html/guix-devel/2018-02/msg00206.html>.
* http: Process client connections really concurrently.Ludovic Courtès2018-02-10
| | | | | | | | Before that, 'run-server' would force sequential processing of client requests one after another. * src/cuirass/http.scm (run-cuirass-server): Rewrite to use its own loop instead of 'run-server'.
* http: /jobsets returns a list of jobsets.Ludovic Courtès2018-02-05
| | | | | | | Reported by Danny Milosavljevic. * src/cuirass/http.scm (url-handler) <"jobsets"> Return the result of 'db-get-specifications' as-is, not just the car.
* http: Evaluate DB requests in 'non-blocking'.Ludovic Courtès2018-01-29
| | | | | * src/cuirass/http.scm (handle-builds-request): Wrap 'db-get-builds' into 'non-blocking'.
* http: /api/queue returns builds sorted by status.Ludovic Courtès2018-01-29
| | | | | | * src/cuirass/database.scm (db-get-builds)[format-order-clause]: Add 'status+submission-time'. * src/cuirass/http.scm (url-handler) <"queue">: Use it.
* http: Reject methods other than GET.Ludovic Courtès2018-01-26
| | | | | * src/cuirass/http.scm (url-handler): Check whether REQUEST's method is 'GET, and return 405 if not.
* http: Provide the correct values for 'finished' and 'busy'.Ludovic Courtès2018-01-26
| | | | | | | | This should placate 'guix-hydra-queued-builds', for instance, which checks these values to choose between "Running" and "Scheduled". * src/cuirass/http.scm (build->hydra-build): Provide the correct value for #:finished and #:busy.
* logging: Add 'with-time-logging' and use it.Ludovic Courtès2018-01-26
| | | | | | * src/cuirass/logging.scm (call-with-time-logging): New procedure. (with-time-logging): New macro. * src/cuirass/http.scm (handle-builds-request): Use it.
* http: Log incoming connections and requests.Ludovic Courtès2018-01-26
| | | | | * src/web/server/fiberized.scm (socket-loop): Add 'log-message' call. * src/cuirass/http.scm (url-handler): Likewise.
* http: Use our own 'fiberized' web server backend.Ludovic Courtès2018-01-25
| | | | | | * src/web/server/fiberized.scm: New file. * Makefile.am (dist_pkgmodule_DATA): Add it. * src/cuirass/http.scm (run-cuirass-server): Use it.
* http: Sort /api/latestbuilds and /api/queue by time.Ludovic Courtès2018-01-25
| | | | | | | * src/cuirass/database.scm (db-get-builds)[format-order-clause]: Add 'order' clauses. * src/cuirass/http.scm (url-handler): Default to (order finish-time) for /latestbuilds and (order submission-time) for /queue.
* http: /build: Include the derivation.Ludovic Courtès2018-01-24
| | | | * src/cuirass/http.scm (build->hydra-build): Add #:derivation.
* http: /build: Gracefully handle empty output list.Ludovic Courtès2018-01-24
| | | | * src/cuirass/http.scm (url-handler): Add case for empty #:outputs.
* http: Implement /api/queue.Ludovic Courtès2018-01-23
| | | | | | | | * src/cuirass/http.scm (url-handler): Add /api/queue handler. * tests/http.scm ("http"): Add a BUILD2 and DERIVATION2, and rename BUILD and DERIVATION accordingly. ("/build/2", "/build/2/log/raw"): Rename to /42. ("/api/queue?nr=100"): New test.
* http: /api/latestbuilds only returns finished builds.Ludovic Courtès2018-01-23
| | | | | | | * src/cuirass/database.scm (db-get-builds)[format-where-clause]: Honor (status done) filter. * src/cuirass/http.scm (url-handler): Always add (status done) to the filters passed to 'handle-builds-request'.
* Introduce concurrency with Fibers.Ludovic Courtès2018-01-22
| | | | | | | | | | | | | | | * README: Mark Fibers as required. * configure.ac: Check for Guile 2.2 only. Check for (fibers). * bin/cuirass.in (main): Use (fibers). Run 'process-specs' and web server in separate fibers. * src/cuirass/base.scm (with-store): New macro. (non-blocking-port): New procedure. (evaluate): Use 'non-blocking-port'. Use 'read-string' followed by 'read'. (process-specs): Move 'db-add-stamp' right after 'string=?' comparison. Run evaluation and subsequent builds in a separate fiber. * src/cuirass/http.scm (run-cuirass-server): Pass 'fibers as the second argument to 'run-server'. Use 'log-message' instead of 'format'. * src/cuirass/database.scm (with-database): Remove 'dynamic-wind'.
* http: /build/N/log/raw redirects to /log.Ludovic Courtès2018-01-07
| | | | | | | | | | | This moves log handling responsibility to 'guix publish'. * src/cuirass/http.scm (handle-log-request): Remove. (url-handler): Change /log/raw URI handler to return 302 to /log/OUTPUT. * tests/http.scm (log-file-name): Remove, and remove code to create and delete it. ("fill-db"): Change #:log value. ("/build/1/log/raw"): Expect 302.
* cuirass: Add --listen command line option.Jan Nieuwenhuizen2017-09-18
| | | | | | | | * bin/cuirass.in (show-help): Add help for --listen option. (%options): Add listen option. (main): Pass host to run-cuirass-server. * doc/cuirass.texi (Invocation): Add --listen option. * src/cuirass/http.scm (run-cuirass-server): Add named #:host parameter.
* cuirass: add Hydra compatible HTTP API.Mathieu Othacehe2017-09-08
| | | | | | | | | | | | | * doc/cuirass.texi (Sections)[Web API]: New section describing the HTTP API. * src/cuirass/http.scm (spec->json-string): Move it to utils.scm and rename it object->json-string. (object->json-scm): Move it utils.scm. (handle-*-request): New helpers procedures. (request-parameters): New procedure to parse a request query. (url-handler): Add new API's. * src/cuirass/utils.scm (object->json-scm, object->json-string): Exported procedures moved from http.scm. * tests/http.scm: Add various tests on new HTTP API.
* cuirass: Add "--port" command line option.Mathieu Lirzin2016-12-28
| | | | | | | | * bin/cuirass.in (%options): Add "--port" and "-p" command line options. (show-help): Adapt. (main): Set default to 8080. Call 'run-cuirass-server' with this. * src/cuirass/http.scm (run-cuirass-server): Display the port number. * doc/cuirass.texi (Invocation): Document new option.
* http: Add 'port' keyword argument to 'run-cuirass-server'.Mathieu Lirzin2016-12-28
| | | | * src/cuirass/http.scm (run-cuirass-server): Add 'port' keyword argument.
* http: Add DB argument to 'url-handler'.Mathieu Lirzin2016-11-03
| | | | | | * src/cuirass/http.scm (not-found): Delete. (url-handler): Add DB argument. (run-cuirass-server): Likewise. Pass it to 'run-server' STATE argument.
* Add (cuirass http) module.Mathieu Lirzin2016-07-31
* src/cuirass/http.scm: New file. * tests/http.scm: Likewise. * Makefile.am (dist_pkgmodule_DATA, TESTS): Add them. * configure.ac: Check for (json) module.