Skip to main content

Air-Gap Code Structure

Purpose: For contributors, provides Air-Gap Python package layout and build pipeline modules.

Package layout

openCenter-AirGap/
├── src/opencenter_build/ # Main package
│ ├── __init__.py # Package init, version
│ ├── cli.py # Typer CLI (all commands)
│ ├── orchestrator.py # Build pipeline orchestration (8 steps)
│ ├── component_manifest.py # Manifest dataclasses, merge_manifests()
│ ├── scanner.py # Repository image/chart scanner
│ ├── manifest.py # Artifact manifest generation
│ ├── config.py # BuildConfig from versions.env
│ ├── validation.py # ComprehensiveConfigValidator, schema checks
│ ├── verifier.py # PackageVerifier (checksum + signature)
│ ├── state.py # Atomic state management (checkpointing)
│ ├── image_utils.py # Image reference parsing/validation
│ ├── version_utils.py # Version string validation
│ ├── zarf_generator.py # Zarf YAML generation from template
│ ├── zarf_utils.py # Zarf CLI interaction utilities
│ ├── downloader.py # Asset download with retries
│ ├── provenance.py # Build provenance tracking
│ ├── provenance_kubespray.py # Kubespray-specific provenance
│ ├── secrets.py # SecretsManager (.secrets/ directory)
│ ├── transaction.py # Rollback support
│ ├── metrics.py # Build metrics collection
│ ├── logging.py # Centralized logging setup
│ └── exceptions.py # Exception hierarchy
├── config/ # Configuration files
│ ├── versions.env # Version pins (source of truth)
│ ├── components.yaml # Component manifest
│ └── schemas/ # JSON Schema validation files
│ ├── versions.schema.json
│ ├── zarf-variables.schema.json
│ ├── openstack-config.schema.json
│ └── nodes.schema.json
├── scripts/ # Shell scripts
│ ├── release.sh # CI release tagging
│ ├── cleanup.sh # Environment cleanup
│ ├── lib/ # Shared bash libraries
│ │ ├── download.sh
│ │ ├── logging.sh
│ │ └── secrets.sh
│ ├── hooks/
│ │ └── check-generated-files.sh
│ └── deploy/ # 24 deployment scripts
│ ├── deploy.sh # Main orchestration
│ ├── deploy_kubespray.sh
│ ├── install_fluxcd.sh
│ ├── terraform_openstack.sh
│ ├── validate_bastion_setup.sh
│ └── ...
├── tests/ # Test suite
│ ├── unit/ # Unit tests
│ ├── property/ # Hypothesis property-based tests
│ └── integration/ # Integration tests
├── testdata/ # Test fixtures
├── zarf.yaml.template # Zarf package template
├── pyproject.toml # Project metadata and tool config
└── mise.toml # Mise tool versions

Module responsibilities

ModuleResponsibility
cli.pyTyper-based CLI. Defines all commands (init, add, scan, generate-manifest, build, validate, verify, status, clean, serve, keygen, release, version). Entry point registered as opencenter-airgap.
orchestrator.pyCoordinates the 8-step build pipeline with checkpointing. Steps: scan_repositories → collect_helm_charts → generate_kubespray_lists → mirror_terraform_providers → organize_assets → generate_zarf_yaml → create_zarf_package → generate_manifest.
config.pyLoads versions.env via python-dotenv. Exposes BuildConfig dataclass with all version pins.
component_manifest.pyDataclasses for components (images, charts, tools, repos, OS packages, Python packages). merge_manifests() preserves manual add edits across regeneration.
scanner.pyClones repos, walks YAML for image: fields and HelmRelease/HelmRepository resources. Outputs to config/all-images.txt, config/helm-charts.txt.
manifest.pyGenerates dist/artifact-manifest.json with checksums for all produced artifacts.
state.pyAtomic state persistence to build/state.json. Supports resume after failure.
transaction.pyWraps build steps in transactions with rollback on failure.
validation.pyComprehensiveConfigValidator — schema validation via jsonschema, cross-reference checks, URL reachability.
verifier.pyPackageVerifier — SHA-256 checksum + Cosign signature verification.
image_utils.pyImage reference parsing, validation, and normalization.
version_utils.pySemver parsing and validation.
zarf_generator.pyRenders zarf.yaml.template with variables from config.
zarf_utils.pyWraps zarf CLI for package create and package deploy.
downloader.pyDownloads assets with retry logic and progress reporting.
provenance.pyTracks build provenance (what was downloaded, when, from where).
secrets.pySecretsManager for .secrets/ directory (Cosign keys, registry creds). Mode 0700.
metrics.pyCollects build timing, counts, and package sizes.
logging.pyConfigures Rich-based structured logging.
exceptions.pyHierarchy: BuildError, ConfigError, ValidationError, ScanError, DownloadError.

Entry point

Registered in pyproject.toml:

[project.scripts]
opencenter-airgap = "opencenter_build.cli:main"

Key dependencies (pinned)

PackageVersionPurpose
jsonschema4.26.0Configuration validation
pyyaml6.0.3YAML parsing
typer0.25.1CLI framework
rich15.0.0Terminal output formatting
python-dotenv1.2.2Loading versions.env files

Dev dependencies

PackageVersionPurpose
pytest9.0.3Test framework
pytest-timeout2.4.0Test timeouts (300s)
pytest-cov7.1.0Coverage reporting
hypothesis6.152.6Property-based testing
black26.3.1Code formatting (100 char)
mypy2.1.0Static type checking
pylint4.0.5Linting
pre-commit4.6.0Git hooks

Build Pipeline Detail

The orchestrator runs 8 steps sequentially with checkpoints:

scan_repositories
└→ collect_helm_charts
└→ generate_kubespray_lists
└→ mirror_terraform_providers
└→ organize_assets
└→ generate_zarf_yaml
└→ create_zarf_package
└→ generate_manifest

Each step writes completion state to build/state.json. Use --resume to restart from last successful step. Use --clean to discard all state and start fresh.

Output: dist/zarf-package-opencenter-airgap-amd64-*.tar.zst (~25 GB compressed) + SBOM + checksum + Cosign signature + artifact-manifest.json.