// CONTENTS Part 10 · Testing, quality, observability

// PART 10

CI, codegen, and quality checks

Chapter 43 / 56 3 min read English Part 10 of 14

General Bots uses Forgejo (ALM) as Git server with Forgejo Runner for CI/CD. The runner lives in a separate container (alm-ci) and builds are triggered by pushing to the ALM repository.

Build and publish pipeline

Architecture

Component Container Port Purpose
Forgejo (ALM) alm 4747 Git server, workflow definitions
Forgejo Runner alm-ci - CI/CD executor
PostgreSQL tables 5432 CI run database (PROD-ALM)
BotServer (deploy target) system 8080 Receives built binary

Deploy flow: Push to ALM → Runner picks up job → cargo build → tar+gzip binary → SSH to system container → extract to /opt/gbo/bin/botserver → restart via systemctl

Runner facts that prevent the classic failures: Forgejo listens on 4747, not 3000; the runner runs as gbuser with its workspace at /opt/gbo/data/; builds use sccache (RUSTC_WRAPPER=sccache); label mismatches between the workflow’s runs-on and the registered labels silently idle the queue.

Status Codes

Code Status
0 pending
1 success
2 failure
3 cancelled
6 running

Database Queries

All queries run against the PROD-ALM database:

sudo incus exec tables -- psql -h localhost -U postgres -d PROD-ALM

List Recent Runs

SELECT id, title, workflow_id, status,
       to_timestamp(created) AS created_at
FROM action_run
ORDER BY id DESC LIMIT 10;

Get Jobs for a Run

SELECT id, name, status, task_id
FROM action_run_job
WHERE run_id = <RUN_ID>;

Get Step-Level Status

SELECT name, status, log_index, log_length
FROM action_task_step
WHERE task_id = <TASK_ID>
ORDER BY index;

Reset a Stuck Run (status 6)

UPDATE action_task SET status = 0 WHERE id = <ID>;
UPDATE action_run_job SET status = 0 WHERE run_id = <RUN_ID>;
UPDATE action_run SET status = 0 WHERE id = <RUN_ID>;

Reading Build Logs

Build logs are stored as zstd-compressed files in the alm container. The database tracks the filename.

# 1. Get log filename from database
sudo incus exec tables -- psql -h localhost -U postgres -d PROD-ALM \
  -c "SELECT log_filename FROM action_task WHERE id = <TASK_ID>;"

# 2. Pull compressed log from alm container
sudo incus file pull alm/opt/gbo/data/data/actions_log/<LOG_FILENAME> /tmp/ci-log.log.zst

# 3. Decompress and read
zstd -d /tmp/ci-log.log.zst -o /tmp/ci-log.log

Quality checks beyond the build

The repository carries a large family of check scripts under scripts/ that CI (and disciplined local runs) use; a representative set:

Script Guards
check_clippy_baseline.py clippy debt cannot grow
check_coverage.py coverage goals
check_dependency_pins.py exact pins for critical deps
check_container_runtime.py --check Incus-only, SafeCommand-only
check_data_protection_audit.py data-handling rules
check_design_system.py --id-* token usage in UI
check_doc_ips.py no internal IPs in documentation
check_dev_login_backdoor.py auth backdoors
check_app_tests.py, check_app_transport.py suite app conventions

The workspace gate itself: cargo clippy --workspace with 0 warnings, and CI on push to main is the authoritative type gate.

Model evaluation in CI

boteval / boteval-run execute only in CI (ci.yml → evaluate / boteval-run). Every task spends paid model calls, results live in the CI run report, and no run history is stored in the repository. A green build does not replace an evaluation; a failed evaluation is a real failure with the report as evidence.

Local pre-flight

scripts/verify-rust-syntax.sh [base-ref]   # quick syntax gate for changed files
cargo clippy --workspace                   # 0 warnings
cargo test -p <crate>                      # touched crates

Found a mistake? Open an issue · All books

// SEARCH ESC
Pagefind · 236 pages · 4 books Enter to open ↑ ↓ to move