import requests
url = "https://platform.ankra.app/api/v1/org/workspaces/{workspace_id}/runs"
payload = {
"agent_id": "<string>",
"argv": ["<string>"],
"head_sha": "<string>",
"snapshot_sha": "<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({
agent_id: '<string>',
argv: ['<string>'],
head_sha: '<string>',
snapshot_sha: '<string>'
})
};
fetch('https://platform.ankra.app/api/v1/org/workspaces/{workspace_id}/runs', 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/workspaces/{workspace_id}/runs \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"agent_id": "<string>",
"argv": [
"<string>"
],
"head_sha": "<string>",
"snapshot_sha": "<string>"
}
'{
"apply": true,
"argv_preview": "<string>",
"base_ref": "<string>",
"base_sha": "<string>",
"bundle_object_key": "<string>",
"created_at": "2023-11-07T05:31:56Z",
"cwd_prefix": "<string>",
"env_names": [
"<string>"
],
"error_message": "<string>",
"exit_code": 123,
"finished_at": "2023-11-07T05:31:56Z",
"head_sha": "<string>",
"run_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"snapshot_sha": "<string>",
"started": true,
"state": "accepted",
"user_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"workspace_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a"
}{
"detail": "Cluster not found"
}{
"detail": "Cluster not found"
}{
"detail": "Cluster not found"
}{
"detail": "Cluster not found"
}{
"detail": "Cluster not found"
}{
"detail": [
{
"loc": [
"<string>"
],
"msg": "<string>",
"type": "<string>"
}
]
}{
"detail": "Cluster not found"
}{
"detail": "Cluster not found"
}{
"detail": "<string>",
"error_code": "CLUSTER_OFFLINE",
"retry_after": 123
}Start a workspace run
Bearer PAT authentication; RBAC permission workspaces.use for the caller’s own workspace, workspaces.manage for another member’s. Starts a command in the workspace against the client’s snapshot and answers the run accepted (202) without waiting for it: the pod syncs the snapshot (base fetched from origin with the repository’s credential, the uploaded bundle on top) and starts the command detached. Follow it on the stream. Only a redacted preview of the argv and the names of the forwarded environment variables are stored.
import requests
url = "https://platform.ankra.app/api/v1/org/workspaces/{workspace_id}/runs"
payload = {
"agent_id": "<string>",
"argv": ["<string>"],
"head_sha": "<string>",
"snapshot_sha": "<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({
agent_id: '<string>',
argv: ['<string>'],
head_sha: '<string>',
snapshot_sha: '<string>'
})
};
fetch('https://platform.ankra.app/api/v1/org/workspaces/{workspace_id}/runs', 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/workspaces/{workspace_id}/runs \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"agent_id": "<string>",
"argv": [
"<string>"
],
"head_sha": "<string>",
"snapshot_sha": "<string>"
}
'{
"apply": true,
"argv_preview": "<string>",
"base_ref": "<string>",
"base_sha": "<string>",
"bundle_object_key": "<string>",
"created_at": "2023-11-07T05:31:56Z",
"cwd_prefix": "<string>",
"env_names": [
"<string>"
],
"error_message": "<string>",
"exit_code": 123,
"finished_at": "2023-11-07T05:31:56Z",
"head_sha": "<string>",
"run_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"snapshot_sha": "<string>",
"started": true,
"state": "accepted",
"user_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"workspace_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a"
}{
"detail": "Cluster not found"
}{
"detail": "Cluster not found"
}{
"detail": "Cluster not found"
}{
"detail": "Cluster not found"
}{
"detail": "Cluster not found"
}{
"detail": [
{
"loc": [
"<string>"
],
"msg": "<string>",
"type": "<string>"
}
]
}{
"detail": "Cluster not found"
}{
"detail": "Cluster not found"
}{
"detail": "<string>",
"error_code": "CLUSTER_OFFLINE",
"retry_after": 123
}Authorizations
Body
A command to run in the workspace against the client's snapshot.
Response
The run, accepted
One command run in a workspace.
Why the run ended without an exit code, when the platform could tell: a command that ran the workspace's main container out of memory (it was OOMKilled, which ends every run in it) carries a message naming the container's memory limit and pointing at resources.memory in the repository's workspace profile, and a run ended by the kubelet evicting the workspace pod (an emptyDir volume past its size limit, the node short of memory or disk) carries a message saying so and quoting the kubelet's reason. Null for every other run, which says nothing about how it ended.