Radish alpha
r
rad:zwTxygwuz5LDGBq255RA2CbNGrz8
Radicle CI broker
Radicle
Git
feat: `cibtool event add` defaults to `HEAD` commit of chosen ref
Lars Wirzenius committed 8 months ago
commit a13b5a9868b4a6f4ebc60b6e20448f179024785b
parent 562465e
2 files changed +42 -42
modified ci-broker.md
@@ -700,7 +700,7 @@ Verify that `cib` can process a branch creation event.

~~~
when I run rm -f ci-broker.db
-
when I run cibtool --db ci-broker.db event add --repo xyzzy --commit HEAD --kind branch-created --id-file id.txt
+
when I run cibtool --db ci-broker.db event add --repo xyzzy --kind branch-created --id-file id.txt
when I run ./env.sh cib --config broker.yaml queued
when I run cibtool --db ci-broker.db run list
then stdout has one line
@@ -710,7 +710,7 @@ Verify that `cib` can process a branch update event.

~~~
when I run rm -f ci-broker.db
-
when I run cibtool --db ci-broker.db event add --repo xyzzy --ref brancy --commit HEAD --base main --kind branch-updated --id-file id.txt
+
when I run cibtool --db ci-broker.db event add --repo xyzzy --ref brancy --base main --kind branch-updated --id-file id.txt
when I run ./env.sh cib --config broker.yaml queued
when I run cibtool --db ci-broker.db run list
then stdout has one line
@@ -720,7 +720,7 @@ Verify that `cib` can process a branch deletion event.

~~~
when I run rm -f ci-broker.db
-
when I run cibtool --db ci-broker.db event add --repo xyzzy --commit HEAD --kind branch-deleted --id-file id.txt
+
when I run cibtool --db ci-broker.db event add --repo xyzzy --kind branch-deleted --id-file id.txt
when I run ./env.sh cib --config broker.yaml queued
when I run cibtool --db ci-broker.db run list
then stdout has one line
@@ -730,7 +730,7 @@ Verify that `cib` can process a patch creation event.

~~~
when I run rm -f ci-broker.db
-
when I run cibtool --db ci-broker.db event add --repo xyzzy --commit HEAD --kind patch-created --patch-id-file patch-id.txt --id-file id.txt
+
when I run cibtool --db ci-broker.db event add --repo xyzzy --kind patch-created --patch-id-file patch-id.txt --id-file id.txt
when I run ./env.sh cib --config broker.yaml queued
when I run cibtool --db ci-broker.db run list
then stdout has one line
@@ -740,7 +740,7 @@ Verify that `cib` can process a patch update event.

~~~
when I run rm -f ci-broker.db
-
when I run cibtool --db ci-broker.db event add --repo xyzzy --commit HEAD --kind patch-updated --patch-id-file patch-id.txt --id-file id.txt
+
when I run cibtool --db ci-broker.db event add --repo xyzzy --kind patch-updated --patch-id-file patch-id.txt --id-file id.txt
when I run ./env.sh cib --config broker.yaml queued
when I run cibtool --db ci-broker.db run list
then stdout has one line
@@ -1021,7 +1021,7 @@ given a Git repository xyzzy in the Radicle node
given a directory reports

when I run ./env.sh cibtool --db ci-broker.db event add --repo xyzzy --commit f42ea5cb9ce2dc7a9b87834ccee5b9bb3867db90 --kind branch-updated --base main
-
when I run ./env.sh cibtool --db ci-broker.db event add --repo xyzzy --commit HEAD --kind branch-updated --base main
+
when I run ./env.sh cibtool --db ci-broker.db event add --repo xyzzy --kind branch-updated --base main

when I run ./env.sh cib --config broker.yaml queued
then stderr contains "f42ea5cb9ce2dc7a9b87834ccee5b9bb3867db90"
@@ -1224,8 +1224,8 @@ 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 --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 cibtool --db ci-broker.db event add --repo xyzzy --kind branch-created
+
when I run cibtool --db ci-broker.db event add --repo xyzzy --ref oksa --kind branch-updated --base main

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

@@ -1259,8 +1259,8 @@ given a Git repository xyzzy in the Radicle node

given file config.yaml from filter-branchupdated.yaml

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

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

@@ -1294,8 +1294,8 @@ given a Git repository xyzzy in the Radicle node

given file config.yaml from filter-branchdeleted.yaml

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

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

