Commit Graph
787 Commits
Author SHA1 Message Date
Lars Wirzenius 765e6b606c fix: "cibtool run remove" removed only by broker run id by default
We need to parse the run info in the database as JSON to get at the
adapter run info. This fails if the run info can't be parsed. That can
happen if the database has run info from a development version. Change
`cibtool run remove` so that it takes only broker run ids by default
so that we can delete using those even if the run info is broken.
Allow removing by adapter run id with the `--adapter` option.

Signed-off-by: Lars Wirzenius <liw@liw.fi>
2025-04-07 15:35:47 +03:00
Lars Wirzenius 900a457157 fix: "cibtool run list" shows ids without loading run info
If the run info can't be parsed as JSON, loading it will fail. Change
`cibtool run list` so that it only lists the run ids by default.

Signed-off-by: Lars Wirzenius <liw@liw.fi>
2025-04-07 15:34:57 +03:00
Lars Wirzenius 756d7ac81d fix: Subplot step to run git in sub directory
Subplot's Rust lib/runcmd library currently sets HOME to the directory
in which a command is run. If the step is "when I run, in foo, git",
then git is run with HOME set to point to the sub-directory foo under
the per-scenario data directory. I suspect this is a bug in Subplot,
but until that is confirmed and fixed by Subplot, and the fix included
in a release, we can avoid that by running "env -C foo git" instead.
This has the effect of changing the working directory to foo before
running git, without affecting any environment variables, which is
what we want.

Signed-off-by: Lars Wirzenius <liw@liw.fi>
2025-04-04 15:00:38 +03:00
Lars Wirzenius 6ec75d1978 doc(doc/userguide.md): document new tag events and filters
Signed-off-by: Lars Wirzenius <liw@liw.fi>
2025-04-04 11:51:04 +03:00
Lars Wirzenius a7d02c18c4 feat: make Tag event filter take a regular expression
Signed-off-by: Lars Wirzenius <liw@liw.fi>
2025-04-04 11:42:11 +03:00
Lars Wirzenius b783ef65d7 feat: events for created, updated, deleted Git tags
Signed-off-by: Lars Wirzenius <liw@liw.fi>
2025-04-04 10:59:07 +03:00
Lars Wirzenius daa73ab7c2 refactor: use new Git ref parser to simplify from_node_event constructor
Signed-off-by: Lars Wirzenius <liw@liw.fi>
2025-04-02 19:51:22 +03:00
Lars Wirzenius 504f13262c feat(src/ci_event.rs): add parser for Git refs for patch, branch, tag
Signed-off-by: Lars Wirzenius <liw@liw.fi>
2025-04-02 19:21:05 +03:00
Lars Wirzenius 6dc057e27f doc: add a "Getting started" section to the user guide
Signed-off-by: Lars Wirzenius <liw@liw.fi>
2025-03-31 15:46:41 +03:00
Lars Wirzenius 7cab201b41 feat: version number now includes Git commit short id
Signed-off-by: Lars Wirzenius <liw@liw.fi>
2025-03-31 15:04:06 +03:00
Lars Wirzenius 5a83c3d9d4 chore: prepare release 0.15.1
Signed-off-by: Lars Wirzenius <liw@liw.fi>
2025-03-26 08:40:42 +02:00
Lars Wirzenius 5038769a41 feat(src/msg.rs): allow logging to stderr in AdminLog
Signed-off-by: Lars Wirzenius <liw@liw.fi>
2025-03-26 07:56:43 +02:00
Lars Wirzenius 68a7a596bf feat: if Adminlog is null, don't log to stderr either
Signed-off-by: Lars Wirzenius <liw@liw.fi>
2025-03-25 16:35:20 +02:00
Lars Wirzenius 19575f49f2 chore: prepare release 0.15.0
Signed-off-by: Lars Wirzenius <liw@liw.fi>
2025-03-25 08:37:07 +02:00
Lars Wirzenius 2450f7b764 feat: log a warning if report directory does not exist
Signed-off-by: Lars Wirzenius <liw@liw.fi>
2025-03-25 08:31:19 +02:00
Lars Wirzenius 33b4b65b0f fix(src/pages.rs): if report dir does not exist, silently do nothing
Signed-off-by: Lars Wirzenius <liw@liw.fi>
2025-03-24 18:11:36 +02:00
Lars Wirzenius 88d819d556 fix(src/bin/cib.rs): log failure of page updater thread
Signed-off-by: Lars Wirzenius <liw@liw.fi>
2025-03-24 18:07:38 +02:00
Lars Wirzenius 29c37f9095 test(ci-broker.md): add scenario to run cib without a report dir
We want to make sure this works.

Signed-off-by: Lars Wirzenius <liw@liw.fi>
2025-03-24 18:05:06 +02:00
Lars Wirzenius 47fc131186 feat: log thread start/end at info level normally
This makes them more obvious than at the debug level. These are not
messages that repeat, so they won't be log spam.

Signed-off-by: Lars Wirzenius <liw@liw.fi>
2025-03-24 18:02:19 +02:00
Lars Wirzenius 192af400ed feat(src/logger.rs): report thread ending with error at error level
Previously, errors were reported at debug level. The error level makes
errors more obvious.

