Commit Graph
333 Commits
Author SHA1 Message Date
Lars Wirzenius a34df9980f refactor: add helper to add the usual stuff to the HEAD element
Signed-off-by: Lars Wirzenius <liw@liw.fi>
2024-08-16 11:45:15 +03:00
Lars Wirzenius 54029ae3e7 feat: move status.json report front page to the end
Signed-off-by: Lars Wirzenius <liw@liw.fi>
2024-08-16 11:36:44 +03:00
Lars Wirzenius 7a11bedc00 feat: make sure the HTML and JSON files get created
This is the most rudimentary requirement. It does not verify they get
updated as the CI broker continues running and doing things, as that's
a little difficult to arrange a test for.

This revealed a problem in how the `cib process-events` threads work
together, so fix that too. Changed the page updater thread to output
the HTML report and JSON status file at least once, even if there were
not events to process. In addition, the event processing thread uses a
timeout to receive notification of new events, so that it doesn't get
stuck, if there aren't any events coming from the node control socket.

Added some logging to make it easier to debug these things in the
future.

Signed-off-by: Lars Wirzenius <liw@liw.fi>
2024-08-15 19:06:21 +03:00
Lars Wirzenius 413fd68642 refactor(cibtool): structure for subcommand implementation
Previously all subcommands for cibtool where in one file,
src/bin/cibtool.rs. That grew rather unwieldy and tiresome to
navigate. Split that into a module cibtoolcmd, with one sub-module per
top level subcommand for the leaf subcommands: the ones that do no
have subcommands themselves. Keep the rest of the subcommand structure
in cibtool.rs, so that it's easier to manage the subcommand structure
in one place.

Signed-off-by: Lars Wirzenius <liw@liw.fi>
2024-08-15 09:29:23 +03:00
Lars Wirzenius f75a78e82f fix(ci-broker.md): some stakeholder references
I failed to search and replace all instances of "Who: Lars". Fix that.

Signed-off-by: Lars Wirzenius <liw@liw.fi>
2024-08-14 18:22:02 +03:00
Lars Wirzenius 00b0d2bec0 docs: document stakeholders for the CI broker
Add stakeholder groups and change all scenarios to use those.

This is an initial set of stakeholders, to be built upon when the CI
broker starts maturing.

Signed-off-by: Lars Wirzenius <liw@liw.fi>
2024-08-14 14:25:29 +03:00
Lars Wirzenius f07da18fbc feat: add "run show" and "run update"
Signed-off-by: Lars Wirzenius <liw@liw.fi>
2024-08-09 11:51:07 +03:00
Lars Wirzenius 2cc1dc4bca feat! "cibtool run add" run state option change
Make the "cibtool run add" options to set the state of a CI run be
more logical. There are now four:

* --triggered
* --running
* --success
* --failure

That is, drop the --running option. This allows the clap configuration
to specify that one of those four is required. I could not find a way
to specify that if --running was present, one of --success and
--failure was required, but that's OK: the --running option didn't
actually help to make things easier for the user.

Signed-off-by: Lars Wirzenius <liw@liw.fi>
2024-08-09 10:40:52 +03:00
Lars Wirzenius a80ab49d7d chore: bump dependency on html-page crate 2024-08-08 17:53:40 +03:00
Lars Wirzenius 8ee42c7cc2 chore: switch from serde-yaml to serde-yml
serde-yml is maintainted, serde-yaml isn't.
2024-08-08 17:52:16 +03:00
Lars Wirzenius bdad79d442 feat: have threads notify each other of needing to do something
Event adding process notifies event processing thread that there are
new events, and the event processing thread notifies the report page
generation thread that a new run has finished. In addition, the
reporting thread reports after a while whether there are any new runs
or not, so that the page time stamp gets updated.

Also drop some now-unused code.

Signed-off-by: Lars Wirzenius <liw@liw.fi>
2024-08-02 18:35:14 +03:00
Lars Wirzenius 2414e342d1 feat: add NotificationChannel
This will be useful for threads to notify each other that they have
work to do. The notification does not carry any information, such as
an event or a run, that goes via the database, for robustness and
simplicity.

Signed-off-by: Lars Wirzenius <liw@liw.fi>
2024-08-02 18:34:15 +03:00
Lars Wirzenius d5159a7400 feat: whenever run info changes, update it in database
Especially, when adapter reports the run ID it assigns or other
information.

