154 Commits
Author SHA1 Message Date
Lars Wirzenius 28ee4580e0 test(ci-broker.md): verify event filter Deny
Signed-off-by: Lars Wirzenius <liw@liw.fi>
2025-01-29 17:42:49 +02:00
Lars Wirzenius 568592aabc test(ci-broker.md): verify event filter Allow
Signed-off-by: Lars Wirzenius <liw@liw.fi>
2025-01-29 17:42:49 +02:00
Lars Wirzenius e0a967af68 test(ci-broker.md): verify event filter BranchDeleted
Signed-off-by: Lars Wirzenius <liw@liw.fi>
2025-01-29 17:42:49 +02:00
Lars Wirzenius 791b7cad6d test(ci-broker.md): verify event filter BranchUpdated
Signed-off-by: Lars Wirzenius <liw@liw.fi>
2025-01-29 17:42:49 +02:00
Lars Wirzenius bb5cf1273a test(ci-broker.md): verify event filter BranchCreated
Signed-off-by: Lars Wirzenius <liw@liw.fi>
2025-01-29 17:42:47 +02:00
Lars Wirzenius d1e9b5e159 test(ci-broker.md): verify event filter Branch
Signed-off-by: Lars Wirzenius <liw@liw.fi>
2025-01-29 17:42:37 +02:00
Lars Wirzenius 59deeed8c1 test(ci-broker.md): verify event filter Node
Signed-off-by: Lars Wirzenius <liw@liw.fi>
2025-01-29 17:41:37 +02:00
Lars Wirzenius 2ea38588ad test(ci-broker.md): verify event filter Repository
Signed-off-by: Lars Wirzenius <liw@liw.fi>
2025-01-29 17:41:16 +02:00
Lars Wirzenius c4bae7b09b test(ci-broker.md): use cibtool trigger option defaults
"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>
2025-01-29 17:41:06 +02:00
Lars Wirzenius f65a5b83b3 tests: trim releases for upgrade testing
Signed-off-by: Lars Wirzenius <liw@liw.fi>
2025-01-29 11:27:58 +02:00
Lars Wirzenius f736bdf8e6 tests(ci-broker.md): document what to upgrade test, use commits
Signed-off-by: Lars Wirzenius <liw@liw.fi>
2025-01-29 10:23:33 +02:00
Lars Wirzenius ba9b4365f9 fix(ci-broker.md): drop bashism: set -o pipefail.
On a machine where /bin/sh it not Bash, the pipefail setting will
fail.

Signed-off-by: Lars Wirzenius <liw@liw.fi>
2025-01-27 18:01:24 +02:00
Fintan Halpenny 8cbc1fe313 refactor: change test shell commands
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.
2025-01-24 10:23:49 +00:00
Lars Wirzenius c239dfb0a9 fix(ci-broker.md): drop unused embedded file
Unused files make `subplot docgen` fail unless it's given the
`--merciful` option.

Signed-off-by: Lars Wirzenius <liw@liw.fi>
2025-01-22 09:46:51 +02:00
Lars Wirzenius aaf687376c tests: add scenarios to verify new "triggers" functionality
Also add a useful extra step.

Signed-off-by: Lars Wirzenius <liw@liw.fi>
2025-01-21 19:11:39 +02:00
Lars Wirzenius ba644e14d6 feat: filter queued events when they are processed
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>
2025-01-21 17:00:19 +02:00
Lars Wirzenius 30fcabba09 test: adjust upgrade test to cover recent releases
Signed-off-by: Lars Wirzenius <liw@liw.fi>
2025-01-15 11:57:23 +02:00
Lars Wirzenius f814880aeb feat: make cibool trigger --ref be preferred over --name
Either will continue to work.

