Cicd¶
CICD — mvp.cicd
Cluster: Uncategorised | Type: base | MCP Tools: None
Overview¶
End-to-end deployment pipeline base that orchestrates the full build → push → deploy → health-check lifecycle for any G6 base. Composes a ContainerRuntime (Docker or Podman) with an InfraTarget (AWS, GCP, bare metal, K8s) selected at runtime from PipelineConfig, generates git-SHA-tagged image versions, and provides blue/green rollout, staging gates, quality gates, and alert hooks. Exposes a CLI entrypoint for operator use.
When to use:
- Running a complete CI/CD pipeline for a G6 REST, gRPC, or MCP base from a single config file
- Wiring blue/green deployments with configurable staging promotion and automatic rollback
- Triggering deployment pipelines programmatically from an agent or GitHub Actions workflow
Example:
from mvp.cicd.config import PipelineConfig
from mvp.cicd.pipeline import run_pipeline
config = PipelineConfig(base="rest", runtime="docker", target="aws", dry_run=True)
result = run_pipeline(config)
# result.ok → True; each stage logs a DeployResult
Works well with: deploy_docker, deploy_aws, deploy_k8s, observability
Public API¶
AlertDispatcher¶
| Field | Type | Default |
|---|---|---|
email_config | EmailConfig \| None | None |
github_token | str | '' |
github_repo | str | '' |
pushgateway_url | str | 'http://pushgateway:9091' |
dry_run | bool | False |
Methods:
dispatch(alert: Alert) -> DeployResult¶
BlueGreenManager¶
| Field | Type | Default |
|---|---|---|
host | str | required |
ssh_config | BareMetalConfig | required |
health_checker | HealthChecker | required |
config | BlueGreenConfig | field(default_factory=BlueGreenConfig) |
dry_run | bool | False |
Methods:
deploy(image_tag: str) -> DeployResult¶
rollback() -> DeployResult¶
status() -> DeployResult¶
PipelineConfig¶
Deployment pipeline configuration.
| Field | Type | Default |
|---|---|---|
runtime | str | 'docker' |
target | str | 'k8s' |
registry | str | '' |
bases | list[str] | field(default_factory=list) |
dry_run | bool | False |
target_config | dict | field(default_factory=dict) |
version | str | '' |
bluegreen | BlueGreenConfig | field(default_factory=BlueGreenConfig) |
staging | StagingConfig | field(default_factory=StagingConfig) |
health | HealthCheckConfig | field(default_factory=HealthCheckConfig) |
alerts | AlertConfig | field(default_factory=AlertConfig) |
gates | GateConfig | field(default_factory=GateConfig) |
Methods:
all_base_names() -> list[str]¶
from_yaml(path: str) -> PipelineConfig¶
QualityGateRunner¶
| Field | Type | Default |
|---|---|---|
gates | list[QualityGate] | field(default_factory=lambda: list(DEFAULT_GATES)) |
dry_run | bool | False |
Methods:
run_gate(gate: QualityGate) -> DeployResult¶
Run a single quality gate.
run_group(group_name: str, gates: list[QualityGate]) -> list[DeployResult]¶
Run gates sequentially (parallel execution delegated to CI matrix).
run_tier(tier: int) -> DeployResult¶
Run all gates in a tier. Fails if any required gate fails.
report(results: list[DeployResult]) -> str¶
Format results as a summary table.
run_release_gate(stages: list[QualityGate] | None = None) -> tuple[list[DeployResult], 'ReleaseGateVerdict']¶
Run the full local release gate and return (results, tri-state verdict).
HealthChecker¶
| Field | Type | Default |
|---|---|---|
config | HealthCheckConfig | field(default_factory=HealthCheckConfig) |
dry_run | bool | False |
Methods:
check_endpoint(url: str) -> DeployResult¶
HTTP GET with retries. Expects 200.
check_endpoints(endpoints: list[str]) -> DeployResult¶
Check multiple endpoints. ALL must pass.
check_container(host: str, ssh_config: BareMetalConfig, container_name: str) -> DeployResult¶
Check Docker container health status via SSH.
check_end_to_end(public_url: str, expected_status: int = 200) -> DeployResult¶
Hit public URL through nginx/TLS.
full_check(host: str, ssh_config: BareMetalConfig, slot: str, endpoints: list[str], public_url: str | None = None) -> DeployResult¶
Run all three levels sequentially. Stops on first failure.
DeployPipeline¶
Constructor:
| Parameter | Type | Default |
|---|---|---|
config | PipelineConfig | required |
runtime | - | None |
target | - | None |
gate_runner | - | None |
staging_manager | - | None |
bluegreen_manager | - | None |
alert_dispatcher | - | None |
state_store | - | _UNSET |
Methods:
run() -> list[DeployResult]¶
StagingManager¶
| Field | Type | Default |
|---|---|---|
host | str | required |
ssh_config | BareMetalConfig | required |
health_checker | HealthChecker | required |
config | StagingConfig | field(default_factory=StagingConfig) |
compose_dir | str | '/opt/g6solver' |
dry_run | bool | False |
Methods:
deploy(image_tag: str) -> DeployResult¶
run_smoke_tests() -> DeployResult¶
teardown() -> DeployResult¶
promote(image_tag: str, bluegreen_manager = None) -> DeployResult¶
Deploy to staging, run smoke tests, optionally teardown, then hand off to blue-green.