Signed-off-by: Lars Wirzenius <liw@liw.fi>
2024-08-02 18:33:47 +03:00
Lars Wirzenius 9a4a39f73b feat(src/pages.rs): tweak per-repo html report with both run ids
Signed-off-by: Lars Wirzenius <liw@liw.fi>
2024-08-02 18:33:47 +03:00
Lars Wirzenius 2317a19fd0 feat(src.pages.rs: both run ids in repo list for latest run
Signed-off-by: Lars Wirzenius <liw@liw.fi>
2024-08-02 18:33:47 +03:00
Lars Wirzenius eeb79ef090 feat(src/msg.rs): add RunId::as_str method
This makes it easier to use the run ID as a string, without creating a
whole new String value.

Signed-off-by: Lars Wirzenius <liw@liw.fi>
2024-08-02 18:33:27 +03:00
Lars Wirzenius 9d912e6ee6 feat(src/bin/cibtool.rs): list broker run id with "run list"
Show both the broker and adapter run IDs in the output of "cibtool run
list".

Signed-off-by: Lars Wirzenius <liw@liw.fi>
2024-08-02 18:32:37 +03:00
Lars Wirzenius 6dadbcd27d feat(src/bin/cibtool.rs)! make --id option to "run add" optional
Previously we always chose a random adapter run id, now use what's
given, if any.

Signed-off-by: Lars Wirzenius <liw@liw.fi>
2024-08-02 18:32:37 +03:00
Lars Wirzenius a4a03b414a feat: add broker run id to Run
Add a unique, immutable broker run ID to each run, in addition to the
adapter run ID that may not always be available, and is not guaranteed
to be unique.

Signed-off-by: Lars Wirzenius <liw@liw.fi>
2024-08-02 18:31:36 +03:00
Lars Wirzenius 17828919ae fix(src/bin/cibtool.rs): ensure ref change event has a base commit
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>
2024-07-31 09:55:19 +03:00
Lars Wirzenius 105a09a8db feat(src/msg.rs)! don't panic on missing commit or unknown type
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>
2024-07-31 09:54:56 +03:00
Lars Wirzenius a3fbb6e0e4 fix(debian/conrol): fix typo in package description
Signed-off-by: Lars Wirzenius <liw@liw.fi>
2024-07-31 09:02:25 +03:00
Lars Wirzenius ba1396ff58 fix(src/bin/cibtool.rs): fix typo in help messwage
Signed-off-by: Lars Wirzenius <liw@liw.fi>
2024-07-31 09:02:25 +03:00
Lars Wirzenius 607699b8d3 fix(src/broker.rs): typo in log message
Signed-off-by: Lars Wirzenius <liw@liw.fi>
2024-07-31 09:02:25 +03:00
Lars Wirzenius 0a8925d961 feat(src/bin/cibtool.rs): handle error without panicing
Signed-off-by: Lars Wirzenius <liw@liw.fi>
2024-07-29 17:44:46 +03:00
Lars Wirzenius f5edaff8f3 refactor(src/msg.rs): handle errors without panic in tests
Signed-off-by: Lars Wirzenius <liw@liw.fi>
2024-07-29 17:41:48 +03:00
Lars Wirzenius 8b31157ab3 refactor(src/pages.rs): handle errors without panic
Signed-off-by: Lars Wirzenius <liw@liw.fi>

xxx

Signed-off-by: Lars Wirzenius <liw@liw.fi>
2024-07-29 17:37:10 +03:00
Lars Wirzenius d82c077579 feat! return errors on fallible errors, instead of panic
This changes the public API of the src/events.rs module, so it's
technically a breaking change.

Signed-off-by: Lars Wirzenius <liw@liw.fi>
2024-07-29 17:19:58 +03:00
Lars Wirzenius 07fa94d406 refactor(src/event.rs): handle errors without panic
No public API change in this commit.

Signed-off-by: Lars Wirzenius <liw@liw.fi>
2024-07-29 16:51:38 +03:00
Lars Wirzenius 89f88e9218 refactor(src/event.rs): handle error without panic in tests
Signed-off-by: Lars Wirzenius <liw@liw.fi>
2024-07-29 16:35:58 +03:00
Lars Wirzenius aea1347c5c refactor(src/run.rs): handle error without panic in test
Signed-off-by: Lars Wirzenius <liw@liw.fi>
2024-07-29 16:33:31 +03:00
Lars Wirzenius bc4b4fc113 refactor(src/broker.rs): handle remaining panics in tests as errors
Signed-off-by: Lars Wirzenius <liw@liw.fi>
2024-07-29 16:30:21 +03:00
Lars Wirzenius fedd3f6752 refactor(src/broker.rs): handle yet more panics as errors in tests
Signed-off-by: Lars Wirzenius <liw@liw.fi>
2024-07-29 16:28:37 +03:00
Lars Wirzenius aa6eed00a9 refactor(src/broker.rs): handle one more panic as an error in tests
Signed-off-by: Lars Wirzenius <liw@liw.fi>
2024-07-29 16:25:37 +03:00
Lars Wirzenius cd071e0957 refactor(src/broker.rs): handle more panics as errors in tests
Signed-off-by: Lars Wirzenius <liw@liw.fi>
2024-07-29 16:23:07 +03:00
Lars Wirzenius 6737686d76 refactor(src/broker.rs): handle errors without panic, in tests
Signed-off-by: Lars Wirzenius <liw@liw.fi>
2024-07-29 16:18:51 +03:00
Lars Wirzenius f0fcfa94eb refactor(src/adapter.rs): avoid panic in tests, return error instead
This makes it easier to grep for ".unwrap(".

Signed-off-by: Lars Wirzenius <liw@liw.fi>
2024-07-29 16:13:34 +03:00
Lars Wirzenius 962e78482c feat(src/bin/cibtool.rs): handle errors without panic
Signed-off-by: Lars Wirzenius <liw@liw.fi>
2024-07-29 14:52:43 +03:00
Lars Wirzenius 15ae4148c9 refactor(build.rs): handle errors without panic
This has no real difference to the user, just makes it easier to find
uses of .expect with grep.

Signed-off-by: Lars Wirzenius <liw@liw.fi>
2024-07-29 14:15:08 +03:00
Lars Wirzenius 1e736c46ea feat(src/db.rs): handle time formatting errors without panic
Signed-off-by: Lars Wirzenius <liw@liw.fi>
2024-07-29 14:15:08 +03:00
Lars Wirzenius 1bf620feca feat(src/db.rs): handle JSON encoding errors without panic
Signed-off-by: Lars Wirzenius <liw@liw.fi>
2024-07-29 14:15:08 +03:00
Lars Wirzenius 573bc76a20 feat(src/broker.rs): handle time formatting errors without panic
Signed-off-by: Lars Wirzenius <liw@liw.fi>
2024-07-29 14:15:03 +03:00
Lars Wirzenius 07ed0639e7 refactor(src/events.rs)): uses ? in tests instead of expect
Change the tests to look more like production code. In addition, have
fewer places where .expect is used, to make it easier to find them by
a simple grep.

