gcp.cloudbuild.repository.ensure ​
Link a repository under a Cloud Build 2nd-gen connection so image.build can use it as a connectedRepository source.
Ensure a repository is linked under a Cloud Build 2nd-gen host connection.
Once linked, repository_name (the full resource name) is what gcp.cloudbuild.image.build consumes as its github_repo / connectedRepository source — so a PRIVATE repo builds without staging a tarball. Idempotent: describes an existing link 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 the repository links under. |
repository_id | string | Yes | — | Repository id, e.g. calendar. |
remote_uri | string | Yes | — | Repository clone URL, e.g. https://github.com/islasoftwarefactory/calendar.git. |
annotations | json | No | — | Repository 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. |
repository_id | string | No | — | Repository id. |
repository_name | string | No | — | Full repository resource name — the image.build connectedRepository source. |
remote_uri | string | No | — | Repository clone URL. |
created | boolean | No | — | True when the link was newly created. |
repository | json | No | — | Sanitized provider repository 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.repository.ensure",
"initial_data": {
"connection_uuid": "value",
"location": "value",
"connection_id": "value",
"repository_id": "value"
}
}