Radish alpha
r
rad:zwTxygwuz5LDGBq255RA2CbNGrz8
Radicle CI broker
Radicle
Git
doc: add a "Getting started" section to the user guide
Merged liw opened 1 year ago

Signed-off-by: Lars Wirzenius liw@liw.fi

1 file changed +114 -0 7cab201b 6dc057e2
modified doc/userguide.md
@@ -43,6 +43,120 @@ also the "native adapter", that runs a shell script locally on the
host where the adapter runs. Each adapter may require a different
configuration to suit the CI system it targets.

+
# Getting started
+

+
To use Radicle CI, you first need to have a Radicle node where you
+
want to run CI. Due to technical limitations, this can't be your usual
+
node, because it won't react to changes you push to it, only to
+
changes it receives from other nodes.
+

+
Once you've [installed a Radicle node and it is
+
running](https://radicle.xyz/#get-started):
+

+
* Install the Radicle CI broker. Currently this is easiest to by
+
  building the latest release from source. This requires the Rust
+
  compiler and tools to be installed.
+

+
~~~sh
+
cargo install radicle-ci-broker --locked
+
~~~
+

+
* Install the Radicle native CI adapter. This is the simplest adapter
+
  to get to work, even if you don't want to use it later.
+

+
~~~sh
+
cargo install radicle-native-ci --locked
+
~~~
+

+
* Create a configuration file. You can call the file anything you like
+
  (the example below assumes `cib.yaml`). You should ensure the
+
  Radicle node is below is your normal node. You should make sure the
+
  `report_dir` field points to a directory that exists. The example
+
  below assumes `_rad` user; adjust paths as necessary.
+

+
~~~yaml
+
db: /home/_rad/ci-broker.db
+
report_dir: /srv/http
+
queue_len_interval: 1min
+
adapters:
+
  native:
+
    command: /bin/radicle-native-ci
+
    env:
+
      RADICLE_NATIVE_CI: /home/_rad/native-ci.yaml
+
      PATH: /bin:/home/_rad/.radicle/bin:/home/_rad/.cargo/bin
+
    sensitive_env: {}
+
triggers:
+
  - adapter: native
+
    filters:
+
    - !And
+
      - !HasFile ".radicle/native.yaml"
+
      - !Node z6MkgEMYod7Hxfy9qCvDv5hYHkZ4ciWmLFgfvm3Wn1b2w2FV
+
      - !Or
+
        - !DefaultBranch
+
        - !PatchCreated
+
        - !PatchUpdated
+
~~~
+

+
* Create a configuration file for the native CI adapter. Place it in
+
  the location specified in `cib.yaml` above in the
+
  `RADICLE_NATIVE_CI` environment variable.
+

+
~~~yaml
+
state: /srv/http
+
log: /home/_rad/native-ci.log
+
base_url: http://setup-ci/
+
~~~
+

+
* Start the CI adapter:
+

+
~~~sh
+
cib --config cib.yaml process-events
+
~~~
+

+
You can also set up a web server to serve the files in `report_dir`
+
directory over HTTP (with TLS, by preference). They are static files,
+
which are easy to serve. Any web server can do it. You can copy the
+
files to another server too, if you prefer.
+

+
To test this, tell your seed node to seed the Radicle CI example
+
project. (You can also seed any other repository, but the example is
+
there to make it easy to try this out.) You will need to do this from
+
a different shell session (terminal window or tab) than the previous
+
command:
+

+
~~~sh
+
rad seed rad:z28U8KUBvVSMQc13NydX3LBDsdEdQ
+
~~~
+

+
Then push a patch to this repository, from your usual node, not the CI
+
node.
+

+
~~~sh
+
rad clone rad:z28U8KUBvVSMQc13NydX3LBDsdEdQ
+
cd radicle-ci-example
+
git switch -c patch
+
date > date
+
git add date
+
git commit -m trigger
+
git push rad HEAD:refs/patches
+
~~~
+

+
Check the report file to see that it works.
+

+
* `/home/_rad/native-ci.log`
+
* `/srv/http/index.html`
+
* With your web browser the URL to where the report directory gets
+
  published.
+

+
If all works, excellent. If not, and you need help, drop by the
+
[Radicle Zulip](https://radicle.zulipchat.com/) chat for ask for help.
+

+
Next, you probably want to consider what adapter you want to use. See
+
the
+
[`radicle-ci-integrations-docs`](https://explorer.radicle.gr/nodes/seed.radicle.gr/rad:z4Uh671FzoooaHjLvmtW9BtGMF9qm)
+
repository for a list.
+

+

# Configuration

The CI broker must be started with a configuration file. The `config`