Commit Graph
171 Commits
Author SHA1 Message Date
Lars Wirzenius 0bbfebc80d refactor(src/pages.rs): use a Duration instead of plain integer
Also, log the duration until the next update, to help impatient node
operators to know what's going on.

Signed-off-by: Lars Wirzenius <liw@liw.fi>
2024-07-18 11:30:11 +03:00
Lars Wirzenius f713e4aa6a fix(cib): tell report page thread to run indefinitely
Previously, we told it to run once and waited for it to finish before
continuing. This makes sense for cibtool, but not for cib.

Signed-off-by: Lars Wirzenius <liw@liw.fi>
2024-07-18 11:25:43 +03:00
Lars Wirzenius cb9142ac8b feat: log when picking an event and starting a run
Signed-off-by: Lars Wirzenius <liw@liw.fi>
2024-07-18 11:01:49 +03:00
Lars Wirzenius 3812aba1f7 feat: shorten log messages for events
Format them on one line, not on many lines. This makes logs easier to
skim.

Signed-off-by: Lars Wirzenius <liw@liw.fi>
2024-07-18 10:53:13 +03:00
Lars Wirzenius 6acd11d086 feat: reduce interval for when pages get updated
Signed-off-by: Lars Wirzenius <liw@liw.fi>
2024-07-18 10:49:14 +03:00
Lars Wirzenius 3b882c43d0 feat: log when report pages are logged, and when not
Signed-off-by: Lars Wirzenius <liw@liw.fi>
2024-07-18 10:47:40 +03:00
Lars Wirzenius 8d622c78ed feat: log what report HTML pages are written
Signed-off-by: Lars Wirzenius <liw@liw.fi>
2024-07-18 10:42:30 +03:00
Lars Wirzenius 1d57cc1f2f chore: drop the "given an installed ci-broker" step
It's not used anywhere now that the binary name has changed to cib.

Signed-off-by: Lars Wirzenius <liw@liw.fi>
2024-07-17 18:11:55 +03:00
Lars Wirzenius 3f755facf3 fix: extend wait time for when database is busy
Five seconds was too short for a slow machine, so make it sixty
seconds. Which might be too long, but if it turns out to be, I'll have
to make it configurable in some way.

Signed-off-by: Lars Wirzenius <liw@liw.fi>
2024-07-17 16:52:42 +03:00
Lars Wirzenius 294a04f951 fix: internal documentation link
Signed-off-by: Lars Wirzenius <liw@liw.fi>
2024-07-17 16:32:38 +03:00
Lars Wirzenius ddbac4fd6e feat! drop "status" column from event queue
It's not currently used. It may be necessary to add this later, but
for now it's better to avoid having the cruft.

Signed-off-by: Lars Wirzenius <liw@liw.fi>
2024-07-16 20:44:43 +03:00
Lars Wirzenius fbb123d953 docs: add help for all subcommands and options
Signed-off-by: Lars Wirzenius <liw@liw.fi>
2024-07-16 20:38:37 +03:00
Lars Wirzenius d421a6ef17 docs: make synthetic-events have a module comment
Signed-off-by: Lars Wirzenius <liw@liw.fi>
2024-07-16 19:58:40 +03:00
Lars Wirzenius c1dc050819 docs: add documentation comments to cib and cibtool
Signed-off-by: Lars Wirzenius <liw@liw.fi>
2024-07-16 19:58:25 +03:00
Lars Wirzenius ff33dcdb1e feat! drop barely-working helper programs
Their functionality can be added to cibtool, if there's a need.

Signed-off-by: Lars Wirzenius <liw@liw.fi>
2024-07-16 19:57:39 +03:00
Lars Wirzenius 84d868c919 refactor: use sqlite::Connection::set_busy_timeout
This replaces previous explicit loops we had. Had to increase the
timeout value to let tests pass with new code.