Signed-off-by: Lars Wirzenius <liw@liw.fi>
2024-07-29 13:48:13 +03:00
Lars Wirzenius cf66efb550 feat: handle JSON encoding errors as errors, without panic
They should never happens, but just in case.

Signed-off-by: Lars Wirzenius <liw@liw.fi>
2024-07-29 13:48:13 +03:00
Lars Wirzenius 2104c1a671 feat(src/pages.rs): add error variant for Mutex::lock failing
This means we do not panic if the locking fails. Instead we return an
error that will hopefully be logged and thus visible to the user in a
way that is easier to deal with than a panic

Signed-off-by: Lars Wirzenius <liw@liw.fi>
2024-07-29 12:57:16 +03:00
Lars Wirzenius 4acabd5f55 chore: bump dependency on tempfile to current version
Signed-off-by: Lars Wirzenius <liw@liw.fi>
2024-07-29 12:21:50 +03:00
Lars Wirzenius 5c44b43e6c chore: bump dependency on uuid to current version
Signed-off-by: Lars Wirzenius <liw@liw.fi>
2024-07-29 12:20:07 +03:00
Lars Wirzenius 33f7301347 chore: bump dependency on time to current version
Signed-off-by: Lars Wirzenius <liw@liw.fi>
2024-07-29 12:18:48 +03:00
Lars Wirzenius 37b23f0fe4 chore: bump version thiserror to current
Signed-off-by: Lars Wirzenius <liw@liw.fi>
2024-07-29 12:17:28 +03:00
Lars Wirzenius 90240a5cfd chore: bump dependencies on serde, serde_json to current versions
Signed-off-by: Lars Wirzenius <liw@liw.fi>
2024-07-29 12:15:37 +03:00