Commit graph

540 commits

Author SHA1 Message Date
234c7a0cb2 Refactor not found logic 2022-07-15 11:13:11 +02:00
9416e0552d error_handler: only show not found for `Not_Found
For all other error status codes we just pass on the suggested response.
2022-07-15 10:51:57 +02:00
rand00
f3d8eea546 Fixed unused param + simplification 2022-07-15 10:51:57 +02:00
rand00
ffc062727a Views: Cleanup 2022-07-15 10:51:57 +02:00
rand00
3e23b4a5bf Implemented general error-handler + Added special error-page for iframes/vizs 2022-07-15 10:51:57 +02:00
af0bb71ee0 Merge pull request 'map_err and bind_lwt_err will be deprecated with lwt.5.6.0' (#124) from upgrade-to-lwt-5.6.0 into main
Reviewed-on: https://git.robur.io/robur/builder-web/pulls/124
2022-07-12 11:24:48 +00:00
76f96b47b2 map_err and bind_lwt_err will be deprecated with lwt.5.6.0 2022-07-12 13:23:23 +02:00
35fa4cd0f1 Merge pull request 'Tests for router and safe links' (#122) from 20220621_tests_for_router into main
Reviewed-on: https://git.robur.io/robur/builder-web/pulls/122
2022-07-12 11:20:01 +00:00
da28758137 Refactor and fix tests
Uuidm.of_string doesn't check if there are additional bytes at the end,
so check for length as well.
2022-07-12 13:14:52 +02:00
cb43734b7b Refactor and address #127 2022-07-12 13:14:52 +02:00
535e3c33fa Update builder-web.opam
New test dependencies, remove old unnecessary pins
2022-07-12 13:14:52 +02:00
rand00
148ddacbe8 Add tests for router/Link module 2022-07-12 13:14:52 +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
rand00
93dc0d6d87 Made all links safe via a Links module 2022-07-12 13:14:52 +02:00
08b16adb1f FreeBSD/create_package.sh: Do not quote glob 2022-07-05 09:37:59 +02:00
19242b816c Fix FreeBSD packaging paths 2022-07-05 09:11:33 +02:00
824cb2d30d Add conffiles erroneosly omitted previously
It should have been part of 949dbab501.
2022-06-24 12:13:25 +02:00
bc692c46c6 Update builder-web.opam
- We no longer directly depend on modulectomy and opam-graph
- We expect ocaml-solo5-elftool >= 0.3.0 that doesn't raise exceptions
  (inshallah)
2022-06-23 12:24:04 +02:00
949dbab501 Package visualization & repo scripts (#123)
The repo scripts are installed in 'share' as examples.

Reviewed-on: https://git.robur.io/robur/builder-web/pulls/123
Co-authored-by: Reynir Björnsson <reynir@reynir.dk>
Co-committed-by: Reynir Björnsson <reynir@reynir.dk>
2022-06-23 09:51:55 +00:00
932b0c963e create_package.sh: quote variables 2022-06-22 12:37:57 +02:00
bac3b3c64b debian: put binaries in sbin, libexec
builder-db and builder-migrations require privileges, and builder-web is
expected to be run from systemd.
2022-06-22 12:31:13 +02:00
66a9d293e6 visualizations.sh: refactoring and error handling
- Specify the sqlite3 query as a command line argument
- Fail more often
2022-06-22 10:50:26 +02:00
0be38475b7 builder-web: Inform expected version on wrong ver. (#121)
Reviewed-on: https://git.robur.io/robur/builder-web/pulls/121
Co-authored-by: Reynir Björnsson <reynir@reynir.dk>
Co-committed-by: Reynir Björnsson <reynir@reynir.dk>
2022-06-22 08:20:29 +00:00
071183ff6c Add GZip support when we generate a tar archive (#119)
Fixes #116.

Co-authored-by: Romain Calascibetta <romain.calascibetta@gmail.com>
Co-authored-by: Reynir Björnsson <reynir@reynir.dk>
Reviewed-on: https://git.robur.io/robur/builder-web/pulls/119
Co-authored-by: dinosaure <romain.calascibetta@gmail.com>
Co-committed-by: dinosaure <romain.calascibetta@gmail.com>
2022-06-21 15:17:50 +00: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
88c91c0856 Merge pull request 'fix version numbering for FreeBSD repository, see #114' (#115) from fix-version into main
Reviewed-on: https://git.robur.io/robur/builder-web/pulls/115
2022-05-31 08:39:07 +00:00
73fbb59377 ensure version string is what we expect 2022-05-31 10:38:11 +02:00
27b40c63a1 fix version numbering for FreeBSD repository, see #114
To allow mixing of tags with git revisions, append a dummy ".0.g0000000" to
FreeBSD packages that originate from a tag.
2022-05-31 10:38:11 +02:00
15baa605a0 packaging: sha256 is encoded as hex, not base64 2022-05-19 15:12:41 +02:00
9f5cc4d156 Merge pull request 'Migration changing uuids from byte to hex format in db' (#106) from 20220509_migrating_uuids_to_hex_format_in_db into main
Reviewed-on: https://git.robur.io/robur/builder-web/pulls/106
2022-05-17 13:06:31 +00:00
397eb29d81 Update database version 2022-05-17 12:24:24 +02: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
9c3a4002af opam: requires dream 1.0.0~alpha4 now 2022-05-16 12:57:41 +02:00
a85be8730c Merge pull request 'Update to caqti 1.8.0 and dream 1.0.0~alpha4' (#103) from caqti-dream-update into main
Reviewed-on: https://git.robur.io/robur/builder-web/pulls/103
2022-05-12 15:06:38 +00:00
702d38a6cc Use Not found for missing visualizations 2022-04-22 12:41:55 +01: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
c72ff72e0d Merge pull request 'use ignorelist to transmit the intention' (#105) from minor-wording into main
Reviewed-on: https://git.robur.io/robur/builder-web/pulls/105
2022-04-22 11:20:01 +00:00
6190347401 use ignorelist to transmit the intention 2022-04-21 20:55:19 +02: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
e5a2b6fc0e Merge pull request 'Redirect /job to / and /job/:job/build to /job/:job' (#104) from redirect-job-and-build into main
Reviewed-on: https://git.robur.io/robur/builder-web/pulls/104
2022-04-11 16:23:38 +00:00
rand00
010197d900 Builder_web: Fixed type-errors + usage of correct dream queries helper 2022-04-11 18:19:54 +02:00
rand00
8f173295ab Merge branch 'main' into redirect-job-and-build 2022-04-11 18:13:12 +02:00
rand00
6a1c8b0ecd Builder_web_app: Fixed type-error + some 80-column fixes 2022-04-11 18:12:23 +02:00
a132a181c8 add ? before query parameters 2022-04-11 17:08:10 +02:00
3bee8a357d add query params to redirect 2022-04-11 16:54:28 +02:00