Commit Graph
124 Commits
Author SHA1 Message Date
Lars Wirzenius bb24029ff5 feat: add helper program to output node events
This mostly useful for development, but serves as a way to show a
valid JSON representation of a node event.

Signed-off-by: Lars Wirzenius <liw@liw.fi>
2024-05-07 19:26:40 +03:00
Lars Wirzenius 1a44586eac feat: add more verbose errors and debug logging to event reading
Add more verbose logging when there's an error reading events from the
node control socket, and more verbose debug logging in general. This
helps figure out what's going on when something fails.

Handle the failure to subscribe (e.g., socket doesn't exist) and
failure to read an event from an open socket (e.g., node was stopped)
as separate errors. This makes troubleshooting easier.

Add a shutdown message, to allow tests to shut down the CI broker
cleanly.

Signed-off-by: Lars Wirzenius <liw@liw.fi>
2024-05-07 19:23:06 +03:00
Lars Wirzenius e243687658 feat: add shutdown event and debug logging for trigger building
Add a shutdown event to allow a clean shutdown of the CI broker, which
is useful for tests.

The added logging helps figure out what's going on, when there's a
problem communicating with the node or something else breaks when a
trigger message is constructed.

Also, handle the directory for status page not existing by silently
not writing a status page.

Signed-off-by: Lars Wirzenius <liw@liw.fi>
2024-05-07 19:17:56 +03:00
Lars Wirzenius defea3a784 chore: add dependencies and update Cargo.lock
Prepare Cargo.toml for an upcoming change to add an integration and
acceptance testing suite. Update Cargo.lock as well. This commit
brings no functional changes.

Signed-off-by: Lars Wirzenius <liw@liw.fi>
2024-05-07 19:01:29 +03:00
Lars Wirzenius 6897866977 fix: if there's an error, exit non-zero
Oops. We were exiting zero if there were errors. This is embarrassing.
A zero exit code should always indicate the program ran successfully.

Signed-off-by: Lars Wirzenius <liw@liw.fi>
2024-05-07 18:59:25 +03:00
Lars Wirzenius f74baba14d Merge branch 'patch/c095a06' 2024-04-16 08:13:45 +03:00
Lars Wirzenius a59b2dba82 refactor: use enum for patch action variants
Stringly typed things tend to break.

Signed-off-by: Lars Wirzenius <liw@liw.fi>
2024-04-15 20:44:00 +03:00
Lars Wirzenius d12e4206e8 docs(README.md): tell how the arch doc is built
Signed-off-by: Lars Wirzenius <liw@liw.fi>
2024-04-15 20:33:40 +03:00
Lars Wirzenius 9791d80792 fix: terminate the CI broker if the connection to the node breaks
Something else, e.g., systemd, can restart the broker.

Signed-off-by: Lars Wirzenius <liw@liw.fi>
2024-04-15 20:06:38 +03:00
Lars Wirzenius f834f3ee5f fix: handle adapter process exiting non-zero
Signed-off-by: Lars Wirzenius <liw@liw.fi>
2024-04-15 16:57:03 +03:00
Michalis Zampetakis 6b4c93146f Removes unused imports 2024-04-15 10:21:26 +03:00
Michalis Zampetakis 2fe966abf3 Adds different error for second message 2024-04-15 10:18:52 +03:00
Michalis Zampetakis a8a9946836 Remove error response 2024-04-12 16:17:12 +03:00
Michalis Zampetakis e342d614cb Update docs with procol version and failure 2024-04-12 16:17:12 +03:00
Lars Wirzenius db73047f48 Merge branch 'patch/30271be' 2024-04-12 16:14:02 +03:00
Lars Wirzenius b42745093c refactor: apply suggestion from clippy to be more idiomatic 2024-04-12 16:13:42 +03:00
Lars Wirzenius d8a1035da0 refactor: use .with_class instead of .with_attribute to set class
It's shorter and easier to grasp.

Signed-off-by: Lars Wirzenius <liw@liw.fi>
2024-04-11 09:37:56 +03:00
Lars Wirzenius 9085ada0db chore: update to html-gen API changes
Signed-off-by: Lars Wirzenius <liw@liw.fi>
2024-04-11 09:37:56 +03:00
Michalis Zampetakis 08e8f32a2b Add support of sensitive_envs sections in configuration
`sensitive_envs` are not printed at debug logging.

Fixes: c746ec1bc7
2024-04-10 10:36:56 +03:00
Lars Wirzenius 5ea5baa1cb fix: drop keyword that is too long
Signed-off-by: Lars Wirzenius <liw@liw.fi>
2024-04-03 14:51:12 +03:00
Lars Wirzenius fe9abb99ba chore: add useful fields to Cargo.toml
Signed-off-by: Lars Wirzenius <liw@liw.fi>
2024-04-03 09:48:57 +03:00
Lars Wirzenius 00affabff8 chore: set authors in Cargo.toml
Signed-off-by: Lars Wirzenius <liw@liw.fi>
2024-04-03 09:37:57 +03:00
Lars Wirzenius 5d7efc43fa chore: cargo update
Signed-off-by: Lars Wirzenius <liw@liw.fi>
2024-04-03 09:37:46 +03:00
Lars Wirzenius 8770e40bab docs: tweak statement on production readiness
But really only test triggering of CI.

Signed-off-by: Lars Wirzenius <liw@liw.fi>
2024-04-02 10:01:09 +03:00
Lars Wirzenius 1e0c9ed755 feat! add version field to request messages
Each request message has a field "version" set to an integer. An
adapter can check that it gets the version of the message it knows how
to handle.

Signed-off-by: Lars Wirzenius <liw@liw.fi>
2024-04-02 09:32:17 +03:00
Lars Wirzenius 601abc94d3 feat! drop the RunResult::Error variant
It was never very clear how Failure and Error actually differ, and
making the choice was thus unnecessarily difficult for an adapter
implementation. Having just Failure is simpler.

We'll re-introduce other variants if there are actual use cases and
things aren't vague.

Signed-off-by: Lars Wirzenius <liw@liw.fi>
2024-04-02 09:18:42 +03:00
Lars Wirzenius 68fd1877e6 chore: depend on the radicle crate via crates.io
If nothing else, this is necessary for publishing the broker to
crates.io.

Signed-off-by: Lars Wirzenius <liw@liw.fi>
2024-03-31 11:22:36 +03:00
Lars Wirzenius d4f7475ab8 docs: update README, add licenses
Signed-off-by: Lars Wirzenius <liw@liw.fi>
2024-03-31 11:16:58 +03:00
Lars Wirzenius ed9df5a86e feat: show result of latest run on front page
Signed-off-by: Lars Wirzenius <liw@liw.fi>
2024-03-31 10:57:38 +03:00
Lars Wirzenius f9196a2c9a fix: allow Whence::Patch revision to be optional
Signed-off-by: Lars Wirzenius <liw@liw.fi>
2024-03-19 17:48:50 +02:00
Lars Wirzenius 10bdac0768 refactor: pagegen.rs
Signed-off-by: Lars Wirzenius <liw@liw.fi>
2024-03-19 17:26:50 +02:00
Lars Wirzenius 42603ef31f feat: add patch revisions to report pages
Signed-off-by: Lars Wirzenius <liw@liw.fi>
2024-03-19 17:07:42 +02:00
Lars Wirzenius 3285c0d407 feat: show JSON status on HTML report front page
Also, prettify the JSON.

Signed-off-by: Lars Wirzenius <liw@liw.fi>
2024-03-19 12:41:27 +02:00
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 706d92b9c2 docs(README.md): update
Signed-off-by: Lars Wirzenius <liw@liw.fi>
2024-03-18 16:16:19 +02:00
Lars Wirzenius 30c7d59e68 docs: bring architecture document up to date
Various updates to bring the text of the architecture document up to
date with what has been implemented. Most of the speculative "we will
probably do it like this" parts have been dropped. Various fixes have
been made.

Signed-off-by: Lars Wirzenius <liw@liw.fi>
2024-03-18 15:58:07 +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
Michalis Zampetakis de44786001 Docs: Adds db section in main Readme 2024-03-08 08:36:40 +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 173231d46c tests: add Radicle native CI file to run CI on collaborating nodes
Signed-off-by: Lars Wirzenius <liw@liw.fi>
2024-03-05 18:38:17 +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