Commit Graph
69 Commits
Author SHA1 Message Date
Lars Wirzenius 0935bbdbbe feat: adjust logging to stderr via pretty_env_logger
Signed-off-by: Lars Wirzenius <liw@liw.fi>
2024-03-18 18:16:05 +02:00
Lars Wirzenius 4740c81c0e fix: make who in Whence variants optional
This should allow us to deal with old run record in the database.

Signed-off-by: Lars Wirzenius <liw@liw.fi>
2024-03-18 12:07:59 +02:00
Lars Wirzenius 1c64e2eb04 feat: show who made patch/commit CI is run for
Signed-off-by: Lars Wirzenius <liw@liw.fi>
2024-03-18 10:54:19 +02:00
Lars Wirzenius c0c48fd3c0 feat: add run count for each repo on front page
Signed-off-by: Lars Wirzenius <liw@liw.fi>
2024-03-15 16:42:18 +02:00
Lars Wirzenius 88e4af565a feat: refresh front page 300 seconds (5 min)
Signed-off-by: Lars Wirzenius <liw@liw.fi>
2024-03-15 16:33:30 +02:00
Lars Wirzenius de9c54ece4 feat: refersh front page every 10 seconds
Signed-off-by: Lars Wirzenius <liw@liw.fi>
2024-03-15 16:26:15 +02:00
Lars Wirzenius 4c504912e3 feat: add Request::try_from_str for tests
Specifically, radicle-native-ci tests.

Signed-off-by: Lars Wirzenius <liw@liw.fi>
2024-03-12 17:30:35 +02:00
Lars Wirzenius 23be5b2133 feat! make list of CI runs in broker be persistent
This means they won't vanish when the broker is restarted.

BREAKING CHANGE: the configuration files MUST now have a field "db"
that is a path to the database file to use. The file will be created
if needed.

Signed-off-by: Lars Wirzenius <liw@liw.fi>
2024-03-06 19:36:26 +02:00
Lars Wirzenius eac7f53dff fix: serialize EventType to lowercase
Signed-off-by: Lars Wirzenius <liw@liw.fi>
2024-03-05 18:36:21 +02:00
Lars Wirzenius 6260b8117e refactor: reorder imports
Signed-off-by: Lars Wirzenius <liw@liw.fi>
2024-03-05 18:36:13 +02:00
Lars Wirzenius 68b589ce37 feat: use an enum for event types
Stringly typing isn't checked by the compiler.

Signed-off-by: Lars Wirzenius <liw@liw.fi>
2024-03-05 18:13:16 +02:00
Lars Wirzenius fee8700dc8 feat: add a RequestBuilder to create Request messages
A builder interface is easier to use I find.

Signed-off-by: Lars Wirzenius <liw@liw.fi>
2024-03-05 18:01:57 +02:00
Lars Wirzenius 65c2cbfd92 fix(src/event.rs): remove unnecessary link target in doc comment
Signed-off-by: Lars Wirzenius <liw@liw.fi>
2024-03-05 17:32:51 +02:00
Lars Wirzenius dbc269b2a1 fix: use node's own alias in report page titles
Signed-off-by: Lars Wirzenius <liw@liw.fi>
2024-03-05 16:27:05 +02:00
Lars Wirzenius fd672cbdf7 chore: format code
Signed-off-by: Lars Wirzenius <liw@liw.fi>
2024-03-05 16:04:18 +02:00
Lars Wirzenius 3c2c2c2494 fix: avoid unnecessary return at the end of a function
Signed-off-by: Lars Wirzenius <liw@liw.fi>
2024-03-05 12:57:39 +02:00
Lars Wirzenius a4d6e64dd2 fix: add "branch" to pattern match
Signed-off-by: Lars Wirzenius <liw@liw.fi>
2024-03-05 12:56:37 +02:00
Michalis Zampetakis 472ca9ba8a Adds branch name for push events 2024-03-05 12:55:06 +02:00
Lars Wirzenius f0cb3d2944 fix: call to create patch in test to use COB cache
Signed-off-by: Lars Wirzenius <liw@liw.fi>
2024-03-04 19:01:41 +02:00
Lars Wirzenius d9aafdc87c fix: link to run log from native CI
We used to have two IDs for each CI run: one assigned by the broker
and one by the adapter. The native CI adapter writes logs to a
directory named by the id it chose itself: it doesn't know the on
chosen by the broker. The broker was generating a report page that
links to a run log using the broker-chosen id. Oops.

