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

Port Validation

The validate-ports.sh script detects port drift across three layers of the platform, ensuring that scripts/config/components.yaml remains the single source of truth for all service ports.

Source: scripts/tools/validate-ports.sh


Usage

# Full validation across all layers
./scripts/tools/validate-ports.sh
 
# Validate specific layers
./scripts/tools/validate-ports.sh --layer1    # Helm vs components.yaml
./scripts/tools/validate-ports.sh --layer2    # Script registries vs components.yaml
./scripts/tools/validate-ports.sh --layer3    # Frontend configs vs components.yaml
./scripts/tools/validate-ports.sh --ips       # Stale hardcoded IP detection

Validation Layers

Layer 1: Helm Values vs components.yaml

Compares service ports defined in Helm values.yaml files with the ports registered in components.yaml:

CheckSource ASource B
Container portvalues.yaml containerPortcomponents.yaml port
Service portvalues.yaml service.portcomponents.yaml port

Layer 2: Script Registries vs components.yaml

Checks that port references in build scripts, deployment scripts, and health check scripts match components.yaml:

CheckFiles Scanned
Port constantsscripts/lib/ shell scripts
Health check URLsStage scripts with port references

Layer 3: Frontend Configs vs components.yaml

Validates that frontend API client configurations match the expected backend ports:

CheckFiles Scanned
API base URLsfrontend/shared/src/utils/apiClient.ts
Docker proxy configsfrontend/*/vite.config.ts

Stale IP Detection

Searches for hardcoded IP addresses that may be stale:

PatternDescription
10.x.x.x:portCluster IPs that may have changed
localhost:portLocal development ports

Output Format

  ai-service               8000     == 8000     PASS
  tenant-service           8082     == 8082     PASS
  billing-service          8087     != 8088     FAIL

Exit Codes

CodeMeaning
0All checks passed
1One or more mismatches detected

CI Integration

This tool is designed for CI pipeline integration. Add to your CI workflow:

- name: Validate port consistency
  run: ./scripts/tools/validate-ports.sh

Related Pages