MATIH Platform is in active MVP development. Documentation reflects current implementation status.
18. CI/CD & Build System
Build System Architecture

Build System Architecture

The MATIH build system supports three language ecosystems -- Java (Maven/Spring Boot), Python (pip/poetry/FastAPI), and TypeScript (npm/Vite/React) -- through a unified build.sh script that orchestrates compilation, testing, Docker image creation, and registry publishing for over 30 services.


Build Order

The build system follows a strict dependency order to ensure shared libraries are available before services that depend on them:

1. Commons Libraries
   ├── commons-java    (Maven install to local repo)
   ├── commons-python  (pip install -e)
   └── commons-typescript (npm install)

2. Control Plane Services (Java/Spring Boot)
   ├── iam-service
   ├── tenant-service
   ├── config-service
   ├── audit-service
   ├── notification-service
   ├── billing-service
   ├── platform-registry
   └── observability-api

3. Data Plane Services
   ├── Java: query-engine, catalog-service, semantic-layer, bi-service,
   │         data-plane-agent, governance-service
   ├── Python: ai-service, ml-service, data-quality-service,
   │           pipeline-service, ontology-service, ops-agent-service
   └── Node.js: render-service

4. Connectors (Java)
   ├── connector-sdk
   ├── postgresql-connector, mysql-connector
   ├── bigquery-connector, snowflake-connector
   ├── salesforce-connector
   └── s3-connector, gcs-connector, azure-blob-connector

5. Frontend Applications (TypeScript/React)
   ├── agentic-workbench, data-workbench, bi-workbench
   ├── ml-workbench, ops-workbench
   ├── control-plane-ui, data-plane-ui
   └── shared (component library)

Service Definitions

The build script maintains explicit service arrays for each category:

# Control Plane Services (Java/Spring Boot)
CONTROL_PLANE_JAVA_SERVICES=(
    "iam-service"
    "tenant-service"
    "config-service"
    "audit-service"
    "notification-service"
    "billing-service"
    "platform-registry"
    "observability-api"
)
 
# Data Plane Services (Python/FastAPI)
DATA_PLANE_PYTHON_SERVICES=(
    "ai-service"
    "ml-service"
    "data-quality-service"
    "pipeline-service"
    "ontology-service"
    "ops-agent-service"
    "ops-agent-service/infra-optimizer"
)
 
# Frontend Applications
FRONTEND_APPS=(
    "agentic-workbench"
    "data-workbench"
    "bi-workbench"
    "ml-workbench"
    "ops-workbench"
    "control-plane-ui"
    "data-plane-ui"
    "shared"
)

Build Flags

FlagDescription
--allBuild everything (default)
--control-planeBuild only control plane services
--data-planeBuild only data plane services
--commonsBuild only commons libraries
--connectorsBuild only connector modules
--frontendBuild only frontend applications
--javaBuild only Java services
--pythonBuild only Python services
--typescriptBuild only TypeScript services
--skip-testsSkip running tests
--test-onlyOnly run tests (no build)
--with-depsStart test dependencies (Redis, PostgreSQL)
--pushPush images to registry
--tag TAGDocker image tag (default: latest)
--registry REGContainer registry (default: ghcr.io/matih)
--parallelBuild services in parallel
--verboseEnable verbose output

Test Dependencies

When using --with-deps, the build system automatically manages test infrastructure:

# Redis container for cache testing
docker run -d --name matih-test-redis -p 6379:6379 redis:7-alpine
 
# PostgreSQL container for database testing
docker run -d --name matih-test-postgres \
    -p 5432:5432 \
    -e POSTGRES_USER=matih \
    -e POSTGRES_PASSWORD=matih \
    -e POSTGRES_DB=matih_test \
    postgres:16-alpine

The script verifies readiness before running tests (Redis via redis-cli ping, PostgreSQL via pg_isready) and stops containers after test completion.


Build Report

Every build produces a comprehensive summary:

Build Configuration:
  - Registry:        ghcr.io/matih
  - Tag:             latest
  - Skip Tests:      false
  - Test Only:       false
  - With Deps:       false
  - Push Images:     false

Build Results:
  [checkmark] iam-service
  [checkmark] tenant-service
  [checkmark] ai-service
  [x] ml-service

Build Summary: 3 succeeded, 1 failed

Test Results:
  Passed: 12
  Failed: 1

Pages in This Section

PageDescription
Build Script Deep DiveComplete walkthrough of scripts/build.sh
Java BuildsMaven build process, commons-java, Spring Boot packaging
Python Buildspip/poetry builds for FastAPI services
TypeScript Buildsnpm/Vite builds for React workbenches
Docker ImagesMulti-stage Dockerfiles, base images, optimization