Signed-off-by: Lars Wirzenius <liw@liw.fi>
2025-01-14 19:11:34 +02:00
Lars Wirzenius cadb933d41 feat: allow setting how often the event queue length is logged
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>
2025-01-14 17:10:31 +02:00
Lars Wirzenius 09db9b7674 fix: capture and log all stderr from adapter
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>
2025-01-08 14:26:46 +02:00
Lars Wirzenius 9f5fff09b0 feat: subcommand "log" to format and filter cib logs from journald
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>
2024-12-12 17:35:22 +02:00
Lars Wirzenius 3ce84a47c0 test: in acceptance scenarios, search for log ids, not message texts
Signed-off-by: Lars Wirzenius <liw@liw.fi>
2024-12-11 12:23:05 +02:00
Lars Wirzenius a7c9bd13c5 feat: don't crash when failing to create trigger message
Signed-off-by: Lars Wirzenius <liw@liw.fi>
2024-12-09 12:44:11 +02:00
Lars Wirzenius 162d80347c chore: tidy up logging
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>
2024-12-05 12:34:13 +02:00
Lars Wirzenius 1bc0ad40dc feat: cibtool can add every type of CI event to event queue
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>
2024-12-05 08:20:04 +02:00
Lars Wirzenius f0a3e65c59 fix: drop unused embedded files from the subplot document
`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>
2024-12-04 10:59:47 +02:00
Lars Wirzenius 4512912804 test: document and test step to construct a refsFetched event
Signed-off-by: Lars Wirzenius <liw@liw.fi>
2024-11-29 10:02:47 +02:00
Lars Wirzenius 4589438f46 test: document and test step to create a repository
Signed-off-by: Lars Wirzenius <liw@liw.fi>
2024-11-29 10:02:47 +02:00
Lars Wirzenius d802be2a69 test: document and test the step to create and configure a node
Signed-off-by: Lars Wirzenius <liw@liw.fi>
2024-11-29 10:02:47 +02:00
Lars Wirzenius d7428e5f94 chore: drop unused scenario step implementations
Signed-off-by: Lars Wirzenius <liw@liw.fi>
2024-11-29 10:02:47 +02:00
Lars Wirzenius a1ff0a41b7 test: use new scenario steps in all scenarios
Signed-off-by: Lars Wirzenius <liw@liw.fi>
2024-11-29 10:02:47 +02:00
Lars Wirzenius 964d3e1ed2 test: add higher level scenario steps
These are q step towards making scenarios less mired with test
implementation details.

Signed-off-by: Lars Wirzenius <liw@liw.fi>
2024-11-29 10:02:44 +02:00
Lars Wirzenius d7bccbfc0b fix: don't run tidy in subplot
Signed-off-by: Lars Wirzenius <liw@liw.fi>
2024-11-13 18:13:21 +02:00
Lars Wirzenius 4caab2118c feat: generate RSS feeds for all, failed CI runs
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>
2024-11-13 18:06:19 +02:00
Lars Wirzenius c377b05a97 test: add step to install an adapter
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>
2024-11-12 16:50:19 +02:00
Lars Wirzenius d76efe4007 test: have just one step to install all of CI broker
Signed-off-by: Lars Wirzenius <liw@liw.fi>
2024-11-12 16:04:59 +02:00
Lars Wirzenius 842ce74f02 test: add new step "then stdout is empty"
This is a little clearer than 'then stdout is exactly ""'

Signed-off-by: Lars Wirzenius <liw@liw.fi>
2024-11-12 15:34:32 +02:00
Lars Wirzenius 5aea92df7b feat: make it harder to leak sensitive environment variables
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>
2024-11-12 08:17:43 +02:00
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 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 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 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 31e930aecf tests(ci-broker.md): update acceptance criteria for new CI events 2024-09-30 12:58:16 +03:00
Lars Wirzenius 975ce518fe tests: verify that cib produces expected log messages
Signed-off-by: Lars Wirzenius <liw@liw.fi>
2024-09-23 09:24:52 +03:00
Lars Wirzenius bc710c36f1 chore: drop use or RUST_LOG, RADICLE_CI_BROKER_LOG
Neither is used by the CI broker any more.

Signed-off-by: Lars Wirzenius <liw@liw.fi>
2024-09-23 09:10:44 +03:00
Lars Wirzenius c7b0b39367 feat: add cibtool subcommand to use filters on recorded events
Signed-off-by: Lars Wirzenius <liw@liw.fi>
2024-09-12 13:44:54 +03:00
Lars Wirzenius 6981c483c6 feat: add cibtool subcommand to show broker events from node ones
"cibtool event broker" is a complement to "cibtool event record".

Signed-off-by: Lars Wirzenius <liw@liw.fi>
2024-09-12 13:44:54 +03:00
Lars Wirzenius 795dc1c97a feat: add cibtool subcommand for recording node events
Signed-off-by: Lars Wirzenius <liw@liw.fi>
2024-09-12 13:44:54 +03:00
Lars Wirzenius a979033cea fix(ci-broker.md): make dummy adapter read trigger message
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>
2024-09-10 13:46:14 +03:00