Git Forges
Faber supports GitHub, GitLab, Forgejo, and Gitea behind a unified internal/operator/forge interface (ForgePRSink and forge-agnostic PRFeedbackSyncer).
Every driver supports:
- Downloading repository archives and recent commit history for offline sandbox injection
- Creating or updating a single open PR or MR per deterministic
agent/<policy>/<key>branch - Inspecting open PR or MR state, reviews, and inline comments for feedback loops
- Closing stale PRs or MRs with an explanatory comment when a later run confirms
noop
GitHub (GitHub App or Fine-Grained PAT Quickstart)
Section titled “GitHub (GitHub App or Fine-Grained PAT Quickstart)”GitHub supports two authentication modes:
- GitHub App (Recommended for Production): Configured via
spec.github(100% backwards-compatible) orspec.forge(provider: github) plusspec.githubcredentials. Mints short-lived 1-hour installation tokens from the PEM key referenced byprivateKeySecretRefand produces GitHub-signedVerifiedcommits via GraphQLcreateCommitOnBranch. - Fine-Grained PAT Quickstart (
spec.forge.tokenSecretRef): Configured viaspec.forge(provider: github) andtokenSecretRefwithout creating a GitHub App. Ideal for getting Tier 1 PRs running in minutes. Upgrade tospec.githublater when you want short-lived installation tokens andVerifiedcommit signatures.
- Required Permissions:
contents: write,pull_requests: write, andmetadata: readon the target repository only. Exclude the app or token from branch-protection bypass rules. - GitHub Enterprise: Set
apiBaseUrl(orspec.forge.baseUrl) to your enterprise API URL (for examplehttps://github.example.com/api/v3).
Fine-grained PAT quickstart example:
apiVersion: faberops.dev/v1alpha1kind: GitOpsRepositorymetadata: name: cluster-gitops namespace: faberspec: forge: provider: github owner: my-org repo: cluster-gitops defaultBranch: main branchPrefix: agent/ tokenSecretRef: name: faber-github-token key: tokenGitHub App production example (Verified GraphQL commits):
apiVersion: faberops.dev/v1alpha1kind: GitOpsRepositorymetadata: name: home-ops namespace: faberspec: github: owner: my-org repo: home-ops defaultBranch: main branchPrefix: agent/ appId: 123456 installationId: 78901234 privateKeySecretRef: name: faber-github-app key: private-key.pemGitLab (REST API v4)
Section titled “GitLab (REST API v4)”GitLab works with both https://gitlab.com (default when baseUrl is omitted) and self-hosted GitLab instances.
- Authentication: Project or group access token supplied via
spec.forge.tokenSecretRefand sent in thePRIVATE-TOKENheader. - Nested Group Paths:
spec.forge.owneraccepts multi-segment group paths (for exampleplatform/infra/clusters) which are URL-encoded automatically in API requests. - Atomic Commits: Multi-file creations, updates, and deletions are submitted in a single atomic
POST /api/v4/projects/:id/repository/commitscall before creating or updating the Merge Request. - Draft MRs and Labels: Draft status uses GitLab’s
Draft:title prefix, and feedback sync reads MR state, discussions, and inline diff notes.
apiVersion: faberops.dev/v1alpha1kind: GitOpsRepositorymetadata: name: platform-gitops namespace: faberspec: forge: provider: gitlab baseUrl: https://gitlab.example.com owner: platform/infra repo: cluster-fleet defaultBranch: main branchPrefix: agent/ tokenSecretRef: name: faber-gitlab-token key: tokenForgejo and Gitea (REST API v1)
Section titled “Forgejo and Gitea (REST API v1)”Both forgejo and gitea use the REST API v1 driver (internal/operator/forge/gitea). spec.forge.baseUrl is required for self-hosted instances.
- Authentication: Personal or bot access token supplied via
spec.forge.tokenSecretRefand sent withAuthorization: token <token>. - Batch Commits with Fallback: The driver uses the batch Contents API when supported by the server and falls back cleanly to sequential file operations on older servers.
- Labels and Review Normalization: Repository label names are resolved to integer label IDs automatically. Review states (
REQUEST_CHANGES) are normalized toCHANGES_REQUESTED, and per-review inline comments are fetched forPRFeedbackSyncer.
apiVersion: faberops.dev/v1alpha1kind: GitOpsRepositorymetadata: name: homelab-gitops namespace: faberspec: forge: provider: forgejo baseUrl: https://git.example.com owner: ops repo: homelab defaultBranch: main branchPrefix: agent/ tokenSecretRef: name: faber-forgejo-token key: tokenCRD Validation and Backwards Compatibility
Section titled “CRD Validation and Backwards Compatibility”GitOpsRepository enforces the CEL admission rule has(self.github) || has(self.forge) at kubectl apply time. spec.github is an optional pointer so spec.forge-only resources validate cleanly without zero-valued GitHub fields, while existing spec.github manifests continue working without changes.