# blender/gitea architecture

> Architecture diagram of the GitHub repository blender/gitea, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2025-10-17). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/blender/gitea
- Repository: https://github.com/blender/gitea

## Overview

##### Project type and purpose
- This is an open-source “patch manager” CI/CD repository built around a fork of go-gitea/gitea.
- Its sole job is to maintain a set of custom patches (in patches/), automatically rebase them onto each new upstream release, build a patched Gitea OCI image, and push that image to your registry.

##### File structure
- .github/workflows/
- build.yml – the pipeline that builds & publishes the container image on code changes or PR merges.
- patch-release.yml – the pipeline that triggers on upstream gitea releases, creates a branch, applies all patches, and then triggers a build.
- patches/ – a numbered list of .patch files, each one a single change against upstream.
- README – describes the repo’s role, the ci branch, and how workflows stitch upstream → patches → build → push.

##### README for additional insights
- Confirms: ci branch is only for storing patches + workflows.
- Workflows create feature branches per upstream tag, apply the entire patch set, then build & push an OCI image.

## Diagram (Mermaid)

```mermaid
graph TD
    %% Repositories
    subgraph "Repositories"
        Upstream["Upstream Gitea Repo"]:::repo
        Fork["Forked Repo"]:::repo
    end

    %% Forked Repo Contents
    subgraph "Forked Repo"
        Patches["Patches Store"]:::repo
        WorkflowsDir["Workflow Definitions"]:::ci
        BuildWF["Build Workflow (build.yml)"]:::ci
        PatchRel["Patch-Release Workflow (patch-release.yml)"]:::ci
        README["Project Documentation (README)"]:::repo
    end

    %% CI Infrastructure
    Runner["GitHub Actions Runner"]:::ci
    ContainerBuild["Container Build Stage (Docker Build)"]:::artifact

    %% External Services
    Registry["Container Registry"]:::external
    Consumers["Consumers (Infra/Users)"]:::external

    %% Workflow file grouping
    WorkflowsDir --> BuildWF
    WorkflowsDir --> PatchRel

    %% Release Flow
    Upstream -->|"GitHub Release Event"| PatchRel
    PatchRel -->|"checkout upstream tag"| Runner
    PatchRel -->|"apply patches (git apply)"| Patches
    PatchRel -->|"commit new branch"| Fork

    %% Build Trigger
    Fork -->|"push branch triggers"| BuildWF

    %% Build Flow
    BuildWF -->|"runs on"| Runner
    BuildWF -->|"checkout patched branch"| Runner
    Runner -->|"docker build & tag"| ContainerBuild
    ContainerBuild -->|"docker push"| Registry

    %% Consumption
    Registry -->|"pull image"| Consumers

    %% Click Events
    click Patches "https://github.com/blender/gitea/tree/ci/patches/"
    click WorkflowsDir "https://github.com/blender/gitea/tree/ci/.github/workflows/"
    click BuildWF "https://github.com/blender/gitea/blob/ci/.github/workflows/build.yml"
    click PatchRel "https://github.com/blender/gitea/blob/ci/.github/workflows/patch-release.yml"
    click README "https://github.com/blender/gitea/tree/ci/README"

    %% Styles
    classDef repo fill:#ffd,stroke:#333,stroke-width:1px
    classDef ci fill:#def,stroke:#333,stroke-width:1px
    classDef artifact fill:#fdc,stroke:#333,stroke-width:1px
    classDef external fill:#dfd,stroke:#333,stroke-width:1px
```
