Add ai-review triggered by ai-review-please label.

Mostly stolen from infra/ansible#3196/

Signed-off-by: Kevin Fenzi <kevin@scrye.com>
This commit is contained in:
Kevin Fenzi 2026-04-10 10:03:55 -07:00
commit a6066940f1
3 changed files with 311 additions and 0 deletions

31
.ai_review/README.md Normal file
View file

@ -0,0 +1,31 @@
# AI Review Context
This directory contains context files that help AI code reviewers understand this codebase.
## Files
- **project.md** — Project-specific context for Fedora Infrastructure documentation
## Generation Info
- **Generated by:** context-generator skill (Claude Code)
- **Model:** claude-sonnet-4-5@20250929
- **Date:** 2026-04-10
- **Tool:** Claude Code CLI
## Usage
AI code review tools should load `project.md` alongside diffs to provide informed feedback that:
- Uses current versions of dependencies and tools (not stale training data)
- Understands project architecture and conventions (not just the diff)
- Recognizes internal services and terminology specific to Fedora Infrastructure
## Maintenance
This context file should be updated when:
- Antora version or build process changes significantly
- New documentation modules are added
- Service migrations occur (e.g., Pagure → Forgejo)
- Major documentation standards change
To update: Run the context-generator skill in this repository.

265
.ai_review/project.md Normal file
View file

