The documentation moves from READMEs into a site in docs/: getting started, a user guide, operations, a reference, and development pages, written in the style of network vendors' documentation (docs/STYLE.md). bin/bgp/README.md and docs/RFCs.md are folded into it. - A theme of its own in the International Typographic Style, in blues, with self-hosted Inter and JetBrains Mono, search over Zola's index, dark mode, and no resources loaded from other hosts. - Example configurations in docs/examples/, shown on the pages and checked with `bgp --check` in CI. - A test that fails when a field of config.proto is missing from the configuration reference. - A CI job that builds the site; Zola fails on broken links and anchors. - A hardened systemd unit, tried under systemd with kernel routes on. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
3.1 KiB
3.1 KiB
+++ title = "Contributing" description = "Describes the checks that continuous integration performs, the coding conventions, and how to change the documentation." weight = 3 +++
Continuous Integration Checks
Continuous integration runs the following commands on every push and pull request, and fails on any warning:
cargo fmt --all -- --check
cargo clippy --locked --workspace --all-targets -- -D warnings
cargo test --locked --workspace
RUSTDOCFLAGS="-D warnings" cargo doc --locked --workspace --no-deps --document-private-items
for f in testdata/server.textpb docs/examples/*.textpb; do cargo run --locked -p bgp -- --check "$f"; done
zola --root docs build
It also runs the kernel tests, the interoperability lab, and each fuzz target for 1 minute. See Testing. In local builds, warnings are not treated as errors.
Coding Conventions
- Memory safety.
unsafecode is forbidden. The lints are configured in[workspace.lints]in the rootCargo.toml, and every crate inherits them. - Comments. Each module begins with a comment that describes its purpose and the reasons for its design. Comments on code explain why the code is written as it is, not what it does.
- External input. All input from neighbors, RPKI caches, and the kernel is parsed without panicking, and each parser has a fuzz target. Events that a neighbor can trigger repeatedly are counted in a metric and rate-limited in the log.
- Tests. Tests are located next to the code that they test. Each defect fix includes a test with the input that exposed the defect.
- Configuration validation. The daemon validates the configuration at startup and reports each error with its location.
Adding a Configuration Statement
- Add the field to
crates/server/proto/config.proto, with a comment that describes its effect and default value. - Validate the field in
crates/server/src/config.rs. - Describe the field in
docs/content/docs/reference/configuration.md. The testthe_configuration_reference_has_every_fieldfails until the field is described.
Changing the Documentation
The documentation is built with Zola from the
docs/ directory:
zola --root docs serve # http://127.0.0.1:1111, rebuilt on every change
zola --root docs build # output in docs/public
The documentation follows the conventions in docs/STYLE.md, which are
based on the technical documentation of network equipment vendors. In
addition:
- Each page is a Markdown file in
docs/content/docs/. Each subdirectory is a section in the navigation, and pages are ordered byweight. - Link to other pages with
@/docs/...mdpaths. Zola verifies these links and their anchors at build time. - Complete configurations are stored in
docs/examples/, validated by continuous integration withbgp --check, and included in pages with{{/* example(name="edge") */}}. - The theme is in
docs/templatesanddocs/sass. The fonts are indocs/static/fonts. The site does not load resources from other hosts.