Radish alpha
r
Radicle CI broker
Radicle
Git (anonymous pull)
Log in to clone via SSH
test(ci-broker.md): verify event filter BranchCreated
Lars Wirzenius committed 1 year ago
commit bb5cf1273a3aa88f089e7cc938a5044442076368
parent d1e9b5e159cbc0ef58012534efd8a6f03181885f
1 file changed +33 -0
modified ci-broker.md
@@ -876,6 +876,39 @@ triggers:
      - !Branch "main"
~~~

+
## Filter predicate `BranchCreated`
+

+
_Want:_ We can allow an event for a branch having been created.
+

+
_Why:_ We want to constrain CI to only new branches.
+

+
~~~scenario
+
given a Radicle node, with CI configured with broker.yaml and adapter dummy.sh
+
given a Git repository xyzzy in the Radicle node
+

+
given file config.yaml from filter-branchcreated.yaml
+

+
when I run cibtool --db ci-broker.db event add --repo xyzzy --ref main --commit HEAD --kind branch-created
+
when I run cibtool --db ci-broker.db event add --repo xyzzy --ref oksa --commit HEAD --kind branch-updated --base main
+

+
when I run ./env.sh cib --config config.yaml queued
+

+
when I run cibtool --db ci-broker.db run list --json
+
then stdout contains "/refs/heads/main"
+
then stdout doesn't contain "/refs/heads/oksa"
+
~~~
+

+
~~~{#filter-branchcreated.yaml .file .json}
+
db: ci-broker.db
+
adapters:
+
  default:
+
    command: ./adapter.sh
+
triggers:
+
  - adapter: default
+
    filters:
+
      - !BranchCreated
+
~~~
+

# Acceptance criteria for test tooling

The event synthesizer is a helper to feed the CI broker node events in