Posted on ::

I been exploring Ambient CI for some weeks now, for use with Radicle.

  • Install deps (see project README)

  • Install Ambient (it is a Rust project, but Debian packages are also available)

  • Create OS user (adduser rad-ci)

  • Add that user (CI user) to kvm group (adduer rad-ci kvm)

  • Install Rust toolchain with rustup onto that user env

  • Create directory in CI user home, srv

  • Download a QEMU image which will provide an isolated environment where the CI runs

  • Create Ambient config in it, "/home/rad-ci/srv/ambient-ci.yaml"

    image: /home/rad-ci/ambient.qcow2
    logdir: /home/rad-ci/srv/http/ambient-log
    log: /home/rad-ci/srv/ambient-ci.log
    base_url: http://localhost:8080/ambient-log
    
  • Create CI broker config, also in the same dir, "/home/rad-ci/srv/ci-broker.yaml"

    db: /home/rad-ci/srv/ci-broker.db
    report_dir: /home/rad-ci/srv/http
    queue_len_interval: 1min
    adapters:
      ambient:
        command: /bin/radicle-ci-ambient
        env:
          RADICLE_CI_AMBIENT: /home/rad-ci/srv/ambient-ci.yaml
          RADICLE_CI_BROKER_WEBROOT: /home/rad-ci/srv/pages/ci-broker
          PATH: /bin:/usr/local/bin:/home/rad-ci/.cargo/bin
    triggers:
      - adapter: ambient
        filters:
        - !And
          # Run CI when repo has this file
          - !HasFile ".radicle/ambient.yaml"
          - !Or
            - !DefaultBranch
            - !PatchCreated
            - !PatchUpdated
          # Rust CI when any of the above 3 events originated from this node
          - !Node z6MkfPSKW7AgQqXSi8fgEJMduHpm9ABmsPYwPhMeF7PssonK
    
  • Create Radicle node for CI user (sudo --user rad-ci rad auth)

  • Start Radicle node for CI user (sudo --user rad-ci rad node start)

  • Seed repos that are to be watched for CI action (sudo --user rad-ci rad seed $RID), where example $RID is z495gX4yCu5U8PmWBNiGHWEn9wBuz, my blog

  • Run Ambient

    sudo --login --user rad-ci \
      cib \
      --config srv/ci-broker.yaml \
      --log-level info \
      process-events
    
  • Watch logs

    sudo --login --user rad-ci tail -F srv/ambient-ci.lo
    
  • Ensure some repo on node listed in CI broker config has as ".radicle/ambient.yaml" file, trigger CI action, and watch the logs.