# jfut/ganeti-rpm architecture

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

- Interactive diagram: https://gitdiagram.com/jfut/ganeti-rpm
- Repository: https://github.com/jfut/ganeti-rpm

## Overview

##### Main Components
- CI/CD/Developer Trigger:
- GitHub Workflows (under .github/workflows) for automated builds, testing, and release drafting.
- Local development actions: commits, pull requests, and manual execution of build scripts.
- Build Scripts and Orchestration:
- The “build” script that triggers container-based builds.
- The “build-rpm” script, which runs inside the container, orchestrating tasks like cleaning, building, signing, and optionally installing the packages.
- “setup” and “setup-ghc” components that initialize the environment.
- Containerized Build Environment:
- Docker containers are core to this design as they encapsulate the build environment for different distributions (e.g., “almalinux:9”, “rockylinux:9”, “centos:7”).
- Container image along with its role in providing a consistent OS environment.
- RPM Build Subsystem:
- The “rpmbuild” directory holds the packaging recipes (SPEC files), patches, and source files for Ganeti, its dependencies (such as python-bitarray, python-inotify, socat), and even integrated repositories (integ-ganeti-release).
- Logical separation of packages being built – Ganeti itself, Ganeti-instance-debootstrap, and other dependencies.
- Package and Repository Management:
- Final built RPM packages are signed and then made available through YUM/DNF repositories (as indicated by repository URLs mentioned in the README).
- This component might also include external repository mirrors (e.g., OSU Open Source Lab mirror).

##### Relationships and Interactions
- CI/CD Trigger to Build Scripts:
- Build Scripts to Containers:
- That the “build” script invokes Docker containers with specific base images corresponding to different OS targets.
- Inside the Container:
- Within the container, the “build-rpm” script reads from the “rpmbuild” directory (which includes SPEC files, source patches and configuration) to construct the RPM packages.
- Deployment Flow:

##### Architectural Patterns & Design Principles
- Modularity:
- The separation between build orchestration (scripts) and the actual packaging (rpmbuild files) exemplifies a modular design.
- Containerization:
- The use of Docker ensures environment consistency and is a critical pattern in the design.
- CI/CD Integration:
- Extensibility:
- The existence of multiple directories for different packaging components (Ganeti, its instance-debootstrap, dependencies) shows an extensible design so that new packages or updates can be integrated with minimal friction.

## Diagram (Mermaid)

```mermaid
flowchart TD

  %% CI/CD and Developer Trigger
  A["GitHub Actions Workflow (CI/CD)"]:::cicd

  %% Build Scripts and Environment Setup
  B["Build Script (build)"]:::script
  C["Environment Setup: setup"]:::script
  D["Environment Setup: setup-ghc"]:::script
  E["Build Script (build-rpm)"]:::script

  %% Docker Containerized Build Environment
  subgraph "Docker Containerized Build Environment"
    F["Docker Container: almalinux:9"]:::container
    G["Docker Container: rockylinux:9"]:::container
    H["Docker Container: centos:7"]:::container
  end

  %% RPM Build Subsystem and Packaging Components
  I["RPM Build Subsystem"]:::rpm
  subgraph "RPM Packaging Components"
    I1["Ganeti Packaging"]:::rpm
    I2["Ganeti-instance-debootstrap"]:::rpm
    I3["python-bitarray"]:::rpm
    I4["python-inotify"]:::rpm
    I5["socat"]:::rpm
  end
  J["Build Process Steps\n(uninstall->clean->build->sign->install)"]:::rpm

  %% Package and Repository Management
  K["RPM Repository Deployment"]:::repo
  subgraph "RPM Repositories"
    L["InteG Ganeti Release - Distro7"]:::repo
    M["InteG Ganeti Release - Distro8"]:::repo
    N["InteG Ganeti Release - Distro9"]:::repo
  end

  %% Flow Connections
  A -->|"triggers"| B
  B -->|"initiates"| C
  B -->|"initiates"| D
  B -->|"invokes"| E
  E -->|"runs in"| F
  E -->|"runs in"| G
  E -->|"runs in"| H
  F -->|"executes"| I
  G -->|"executes"| I
  H -->|"executes"| I
  I -->|"contains"| I1
  I -->|"contains"| I2
  I -->|"contains"| I3
  I -->|"contains"| I4
  I -->|"contains"| I5
  I -->|"triggers"| J
  J -->|"deploys to"| K
  K --> L
  K --> M
  K --> N

  %% Click Events for Component Mapping
  click A "https://github.com/jfut/ganeti-rpm/tree/master/.github/workflows"
  click B "https://github.com/jfut/ganeti-rpm/tree/master//build"
  click C "https://github.com/jfut/ganeti-rpm/tree/master//setup"
  click D "https://github.com/jfut/ganeti-rpm/tree/master//setup-ghc"
  click E "https://github.com/jfut/ganeti-rpm/tree/master//build-rpm"
  click I "https://github.com/jfut/ganeti-rpm/tree/master//rpmbuild"
  click I1 "https://github.com/jfut/ganeti-rpm/tree/master//rpmbuild/ganeti"
  click I2 "https://github.com/jfut/ganeti-rpm/tree/master//rpmbuild/ganeti-instance-debootstrap"
  click I3 "https://github.com/jfut/ganeti-rpm/tree/master//rpmbuild/python-bitarray"
  click I4 "https://github.com/jfut/ganeti-rpm/tree/master//rpmbuild/python-inotify"
  click I5 "https://github.com/jfut/ganeti-rpm/tree/master//rpmbuild/socat"
  click L "https://github.com/jfut/ganeti-rpm/tree/master//rpmbuild/integ-ganeti-release-7"
  click M "https://github.com/jfut/ganeti-rpm/tree/master//rpmbuild/integ-ganeti-release-8"
  click N "https://github.com/jfut/ganeti-rpm/tree/master//rpmbuild/integ-ganeti-release-9"

  %% Styles
  classDef cicd fill:#add8e6,stroke:#0000ff,stroke-width:2px;
  classDef script fill:#90ee90,stroke:#008000,stroke-width:2px;
  classDef container fill:#FFA500,stroke:#FF8C00,stroke-width:2px;
  classDef rpm fill:#dda0dd,stroke:#9932cc,stroke-width:2px;
  classDef repo fill:#deb887,stroke:#a0522d,stroke-width:2px;
```
