H-15 CI/CD
Brick H of the Enterprise AI Platform. Technology: GitLab CE CI or Forgejo Actions runners (self hosted). French version: ../../fr/bricks/H-15-ci-cd.md.
Role and responsibilities
- Build, test, scan (H-11), SBOM (H-12), sign (H-13), push (H-16), run quality gates (G-13), update GitOps repo (H-08).
Position and interactions
- Execution path: workflow.
- enterprise-ai validate and enterprise-ai test commands run in pipelines.
Open source and developed parts
- Open source reused: GitLab CE or Forgejo, runners.
- Developed in the platform: Pipeline templates for platform and tenant artifacts.
Data model
Control Plane tables (schema eai): eai.eval_runs.
Every tenant table has tenant_id uuid NOT NULL and a row level security policy on current_setting('app.tenant_id', true)::uuid. ClickHouse usage_events is the analytics replica of eai.usage_events (ReplacingMergeTree keyed by event_id).
Contract: contracts/v1/evaluation-contract.schema.json (schema_version 1.0). Usage is always reported with contracts/v1/usage-event.schema.json, audit with contracts/v1/audit-event.schema.json.
API endpoints
| Method | Path |
|---|---|
| POST | /v1/evaluations/gates/check |
| POST | /v1/contracts/{name}/validate |
POST /v1/evaluations/gates/check
Request:
{
"target": {
"type": "agent",
"ref": "agt_ap",
"version": "1.4.0"
},
"suite_ids": [
"evs_12"
],
"run_missing": true
}
Response:
{
"passed": false,
"reasons": [
"redteam run missing for version 1.4.0"
],
"evidence": [
"evr_77"
]
}
POST /v1/contracts/{name}/validate
Request:
{
"document": {
"schema_version": "1.0"
}
}
Response:
{
"valid": false,
"errors": [
{
"path": "/event_id",
"message": "required"
}
]
}
SDK examples
Python
from enterprise_ai import EnterpriseAI
client = EnterpriseAI(base_url="<control-plane-url>", api_key="eai_live_xxx", tenant="acme", locale="en")
client.evaluation.check_gate(target={"type": "agent", "ref": "agt_ap", "version": "1.4.0"})
client.contracts.validate(name="usage-event", document={"schema_version": "1.0"})
TypeScript
import { EnterpriseAI } from "@enterprise-ai/sdk";
const client = new EnterpriseAI({ baseUrl: "<control-plane-url>", apiKey: process.env.EAI_API_KEY, tenant: "acme", locale: "en" });
await client.evaluations.checkGate({ target: { type: "agent", ref: "agt_ap", version: "1.4.0" }, suite_ids: ["evs_12"] });
await client.contracts.validate({ name: "usage-event", document: { schemaVersion: "1.0" } });
Java
EnterpriseAIClient client = EnterpriseAIClient.builder()
.baseUrl("<control-plane-url>")
.apiKey(System.getenv("EAI_API_KEY"))
.tenant("acme")
.locale(Locale.ENGLISH)
.build();
client.evaluations().checkGate(Map.of("target", Map.of("type", "agent", "ref", "agt_ap", "version", "1.4.0"), "suite_ids", List.of("evs_12")));
client.contracts().validate("usage-event", Map.of("schema_version", "1.0"));
Go
client, err := eai.NewClient(eai.WithBaseURL("<control-plane-url>"), eai.WithAPIKey(os.Getenv("EAI_API_KEY")), eai.WithTenant("acme"), eai.WithLocale("en"))
if err != nil { log.Fatal(err) }
ctx := context.Background()
_, err = client.Evaluations.CheckGate(ctx, map[string]any{"target": map[string]any{"type": "agent", "ref": "agt_ap", "version": "1.4.0"}})
_, err = client.Contracts.Validate("usage-event", map[string]any{"schema_version": "1.0"})
Configuration
Environment variables: EAI_API_URL.
Security
- Runners isolated, OIDC to OpenBao, no long lived secrets.
- Tenant resolved from the credential, never from the body; PostgreSQL row level security on every tenant table.
- Every mutation and policy decision writes a hash chained audit event (G-11).
- Errors use the standard envelope with message_i18n en and fr.
Observability
- Pipeline duration and failure rate.
- W3C traceparent propagated, X-Request-Id returned, spans carry eai.tenant_id, eai.project, eai.agent_id, eai.run_id.
FinOps units
- Evaluation runs in CI are budgeted by a CI quota.
Failure modes and resilience
- Gate failure blocks the merge.
Standalone adoption
Templates portable to GitHub Actions.
Acceptance tests
- A pipeline with a failing contract validation stops before build.