Commit Graph
41 Commits
Author SHA1 Message Date
Lars Wirzenius f38697e2d9 refactor: move creation of PushEvent to its own function
This is clearer for me.

Signed-off-by: Lars Wirzenius <liw@liw.fi>
2024-06-18 20:36:22 +03:00
Lars Wirzenius d84eccdcb6 refactor: drop unnecessary PathAction conversion from string
Signed-off-by: Lars Wirzenius <liw@liw.fi>
2024-06-18 20:36:22 +03:00
Lars Wirzenius 5fa43fc325 refactor: simplify how common fields Repository is created
Signed-off-by: Lars Wirzenius <liw@liw.fi>
2024-06-18 20:36:22 +03:00
Lars Wirzenius a216b84bd1 refactor: drop debug logging, to make code easier to grok
I want to debug the trigger message creation, and the `build_trigger`
method is long, and hard to follow. So I'll refactor it to be easier
for me to understand. First step: remove the `debug!` calls to make
the code shorter.

Signed-off-by: Lars Wirzenius <liw@liw.fi>
2024-06-18 20:35:14 +03:00
Lars Wirzenius c82fc3f657 fix: use the latest commit in a patch or push change
The commits in the trigger event are newest-first. When I wrote the
code I thought they were oldest-first. Mea culpa.

Signed-off-by: Lars Wirzenius <liw@liw.fi>
2024-06-06 14:40:02 +03:00
Michalis Zampetakis e3a90dfc19 Provide a parser function for parsing reference.
Currently supported handlers for puch and patch events.
2024-05-24 22:26:39 +03:00
Michalis Zampetakis 8adca82fe3 Change the way that the broker perceives a patch
Instead of checking for changes in patch cob, check if push is at
`/refs/heads/patches/`.

Adds AnyPushRef filter.
2024-05-23 21:15:43 +03:00
Lars Wirzenius fb51ce2bd9 feat: allow adapter to report an optional URL for a run
Also verify that the URL ends up in the HTML pages generated by the CI
broker.

Signed-off-by: Lars Wirzenius <liw@liw.fi>
2024-05-20 17:24:57 +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 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 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 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 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 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 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 fd672cbdf7 chore: format code
Signed-off-by: Lars Wirzenius <liw@liw.fi>
2024-03-05 16:04:18 +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 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 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 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 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 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
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 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 87b93de078 feat: add start of CI broker, and helper programs
Signed-off-by: Lars Wirzenius <liw@liw.fi>
2023-12-06 17:49:56 +02:00