Signed-off-by: Lars Wirzenius <liw@liw.fi>
2024-07-16 19:46:57 +03:00
Lars Wirzenius 24ed10c6da fix: partial comment explaining Db::execute_valueless
Signed-off-by: Lars Wirzenius <liw@liw.fi>
2024-07-16 17:39:12 +03:00
Lars Wirzenius 3303d7d873 fix: typo in error variant name
Signed-off-by: Lars Wirzenius <liw@liw.fi>
2024-07-16 17:37:56 +03:00
Lars Wirzenius 8c055c1f3b refactor: use a typed Duration constant instead of integer
This makes it clearer what unit of time is being used.

Signed-off-by: Lars Wirzenius <liw@liw.fi>
2024-07-16 17:37:29 +03:00
Lars Wirzenius 0511e77702 fix: set node alias for reports
Signed-off-by: Lars Wirzenius <liw@liw.fi>
2024-07-11 15:20:00 +03:00
Lars Wirzenius d1c3f1801d feat: cib reads and process events in one subcommand
Signed-off-by: Lars Wirzenius <liw@liw.fi>
2024-07-11 12:45:33 +03:00
Lars Wirzenius 14e2eaec01 feat: treat end-of-events as end, not as an error
If there are no more events to be received from the node, treat that
as an "end of file" situation, instead of as an error. In other words,
do a normal shutdown and let a system manager restart the CI broker if
need be.

Still handle actual errors when receiving node events as errors.

Signed-off-by: Lars Wirzenius <liw@liw.fi>
2024-07-11 12:45:33 +03:00
Lars Wirzenius ad80772033 refactor: change code to produce HTML report to run in a thread
Run it once, for cibtool.

Signed-off-by: Lars Wirzenius <liw@liw.fi>
2024-07-11 12:45:33 +03:00
Lars Wirzenius 8245df4722 fix(cibtool): use node alias in reports
Signed-off-by: Lars Wirzenius <liw@liw.fi>
2024-07-11 12:45:22 +03:00
Lars Wirzenius bbf65cb29a refactor: add Db::get_all_runs
This is needed in a few places, and it's nominally more efficient to
get all runs with one SELECT, than first get all run ids and then each
run one by one.

Signed-off-by: Lars Wirzenius <liw@liw.fi>
2024-07-10 12:43:33 +03:00
Lars Wirzenius 968d0e091b feat(cibtool): add command to produce HTML report from database
Signed-off-by: Lars Wirzenius <liw@liw.fi>
2024-07-10 12:43:14 +03:00
Lars Wirzenius 6cd968d480 feat(cibtool): allow user to add information about a run
This is primarily going to be useful for setting up runs in the
database for testing report generation, which will happen in the near
future.

Signed-off-by: Lars Wirzenius <liw@liw.fi>
2024-07-10 12:41:37 +03:00
Lars Wirzenius 5f1ce255c0 refactor: rename *Cmd to *SubCmd, Counter/EventRun to *Cmd
This will allow use to import "crate::run::Run" later, without any
hoops to jump though.

Signed-off-by: Lars Wirzenius <liw@liw.fi>
2024-07-10 12:37:18 +03:00
Lars Wirzenius d4cbcc81ed refactor: use BrokerError only in broker.rs
Signed-off-by: Lars Wirzenius <liw@liw.fi>
2024-07-08 19:30:31 +03:00
Lars Wirzenius 9f5db36e44 refactor(filter-events.rs): drop use of BrokerError
Signed-off-by: Lars Wirzenius <liw@liw.fi>
2024-07-08 18:15:09 +03:00
Lars Wirzenius e4b6897037 refactor: store run id from Run (i.e., from adapter) in db
Previously we invented a new run id that was meaningless.

Signed-off-by: Lars Wirzenius <liw@liw.fi>
2024-07-08 18:00:07 +03:00
Lars Wirzenius 50ea2eb1e5 fix(src/event.rs): allow branch names to have slashes
A branch name "liw/fix" if perfectly fine, so "parse_ref" should allow that.

Signed-off-by: Lars Wirzenius <liw@liw.fi>
2024-07-08 17:49:54 +03:00
Lars Wirzenius 93e17fe9ec fix(cibtool): make verbose listing events be explicit when not found
Previously, we output an Option, but now we output what's contained in
the option, or an explicit "no such event". This helps output to be
easier to understand for users, and simplifies testing, too.

