This makes it easier to specify several adapters, with varying
configurations, by not having to put the configuration for each
specification in a separate file.
Signed-off-by: Lars Wirzenius <liw@liw.fi>
For a reason I do not entirely understand, the upgrade test started
failing when I removed `rust-toolchain` from the **current** git, even
though old releases still have it. The failures are due to warnings.
Work around this by removing the `#![deny(...)]` and `#[deny(...)]`
lines from the source of the old releases.
Signed-off-by: Lars Wirzenius <liw@liw.fi>
Oops. Brown paper bag moment.
This undoes the type mangling to ensure the field value is never zero,
in favor of doing run time logic. That should be done with types some
day, but today I need to get running.
Signed-off-by: Lars Wirzenius <liw@liw.fi>
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>
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>
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>
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>
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>
Change the logical negation operator `Not` to take a list of filters
as operands. The operator returns true, if and only if all of the
operands are false. The syntax is now consistent with logical `And`
and `Or`, which simplifies code, and is expected to simplify use.
In YAML syntax, `Not` now works like this:
~~~
!Not
- !Allow
~~~
Previously, `!Not` only had one operand, so that above would have been
expressed as `!Not Allow`.
Signed-off-by: Lars Wirzenius <liw@liw.fi>
"cibtool trigger" option "--ref" defaults to "main" and "--commit" to
"HEAD", and there's no need to say those explicitly.
Signed-off-by: Lars Wirzenius <liw@liw.fi>
While setting up a Nix flake, a series of tests were failing due to shell
invocations. The falling were the changes required:
- Use `!#/bin/sh` instead of `!#/bin/bash`
- Use `$$` instead of `$BASHPID`
- Use `true` and `false` instead of `/bin/true` and `/bin/false`
It was also noted that the `git-remote-helper` is needed alongside the `rad`
binary for some of the acceptance tests to work.
Move CI event filtering from the queue adder to the queue processor.
This is ground work for supporting different adapters for different
runs.
Later, each "trigger" will have a separate filter, and if the filter
allows an event, the adapter for that trigger is run. However, we have
no way to communicate the chosen adapter via the event queue in the
database, without making a breaking database schema, which I would
prefer to avoid.
Instead, we add all events into the queue, and filter when we remove
them from the queue. This may be a little wasteful in terms of disk
space and I/O, if there are very large numbers of events. If this
turns out to be too expensive, we'll revert this change and do a
breaking schema change.
Signed-off-by: Lars Wirzenius <liw@liw.fi>
The configuration file can have a field `queue_len_interval`, and
defaults to 10 seconds. This should reduce log spam.
Signed-off-by: Lars Wirzenius <liw@liw.fi>
Previously, we failed to capture all of stderr from the adapter if the
adapter sent messages to its stdout could not be parsed, or otherwise
meant the CI broker deduced the CI run had failed. Now we read all of
stderr (module time limits) before returning an error result.
Signed-off-by: Lars Wirzenius <liw@liw.fi>
Add subcommand "cibtool log" to extract cib log messages from journald
logs, and pretty print them. Optionally with some very rudimentary
filtering based on log level, message kind, or broker run id.
Example:
sudo journalctl -S today -u radicle-ci-broker -o json | cibtool log --log-level info
Signed-off-by: Lars Wirzenius <liw@liw.fi>