gcp.cloudbuild.connection.ensure ​
Ensure a Cloud Build 2nd-gen host connection (GitHub/GitLab) exists for private-repo source access.
Ensure a Cloud Build 2nd-gen host connection (GitHub/GitLab) exists.
A host connection is the credential boundary that lets Cloud Build read a PRIVATE source repo. For GitHub, pass app_installation_id (the Cloud Build GitHub App installation on the org/repo) and authorizer_credential_secret_version (a Secret Manager version holding a GitHub OAuth/PAT token with repo scope). Idempotent: describes an existing connection rather than failing.
Overview ​
| Property | Value |
|---|---|
| Workflow type | Linear |
| Library | Base-gcp |
| Version | 1.0 |
Input Schema ​
| Field | Type | Required | Default | Description |
|---|---|---|---|---|
connection_uuid | uuid | Yes | — | GCP CloudConnection UUID. |
project_id | string | No | — | GCP project override; defaults to the connection project. |
location | string | Yes | — | Cloud Build region, e.g. us-central1. |
connection_id | string | Yes | — | Host-connection id, e.g. github-islasoftwarefactory. |
app_installation_id | integer | No | — | GitHub App installation id (Cloud Build GitHub App on the org/repo). |
authorizer_credential_secret_version | string | No | — | Secret Manager version holding the GitHub OAuth/PAT token (repo scope). |
github_enterprise_config | json | No | — | Raw githubEnterpriseConfig for GHE connections. |
gitlab_config | json | No | — | Raw gitlabConfig for GitLab connections. |
annotations | json | No | — | Connection annotations. |
poll_interval_seconds | integer | No | — | LRO poll interval. |
timeout_seconds | integer | No | — | LRO wait timeout. |
Output Schema ​
| Field | Type | Required | Default | Description |
|---|---|---|---|---|
connection_uuid | uuid | No | — | Echoed connection UUID. |
project_id | string | No | — | Effective project id. |
location | string | No | — | Build region. |
connection_id | string | No | — | Host-connection id. |
connection_name | string | No | — | Full connection resource name. |
created | boolean | No | — | True when the connection was newly created. |
installation_state | string | No | — | installationState.stage — COMPLETE means ready; PENDING_* means the GitHub App still needs authorizing. |
connection | json | No | — | Sanitized provider connection resource. |
failure_reason | string | No | — | Human-readable failure reason. |
failed_step | string | No | — | Failed logical step. |
failed_layer | json | No | — | Engine failed layer envelope. |
failed_at_state | string | No | — | State where failure occurred. |
error | string | No | — | Error message. |
error_type | string | No | — | Error class. |
States ​
| State | Initial | Terminal | Success | Auto-advance | Description |
|---|---|---|---|---|---|
pending | Yes | No | — | preflight | — |
ensuring | No | No | — | complete | — |
preflighting | No | No | — | execute | — |
completed | No | Yes | Yes | — | — |
failed | No | Yes | No | — | — |
State Diagram ​
Transitions ​
| From | Action | To | Description |
|---|---|---|---|
pending | preflight | preflighting | — |
preflighting | execute | ensuring | — |
ensuring | complete | completed | — |
* (any state) | fail | failed | — |
API Usage ​
bash
POST /api/workflows/start
Content-Type: application/json
{
"workflow_type": "gcp.cloudbuild.connection.ensure",
"initial_data": {
"connection_uuid": "value",
"location": "value",
"connection_id": "value"
}
}