Radish alpha
r
Radicle CI broker
Radicle
Git (anonymous pull)
Log in to clone via SSH
enriches broker request payload to enable complex workflows in external CI
Yorgos Saslis committed 2 years ago
commit a00212538ba5ec909a05a8933360520af93b303d
parent 93654fa547eee7f6cf92add54a6824d71db28a79
1 file changed +133 -6
modified doc/architecture.md
@@ -76,24 +76,151 @@ run. If the CI engine calls back via web hook to notify of the run
finishing, the adapter process needs to receive the call and process
it.

+
External CI engines allow complex pipelines to be written and support 
+
a variety of workflows. Different jobs or tasks can be triggered
+
based on different events (e.g. `push`, `patch created`, `patch 
+
updated`, etc.), to satisfy different workflow needs. Some examples 
+
of real-world use-cases:
+

+
- trigger "fast" tests on every push to any branch
+
- trigger "relatively fast" tests only when a Patch is created / 
+
updated
+
- trigger "full test suite" on every push to the default branch (e.g. 
+
`main`)
+

+
In order to allow developers using Radicle the same flexibility that
+
they are used to on other forges, we want the broker to pass on 
+
whatever information it already has from the node events to the 
+
adapters, so they can pass it on to external CI systems, as appropriate. 
+

# Request and response messages

Note: the JSON objects below are formatted on multiple lines to make
them easier to read. The actual wire format is one line per message.

-
The request that the broker sends looks like this:
+

+
## Push Event Request
+

+
An example request that the broker sends looks like this:

~~~{.json .numberLines}
{
    "request": "trigger",
-
    "repo": "<RID>",
-
    "commit": "<COMMIT>"
+
    "event-type": "push",
+
    "pusher": {
+
        "id": "did:key:z6MkltRpzcq2ybm13yQpyre58JUeMvZY6toxoZVpLZ8YabRa",
+
        "alias": "node_alias"
+
    },
+
    "before": "<BEFORE_COMMIT>",
+
    "after": "<AFTER_COMMIT>",
+
    "commits": [
+
        "<SOME_OTHER_COMMIT_BEING_PUSHED>",
+
        "<AFTER_COMMIT>"
+
    ],
+
    "repository": {
+
        "id": "<RID>",
+
        "name": "heartwood",
+
        "description": "Radicle is a sovereign peer-to-peer network for 
+
        code collaboration, built on top of Git.",
+
        "private": false,
+
        "default_branch": "main",
+
        "delegates": [
+
          "did:key:z6MkltRpzcq2ybm13yQpyre58JUeMvZY6toxoZVpLZ8YabRa",
+
          "did:key:z6MkltRpzcq2ybm13yQpyre58JUeMvZY6toxoZVpLZ8YabRb"
+
        ]
+
    }
}
~~~

-
where `<RID>` is the repository ID, and `<COMMIT>` is the commit id
-
(the SHA checksum). The `request` fields allows us to extend this in
-
the future.
+
where:
+
  - `<RID>` is the repository ID, in its `rad:` URN format,
+
  - `<AFTER_COMMIT>` is the commit id of the last commit being pushed,
+
  - `<BEFORE_COMMIT>` is the commit id of the **parent** of the first 
+
commit being pushed (i.e. ` <SOME_OTHER_COMMIT_BEING_PUSHED>`),
+
(the SHA checksum). 
+

+
The `request` fields allows us to extend this in the future.
+

+
## Patch Event Request
+

+
An example request that the broker sends looks like this:
+

+
~~~{.json .numberLines}
+
{
+
    "request": "trigger",
+
    "event-type": "patch",
+
    "action": "created|updated",
+
    "patch": {
+
        "id": "<PATCH_ID>",
+
        "author": {
+
            "id": "did:key:z6MkltRpzcq2ybm13yQpyre58JUeMvZY6toxoZVpLZ8YabRa",
+
            "alias": "node_alias"
+
        },
+
        "title": "Add description in README",
+
        "state": {
+
            "status": "Open",
+
            "conflicts": [
+
                {
+
                    "revisionId": "string",
+
                    "oid": "string"
+
                }
+
            ]
+
        },
+
        "before": "<BEFORE_COMMIT>",
+
        "after": "<AFTER_COMMIT>",
+
        "commits": [
+
            "<SOME_OTHER_COMMIT_BEING_PUSHED>",
+
            "<AFTER_COMMIT>"
+
        ],
+
        "target": "delegates",
+
        "labels": [
+
            "small",
+
            "goodFirstIssue",
+
            "enhancement",
+
            "bug"
+
        ],
+
        "assignees": [
+
            "did:key:z6MkltRpzcq2ybm13yQpyre58JUeMvZY6toxoZVpLZ8YabRa"
+
        ],
+
        "revisions": [
+
            {
+
                "id": "41aafe22200464bf905b143d4233f7f1fa4a9123",
+
                "author": {
+
                    "id": "did:key:z6MkltRpzcq2ybm13yQpyre58JUeMvZY6toxoZVpLZ8YabRa",
+
                    "alias": "my_alias"
+
                },
+
                "description": "The revision description",
+
                "base": "193ed2f675ac6b0d1ab79ed65057c8a56a4fab23",
+
                "oid": "f0f5d38ffa8d54a7cc737fc4e75ab1e2e178eaa1",
+
                "timestamp": 1699437445
+
            }
+
        ]
+
    },
+
    "repository": {
+
        "id": "<RID>",
+
        "name": "heartwood",
+
        "description": "Radicle is a sovereign peer-to-peer network for 
+
        code collaboration, built on top of Git.",
+
        "private": false,
+
        "default_branch": "main",
+
        "delegates": [
+
          "did:key:z6MkltRpzcq2ybm13yQpyre58JUeMvZY6toxoZVpLZ8YabRa",
+
          "did:key:z6MkltRpzcq2ybm13yQpyre58JUeMvZY6toxoZVpLZ8YabRb"
+
        ]
+
    }
+
}
+
~~~
+

+
where:
+
  - `<RID>` is the repository ID, in its `rad:` URN format,
+
  - `<AFTER_COMMIT>` is the commit id of the last commit being pushed,
+
  - `<BEFORE_COMMIT>` is the commit id of the **parent** of the first 
+
commit being pushed (i.e. ` <SOME_OTHER_COMMIT_BEING_PUSHED>`),
+
(the SHA checksum). 
+

+
The `request` fields allows us to extend this in the future.
+

+
## Responses

The first response from the adapter looks like this: