import requests
url = "https://platform.ankra.app/api/v1/org/pipeline-repositories/{repository_id}/pipeline-time-saved"
headers = {"Authorization": "Bearer <token>"}
response = requests.get(url, headers=headers)
print(response.text)const options = {method: 'GET', headers: {Authorization: 'Bearer <token>'}};
fetch('https://platform.ankra.app/api/v1/org/pipeline-repositories/{repository_id}/pipeline-time-saved', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));curl --request GET \
--url https://platform.ankra.app/api/v1/org/pipeline-repositories/{repository_id}/pipeline-time-saved \
--header 'Authorization: Bearer <token>'{
"window": "7d",
"from": "2023-11-07T05:31:56Z",
"to": "2023-11-07T05:31:56Z",
"runs": 1,
"saved_seconds": 1,
"saved_cpu_minutes": 1,
"estimated_count": 1,
"unknown_count": 1,
"reasons": [
{
"reason": "path_filter",
"saved_seconds": 1,
"saved_cpu_minutes": 1,
"estimated_count": 1,
"unknown_count": 1
}
],
"repositories": [
{
"repository_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"full_name": "<string>",
"runs": 1,
"saved_seconds": 1,
"saved_cpu_minutes": 1,
"estimated_count": 1,
"unknown_count": 1
}
],
"days": [
{
"date": "2023-12-25",
"saved_seconds": 1,
"saved_cpu_minutes": 1,
"estimated_count": 1,
"unknown_count": 1
}
],
"method": {
"statistic": "median",
"sample_window": 2,
"history_run_scan": 2
},
"caches": {
"since": "2023-11-07T05:31:56Z",
"until": "2023-11-07T05:31:56Z",
"runs_counted": 1,
"total_saved_seconds": 1,
"total_unknown_reason": "nothing_recorded",
"unmeasured_count": 1,
"unrecorded_count": 1,
"savings_capped": true,
"items": [
{
"stage": "<string>",
"paths": [
"<string>"
],
"name": "<string>",
"name_source": "file",
"saved_seconds_per_run": 1,
"basis": "measured",
"warm_runs": 1,
"cold_runs": 1
}
],
"typical_run_seconds": 1,
"typical_run_count": 1,
"cold_run_seconds": 1,
"cold_run_count": 1,
"run_figures_unavailable": "default_branch_unknown",
"run_scan_capped": true,
"newest_cold_run": {
"id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"run_number": 1,
"duration_seconds": 1,
"finished_at": "2023-11-07T05:31:56Z",
"cold": {
"reason": "restore_failed",
"caches": [
{
"stage": "<string>",
"path": "<string>",
"name": "<string>",
"name_source": "file",
"reason": "restore_failed",
"detail": "<string>"
}
],
"caches_capped": true,
"warm_run_before": {
"id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"run_number": 1,
"finished_at": "2023-11-07T05:31:56Z"
},
"cluster_before": {
"id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"name": "<string>"
},
"cluster_now": {
"id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"name": "<string>"
}
},
"cold_unavailable_reason": "read_failed"
}
},
"caches_unavailable_reason": "read_failed"
}Get the time a repository's pipeline saved
The CI time one repository’s runs did not spend over the last 7 or 30 days, in total, by reason and by UTC day. Each saving is estimated when the run is planned or skipped, from the stage’s own history in the same repository: the median of its newest 20 successful runs among the repository’s newest 300 concluded runs (a promoted step uses its duration in the run it was promoted from; a whole run uses the median total of the newest 20 successful runs of the same trigger). CPU-minutes are requested CPU times duration. A stage with no history is counted as unknown, never as a saving. The time is runner time, not wall-clock time. The caches block says what each cache saved a run (recorded when a step that ran with its whole cache warm settles, against the same step’s cold attempts), what a successful default-branch run takes warm and cold, and why the newest cold run was cold; it is null when it could not be read, and caches_unavailable_reason says why. The answer is PipelineRepositoryTimeSaved: the summary the organisation route answers plus caches and caches_unavailable_reason. A client that validates it against the earlier, closed summary schema refuses those two keys. Requires pipelines.read. Read-only.
import requests
url = "https://platform.ankra.app/api/v1/org/pipeline-repositories/{repository_id}/pipeline-time-saved"
headers = {"Authorization": "Bearer <token>"}
response = requests.get(url, headers=headers)
print(response.text)const options = {method: 'GET', headers: {Authorization: 'Bearer <token>'}};
fetch('https://platform.ankra.app/api/v1/org/pipeline-repositories/{repository_id}/pipeline-time-saved', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));curl --request GET \
--url https://platform.ankra.app/api/v1/org/pipeline-repositories/{repository_id}/pipeline-time-saved \
--header 'Authorization: Bearer <token>'{
"window": "7d",
"from": "2023-11-07T05:31:56Z",
"to": "2023-11-07T05:31:56Z",
"runs": 1,
"saved_seconds": 1,
"saved_cpu_minutes": 1,
"estimated_count": 1,
"unknown_count": 1,
"reasons": [
{
"reason": "path_filter",
"saved_seconds": 1,
"saved_cpu_minutes": 1,
"estimated_count": 1,
"unknown_count": 1
}
],
"repositories": [
{
"repository_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"full_name": "<string>",
"runs": 1,
"saved_seconds": 1,
"saved_cpu_minutes": 1,
"estimated_count": 1,
"unknown_count": 1
}
],
"days": [
{
"date": "2023-12-25",
"saved_seconds": 1,
"saved_cpu_minutes": 1,
"estimated_count": 1,
"unknown_count": 1
}
],
"method": {
"statistic": "median",
"sample_window": 2,
"history_run_scan": 2
},
"caches": {
"since": "2023-11-07T05:31:56Z",
"until": "2023-11-07T05:31:56Z",
"runs_counted": 1,
"total_saved_seconds": 1,
"total_unknown_reason": "nothing_recorded",
"unmeasured_count": 1,
"unrecorded_count": 1,
"savings_capped": true,
"items": [
{
"stage": "<string>",
"paths": [
"<string>"
],
"name": "<string>",
"name_source": "file",
"saved_seconds_per_run": 1,
"basis": "measured",
"warm_runs": 1,
"cold_runs": 1
}
],
"typical_run_seconds": 1,
"typical_run_count": 1,
"cold_run_seconds": 1,
"cold_run_count": 1,
"run_figures_unavailable": "default_branch_unknown",
"run_scan_capped": true,
"newest_cold_run": {
"id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"run_number": 1,
"duration_seconds": 1,
"finished_at": "2023-11-07T05:31:56Z",
"cold": {
"reason": "restore_failed",
"caches": [
{
"stage": "<string>",
"path": "<string>",
"name": "<string>",
"name_source": "file",
"reason": "restore_failed",
"detail": "<string>"
}
],
"caches_capped": true,
"warm_run_before": {
"id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"run_number": 1,
"finished_at": "2023-11-07T05:31:56Z"
},
"cluster_before": {
"id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"name": "<string>"
},
"cluster_now": {
"id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"name": "<string>"
}
},
"cold_unavailable_reason": "read_failed"
}
},
"caches_unavailable_reason": "read_failed"
}Authorizations
Response
The repository's savings over the window.
The CI time a repository's runs did not spend, and what its caches saved.