Signed-off-by: Lars Wirzenius <liw@liw.fi>
2024-07-08 17:25:39 +03:00
Lars Wirzenius 441030205a cibtool: show contents of run, not just id
Signed-off-by: Lars Wirzenius <liw@liw.fi>
2024-07-03 19:20:17 +03:00
Lars Wirzenius 99f0124aa1 ydb.rs: fix list and get runs
Signed-off-by: Lars Wirzenius <liw@liw.fi>
2024-07-03 19:19:25 +03:00
Lars Wirzenius c62a4bee95 event.rs: add trace logging to parse_ref, and enable logging in its tests
Signed-off-by: Lars Wirzenius <liw@liw.fi>
2024-07-03 18:00:47 +03:00
Lars Wirzenius b24692c6d1 drop status page argument to Broker::execute_ci
We'll insert them into the db soon enugh.

Signed-off-by: Lars Wirzenius <liw@liw.fi>
2024-07-03 17:25:23 +03:00
Lars Wirzenius b3638a2342 drop Adapter::run status argument harder
Signed-off-by: Lars Wirzenius <liw@liw.fi>
2024-07-03 17:21:30 +03:00
Lars Wirzenius 67b66b1f91 drop status page argument for Adapter::run
We'll not update StatusPage in memory with runs any more soon.

Signed-off-by: Lars Wirzenius <liw@liw.fi>
2024-07-03 17:15:28 +03:00
Lars Wirzenius e4573ec3fb feat: add a thread for adding events to queue
Signed-off-by: Lars Wirzenius <liw@liw.fi>
2024-07-03 14:01:13 +03:00
Lars Wirzenius 0db9dfe34c test: update the subplot scenarios to verify the changes
Add a couple of helper scripts to make scenarios a little less
repetitive. These aren't great for understanding, and we may need to
add more understandable steps later.

Signed-off-by: Lars Wirzenius <liw@liw.fi>
2024-07-02 19:56:05 +03:00
Lars Wirzenius 003e901279 feat: rewrite ci-broker.rs as cib.rs
Drop the old ci-broker binary. New binary is cib.

New tool has a command line interface that is more extensible and
nicer to use.
2024-07-02 19:56:05 +03:00
Lars Wirzenius 86884cbe43 feat: change cibtool to list runs
Drop old list_runs binary.

Signed-off-by: Lars Wirzenius <liw@liw.fi>
2024-07-02 19:56:05 +03:00
Lars Wirzenius 21ef36aa23 feat: add new CI broker management tool
This will be useful for the node operator to manage CI broker event
queue, and for other purposes.
2024-07-02 19:56:05 +03:00
Lars Wirzenius 1fbb4ccbd5 chore: add new modules to src/lib.rs 2024-07-02 19:56:05 +03:00
Lars Wirzenius 56c212a8ca feat: module to process events in event queue 2024-07-02 19:56:05 +03:00
Lars Wirzenius 77d08d3fcc feat: module to insert events into event queue
Make BrokerEvent de-serializable so that we can store them as JSON in
the database in the persistent event queue.

Signed-off-by: Lars Wirzenius <liw@liw.fi>
2024-07-02 19:55:42 +03:00
Lars Wirzenius 6e5c0d0290 fix: adapt src/broker.rs to new database abstraction 2024-07-02 19:55:35 +03:00
Lars Wirzenius 1386c94189 feat: rewrite database abstraction
Add a "counter" table, to enable a rudimentary concurrency test. Used
this to verify that multiple processes can safely update the same
database. Multi-process concurrency can result in temporary, short
lived lock conflicts in transactions: deal with this by re-trying for
a short duration.

Add a persistent event queue. Add methods to the Db type to deal with
counters and event queue.

Add a new error type to allow Db methods to return errors that do not
come from SQLite.

Restructure the internals a bit to make them easier for me to follow.
2024-07-02 19:55:35 +03:00
Lars Wirzenius 969f4fb2fb feat: serialize a configuration as JSON
This will allow the CI broker to show the full actual configuration to
the user.
2024-07-02 19:55:35 +03:00