Drop the id chosen by the broker, it doesn't serve any useful purpose
anymore.

Signed-off-by: Lars Wirzenius <liw@liw.fi>
2024-03-04 18:12:52 +02:00
Lars Wirzenius 443bf0b184 feat! generate HTML report pages
Instead of only a single JSON file, updated every so often, also
generate HTML pages that show CI broker status, and lists every
repository for which the broker has run CI.

This currently assumes the native CI adapter, but that can be fixed to
be more generic later.

Signed-off-by: Lars Wirzenius <liw@liw.fi>
2024-03-04 16:43:51 +02:00
Lars Wirzenius d96861408c fix: update status page atomically
Signed-off-by: Lars Wirzenius <liw@liw.fi>
2024-02-20 09:41:28 +02:00
Lars Wirzenius 43b434fadd feat: allow config file to set a status page update interval
Default is now 10 seconds.

Signed-off-by: Lars Wirzenius <liw@liw.fi>
2024-02-20 09:36:01 +02:00
Lars Wirzenius 5d3aa44a92 feat: update status page in a background thread
Previously, we updated the status page only when we got a new broker
event, or after a CI run finished. This made it unsuitable as a "is
the broker alive?" service.

Signed-off-by: Lars Wirzenius <liw@liw.fi>
2024-02-19 20:54:47 +02:00
Lars Wirzenius d6be37d7ee feat: update a status page, if configured
Signed-off-by: Lars Wirzenius <liw@liw.fi>
2024-02-15 18:36:00 +02:00
Lars Wirzenius ab5197b7e4 fix: use git dependency on radicle, drop features
With this, importing radicle::prelude::RepoId works for me again.

Signed-off-by: Lars Wirzenius <liw@liw.fi>
2024-02-08 17:24:32 +02:00
Lars Wirzenius 0e80ed89e2 fix: import RepoId from identity module
rust-analyzer gets confused for me when it's imported from prelude.

Signed-off-by: Lars Wirzenius <liw@liw.fi>
2024-02-05 13:26:19 +02:00
Lars Wirzenius b483ab914d style: add note to errors.rs about module specific error types
Signed-off-by: Lars Wirzenius <liw@liw.fi>
2024-02-05 13:24:48 +02:00
Lars Wirzenius 1c87d349ef fix: if no adapter is available, print error message, don't give up
Signed-off-by: Lars Wirzenius <liw@liw.fi>
2024-02-02 20:23:45 +02:00
Lars Wirzenius 9886cfd48b refactor(src/bin/ci-broker.rs): use new modules in main program
Signed-off-by: Lars Wirzenius <liw@liw.fi>
2024-02-02 17:44:15 +02:00
Lars Wirzenius f298cc3ebd feat(src/lib.rs): allow use of new modules
Signed-off-by: Lars Wirzenius <liw@liw.fi>
2024-02-02 17:43:59 +02:00
Lars Wirzenius 30ea57549e feat(src/error.rs): add errors from new modules
Signed-off-by: Lars Wirzenius <liw@liw.fi>
2024-02-02 17:43:44 +02:00
Lars Wirzenius 7c562e1cbf feat(src/broker.rs): capture CI broker business logic
Implement a type to capture the business logic of the CI broker in a
way that is reasonable to test in isolation rather than as part of a
full Radicle network.

Signed-off-by: Lars Wirzenius <liw@liw.fi>
2024-02-02 17:42:38 +02:00
Lars Wirzenius 1c90e35cef feat(src/adapter.rs): run a CI adapter
Add module to represent a CI adapter and execute it. Add tests for a
variety of test cases.

Signed-off-by: Lars Wirzenius <liw@liw.fi>
2024-02-02 17:41:52 +02:00
Lars Wirzenius b096d9fb6f feat(src/run.rs): represent metadata about a CI run
This captures all the metadata about a CI run that the CI broker needs
to know. It can also be updated piecemeal.

