Commit graph

133 commits

Author SHA1 Message Date
e96234488f Add BUILDER_WEB_DATADIR env, fix bug
The builder-web commands now understand the BUILDER_WEB_DATADIR
environment variable which is used as --datadir.

During a change the transaction when vacuuming was committed twice which
is an error in sqlite. This was found during testing.
2024-02-13 14:23:25 +01:00
878acf002f Implement builder-db vacuum except-latest-successful
And some minor things.
2024-02-13 14:07:16 +01:00
d4da5a199f Implement builder-db vacuum {older-than,latest-n}
- `builder-db vacuum older-than [--job JOBNAME] RFC3339` removes all
  builds in `JOBNAME` (defaults to all jobs) that were built before
  `RFC3339`.
- `builder-db vacuum except-latest [--job JOBNAME] LATEST-N` removes all
  builds in `JOBNNAME` (defaults to all jobs) except for the latest
  `LATEST-N` builds (successful or not).
2024-02-12 15:09:08 +01:00
Robur
1e522e2b39 builder_db_app: verify_data_dir: compute size and sha256 only once per artifact 2024-01-09 14:48:53 +00:00
Robur
f66932da48 content addressing migration: add indices 2024-01-09 14:31:49 +00:00
36afb35e08 Update builder-db with content addressing 2024-01-09 13:32:13 +00:00
9f5458c8f4 Fix migration script
It didn't even compile :(
2024-01-09 13:32:13 +00:00
78a66dc089 Add migration script for content-addressed artifacts 2024-01-09 13:32:13 +00:00
bfa06c95f8 whitespace-cleanup 2023-09-19 15:07:47 +02:00
848186bd1a make the expiry of jobs configurable via cli (default 30) 2023-09-19 15:07:47 +02:00
fde834ad02 Initialize rng 2023-09-19 15:07:12 +02:00
89f2c54973 Fix migrate-2023-09-11 by dropping hte index first 2023-09-18 14:09:54 +02:00
207252401f auto-format 2023-09-12 13:10:10 +02:00
3fe8bcb997 Add migration for modified index 2023-09-11 12:31:11 +02:00
a333d4eb9d verify_cache_dir: only consider where main_binary is present 2023-09-11 11:10:03 +02:00
c2cf97436d whitespace cleanup in builder_db_app 2023-09-11 11:10:03 +02:00
6f30d5d144 Fix build of builder-web with more recent packages:
Cstruct.copy is deprecated
Mirage_crypto_rng_unix.initialize requires the RNG module as paramater (since mirage-crypto-rng 0.11.0)
Lwt_result.catch takes a function (unit -> 'a Lwt.t) since lwt 5.7.0
2023-08-25 10:09:21 +02:00
f666c9d0d1 Improve builder-web setup error messages
Give hints what to do in case the database file does not exist, or when
the database is not of the expected version.

Addresses #82
2022-07-15 12:52:21 +02:00
rand00
3e23b4a5bf Implemented general error-handler + Added special error-page for iframes/vizs 2022-07-15 10:51:57 +02:00
rand00
c533ea7c07 Made Builder_web.routes be a list of methods, routes and handlers - to become testable without depending on DB 2022-07-12 13:14:52 +02:00
rand
5307a7b91a add builder-db verify-cache-dir command (#113)
Co-authored-by: rand00 <oth.rand@gmail.com>
Co-authored-by: Reynir Björnsson <reynir@reynir.dk>
Reviewed-on: https://git.robur.io/robur/builder-web/pulls/113
Co-authored-by: rand <rand@r7p5.earth>
Co-committed-by: rand <rand@r7p5.earth>
2022-06-16 09:03:05 +00:00
09a180c3cd Automatic viz migration on builder-web startup (#111)
Co-authored-by: rand00 <oth.rand@gmail.com>
Reviewed-on: https://git.robur.io/robur/builder-web/pulls/111
Co-authored-by: Reynir Björnsson <reynir@reynir.dk>
Co-committed-by: Reynir Björnsson <reynir@reynir.dk>
2022-06-08 10:18:46 +00:00
da2aa77b53 M20220509 changes
* Do not depend on the uuid representation in Builder_db.Rep; instead
  copy the custom caqti type so the migration doesn't break if
  Builder_db.Rep changes
* We don't need to recreate any indices since we don't change the
  schema: The uuid column was erroneously VARCHAR(36) before as well(!)
2022-05-17 12:14:39 +02:00
bfc4e5e64f Update m20220509 to new caqti syntax 2022-05-16 15:57:58 +02:00
rand00
bca4c80127 Creating index for uuid after migration, and dropping on rollback 2022-05-16 15:43:58 +02:00
rand00
a45b373019 Migration changing uuids from byte to hex format in db 2022-05-16 15:43:58 +02:00
3de78b1113 Update to dream.1.0.0~alpha4
- Dream.path is deprecated. For now the deprecation is suppressed.

- Remove unused dream_svg.

- Remove datadir global. The datadir variable is in scope already, and
  global variables were removed in alpha3.

- Dream_tar.tar_response: flush before closing. It's unclear if this is
  necessary.

- Change Builder_web.add_routes to Builder_web.routes returning a list
  of routes, and in Builder_web_app construct the router.

- Builder_web.not_found is removed due to changes in Dream.router. It
  seems an error handler might be the way forward.
2022-04-22 12:37:01 +01:00
6e75a653bc Update to caqti 1.8.0 2022-04-22 12:20:43 +01:00
rand
0f493e9b47 Removing trailing slashes (#80)
This PR solves the issue of there being both "<url>/" and "<url>" paths, that in the builder-web context shouldn't mean different things.

The slashes are now removed using a `Dream` middleware, and the request is redirected using a permanent redirect (that doesn't change the method used): https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Location

Notable changes:
* Trailing slashes from the hardcoded link urls were removed, as unneccesary redirects are then avoided.
* All links in `Views` were rewritten to be absolute instead of relative.
* As `Dream` deprecated `path` - `Utils.Path` was created containing some helpers for manipulating paths. *Note that `String.split_on_char` has a different semantics.*
* A blacklist `routeprefix_blacklist_when_removing_trailing_slash` was added, containing `Dream` route-prefixes to ignore.
* Only `GET` and `HEAD` requests are redirected.
* `redirect_parent` helper was rewritten using new `Utils.Path` functions to avoid brittle string manipulation + fixed the edgecase of redirecting to `/`.
* Added `Uri` dependency to make URL manipulation safer.

Co-authored-by: rand00 <oth.rand@gmail.com>
Co-authored-by: Reynir Björnsson <reynir@reynir.dk>
Reviewed-on: https://git.robur.io/robur/builder-web/pulls/80
Co-authored-by: rand <rand@r7p5.earth>
Co-committed-by: rand <rand@r7p5.earth>
2022-04-21 10:40:21 +00:00
rand00
6a1c8b0ecd Builder_web_app: Fixed type-error + some 80-column fixes 2022-04-11 18:12:23 +02:00
1adc67c297 minor nits 2022-04-11 16:26:58 +02:00
rand00
68849fecf3 Fixed that cachedir should default to being relative to given datadir 2022-04-06 13:47:07 +02:00
rand00
1207ddbf70 Merge branch 'main' into 20220329_passing_separate_cache-dir 2022-04-06 13:31:42 +02:00
rand00
ab3be6ec8e builder-web: Added --cachedir CLI arg for staging new vizs 2022-03-29 22:27:24 +02:00
rand00
462859f4fb Builder-viz: Changed sharing-stats to be based on direct deps instead of transitive 2022-03-18 13:16:26 +01:00
rand00
34a8bf9160 Builder-viz: Passing transitive deps stats for coloring of nodes in opam-graph 2022-03-17 16:31:07 +01:00
rand00
60ee718160 Merged with main/master 2022-03-16 12:10:25 +01:00
rand
b2b593796a Merge pull request 'Supporting new modulectomy scoping of CSS' (#98) from 20220315_supporting_new_modulectomy_scoping_of_CSS into main
Reviewed-on: https://git.robur.io/robur/builder-web/pulls/98
2022-03-16 11:03:06 +00:00
b6f6090ce5 Merge branch '20220221_fix_cmdliner_deprecations'
Reviewed-on: https://git.robur.io/robur/builder-web/pulls/87
2022-03-16 10:42:35 +00:00
rand00
f68f383ba6 Fixed all binaries using cmdliner to avoid newly deprecated functions 2022-03-16 10:40:35 +00:00
rand00
1bcb6d0cef Merged with stash 2022-03-15 18:41:57 +01:00
rand00
bfd0299844 Builder-viz: Supporting new modulectomy scoping of CSS 2022-03-15 13:15:25 +01:00
rand00
5897484cb2 Fixed that Builder_db_app.job_remove didn't take all related tables into account
+ Added a function for making a db-id into an int64 for printing
2022-02-22 13:16:42 +01:00
Robur
7bb9e2d8fe Allow -d as well as --datadir in commands
Fixes #86
2022-02-21 13:08:58 +00:00
f7bc55f2e3 execute all executables in <conigdir>/upload-hooks when an upload succeeded
Only uploads with a single main binary invoke the hooks (since they use the
main_binary)
2022-02-21 13:05:16 +00:00
rand00
550dd59a19 Builder-web: Implemented better page-not-found 2022-02-21 12:13:51 +00:00
3fe07c7b34 Clean up trailing spaces 2022-02-01 11:43:07 +00:00
rand00
2a1b75ba2b Removals of uncommented code and unneccesary parens 2022-02-01 11:30:44 +00:00
rand00
302d53835a bin/Builder-viz: Added override_css params to viz's + used them to define a common theme 2022-02-01 11:30:44 +00:00
rand00
95ef54fc82 bin/Builder-viz: Added dependencies visualization 2022-02-01 11:30:44 +00:00