Commit Graph
1000 Commits
Author SHA1 Message Date
Lars Wirzenius 10b6e6da9e test: use more recent releases for upgrade testing
Each additional version makes the upgrade test take longer, and we
only really need to care about recent releases, I think.

Signed-off-by: Lars Wirzenius <liw@liw.fi>
2024-11-08 13:49:51 +02:00
Lars Wirzenius 869b451728 chore: prepare release 0.8.0
Signed-off-by: Lars Wirzenius <liw@liw.fi>
2024-11-08 10:17:11 +02:00
Lars Wirzenius 55e1e7dba5 feat: add optional max_run_time field to configuration file
Signed-off-by: Lars Wirzenius <liw@liw.fi>
2024-11-06 18:52:30 +02:00
Lars Wirzenius 30435e2001 feat: use new timeout-command module to execute adapter
The time out is hard coded to be 1000 seconds in this commit. Making
it configurable will come later.
2024-11-06 17:34:17 +02:00
Lars Wirzenius 0e78c6a8d8 feat: add a "cibtool timeout" subcommand
This lets us use the previously added code to run a sub-process with a
time limit. This is only meant for experimentation.
2024-11-06 16:30:42 +02:00
Lars Wirzenius 68f392dd78 feat: add a module to run a sub-process with a time limit
Also, capture its stdout and stderr.
2024-11-06 16:23:51 +02:00
Lars Wirzenius 0f90e97a3e feat: notify page generation about changes to runs more often
Change src/adapter.rs to send notification via the run notification
channel when the adapter is spawned, and when the adapter sends a
"triggered" message.

Signed-off-by: Lars Wirzenius <liw@liw.fi>
2024-10-21 16:19:09 +03:00
Lars Wirzenius 10ee855966 refactor: store timeout in receiver, separate event/run senders
Add new NotificationChannel constructors, for different kinds of
channels. Store the receive timeout in the receiver; it depends on
kind of channel.

Also add methods to send and receive notifications to senders and
receivers. This hides the std::sync::mpsc machinery better, and makes
the types easier to use.

Signed-off-by: Lars Wirzenius <liw@liw.fi>
2024-10-21 16:11:12 +03:00
Lars Wirzenius d537fd39d1 feat: filter on originating node for an event
Add the `Node(nid)` event filter.

Add the `from_node` field to the `BranchDeleted` event so that it too
can be filtered based on node.

Adjust debug logging for event filtering so that it reports the
filtering decision.

Signed-off-by: Lars Wirzenius <liw@liw.fi>
2024-10-21 14:07:11 +03:00
Lars Wirzenius caf839b592 feat: add cibtool remove event option --all to empty event queue
Signed-off-by: Lars Wirzenius <liw@liw.fi>
2024-10-21 11:42:04 +03:00
Lars Wirzenius 3282510629 fix: make sure cib doesn't use node it shouldn't
Signed-off-by: Lars Wirzenius <liw@liw.fi>
2024-10-18 12:26:43 +03:00
Lars Wirzenius 35acece8d0 fix: spelling of reference to RequestBuilder
Signed-off-by: Lars Wirzenius <liw@liw.fi>
2024-10-18 12:26:30 +03:00
Lars Wirzenius 98665ff4ac docs: format and publish user guide in CI
Signed-off-by: Lars Wirzenius <liw@liw.fi>
2024-10-18 10:17:17 +03:00
Lars Wirzenius fa61cdda23 tests: hide log messages from output in successful tests
This was unexpectedly difficult to figure out, but I got there.

Signed-off-by: Lars Wirzenius <liw@liw.fi>
2024-10-18 09:29:01 +03:00
Lars Wirzenius 513eb2c568 feat: on the front status page, tell result run if known
Previously we just said "finished", now we say "finished, success" or
the like.

Signed-off-by: Lars Wirzenius <liw@liw.fi>
2024-10-16 11:13:15 +03:00
Lars Wirzenius 535b159290 chore: update release 0.7.0
Signed-off-by: Lars Wirzenius <liw@liw.fi>
2024-10-14 11:11:07 +03:00
Lars Wirzenius 938f627443 feat: cibtool event add --base value is not rev-parsed
This allows a value of, say, HEAD, which is convenient.

