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 detectionValidation Layers
Layer 1: Helm Values vs components.yaml
Compares service ports defined in Helm values.yaml files with the ports registered in components.yaml:
| Check | Source A | Source B |
|---|---|---|
| Container port | values.yaml containerPort | components.yaml port |
| Service port | values.yaml service.port | components.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:
| Check | Files Scanned |
|---|---|
| Port constants | scripts/lib/ shell scripts |
| Health check URLs | Stage scripts with port references |
Layer 3: Frontend Configs vs components.yaml
Validates that frontend API client configurations match the expected backend ports:
| Check | Files Scanned |
|---|---|
| API base URLs | frontend/shared/src/utils/apiClient.ts |
| Docker proxy configs | frontend/*/vite.config.ts |
Stale IP Detection
Searches for hardcoded IP addresses that may be stale:
| Pattern | Description |
|---|---|
10.x.x.x:port | Cluster IPs that may have changed |
localhost:port | Local development ports |
Output Format
ai-service 8000 == 8000 PASS
tenant-service 8082 == 8082 PASS
billing-service 8087 != 8088 FAILExit Codes
| Code | Meaning |
|---|---|
| 0 | All checks passed |
| 1 | One 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.shRelated Pages
- Core Libraries -- ports.sh library
- Stage 18: Validation -- Deployment validation
- Build System -- Build configuration