@ -0,0 +1,265 @@
# Fedora Infrastructure Documentation — AI Review Context
## Project Overview
Documentation for Fedora Infrastructure and Release Engineering teams. Built with Antora static site generator from AsciiDoc sources. Published at https://docs.fedoraproject.org/en-US/infra/. Covers sysadmin guides, SOPs (Standard Operating Procedures), developer guides, release engineering workflows, and operational howtos for Fedora infrastructure services.
## Technology Stack & Versions
**Static Site Generator:**
- Antora (containerized build via `docker.io/antora/antora`)
- Build script: `docsbuilder.sh` version 1.2.0
- Container runtime: Podman (Linux) or Docker (macOS/Linux fallback)
- Local preview: Python 3 http.server on port 8080 (Linux), nginx (macOS)
**Documentation Format:**
- AsciiDoc markup (`.adoc` files)
- Asciidoctor processor (via Antora container)
- Antora UI bundle from: `https://gitlab.com/fedora/docs/docs-website/ui-bundle/-/jobs/artifacts/HEAD/raw/build/ui-bundle.zip?job=bundle-stable`
**CI/CD:**
- Forgejo Actions (`.forgejo/workflows/`)
- AI code review triggered by `ai-review-please` label on PRs
- Review workflow: `quality/workflows/.forgejo/workflows/ai-review.yml@main`
- Runs on: `infra-1` runner
- Uses Gemini API for reviews
**Content Sources:**
- Primary: This repository
- Secondary: `https://forge.fedoraproject.org/infra/ansible.gitt` (ansible)
## Architecture & Code Organization
**Module Structure:**
```
modules/
├── ROOT/ # Landing pages, team info, SLE
├── developer_guide/ # Code style, auth, db, frameworks, testing
├── howtos/ # Operational procedures (one-off tasks)
├── release_guide/ # Release engineering philosophy, SOPs
├── releng_misc_guide/ # Miscellaneous release engineering SOPs
└── sysadmin_guide/ # Service-specific admin guides (Bodhi, Koji, etc.)
```
**File Naming:**
- Index files: `index.adoc` (entry point for each module)
- Navigation: `nav.adoc` (defines module menu structure)
- SOPs typically prefixed with `sop_` (e.g., `sop_hotfix.adoc`)
- Service guides named after service (e.g., `bodhi.adoc`, `koji.adoc`)
**Build Process:**
1. Antora reads `site.yml` for content sources and UI bundle
2. Module config in `antora.yml` defines component name (`infra`), title, nav
3. Container mounts current directory to `/antora` with `:z` SELinux label
4. Output to `./public/` directory
5. `--html-url-extension-style=indexify` for clean URLs
**Key Files:**
- `antora.yml`: Component metadata (name: `infra`, title, version, nav)
- `site.yml`: Build configuration (content sources, UI, output directory)
- `docsbuilder.sh`: Wrapper for containerized builds, watch mode, preview server
- `nginx.conf`: Preview server config for macOS Docker setup
## Review Guidance
### AsciiDoc Syntax
**Common Elements to Validate:**
- Section headers use `=` prefix (not `#`): `= Title`, `== Section`, `=== Subsection`
- Cross-references: `xref:module:page.adoc[Link Text]` or `xref:page.adoc[Link Text]`
- Code blocks: delimited by `....` (literal) or `----` (source with highlighting)
- Admonitions: `[NOTE]`, `[WARNING]`, `[IMPORTANT]`, `[TIP]`, `[CAUTION]`
- Attributes: Set at top of file (e.g., `:experimental:` for keyboard macros)
- Links: `https://example.com[Link Text]` or bare URLs
**Antora-Specific Syntax:**
- Page references must include module if cross-module: `xref:sysadmin_guide:bodhi.adoc[]`
- Same-module refs can omit module: `xref:hotfix.adoc[]`
- Images: `image::filename.png[Alt Text]` (stored in `modules/*/assets/images/`)
- Attachments: `link:{attachmentsdir}/file.pdf[Download]`
### Documentation Standards
**SOP (Standard Operating Procedure) Structure:**
- Title clearly states purpose (e.g., "HOTFIXES SOP")
- Context/background section explaining when procedure applies
- Step-by-step instructions with clear headings
- Code examples in literal blocks (`.…` delimiter) or console blocks
- Links to upstream bugs/tickets when documenting workarounds
- Tag hotfixes with "HOTFIX" in task names, link to upstream issues
**Command Examples:**
- Use `$` or `#` prompt only when showing shell context is important
- Console blocks for command sequences: `[source,console]` or plain `....`
- Variable placeholders in commands: Use `${VARIABLE}` or `<placeholder>` format
- Ansible playbook snippets: Show full task structure with name, tags, handlers
**Common Services to Reference Correctly:**
- Build system: Koji (not "koji")
- Update system: Bodhi (not "bodhi")
- Source control: dist-git, Pagure (being phased out), Forgejo (new)
- Release process: Pungi (compose tool), OSBS (container builds)
- Monitoring: Zabbix, Nagios (legacy)
- Auth: Ipsilon, FAS (Fedora Account System)
### URL and Link Updates
**Service Migration Awareness:**
- Pagure links should transition to alternatives when available
- Copr docs moved to: `docs.copr.fedorainfracloud.org`
- PDC (Product Definition Center) is decommissioned — remove references
- Wiki should generally link to `fedoraproject.org/wiki/`
- Bugzilla: `bugzilla.redhat.com`
- Published docs: `docs.fedoraproject.org`
**Matrix vs IRC:**
- Team uses Matrix (not IRC): `#admin:fedoraproject.org`, `#apps:fedoraproject.org`, `#noc:fedoraproject.org`
- Matrix user format: `@username:fedora.im` or `@username:matrix.scrye.com`
### Commit Message Format
**Conventional Commits (observed pattern):**
- `fix:` — Corrections to existing content (typos, broken commands, outdated info)
- `feat:` — New documentation sections or capabilities
- `doc:` or `docs:` — General documentation updates
- Scope in parentheses: `doc(remote_tarballs_dist_git):`, `fix(releng index):`
- Descriptive but concise (not just "update docs")
**Examples from history:**
- `fix: reflect room and time change`
- `doc(remote_tarballs_dist_git): adding new documentation section for removing unwanted tarball`
- `docs: Update Mass Branching SOP`
### Common Pitfalls
**Cross-Reference Errors:**
- Broken xrefs when moving pages between modules (update all references)
- Missing module prefix in cross-module links
- Using `.html` extension in xrefs (Antora handles extensions automatically)
**Build Warnings:**
- Recent commits fixed "docs build errors and warnings" — CI now tests builds
- Validate Antora can resolve all xrefs and includes
- Check attribute references are defined
**Content Accuracy:**
- Verify command syntax before suggesting changes (infrastructure-specific conventions)
- Don't suggest "modern" alternatives to infrastructure tooling without context
- Ansible playbooks may use specific variable formats mandated by the playbooks repo
- EPEL branching process is well-documented but complex — changes need careful review
**Service Name Accuracy:**
- Service names are often capitalized in titles: Bodhi, Koji, Pagure
- Hostnames/commands lowercase: `bodhi`, `koji`
- Be aware of decommissioned services mentioned in older docs
## Internal
**Fedora Infrastructure Services (internal context):**
- **Batcave**: Ansible control host for infrastructure management
- **Bastion hosts**: Jump servers for accessing internal infrastructure
- **Sigul**: RPM signing service (sigul-server, sigul-bridge, sigul-client)
- **Robosignatory**: Automated signing for Koji builds
- **MirrorManager**: Manages Fedora mirror network
- **Koschei**: Continuous integration for Fedora packages
- **Anitya**: Upstream release monitoring
- **Datanommer**: Message bus data archive
- **Greenwave**: Gating decisions for CI results
**Fedora-Specific Terminology:**
- **Rawhide**: Rolling development branch (always latest Fedora version + 1)
- **Branched**: Stabilization branch for upcoming release
- **EPEL**: Extra Packages for Enterprise Linux (separate from Fedora)
- **Mass Branching**: Creating new Fedora version branches in dist-git
- **Compose**: Built artifacts (ISOs, images) from package collection
- **SLE**: Service Level Expectation (not SLA — Fedora is community-driven)
**Access Groups:**
- `sysadmin-main`: Root access to nearly all infrastructure ("Mainers")
- Role-specific groups: `sysadmin-noc`, `sysadmin-web`, `releng`, etc.
- FAS (Fedora Account System) groups control access
<!-- MANUAL SECTIONS - DO NOT MODIFY THIS LINE -->
## Architecture & Design Decisions
**Antora Adoption:**
- Chose Antora for multi-repository documentation aggregation
- Allows site.yml to pull from multiple git repos (this repo + operations docs)
- Component-based structure enables modular documentation
- Indexified URLs for clean paths without `.html` extensions
**Module Organization:**
- Separation of developer vs sysadmin content reflects team structure
- HOWTOs distinct from SOPs: HOWTOs are one-off tasks, SOPs are procedures
- ROOT module for team/organizational info, other modules for technical content
**Build Approach:**
- Containerized builds ensure reproducibility across macOS and Linux
- Local preview script reduces friction for contributors
- Watch mode (`-w`) enables iterative writing workflow
## Common Pitfalls
**EPEL Branching Process:**
- Highly scripted and order-dependent
- Ansible playbooks don't accept external variables for RBAC operations (use `ansible-playbook` directly)
- Variables must align between documentation and actual automation (`ansible/` repo)
- Koschei branching, MirrorManager symlinks, and autosign setup are easy to forget
**Hotfix Management:**
- Must tag Ansible tasks with `hotfix` tag
- Must link to upstream bug in comments
- Must check in original files first, then diffs
- Easy to forget to remove after upstream fix
**Service Migrations:**
- Ongoing migration from Pagure to Forgejo
- Watch for hardcoded pagure.io links that should update
- Some services still use legacy tooling (check before suggesting "modern" replacements)
**Ansible Conventions:**
- Infrastructure playbooks have specific variable naming conventions
- Don't suggest refactoring without understanding the broader Ansible repo context
- HOTFIX tasks follow specific naming and tagging patterns (see sysadmin_guide/hotfix.adoc)
## Business Logic
**Documentation Publication Flow:**
1. Changes merged to this repo (`infra/docs`)
2. Fedora Docs build system aggregates from multiple repos (via docs-fp-o repo)
3. Published to https://docs.fedoraproject.org/en-US/infra/
4. Local preview only builds this repo (cross-repo links will be broken in preview)
**Review Workflow:**
- PRs can request AI review via `ai-review-please` label
- Runs on Fedora Forgejo instance (not GitHub)
- Uses reusable workflow from `quality/workflows` repo
**Team Structure:**
- Infrastructure Lead: Kevin Fenzi
- Development Manager: Aurelien Bompard
- Quality Engineering: Adam Williamson
- Release Engineering: Samyak Jain
- Changes should align with team areas of responsibility
## Domain-Specific Context
**Release Engineering Terminology:**
- **Compose**: Building all packages into installable artifacts (ISOs, trees, images)
- **Pungi**: Tool that runs composes
- **Bodhi**: Update management system (creates, tests, pushes updates)
- **Koji**: Build system (compiles RPMs from source)
- **dist-git**: Source control for package spec files and patches
- **Side tag**: Temporary Koji tag for building groups of related packages
**Update Flow:**
Package built in Koji → Bodhi update created → Automated tests (Greenwave) → Push to mirrors (if gated)
**Signing Flow:**
Koji build → Robosignatory auto-signs → Or manual via Sigul client → Signed RPMs available
**Mirror Infrastructure:**
- Master mirror: Primary storage for releases
- MirrorManager: Database of public mirrors, provides metalink/mirrorlist
- Sync process: Master → Public mirrors → Users via fastest mirror

View file

@ -0,0 +1,15 @@
---
name: AI Code Review
on:
pull_request_target:
types: [labeled]
jobs:
ai-review:
runs-on: infra-1
if: forgejo.event.label.name == 'ai-review-please'
uses: quality/workflows/.forgejo/workflows/ai-review.yml@main
with:
pr: ${{ forgejo.event.pull_request.number }}
secrets:
GEMINI_API_KEY: ${{ secrets.GEMINI_API_KEY }}