Signed-off-by: Lars Wirzenius <liw@liw.fi>
2024-10-11 08:58:21 +03:00
Lars Wirzenius a0122d8842 feat! mark CI event enum type as non-exhaustive
This should make it easier to evolve the enums as it forces users to
handle unknown variants explicitly.

Signed-off-by: Lars Wirzenius <liw@liw.fi>
2024-10-11 08:41:50 +03:00
Lars Wirzenius 320c426904 refactor: make BrokerError::NotTrigger not be so large
It's awkward if enum variants have wildly different sizes. Change
BrokerError::NotTrigger to store the Request value in a Box, so that
it's not in the enum directly. This makes all variants about the same
size, and thus the decorators that allow the
clippy::large_enum_variant can be dropped.

Signed-off-by: Lars Wirzenius <liw@liw.fi>
2024-10-10 18:44:11 +03:00
Lars Wirzenius 145e061aff feat: make CI events versioned
This will help us avoid breaking changes in the future, when CI events
need to be modified, and CI broker instances need to cope with the
event queues in their databases.

Previously we had

    enum CiEvent {
        BranchCreated { ... },
        BranchUpdatee { ... },
        ....
    }

Change that to:

    enum CiEvent {
        V1(CiEventV1),
    }

    enum CiEventV1 {
        BranchCreated { ... },
        BranchUpdatee { ... },
        ....
    }

This will allow us to add new version variants to CiEvent, without
losing access to the already enqueued V1 events.

Signed-off-by: Lars Wirzenius <liw@liw.fi>
2024-10-10 18:11:16 +03:00
Lars Wirzenius 5e813f739e fix: doc comment
Signed-off-by: Lars Wirzenius <liw@liw.fi>
2024-10-10 13:03:27 +03:00
Lars Wirzenius 441a9db7dc fix: spurious plural in log message
Signed-off-by: Lars Wirzenius <liw@liw.fi>
2024-10-10 12:56:48 +03:00
Lars Wirzenius 85efaa10d1 feat: allow user to set minimum log level for cib
Signed-off-by: Lars Wirzenius <liw@liw.fi>
2024-10-10 12:35:51 +03:00
Lars Wirzenius 5b5ba29e9d feat: log event queue length at log level "trace"
This reduces log spam.

Signed-off-by: Lars Wirzenius <liw@liw.fi>
2024-10-10 09:16:44 +03:00
Lars Wirzenius c8d6c0f53f fix: adjust log level for error message
Log the "CI broker ends in unrecoverable error" message at the
error level. instead of info.

Signed-off-by: Lars Wirzenius <liw@liw.fi>
2024-10-09 10:29:23 +03:00
Lars Wirzenius 47064e5785 chore: deny clippy warning about unwrap being used
An unwrap (or unwrap_err, or their expect variants) can result in run
time panics: unwrapping an Option that is None can't return a useful
result, so it panics. Similar for a Result. I've previously tried to
grep for uses of unwrap, but the clippy warning is much more precise.

Add "deny(clippy::unwrap_used)" to the top of src/lib.rs, so it
affects the whole crate. Then fix any places where unwrap is used.

It's OK to use unwrap in tests: if the value is expected, but isn't
there, the test should fail, and panic is a fine way to fail the test.

Everywhere else it's better to make sure unwrap can't fail, and if it
can, return a Result and have the caller handle that.

