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>
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>
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>
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>
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>
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>
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>
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.
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>
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>