# truenas/build architecture

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

- Interactive diagram: https://gitdiagram.com/truenas/build
- Repository: https://github.com/truenas/build

## Overview

##### Main Components (Top Level)
- Build System Core (Central component)
- Profile Management
- Build Tools
- Testing Framework
- Jenkins Integration
- Package Management
- ISO Creation Pipeline

##### Component Relationships

a) Build System Core:
- To all other major components
- Make targets (checkout, update, release, clean)
- Connection to external Git repositories

b) Profile Management (build/profiles):
- To Build System Core
- FreeNAS profile structure:
- Kernel configurations
- Package definitions
- Release information
- Validation components

c) Build Tools Pipeline (build/tools):
- In sequential order:
1. Environment Setup (buildenv.py, check-host.py)
2. Source Management (checkout.py, apply-tag.py)
3. Build Process (build-os.py, build-packages.py)
4. Distribution Creation (create-iso.py, create-upgrade-distribution.py)

d) Testing Framework (tests/):
- Parallel tracks for:
- FreeNAS tests
- TrueOS tests
- Test configurations
- VM-based testing

e) Jenkins Integration:
- Connection to:
- Nightly builds
- Release builds
- Build artifacts

##### Elements
- Version information
- System requirements
- Key file paths
- Build target relationships

## Diagram (Mermaid)

```mermaid
graph TB
    classDef core fill:#2196F3,stroke:#1565C0,color:white
    classDef tools fill:#FFC107,stroke:#FFA000,color:black
    classDef test fill:#4CAF50,stroke:#388E3C,color:white
    classDef jenkins fill:#9C27B0,stroke:#7B1FA2,color:white
    classDef profile fill:#FF5722,stroke:#E64A19,color:white
    classDef package fill:#795548,stroke:#5D4037,color:white
    classDef output fill:#607D8B,stroke:#455A64,color:white

    subgraph BuildCore["Build System Core"]
        Core["Build System Core"]:::core
        MakeTargets["Make Targets<br/>checkout | update<br/>release | clean"]:::core
    end
    click Core "https://github.com/truenas/build/tree/master/Makefile"
    click MakeTargets "https://github.com/truenas/build/blob/master/Makefile.inc1"

    subgraph ProfileMgmt["Profile Management"]
        Profile["Profile Manager"]:::profile
        Kernel["Kernel Config"]:::profile
        PkgDef["Package Definitions"]:::profile
        Release["Release Info"]:::profile
    end
    click Profile "https://github.com/truenas/build/tree/master/build/profiles/freenas"
    click Kernel "https://github.com/truenas/build/tree/master/build/profiles/freenas/kernel"
    click PkgDef "https://github.com/truenas/build/tree/master/build/profiles/freenas/packages"
    click Release "https://github.com/truenas/build/tree/master/build/profiles/freenas/release"

    subgraph BuildTools["Build Tools Pipeline"]
        EnvSetup["Environment Setup"]:::tools
        SrcMgmt["Source Management"]:::tools
        BuildProc["Build Process"]:::tools
        DistCreate["Distribution Creation"]:::tools
    end
    click EnvSetup "https://github.com/truenas/build/blob/master/build/tools/buildenv.py"
    click SrcMgmt "https://github.com/truenas/build/blob/master/build/tools/checkout.py"
    click BuildProc "https://github.com/truenas/build/blob/master/build/tools/build-os.py"
    click DistCreate "https://github.com/truenas/build/blob/master/build/tools/create-iso.py"

    subgraph Testing["Testing Framework"]
        FreeNASTest["FreeNAS Tests"]:::test
        TrueOSTest["TrueOS Tests"]:::test
        TestConfig["Test Configurations"]:::test
    end
    click FreeNASTest "https://github.com/truenas/build/tree/master/tests/freenas"
    click TrueOSTest "https://github.com/truenas/build/tree/master/tests/trueos"

    subgraph JenkinsInt["Jenkins Integration"]
        NightlyBuilds["Nightly Builds"]:::jenkins
        ReleaseBuilds["Release Builds"]:::jenkins
        BuildArtifacts["Build Artifacts"]:::jenkins
    end
    click NightlyBuilds "https://github.com/truenas/build/tree/master/Jenkins/freenas-nightlies"
    click ReleaseBuilds "https://github.com/truenas/build/tree/master/Jenkinsfile"

    subgraph PkgMgmt["Package Management"]
        PkgRepos["Package Repositories"]:::package
        PkgConfig["Package Configuration"]:::package
    end
    click PkgRepos "https://github.com/truenas/build/tree/master/build/config/templates/pkg-repos"
    click PkgConfig "https://github.com/truenas/build/tree/master/build/profiles/freenas/packages"

    subgraph Custom["Customization Pipeline"]
        CustomTools["Customization Tools"]:::tools
        EarlyCustom["Early Customization"]:::tools
    end
    click CustomTools "https://github.com/truenas/build/blob/master/build/tools/customize.py"
    click EarlyCustom "https://github.com/truenas/build/blob/master/build/tools/early-customize.py"

    Core --> MakeTargets
    Core --> Profile
    Profile --> Kernel
    Profile --> PkgDef
    Profile --> Release
    
    Core --> EnvSetup
    EnvSetup --> SrcMgmt
    SrcMgmt --> BuildProc
    BuildProc --> DistCreate
    
    Core --> FreeNASTest
    Core --> TrueOSTest
    FreeNASTest --> TestConfig
    TrueOSTest --> TestConfig
    
    Core --> NightlyBuilds
    Core --> ReleaseBuilds
    NightlyBuilds --> BuildArtifacts
    ReleaseBuilds --> BuildArtifacts
    
    Core --> PkgRepos
    PkgRepos --> PkgConfig
    
    BuildProc --> CustomTools
    CustomTools --> EarlyCustom
    
    %% Legend
    subgraph Legend
        L1["Core Components"]:::core
        L2["Build Tools"]:::tools
        L3["Testing"]:::test
        L4["Jenkins"]:::jenkins
        L5["Profile"]:::profile
        L6["Package"]:::package
    end
```
