The trigger message given to the CI adapter to start a CI run must
have a list of commits. This requires the "ref changed" event to have
a base commit. The commits after the base commit to the tip commit in
the event become the list of commits in the trigger message.
"cibtool trigger" is given the tip commit with the "--commit" option.
Change it to use a parent commit of that as the base commit, or if
there is no parent commit (i.e., there is only the one commit in the
repository), the commit itself.
Signed-off-by: Lars Wirzenius <liw@liw.fi>
Change Request::commit to not panic if the push or patch data has no
commits, or if the request is neither push nor patch. Instead, return
an appropriate error. A panic message isn't very helpful to users;
errors can have helpful messages.
This changes the method signature of an exported method and that is a
breaking change.
Signed-off-by: Lars Wirzenius <liw@liw.fi>
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>