Commit Graph
317 Commits
Author SHA1 Message Date
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
Lars Wirzenius 1b5700c0c5 chore: bump dependency on regex to current version
Signed-off-by: Lars Wirzenius <liw@liw.fi>
2024-07-29 12:13:58 +03:00
Lars Wirzenius 1a8abc5990 chore: bump dependency on log to current version
Signed-off-by: Lars Wirzenius <liw@liw.fi>
2024-07-29 12:10:31 +03:00
Lars Wirzenius a3ba1cac59 chore: bump dependency on env_logger to current version
Signed-off-by: Lars Wirzenius <liw@liw.fi>
2024-07-29 12:08:18 +03:00
Lars Wirzenius 49fd17fd29 chore: bump dependency on clap to current version
Signed-off-by: Lars Wirzenius <liw@liw.fi>
2024-07-29 12:06:41 +03:00
Lars Wirzenius 01c666547f chore: bump dependency on anyhow to current version
Signed-off-by: Lars Wirzenius <liw@liw.fi>
2024-07-29 12:05:20 +03:00
Lars Wirzenius 2d4bf57936 chore: depend on current release version of Subplot
Depend on subplot-build and subplotlib 0.10.0, drop dependency on
fehler, add dependency on culpa, and bump MSRV to 1.77 to match
radicle and be sufficiently new for Subplot.

Signed-off-by: Lars Wirzenius <liw@liw.fi>
2024-07-29 12:02:24 +03:00
Lars Wirzenius 912347a564 chore: bump dependency on radicle to 0.12.0
Signed-off-by: Lars Wirzenius <liw@liw.fi>
2024-07-29 11:55:47 +03:00
Lars Wirzenius 5f24cf53fc fix: if adapter does not provide a run id, invent one
This is arguably not a proper fix, but the best I can do late on
Friday. The proper fix would not use the run ID as a key.

Signed-off-by: Lars Wirzenius <liw@liw.fi>
2024-07-26 18:34:49 +03:00
Lars Wirzenius fe0a86bf83 docs(README.md): add section to show how to run with cargo run
Signed-off-by: Lars Wirzenius <liw@liw.fi>
2024-07-25 11:00:25 +03:00
Lars Wirzenius bbaa1c27c6 fix: handle run id not being set without unwrap
This makes it easier to grep for unsafe unwraps.

Signed-off-by: Lars Wirzenius <liw@liw.fi>
2024-07-22 13:51:07 +03:00
Lars Wirzenius 5fe771bd57 refactor: unpack options without .unwrap
The unwrap was safe, as we checked the options were not None, but
writing the code without .unwrap means it's easier to grep the code
for unwraps that are not safe.

Signed-off-by: Lars Wirzenius <liw@liw.fi>
2024-07-22 13:51:07 +03:00
Lars Wirzenius 0b433336fc fix: handle error from statement reset without panic
Return an error instead.

Signed-off-by: Lars Wirzenius <liw@liw.fi>
2024-07-22 13:51:07 +03:00
Lars Wirzenius 42b1265a43 fix: handle error from reading SQL column value without panicing
Return an error instead.

Signed-off-by: Lars Wirzenius <liw@liw.fi>
2024-07-22 13:51:07 +03:00
Lars Wirzenius ba999b9719 fix: handle SQLite bind errors instead of panicing
Return an error instead.

Signed-off-by: Lars Wirzenius <liw@liw.fi>
2024-07-22 13:51:07 +03:00
Lars Wirzenius a123034ead fix: make sure the conversion to milliseconds is safe
Make sure the milliseconds fit into a usize, and then the conversion
can't fail.

Signed-off-by: Lars Wirzenius <liw@liw.fi>
2024-07-22 13:51:07 +03:00
Lars Wirzenius a059a0fb08 feat: add an easier way to trigger a CI run.
This duplicates the functionality of "cibtool event add", but is a
little easier to use.

Signed-off-by: Lars Wirzenius <liw@liw.fi>
2024-07-22 13:47:10 +03:00