Signed-off-by: Lars Wirzenius <liw@liw.fi>
2024-10-09 10:16:41 +03:00
Lars Wirzenius a9fea0fdbe Merge branch 'patch/bc2cc00' 2024-10-09 09:32:13 +03:00
Lars Wirzenius 48f40d53f7 chore: add missing empty line between functions
Signed-off-by: Lars Wirzenius <liw@liw.fi>
2024-10-09 09:26:20 +03:00
Lars Wirzenius feec4a501e fix: remove unnecessary borrows
Signed-off-by: Lars Wirzenius <liw@liw.fi>
2024-10-09 09:24:26 +03:00
Lars Wirzenius 5483acf427 fix: handle end of events betterer in CiEventSource
Signed-off-by: Lars Wirzenius <liw@liw.fi>
2024-10-08 17:57:48 +03:00
Lars Wirzenius 0ac3b62301 fix: change how NodeEventSource treats closed connection
Signed-off-by: Lars Wirzenius <liw@liw.fi>
2024-10-08 17:18:00 +03:00
Lars Wirzenius 3a345c6492 feat: log stuff happaning in CiEventSource
Signed-off-by: Lars Wirzenius <liw@liw.fi>
2024-10-08 14:35:40 +03:00
Lars Wirzenius 593cedeaad feat: log NodeEventSource EOF
Signed-off-by: Lars Wirzenius <liw@liw.fi>
2024-10-08 14:29:22 +03:00
Lars Wirzenius d2324ca652 feat: log received node events
Signed-off-by: Lars Wirzenius <liw@liw.fi>
2024-10-08 14:21:54 +03:00
Lars Wirzenius 21b14a2328 feat: log when a NodeSourceEvent is created
Signed-off-by: Lars Wirzenius <liw@liw.fi>
2024-10-08 14:14:11 +03:00
Lars Wirzenius 92bee78f78 fix: drop pushing a shutdown event into queue, when node conn closes
For bad historical reasons, the CI broker was using a synthetic
"shutdown" event to signal from one thread to another that the node
connection has been disconnected. At an earlier stage of development,
this the only way for the "read node events" thread to notify the
"process queued events" thread that there would never be any more
events.

Now we have inter-thread message channels and we can use their closing
to do the signaling.

However, this meant that the queue would have a spurious shutdown
event. This led to the following sequence of things happening:

* node shuts down
* CI broker notices this, adds a shutdown event to queue, then
  terminates the event-reading thread, thereby closing the message
  channel
* the queue processing notices the message channel is closed, and
  terminates
* the CI broker process terminates
* systemd restarts the CI broker
* the CI broker finds a shutdown event in the queue and terminates

The shutdown event is still needed so that the node admin has a
convenient way to tell the CI broker to terminate, even if they don't
have the privilege to stop systemd units.

Signed-off-by: Lars Wirzenius <liw@liw.fi>
2024-10-08 13:43:05 +03:00
Lars Wirzenius 51a0834b7f feat: log the picked event when processing queue
Signed-off-by: Lars Wirzenius <liw@liw.fi>
2024-10-08 11:29:56 +03:00
Lars Wirzenius 69f10e3eb2 docs: start user guide; document CI events and filters 2024-09-30 14:01:03 +03:00
Lars Wirzenius f147c77d32 chore: drop old broker event code, which isn't used anymore
Signed-off-by: Lars Wirzenius <liw@liw.fi>
2024-09-30 14:01:03 +03:00
Lars Wirzenius 07612f53e9 feat(src/pages.rs): use CI events in HTML report pages
Signed-off-by: Lars Wirzenius <liw@liw.fi>
2024-09-30 14:00:51 +03:00
Lars Wirzenius d44877da78 feat: verify there are no unprocessed broker events in the db
To process old queued events, run older version of CI broker until
queue is empty ("cib queued"), then upgrade.

Signed-off-by: Lars Wirzenius <liw@liw.fi>
2024-09-30 13:58:13 +03:00
Lars Wirzenius 31e930aecf tests(ci-broker.md): update acceptance criteria for new CI events 2024-09-30 12:58:16 +03:00
Lars Wirzenius 41375b8bb6 feat: change cibtool subcommands to use new CI events 2024-09-30 12:58:16 +03:00
Lars Wirzenius e82652b522 feat: add new CI event source 2024-09-30 12:58:16 +03:00
Lars Wirzenius 1876b0f186 feat(src/queueproc.rs): process CI events 2024-09-30 12:58:16 +03:00
Lars Wirzenius c75c87030b feat(src/queueadd.rs): add CI events to queue 2024-09-30 12:58:16 +03:00
Lars Wirzenius 42d6184967 feat(src/msg.rs): build trigger message from CI event 2024-09-30 12:58:16 +03:00
Lars Wirzenius 31ee715d30 feat(src/logger.rs): update to log CI event 2024-09-30 12:58:16 +03:00
Lars Wirzenius ef8384b05b feat(src/db.rs): add queue for CI events
Add a new table for a queue of CI events. Drop most of the methods
that operate on the old queue of broker events, but leave a method to
check if its empty.

We can't use the existing table event_queue, as that contains
serialized broker events, which are entirely incompatible with CI
events.
2024-09-30 12:58:16 +03:00
Lars Wirzenius 1274368a20 feat(src/config.rs): use new CI event filter in config 2024-09-30 12:58:16 +03:00