Hosting a registry
A registry is any folder with this layout and an index.yaml at
its root. Use one for in-house tools, for a changed copy of an official
matcher, or as an offline mirror of the official registry.
index.yaml # generated: ci-doctor registry index
bundles/<ecosystem>.yaml # generated, one per ecosystem folder
bundles/<id>.yaml # curated bundles, by hand
matchers/<ecosystem>/<id>/matcher.yaml
matchers/<ecosystem>/<id>/fixtures/<case>.github.log # a raw GitHub Actions log
matchers/<ecosystem>/<id>/fixtures/<case>.gitlab.log # a raw GitLab CI trace
matchers/<ecosystem>/<id>/fixtures/<case>.log # plain tool output
matchers/<ecosystem>/<id>/fixtures/<case>[.<output>].expected
The folder a matcher sits in is its ecosystem: there is no field for it,
and its bundle is generated from the folder. A matcher's id
equals its own folder's name. The file format is on
Matcher format v1.
Fixtures
A fixture is a log plus, for each output, the .expected lines
that output alone selects from it. An empty .expected means it
must not fire. The log's name declares its framing: a
.github.log or .gitlab.log is read the way
analyze reads a failed job, keeping only the step it blames, and a
plain .log is read as it is. A
one-output matcher's golden is <case>.expected; with
several outputs each has <case>.<output>.expected.
Test and index it
ci-doctor matchers examine matchers/acme/deploy_cli/matcher.yaml ./job.log # see what it selects
ci-doctor matchers verify --update . # write the .expected files, then read the diff
ci-doctor matchers verify . # every rule, every golden
ci-doctor matchers verify . --only deploy_cli # just the matcher you're working on
ci-doctor registry index . # write index.yaml and the ecosystem bundles
ci-doctor registry index . --check # in CI: fail when either is stale
verify fails when:
- a file doesn't validate or compile;
- an output's selection differs from its
.expected; - a variant anchors in none of its matcher's fixtures;
- an output other than a
fallbackfires on a runner's own "job failed" line, which would make it fire on every failed job; - an output has fewer positive or negative fixtures than the registry asks for.
A selection that differs prints a diff of its .expected file
against what the output selects now. --only NAME (or
NAME.OUTPUT, repeatable) checks just those, still running them
over every fixture in the registry for cross-fire; with --update
it rewrites only their .expected files.
How many fixtures are enough is your registry's policy, set by flags. The
defaults are the official registry's. --json writes the full
report, including every output that fires on another matcher's fixture;
--cross-fire fails on those too.
ci-doctor matchers verify . \
--min-positive 3 --min-negative 2 \
--exempt verify-exempt.txt \
--cross-fire \
--json report.json
ci-doctor checks every file again when it loads it, so a registry that never
ran verify still can't hand it an invalid matcher. It also
refuses a matcher or bundle whose bytes don't match the sha256
that index.yaml lists for it, so a file edited, truncated or
swapped after indexing fails the setup. Run registry index after
every edit, and publish the index together with the files it was built from.
Publish it and register it
Point ci-doctor at the folder, never at index.yaml.
| Host | Publish | Register |
|---|---|---|
| Local disk or NFS | nothing | acme=/mnt/nfs/matchers or acme=file:///mnt/nfs/matchers |
| A git repository | push | acme=https://raw.githubusercontent.com/acme/matchers/main/, or a tag in place of main to pin |
| A web server, GitHub Pages, an S3 bucket over HTTPS | copy the tree | acme=https://matchers.acme.dev/ |
Register with ci-doctor registry add acme=…, or in the config:
matchers:
registries:
acme: https://matchers.acme.dev/
include: [official/python, acme/deploy_cli]
- Plain
http://works, but nothing protects the files in transit; every run that uses one logs a warning. - A presigned URL can't be a registry: it signs one file, and ci-doctor fetches many relative to the folder.
- Air-gapped: run
ci-doctor registry mirror official DIRwhere the official registry is reachable, copyDIRinside the network, and register its path (or a server serving it) asofficialto replace the built-in one. A plain clone ofci-doctor/matchersworks asofficialtoo.