Signed-off-by: Lars Wirzenius <liw@liw.fi>
2025-03-24 17:57:34 +02:00
Lars Wirzenius bcbd2ffcfa chore: prepare release 0.14.0
Signed-off-by: Lars Wirzenius <liw@liw.fi>
2025-03-24 12:31:05 +02:00
Lars Wirzenius 6e0d8853d0 fix(src/ci_event.rs): don't error if namespaced ref is not branch
When we get a CI event, we parse the namespaced name in the event to
see if it's a patch, or branch update. However, if might not be a
either: it might, for example, be a sigrefs update. Create a
branch event only if it's a branch event. Previously we would assume
it's branch event if not a patch event, and return an error if it's
not actually a branch.

If it's not a patch or branch change, ignore the event, as there's
nothing useful we can do about it, at least for now.

Signed-off-by: Lars Wirzenius <liw@liw.fi>
2025-03-24 11:42:27 +02:00
Lars Wirzenius 041e736a23 feat: when CI event source closes, log the error
Signed-off-by: Lars Wirzenius <liw@liw.fi>
2025-03-24 11:40:02 +02:00
Lars Wirzenius 6ef5675a2a feat: reduce log spam
Don't log unstructured messages from various places in processing
events and the execution of a CI run. I think these are unnecessary
messages anyway, by now. If it turns out we need them, we'll add them
back as structured log messages.

Drop the now-unused logger::debug, debug2, trace, and trace2
functions, may the never return.

Signed-off-by: Lars Wirzenius <liw@liw.fi>
2025-03-24 11:37:59 +02:00
Lars Wirzenius 3e51c02d04 feat: make event queue processing use structured log messages
Signed-off-by: Lars Wirzenius <liw@liw.fi>
2025-03-24 11:37:16 +02:00
Lars Wirzenius e17b467b37 fix(src/queueproc.rs): always drop a picked event from queue
Previously, we might not remove the event from the queue if something
went wrong while processing it. This could result in the CI broker
picking again in the future, and it might fail again, and repeat ad
nauseam.

It's better to remove the event from the queue at once, and log any
problems while processing it, and let humans deal with failures, and
decide if re-processing is needed.

Signed-off-by: Lars Wirzenius <liw@liw.fi>
2025-03-24 11:34:25 +02:00
Lars Wirzenius 11bb07ddf7 feat: always log thread start and result for page updating thread
This means that even if the thread ends due to an error, the error
gets logged. This will help with diagnosing problems.

Signed-off-by: Lars Wirzenius <liw@liw.fi>
2025-03-24 11:34:25 +02:00
Lars Wirzenius fb03457460 feat: always log the start and end result in the queueproc thread
This means that even if the thread ends due to an error, the error
gets logged. This will help with diagnosing problems.

Signed-off-by: Lars Wirzenius <liw@liw.fi>
2025-03-24 11:34:25 +02:00
Lars Wirzenius 923a4f1637 feat: always log thread start, end, result of queueadd thread
This means that even if the thread ends due to an error, the error
gets logged. This will help with diagnosing problems.

Signed-off-by: Lars Wirzenius <liw@liw.fi>
2025-03-24 11:34:23 +02:00
Lars Wirzenius b73d00df9d refactor: drop unused function ci_event_source_eof
Signed-off-by: Lars Wirzenius <liw@liw.fi>
2025-03-24 11:30:56 +02:00
Lars Wirzenius c22a12f085 feat: add a "kind" field to log messages that don't have it
Only queueproc_filter_decision and queueproc_filter_predicate seemed
to be missing it.

Signed-off-by: Lars Wirzenius <liw@liw.fi>
2025-03-24 11:30:56 +02:00
Lars Wirzenius 0d1d3291cc fix: use new Git refs module, fix bugs found
This is a huge change, but it's mostly a few kinds of similar changes
in a lot of places. Unfortunately, they were not easy to tease apart
into small, easily reviewed commits.

Use the Git ref types created by the new refs module. Fix problems
this exposes.

The CiEvent enum variants for branch events now use the BranchName
type for branch names. In other words, they have a plain branch name.
The CiEvent::from_node_event constructor also always sets the branch
name to a plain branch name, instead of a name spaced ref for updated
or deleted branches. The ci_event.rs module's unit tests have been
fixed to use the correct kind of Git ref in each test. (It used to be
a mess.)

The CI event filter "Branch" now contains a BranchName, previously a
RefString. This should not break anything, as a RefString will always
work as a BranchName.

The DefaultBranch filter now works, because it compares plain branch
names, where it previously would compare a plain and a name spaced
branch name, and those are never equal.

"cibtool trigger" and "cibtool event add" now add branch events with a plain
branch instead of a name spaced ref.

Signed-off-by: Lars Wirzenius <liw@liw.fi>
2025-03-20 18:33:39 +02:00
Lars Wirzenius 9222f6d332 feat: module for manipulating Git refs
Add helper functions to construct plain branch names ("main"), full
branch refs ("refs/heads/main"), and namespaced full branch
names ("refs/namespaces/$NID/refs/heads/main").

