Typically, build data will disappear after a set amount of time, based on your organization's plan. But what if I need data that is outside of my organization's plan? The CircleCI v2 API contains endpoints that will help retrieve build data outside of your retention period by iterating through the data as required.
Steps to Retrieve Data:
- Retrieve a list of pipelines for a given project: Get all pipelines
- Retrieve a list of workflows for a given pipeline by the pipeline ID: Get a pipeline’s workflows
- Retrieve the workflow data by the workflow ID: Get a workflow by ID
- Retrieve the jobs of a workflow by the workflow ID: Get a workflow’s jobs
- Store the retrieved pipeline, workflow, and job data in your chosen data stores
- Repeat steps as required with the
next_page_tokenresponse from step 1
To expedite to process, we would recommend performing these steps in a script that can be reused and modified to suit your needs.
- CircleCI API Developer's Guide - CircleCI - Please see the v2 API developer's guide for relevant information, including prerequisites and rate limits