Deploy Governance to a VB-OS Environment
Create Environments
Section titled “Create Environments”Set up environments for your project:
from vbos import VBOSClient
client = VBOSClient(api_key="YOUR_API_KEY")
dev_env = client.environments.create( project_id="PROJECT_ID", name="development",)
staging_env = client.environments.create( project_id="PROJECT_ID", name="staging",)
prod_env = client.environments.create( project_id="PROJECT_ID", name="production",)Deploy a Boundary Version
Section titled “Deploy a Boundary Version”Deploy a compiled boundary version to an environment:
deployment = client.deployments.create( project_id="PROJECT_ID", environment_id=dev_env["id"], boundary_version_id="COMPILED_VERSION_ID",)If the environment already has an active deployment, it transitions to SUPERSEDED status. The new deployment becomes ACTIVE.
Promotion Flow
Section titled “Promotion Flow”Promote a specific version through environments:
version_id = "COMPILED_VERSION_ID"
# Deploy to developmentclient.deployments.create( project_id="PROJECT_ID", environment_id=dev_env["id"], boundary_version_id=version_id,)
# Test in development...
# Promote to stagingclient.deployments.create( project_id="PROJECT_ID", environment_id=staging_env["id"], boundary_version_id=version_id,)
# Run certifications against staging...
# Promote to productionclient.deployments.create( project_id="PROJECT_ID", environment_id=prod_env["id"], boundary_version_id=version_id,)Promotion requires an explicit boundary_version_id. You cannot promote “the latest”: you must specify the exact compiled version. This prevents TOCTOU races where a newer version is compiled between your decision to promote and the actual promotion.
Rollback
Section titled “Rollback”Roll back a deployment:
client.deployments.rollback( project_id="PROJECT_ID", environment_id="ENVIRONMENT_ID", boundary_id="BOUNDARY_ID", reason="Rolling back due to evaluation failures",)Rollback targets a specific boundary within an environment. The current deployment transitions to ROLLED_BACK. To restore a previous version, create a new deployment with that version’s ID.
CLI Deployment
Section titled “CLI Deployment”vbos deployments create \ --project PROJECT_ID \ --environment ENVIRONMENT_ID \ --boundary-version VERSION_IDNext Steps
Section titled “Next Steps”- Environments: understanding isolation
- Deployments: deployment lifecycle
- Manage Boundary Versions: versioning workflow
