Deploy Gcp¶
Deploy GCP — mvp.deploy_gcp
Cluster: Core Infrastructure | Type: component | MCP Tools: None
Overview¶
Google Cloud Platform deployment provider that pushes images to Artifact Registry and deploys them to Cloud Run. Configures concurrency, instance scaling, CPU/memory limits, and authentication policies via CloudRunConfig, and wires into the deploy_core InfraTarget protocol for drop-in use alongside other providers in the cicd pipeline. This component is Cloud Run only: App Engine, GKE, and Cloud Functions are explicitly unsupported without a separate adapter/resource contract.
When to use:
- Deploying a serverless G6 base (REST, MCP) to Cloud Run with auto-scaling
- Pushing a built image to Google Artifact Registry as part of a GCP CI/CD workflow
- Querying Cloud Run service status or rolling back a failed revision from an agent
GCP deployment scope
deploy_gcp is a Cloud Run deployment adapter, not the recommended first-launch hosting plan by itself. It is useful for staging, internal GCP deployments, and managed/enterprise paths where a GCP project is already approved and configured.
Use the capabilities op before live mutation to distinguish missing gcloud, missing Docker, missing auth, unconfirmed APIs, region gaps, IAM gaps, and rollback support. Capability probes are read-only; they do not deploy or delete Cloud Run services.
For the first paid-customer launch path, the launch plan still favors a simpler VPS/Docker Compose deployment unless GCP credits or a customer requirement justify the extra operational surface. Before treating this as production infrastructure, complete the surrounding launch checks separately: immutable image tags, release pipeline verification, production environment validation, database migrations and rollback, post-deploy smoke tests, billing/email verification, monitoring, backups, and cost/billing controls.
Example:
from mvp.deploy_gcp import GCPBlock, GCPInput
from mvp.deploy_core.schema import ImageSpec, DeployTarget
block = GCPBlock(name="gcp")
result = block.infer(GCPInput(
op="deploy",
image=ImageSpec(name="g6-rest", tag="latest", registry="us-central1-docker.pkg.dev/my-project"),
target=DeployTarget(provider="gcp", service_name="g6-rest"),
project="my-project",
region="us-central1",
))
# result.ok → True; result.value.stage → "deploy"
Works well with: deploy_core, deploy_docker, cicd
Public API¶
GCPBlock(AIBlock[GCPInput, DeployResult, None])¶
| Field | Type | Default |
|---|---|---|
name | str | 'gcp' |
planner | Any | None |
Methods:
infer(data: GCPInput) -> Result[DeployResult]¶
CloudRunConfig¶
Cloud Run deployment configuration.
| Field | Type | Default |
|---|---|---|
allow_unauthenticated | bool | True |
memory | str | '512Mi' |
cpu | str | '1' |
max_instances | int | 10 |
min_instances | int | 0 |
concurrency | int | 80 |
GCPInput¶
Input for GCPBlock.infer().
| Field | Type | Default |
|---|---|---|
op | str | required |
image | ImageSpec | field(default_factory=lambda: ImageSpec(name='')) |
target | DeployTarget | field(default_factory=lambda: DeployTarget(provider='gcp')) |
project | str | '' |
region | str | 'us-central1' |
cloud_run_config | CloudRunConfig | field(default_factory=CloudRunConfig) |
dry_run | bool | True |
approval_confirmed | bool | False |
GCPTarget¶
Constructor:
| Parameter | Type | Default |
|---|---|---|
project | str | '' |
cloud_run_config | CloudRunConfig \| None | None |
dry_run | bool | False |
Methods:
push_image(image: ImageSpec, target: DeployTarget | None = None) -> DeployResult¶
deploy(image: ImageSpec, target: DeployTarget, cloud_run_config: CloudRunConfig | None = None) -> DeployResult¶
wait_healthy(image: ImageSpec, target: DeployTarget) -> DeployResult¶
Poll gcloud run services describe until 100% traffic on latest revision.
status(target: DeployTarget) -> DeployResult¶
teardown(target: DeployTarget) -> DeployResult¶
rollback(image: ImageSpec, target: DeployTarget) -> DeployResult¶
Rollback Cloud Run traffic to the previous ready revision when available.