thecr3w-dev/contracts/schemas/deployment-manifest.schema.json

134 lines
3.9 KiB
JSON

{
"$schema": "https://json-schema.org/draft/2020-12/schema",
"$id": "https://contracts.thecr3wnet.com/schemas/deployment-manifest.schema.json",
"title": "TheCr3wDeploymentManifest",
"description": "Kanoniczny schemat manifestu wdrożeniowego dla TheCr3w-dev Docker Deployment System",
"type": "object",
"required": [
"manifest_id",
"project",
"environment",
"service_name",
"image",
"immutable_digest",
"config_hash",
"secrets_references",
"required_migrations",
"healthcheck",
"rollback_strategy",
"created_at",
"created_by",
"signature_ed25519"
],
"properties": {
"manifest_id": {
"type": "string",
"format": "uuid",
"description": "Niezmienny unikalny identyfikator manifestu wdrożeniowego"
},
"project": {
"type": "string",
"pattern": "^[a-z0-9-]+$",
"description": "Nazwa projektu (np. thecr3w-backend, thecr3w-frontend)"
},
"environment": {
"type": "string",
"enum": ["development", "staging", "production"],
"description": "Docelowe środowisko wdrożeniowe"
},
"service_name": {
"type": "string",
"pattern": "^[a-z0-9_-]+$",
"description": "Nazwa usługi lub kontenera docelowego"
},
"image": {
"type": "string",
"description": "Nazwa repozytorium obrazu OCI w Forgejo (np. git.thecr3wnet.com/thecr3w/backend)"
},
"immutable_digest": {
"type": "string",
"pattern": "^sha256:[a-f0-9]{64}$",
"description": "Kryptograficzny skrót SHA256 obrazu OCI gwarantujący niezmienność (zakaz wdrażania po latest)"
},
"config_hash": {
"type": "string",
"pattern": "^[a-f0-9]{64}$",
"description": "Skrót SHA256 konfiguracji niemającej charakteru tajnego"
},
"secrets_references": {
"type": "array",
"items": {
"type": "string",
"pattern": "^[A-Z0-9_]+$"
},
"description": "Wyłącznie nazwy referencyjne wymaganych zmiennych środowiskowych - BEZ WARTOŚCI"
},
"required_migrations": {
"type": "array",
"items": {
"type": "string"
},
"description": "Wymagane identyfikatory migracji bazy danych dla danego wydania"
},
"healthcheck": {
"type": "object",
"required": ["path", "port", "interval_seconds", "timeout_seconds", "retries"],
"properties": {
"path": {
"type": "string",
"default": "/health"
},
"port": {
"type": "integer",
"minimum": 1,
"maximum": 65535
},
"interval_seconds": {
"type": "integer",
"minimum": 1,
"default": 10
},
"timeout_seconds": {
"type": "integer",
"minimum": 1,
"default": 5
},
"retries": {
"type": "integer",
"minimum": 1,
"default": 3
}
}
},
"rollback_strategy": {
"type": "object",
"required": ["mode", "target_immutable_digest"],
"properties": {
"mode": {
"type": "string",
"enum": ["automatic_on_health_failure", "manual_approval_only", "disabled"]
},
"target_immutable_digest": {
"type": "string",
"pattern": "^(sha256:[a-f0-9]{64}|none)$",
"description": "Poprzedni sprawdzony digest, do którego nastąpi powrót w razie awarii"
}
}
},
"created_at": {
"type": "string",
"format": "date-time"
},
"created_by": {
"type": "string",
"description": "Tożsamość inicjatora wdrożenia (Keycloak user sub lub CI/CD workflow SHA)"
},
"signature_ed25519": {
"type": "string",
"pattern": "^[a-f0-9]{128}$",
"description": "Podpis cyfrowy Ed25519 w formacie hex (64 bajty) kanonicznej reprezentacji JSON tego manifestu"
}
},
"additionalProperties": false
}