import requests
url = "https://platform.ankra.app/api/v1/org/pipelines/repositories/{repository_id}"
payload = {
"cluster_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"workspaces_only": True
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.patch(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'PATCH',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({cluster_id: '3c90c3cc-0d44-4b50-8888-8dd25736052a', workspaces_only: true})
};
fetch('https://platform.ankra.app/api/v1/org/pipelines/repositories/{repository_id}', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));curl --request PATCH \
--url https://platform.ankra.app/api/v1/org/pipelines/repositories/{repository_id} \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"cluster_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"workspaces_only": true
}
'{
"id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"organisation_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"provider": "github",
"owner": "<string>",
"name": "<string>",
"credential_name": "<string>",
"default_branch": "<string>",
"application_id": "<string>",
"cluster_id": "<string>",
"created_at": "2023-11-07T05:31:56Z",
"updated_at": "2023-11-07T05:31:56Z",
"last_trigger": {},
"merge_train_enabled": true,
"merge_train_max_cars": 4,
"workspaces_only": true
}Change a repository's CI cluster
Changes a connected repository’s CI cluster override (or clears it with null), its Workspaces-only mode, or both, without disconnecting the repository. The repository is resolved in the project the request acts in, as GET resolves it. The cluster must be a live cluster of that project with an agent; when its agent runs no pipeline-step workers, Ankra switches them on. It changes where the repository’s next runs go: runs already queued or running keep the cluster they were pinned to. A Workspaces-only repository starts no pipeline run from any trigger, posts no commit status or check run and records no pipeline definition, while workspaces keep working; turning the mode on is refused with 409 while a run is queued or running. Needs pipelines.manage. A browser session twin is mounted at the same path without the /api/v1 prefix (cookie authentication).
import requests
url = "https://platform.ankra.app/api/v1/org/pipelines/repositories/{repository_id}"
payload = {
"cluster_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"workspaces_only": True
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.patch(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'PATCH',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({cluster_id: '3c90c3cc-0d44-4b50-8888-8dd25736052a', workspaces_only: true})
};
fetch('https://platform.ankra.app/api/v1/org/pipelines/repositories/{repository_id}', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));curl --request PATCH \
--url https://platform.ankra.app/api/v1/org/pipelines/repositories/{repository_id} \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"cluster_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"workspaces_only": true
}
'{
"id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"organisation_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"provider": "github",
"owner": "<string>",
"name": "<string>",
"credential_name": "<string>",
"default_branch": "<string>",
"application_id": "<string>",
"cluster_id": "<string>",
"created_at": "2023-11-07T05:31:56Z",
"updated_at": "2023-11-07T05:31:56Z",
"last_trigger": {},
"merge_train_enabled": true,
"merge_train_max_cars": 4,
"workspaces_only": true
}Authorizations
Body
Change a connected repository's CI cluster override, its Workspaces-only mode, or both. At least one member is named; a member left out is left unchanged. A body naming neither answers 422 with cluster_id missing.
Response
The repository as stored.
A repository connected to Ankra Pipelines.
The repository is connected for Ankra Workspaces only: no push, pull request, tag, schedule, merge train or manual dispatch starts a pipeline run for it, no commit status or check run is posted for it, and no pipeline definition is recorded for it. Workspaces (up, runs, the clone credential, workspace profiles) work as for any connected repository.