@@ -1328,8 +1328,8 @@ given a Git repository xyzzy in the Radicle node

given file config.yaml from filter-allow.yaml

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

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

@@ -1362,8 +1362,8 @@ given a Git repository xyzzy in the Radicle node

given file config.yaml from filter-deny.yaml

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

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

@@ -1397,8 +1397,8 @@ given a Git repository xyzzy in the Radicle node

given file config.yaml from filter-and.yaml

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

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

@@ -1434,8 +1434,8 @@ given a Git repository xyzzy in the Radicle node

given file config.yaml from filter-or.yaml

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

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

@@ -1470,8 +1470,8 @@ given a Git repository xyzzy in the Radicle node

given file config.yaml from filter-not.yaml

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

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

@@ -1507,8 +1507,8 @@ given a Git repository xyzzy in the Radicle node

given file config.yaml from filter-defaultbranch.yaml

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

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

@@ -1542,13 +1542,13 @@ 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-hasfile-missing.yaml
-
when I run cibtool --db ci-broker.db event add --repo xyzzy --commit HEAD --kind branch-created
+
when I run cibtool --db ci-broker.db event add --repo xyzzy --kind branch-created
when I run ./env.sh cib --config config.yaml queued
when I run cibtool --db ci-broker.db run list --json
then stdout doesn't contain "main"

given file config.yaml from filter-hasfile.yaml
-
when I run cibtool --db ci-broker.db event add --repo xyzzy --commit HEAD --kind branch-created
+
when I run cibtool --db ci-broker.db event add --repo xyzzy --kind branch-created
when I run ./env.sh cib --config config.yaml queued
when I run cibtool --db ci-broker.db run list --json
then stdout contains "main"
@@ -1778,7 +1778,7 @@ down.
given a Radicle node, with CI configured with broker.yaml and adapter dummy.sh
given a Git repository testy in the Radicle node

-
when I run ./env.sh cibtool --db ci-broker.db event add --repo testy --commit HEAD --kind branch-updated --base main
+
when I run ./env.sh cibtool --db ci-broker.db event add --repo testy --kind branch-updated --base main
when I run cibtool --db ci-broker.db event shutdown

given a directory reports
@@ -1901,7 +1901,7 @@ given a Git repository xyzzy in the Radicle node
when I run cibtool --db x.db event list
then stdout is empty

-
when I run ./env.sh cibtool --db x.db event add --repo xyzzy --commit HEAD --base HEAD --id-file id.txt --kind branch-updated
+
when I run ./env.sh cibtool --db x.db event add --repo xyzzy --base HEAD --id-file id.txt --kind branch-updated

when I run cibtool --db x.db event show --id-file id.txt
then stdout contains "rad:"
@@ -1930,12 +1930,12 @@ given a Git repository testy in the Radicle node
when I run cibtool --db x.db event list
then stdout is empty

-
when I run ./env.sh cibtool --db x.db event add --repo testy --commit HEAD --base HEAD --kind branch-updated
-
when I run ./env.sh cibtool --db x.db event add --repo testy --commit HEAD --base HEAD --kind branch-updated
-
when I run ./env.sh cibtool --db x.db event add --repo testy --commit HEAD --base HEAD --kind branch-updated
-
when I run ./env.sh cibtool --db x.db event add --repo testy --commit HEAD --base HEAD --kind branch-updated
-
when I run ./env.sh cibtool --db x.db event add --repo testy --commit HEAD --base HEAD --kind branch-updated
-
when I run ./env.sh cibtool --db x.db event add --repo testy --commit HEAD --base HEAD --kind branch-updated
+
when I run ./env.sh cibtool --db x.db event add --repo testy --base HEAD --kind branch-updated
+
when I run ./env.sh cibtool --db x.db event add --repo testy --base HEAD --kind branch-updated
+
when I run ./env.sh cibtool --db x.db event add --repo testy --base HEAD --kind branch-updated
+
when I run ./env.sh cibtool --db x.db event add --repo testy --base HEAD --kind branch-updated
+
when I run ./env.sh cibtool --db x.db event add --repo testy --base HEAD --kind branch-updated
+
when I run ./env.sh cibtool --db x.db event add --repo testy --base HEAD --kind branch-updated

when I run cibtool --db x.db event remove --all
when I run cibtool --db x.db event list
@@ -1977,7 +1977,7 @@ given a Radicle node, with CI configured with broker.yaml and adapter dummy.sh
given a Git repository xyzzy in the Radicle node