Signed-off-by: Lars Wirzenius <liw@liw.fi>
2024-02-02 17:40:37 +02:00
Lars Wirzenius 13e2c2488e tests(src/msg.rs): use test helpers from test.rs
This simplifies the test code somewhat.

Signed-off-by: Lars Wirzenius <liw@liw.fi>
2024-02-02 17:39:46 +02:00
Lars Wirzenius c468331c10 feat(src/test.rs): add module with test helpers
Signed-off-by: Lars Wirzenius <liw@liw.fi>
2024-02-02 17:39:30 +02:00
Lars Wirzenius fbd1911e2f feat(src/msg.rs): add a Response constructor from string slice
This will make it easier to process adapter output line by line.

Signed-off-by: Lars Wirzenius <liw@liw.fi>
2024-02-02 17:38:26 +02:00
Lars Wirzenius 1321c25f29 feat(src/msg.rs): add helpers to get repo, commit from Request
This relieves uses for a Request from having to unpack it with pattern
matching. The helpers are much more convenient, when they are sufficient.

Signed-off-by: Lars Wirzenius <liw@liw.fi>
2024-02-02 17:37:20 +02:00
Lars Wirzenius 84051a2f1d feat(src/msg.rs): make RunResult implement Eq
Signed-off-by: Lars Wirzenius <liw@liw.fi>
2024-02-02 17:36:40 +02:00
Lars Wirzenius b53cf99e22 feat(src/msg.rs): set a uuid as the RunId by default
This will be useful for tests in a near-future commit.

Signed-off-by: Lars Wirzenius <liw@liw.fi>
2024-02-02 17:35:57 +02:00
Lars Wirzenius cd3c81222a refactor: Config::envs returns a ref to hashmap
This turns out to be more convenient in a near-future commit.

Signed-off-by: Lars Wirzenius <liw@liw.fi>
2024-02-02 17:34:31 +02:00
Lars Wirzenius 0b862ab0ed refactor: add a ConfigError type for config.rs
It's more tidy if every module has its own error type, to avoid
unnecessary coupling and tangling between modules.

Signed-off-by: Lars Wirzenius <liw@liw.fi>
2024-01-29 16:37:52 +02:00
Lars Wirzenius f31ac159e0 refactor: combine event.rs and filter.rs
The division of concerns between the two was artificial and unclear.

Signed-off-by: Lars Wirzenius <liw@liw.fi>
2024-01-29 16:18:13 +02:00
Lars Wirzenius de92f988b3 chore: drop src/bin/node-events.rs
filter-events.rs is almost identical, but a little bit more flexible.

Signed-off-by: Lars Wirzenius <liw@liw.fi>
2024-01-29 15:29:51 +02:00
Lars Wirzenius e43dfc9a98 chore: drop unused dummy-adapter.rs
I doesn't even work well as an example, as it's too simplistic.

Signed-off-by: Lars Wirzenius <liw@liw.fi>
2024-01-29 15:27:02 +02:00
Lars Wirzenius a6da02f852 refactor: move message related errors from error.rs to msg.rs
Signed-off-by: Lars Wirzenius <liw@liw.fi>
2024-01-26 17:16:27 +02:00
Lars Wirzenius 833be8d0cc docs: add documentation comments for everything in msg.src
FIXMEs mostly now.

Signed-off-by: Lars Wirzenius <liw@liw.fi>
2024-01-26 15:33:13 +02:00
Lars Wirzenius fe08cb9248 fix: use `` to prevent placeholder from being interpreted as HTML
Signed-off-by: Lars Wirzenius <liw@liw.fi>
2024-01-26 15:06:54 +02:00
jchrist c3d223d7fc feat(adapter): enrich adapter run context
Include context information to the adapter(s) about the trigger, distinguishing a trigger for a patch and a trigger for a push (possibly to a patch), according to the architecture.

Specifically, add push information for git pushes, including commit(s) and author.
For patches, add information about the specific patch that was updated, its revisions, along with the latest revision and the commits it includes.
2024-01-25 08:54:16 +02:00