"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>
Adjust log levels for messages, move data from free-form text field
into extra fields (even if still in free-form text form, as debug
formatted Rust values), and other related changes.
Signed-off-by: Lars Wirzenius <liw@liw.fi>
Add support to "cibtool event add" for branch deletion, and patch
creation and update events. Use this in a scenario that adds every
type of event to the queue and processes them. This ensures the CI
broker can actually handle any kind of CI event.
Signed-off-by: Lars Wirzenius <liw@liw.fi>
`subplot docgen` fails if an embedded file is not used. Drop the three
files that are no longer used.
This would've been found earlier if I gated merges on CI passing.
Signed-off-by: Lars Wirzenius <liw@liw.fi>
This is primarily a stop-gap measure so I can have some notification
of CI runs, without having to manually check the report page. It may
also be useful for other people, who do not use Radicle themselves,
but are interested in CI runs on Radicle nodes.
Signed-off-by: Lars Wirzenius <liw@liw.fi>
This is simpler to understand, for most readers of the subplot, than
installing a file and adjusting its Unix permissions with chmod.
Signed-off-by: Lars Wirzenius <liw@liw.fi>
Add a new type for sensitive values, for `sensitive_envs`.
The CI broker can define sensitive environment variables for each
adapter, in the `sensitive_envs` field in the configuration file. The
idea is the this can be used to configure, say, API keys that the CI
run needs. To avoid them leaking accidentally, the code tries to
prevent the sensitive value from being printed. However, there have
been case where this has failed to be done correctly. The problem is
that each place where the `Config` value is used needs to be careful
to avoid leaking sensitive data.
The new type provides the protection in a more concentrated location.
The value can be created via serde de-serialization, but can't be
printed using normal formatting, debug formatting, or serde
serialization. This doesn't protect against the sensitive value
leaking via a core dump, or direct memory reading.
None of this makes it a good idea to use environment variables to
convey sensitive values. They're a bad idea and one should find a
better way to achieve the same thing. However, as long as the CI
broker provides the `sensitive_envs` configuration variable the least
it can do is try to make it hard to accidentally leak the values.
This is not a breaking change.
Signed-off-by: Lars Wirzenius <liw@liw.fi>
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>
Change the dummy adapter to read the trigger message from its stdin.
This prevents a race condition where the adapter exits before the CI
broker has time to write the trigger message to the adapter.
Signed-off-by: Lars Wirzenius <liw@liw.fi>