when I run ./env.sh env -C xyzzy git switch -c oksa
-
when I run ./env.sh cibtool --db x.db event add --repo xyzzy --ref oksa --commit HEAD --kind branch-created
+
when I run ./env.sh cibtool --db x.db event add --repo xyzzy --ref oksa --kind branch-created

when I run cibtool --db x.db event list --json
then stdout contains "BranchCreated"
@@ -1997,7 +1997,7 @@ given a Radicle node, with CI configured with broker.yaml and adapter dummy.sh
given a Git repository xyzzy in the Radicle node

when I run ./env.sh env -C xyzzy git switch -c oksa
-
when I run ./env.sh cibtool --db x.db event add --repo xyzzy --ref oksa --commit HEAD --kind branch-updated --base HEAD
+
when I run ./env.sh cibtool --db x.db event add --repo xyzzy --ref oksa --kind branch-updated --base HEAD

when I run cibtool --db x.db event list --json
then stdout contains "BranchUpdated"
@@ -2017,7 +2017,7 @@ given a Radicle node, with CI configured with broker.yaml and adapter dummy.sh
given a Git repository xyzzy in the Radicle node

when I run ./env.sh env -C xyzzy git switch -c oksa
-
when I run ./env.sh cibtool --db x.db event add --repo xyzzy --ref oksa --commit HEAD --kind branch-deleted
+
when I run ./env.sh cibtool --db x.db event add --repo xyzzy --ref oksa --kind branch-deleted

when I run cibtool --db x.db event list --json
then stdout contains "BranchDeleted"
@@ -2037,7 +2037,7 @@ given a Radicle node, with CI configured with broker.yaml and adapter dummy.sh
given a Git repository xyzzy in the Radicle node

when I run ./env.sh env -C xyzzy git switch -c oksa
-
when I run ./env.sh cibtool --db x.db event add --repo xyzzy --ref oksa --commit HEAD --kind patch-created --patch-id f863364f6774160607d90811b06a0e401c097466
+
when I run ./env.sh cibtool --db x.db event add --repo xyzzy --ref oksa --kind patch-created --patch-id f863364f6774160607d90811b06a0e401c097466

when I run cibtool --db x.db event list --json
then stdout contains "PatchCreated"
@@ -2057,7 +2057,7 @@ given a Radicle node, with CI configured with broker.yaml and adapter dummy.sh
given a Git repository xyzzy in the Radicle node

when I run ./env.sh env -C xyzzy git switch -c oksa
-
when I run ./env.sh cibtool --db x.db event add --repo xyzzy --ref oksa --commit HEAD --kind patch-updated --patch-id f863364f6774160607d90811b06a0e401c097466
+
when I run ./env.sh cibtool --db x.db event add --repo xyzzy --ref oksa --kind patch-updated --patch-id f863364f6774160607d90811b06a0e401c097466

when I run cibtool --db x.db event list --json
then stdout contains "PatchUpdated"
@@ -2295,11 +2295,11 @@ Note that we verify both lookup by name and by repository ID, and by
given a Radicle node, with CI configured with broker.yaml and adapter dummy.sh
given a Git repository testy in the Radicle node

-
when I try to run ./env.sh cibtool --db x.db event add --repo missing --commit HEAD --base c0ffee --kind branch-updated
+
when I try to run ./env.sh cibtool --db x.db event add --repo missing --base c0ffee --kind branch-updated
then command fails
then stderr contains "missing"

-
when I try to run ./env.sh cibtool --db x.db event add --repo rad:z3byzFpcfbMJBp4tKYyuuTZiP8WUB --commit HEAD --base c0ffee --kind branch-updated
+
when I try to run ./env.sh cibtool --db x.db event add --repo rad:z3byzFpcfbMJBp4tKYyuuTZiP8WUB --base c0ffee --kind branch-updated
then command fails
then stderr contains "rad:z3byzFpcfbMJBp4tKYyuuTZiP8WUB"

modified src/bin/cibtoolcmd/event.rs
@@ -85,7 +85,7 @@ pub struct AddEvent {
    /// Set the commit the event refers to. Can be the SHA1 commit id,
    /// or a symbolic Git revision, as understood by `git rev-parse`.
    /// For example, `HEAD`.
-
    #[clap(long)]
+
    #[clap(long, default_value = "HEAD")]
    commit: String,

    /// Type of event to create.