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. 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
Bearer authentication header of the form Bearer <token>, where <token> is your auth token.
Body
Connect a repository to the organisation.
github, gitlab, bitbucket_cloud The owner, group or workspace, as one path segment.
The repository name, as one path segment.
The organisation's stored Git credential the repository is read and cloned with.
The branch the pipeline file is read from; main when empty.
An application of this organisation to link; empty links none.
A CI cluster override: a cluster of this organisation whose agent runs pipeline steps; empty stores none.
Connect the repository for Ankra Workspaces only: its 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.
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.
github, gitlab, bitbucket_cloud The linked application; null when none.
The repository's CI cluster override; null when its runs follow the organisation's CI settings.
What the trigger last decided for this repository; null when it has never decided anything.
What the connect did with the committed pipeline file.
Show child attributes
Show child attributes
Whether the repository's merge train is on (GET .../merge-train answers the same value with the queue).
How many pull requests the repository's merge train tests at once.
1 <= x <= 8The 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.