We used to parse the ref name to find out the branch name, when
creating a trigger message. The CI events now do that for us. This
meant that parsing the branch name failed, and resulted in the empty
string.
Fix this by using already-parsed branch name from the CI event instead
of trying to parse it again.
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 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>
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>
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>
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>
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>
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>