import requests
url = "https://platform.ankra.app/api/v1/org/pipelines/repositories"
payload = {
"owner": "<string>",
"name": "<string>"
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({owner: '<string>', name: '<string>'})
};
fetch('https://platform.ankra.app/api/v1/org/pipelines/repositories', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));curl --request POST \
--url https://platform.ankra.app/api/v1/org/pipelines/repositories \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"owner": "<string>",
"name": "<string>"
}
'{
"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": {},
"definition": {
"status": "recorded",
"detail": "<string>",
"definition_id": "<string>",
"spec_hash": "<string>",
"violations": [
"<string>"
],
"read_error": "<string>"
},
"merge_train_enabled": true,
"merge_train_max_cars": 4,
"workspaces_only": true
}Connect a repository
Connects a repository to the organisation. By default it becomes a pipeline repository: its committed .ankra/pipeline.yaml is read from the default branch through the named credential and recorded as the definition of record, and pushes, pull requests and tags start runs. With workspaces_only true it is connected for Ankra Workspaces only: the pipeline file is not read, no definition is recorded, no run is started from any trigger and no commit status or check run is posted, which suits a repository whose pipeline already runs in another organisation. A disconnected repository with the same identity is revived, into the project the request acts in. A caller held to one project (a project-only member, or a token pinned to a project) cannot connect a repository another project already reaches through an application or a connected pipeline repository, nor one another project keeps a pipeline repository row of, connected or disconnected, so they never revive another project’s repository. An application_id or cluster_id must be in the project the repository lands in. A cluster_id whose agent runs no pipeline-step workers has them switched on. 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"
payload = {
"owner": "<string>",
"name": "<string>"
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({owner: '<string>', name: '<string>'})
};
fetch('https://platform.ankra.app/api/v1/org/pipelines/repositories', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));curl --request POST \
--url https://platform.ankra.app/api/v1/org/pipelines/repositories \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"owner": "<string>",
"name": "<string>"
}
'{
"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": {},
"definition": {
"status": "recorded",
"detail": "<string>",
"definition_id": "<string>",
"spec_hash": "<string>",
"violations": [
"<string>"
],
"read_error": "<string>"
},
"merge_train_enabled": true,
"merge_train_max_cars": 4,
"workspaces_only": true
}Authorizations
Body
Connect a repository to the organisation.
Response
The repository as stored, and what the connect did with its committed pipeline file.
A repository just connected, and what the connect did with its committed pipeline file.
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.