Keeping track of while only using RefStrings is too hard to get right.
We need to use the types provided by the radicle crate: BranchName,
Qualified, and Namespaced. Even if I find the type names less than
obvious, they're much better than plain RefStrings.

Signed-off-by: Lars Wirzenius <liw@liw.fi>
2025-03-20 17:57:29 +02:00
Lars Wirzenius b0adc805ec doc(doc/userguide.md): add a chapter on configuration
Signed-off-by: Lars Wirzenius <liw@liw.fi>
2025-03-13 18:03:06 +02:00
Lars Wirzenius 4f98127322 feat: RSS feeds now only contain up to ten entries
Very long RSS feeds can cause problems for some readers. Apparently
they forget they've already seen very old entries and show them as
new. To work around this, only include the ten newest CI runs.

Signed-off-by: Lars Wirzenius <liw@liw.fi>
2025-03-13 12:05:14 +02:00
Lars Wirzenius 746445cb86 feat: "event filter --explain" shows why an event was allowed or not
Also refactor the code that makes the decision for simplicity and
clarity.

Signed-off-by: Lars Wirzenius <liw@liw.fi>
2025-03-10 19:42:27 +02:00
Lars Wirzenius 515cf386ab chore: prepare release 0.13.1
Signed-off-by: Lars Wirzenius <liw@liw.fi>
2025-03-05 10:12:35 +02:00
Lars Wirzenius e57c1e1ed7 feat: add an admin log to msg::helper
Also make runcmd and get_sources log what they do, to the admin log.

This originally comes from radicle-ci-ambient, the Radicle CI adapter
for Ambient.

Signed-off-by: Lars Wirzenius <liw@liw.fi>
2025-03-05 09:07:30 +02:00
Lars Wirzenius 43306e1513 feat: output trigger event to stdout, file
Signed-off-by: Lars Wirzenius <liw@liw.fi>
2025-03-04 18:43:57 +02:00
Lars Wirzenius fe9ffca3d2 feat: cibool run remove
Also fix Db::remove_run, which has never actually worked, because the
run id column was named wrongly. Oops.

Signed-off-by: Lars Wirzenius <liw@liw.fi>
2025-03-04 17:43:05 +02:00
Lars Wirzenius e167d05e04 feat: msg::helper::runcmd takes a non-empty argv vector
This makes is the empty-argv mistake that much easier to avoid.

Signed-off-by: Lars Wirzenius <liw@liw.fi>
2025-03-04 12:14:29 +02:00
Lars Wirzenius 23ad83a969 chore(deny.toml): allow multiple versions
Everything works, binary is just a bit bigger. To avoid duplicates
would require co-ordination between various parties in the dependency
graph, and while that'd be worthwhile, it's too much work for now.

Signed-off-by: Lars Wirzenius <liw@liw.fi>
2025-02-26 17:48:48 +02:00
Lars Wirzenius c7d4f192ea chore(deny.toml): drop unused allowed licenses
Signed-off-by: Lars Wirzenius <liw@liw.fi>
2025-02-26 17:48:48 +02:00
Lars Wirzenius e9a4070b5b chore(deny.toml): ignore advisory: unmaintained proc-macro-error
Can't do anything about it in this crate, the git-ref-format crate or
radicle-git-ext crate needs to change.

Signed-off-by: Lars Wirzenius <liw@liw.fi>
2025-02-26 17:48:48 +02:00
Lars Wirzenius c45291bc6a feat: use the same Oid type everywhere
Previously we imported the Oid type (for Git object identifiers)
different places. This was confusing, and also meant that upgrading a
dependency (radicle-git-ext) broke, because two types with the same
name imported from different versions of the same crate are different
types.

Change this so that radicle::git::Oid is the one true Oid type we use.

Signed-off-by: Lars Wirzenius <liw@liw.fi>
2025-02-26 17:41:08 +02:00
Lars Wirzenius 00ca0e8fcc feat: produce RSS feed of unfinished CI runs
That's CI runs that have been triggered, are running, but have not
finished.

Signed-off-by: Lars Wirzenius <liw@liw.fi>
2025-02-19 17:26:39 +02:00
Lars Wirzenius e69262d186 feat: add metadata about CI run to RSS feed entries
Signed-off-by: Lars Wirzenius <liw@liw.fi>
2025-02-19 17:26:39 +02:00
Lars Wirzenius 0c5eaeb8fa doc(README.md): replace now-faulty examples with pointer to subplot
Signed-off-by: Lars Wirzenius <liw@liw.fi>
2025-02-18 16:51:31 +02:00
Lars Wirzenius 08bcf70308 refactor: simplify patch related constructors for CiEvent
Signed-off-by: Lars Wirzenius <liw@liw.fi>
2025-02-18 16:34:58 +02:00
Lars Wirzenius a01aa8ce49 doc(doc/userguide.md): add DefaultBranch, HasFile, NoneOf, AnyOf, AllOf
Also sort table alphabetically, for easier skimming.

Signed-off-by: Lars Wirzenius <liw@liw.fi>
2025-02-18 15:55:31 +02:00