Overview:
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 on a regular basis so you can keep records going forward.
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_token
response 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.
Limitations:
While this method may allow you to get build data that is outside of your retention period, it will not be able to get all build data for a project that is outside of your plan's retention period. This is why we recommend that users regularly retrieve their build data and store it securely.
Additional Resources:
- CircleCI API Developer's Guide - CircleCI - Please see the v2 API developer's guide for relevant information, including prerequisites and rate limits
Comments
Article is closed for comments.