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
Lars Wirzenius
c7a2572e80
fix: adapt to radicle's Id->RepoId rename
...
Signed-off-by: Lars Wirzenius <liw@liw.fi >
2024-01-23 17:21:21 +02:00
Lars Wirzenius
a3a8a222a6
chore: add rust-toolchain
2024-01-23 17:08:26 +02:00
Lars Wirzenius
da51901b85
fix: use std:io:Error for error type from node event subscription
...
Signed-off-by: Lars Wirzenius <liw@liw.fi >
2024-01-15 12:08:57 +02:00
Lars Wirzenius
c73447a745
fix: type of errors returned from node::subscribe
...
Signed-off-by: Lars Wirzenius <liw@liw.fi >
2024-01-12 15:39:58 +02:00
Lars Wirzenius
4ffa6115e7
chore: drop useless example file
2024-01-02 08:30:18 +02:00
Michalis Zampetakis
e11a62ead1
Fix some letter casing in doc/architecture.md
2023-12-22 13:28:35 +02:00
Lars Wirzenius
0c6ce32472
Merge branch 'patch/df4563f'
2023-12-18 20:07:39 +02:00
Yorgos Saslis
a00212538b
enriches broker request payload to enable complex workflows in external CI
...
Signed-off-by: Yorgos Saslis <yorgo@proton.me >
2023-12-18 19:42:39 +02:00
Yorgos Saslis
93654fa547
fixes config path
...
Signed-off-by: Yorgos Saslis <yorgo@proton.me >
2023-12-18 19:42:38 +02:00
Lars Wirzenius
77860a8c28
docs: explain about the config file and filters in README
...
Signed-off-by: Lars Wirzenius <liw@liw.fi >
2023-12-18 19:41:01 +02:00
Lars Wirzenius
b2862d2290
refactor(ci-broker): drop unused imports and other useless code
...
Signed-off-by: Lars Wirzenius <liw@liw.fi >
2023-12-18 19:30:47 +02:00
Lars Wirzenius
43d1a0851b
refactor(filter-events): drop unused imports and other useless code
...
Signed-off-by: Lars Wirzenius <liw@liw.fi >
2023-12-18 19:30:25 +02:00
Lars Wirzenius
6c5012453e
refactor: move config stuff into src/config.rs
...
Signed-off-by: Lars Wirzenius <liw@liw.fi >
2023-12-18 19:19:39 +02:00
Lars Wirzenius
a4047dc968
feat: more flexible filtering
...
Add filters on a specific branch, any patch, a specific branch, and
allow combining filters with AND, OR, NOT, and document the motivation
for each of these in requirements.md.
Signed-off-by: Lars Wirzenius <liw@liw.fi >
2023-12-18 18:58:36 +02:00
Lars Wirzenius
176235883e
feat: add helper program to show events after filtering
...
Signed-off-by: Lars Wirzenius <liw@liw.fi >
2023-12-18 18:58:36 +02:00
Lars Wirzenius
c7153deb3f
fix: rename binary to broker-messages
...
Signed-off-by: Lars Wirzenius <liw@liw.fi >
2023-12-18 16:54:13 +02:00
Lars Wirzenius
acfa963774
feat: add3d program to write out examples of JSON messages
...
These may change, so having code seems better than copy-pasting them
into static documentation.
Signed-off-by: Lars Wirzenius <liw@liw.fi >
2023-12-18 16:52:21 +02:00
Lars Wirzenius
b4fb1e347b
This is a combination of 2 commits.
...
feat: read configuration from a file
The configuration file specifies what adapters are available, and
environment variables to set for each, and the node event filtering
that is applied.
Signed-off-by: Lars Wirzenius <liw@liw.fi >
2023-12-14 20:18:21 +02:00
Lars Wirzenius
7b31ac5c46
chore: make Request and Response cloneable
...
This helps native CI have better error messages.
Signed-off-by: Lars Wirzenius <liw@liw.fi >
2023-12-14 17:20:51 +02:00
Lars Wirzenius
f37948149b
refactor: error types
...
Have a top level error type that users of the library can import. Then
have a per-module error type so that errors returned by that module
can be as specific and precise as they can be.
Signed-off-by: Lars Wirzenius <liw@liw.fi >
2023-12-14 16:28:44 +02:00
Lars Wirzenius
af03df8517
chore: drop anyhow in favor of just thiserror
...
Signed-off-by: Lars Wirzenius <liw@liw.fi >
2023-12-14 16:11:33 +02:00
Lars Wirzenius
f31ff2718f
fix: use the canonical names for Id, Oid
...
Signed-off-by: Lars Wirzenius <liw@liw.fi >
2023-12-14 13:35:02 +02:00
Lars Wirzenius
0014c6a4dd
fix: handle all cases for RunResult
...
Signed-off-by: Lars Wirzenius <liw@liw.fi >
2023-12-14 13:29:12 +02:00
Lars Wirzenius
e2f352d68e
fix: make enums non-exhaustive, add an error result
...
A non-exhaustive enum allows us to add new variants later, but not
break existing code. The compiler will check that code using current
the current version of the enum is written in such a way that it won't
break if a new variant is added.
Also add a new variant `RunResult::Error` to handle cases where a CI
run fails, but due to reasons probably unrelated to the software under
test. For example, network failure during a run.
Signed-off-by: Lars Wirzenius <liw@liw.fi >
2023-12-14 13:10:27 +02:00
Lars Wirzenius
53281dee84
fix: re-export types for repository and commit IDs
...
Signed-off-by: Lars Wirzenius <liw@liw.fi >
2023-12-14 12:22:25 +02:00
Lars Wirzenius
46e3afad6b
chore: "cargo update" to update Cargo.lock
...
Signed-off-by: Lars Wirzenius <liw@liw.fi >
2023-12-14 11:39:43 +02:00
Lars Wirzenius
a9baf73eb6
chore: set radicle to use a git repository instead of file path
...
Signed-off-by: Lars Wirzenius <liw@liw.fi >
2023-12-14 11:34:25 +02:00
Lars Wirzenius
0ca17e15b9
docs: add a README placeholder
...
Signed-off-by: Lars Wirzenius <liw@liw.fi >
2023-12-06 17:51:13 +02:00