turbot/circleci
steampipe plugin install circleci

Table: circleci_pipeline - Query CircleCI Pipelines using SQL

CircleCI is a continuous integration and delivery platform that automates the build, test, and deploy processes for software applications. The Pipeline is a key feature of CircleCI, representing an individual instance of a run workflow, including its status, triggers, and associated metadata. It provides developers with a detailed view of their application's build process, enabling them to quickly identify and resolve issues.

Table Usage Guide

The circleci_pipeline table provides insights into each pipeline run within CircleCI. As a developer or DevOps engineer, explore pipeline-specific details through this table, including status, triggers, and associated metadata. Utilize it to monitor your application's build process, identify bottlenecks or failures, and optimize your continuous integration and delivery workflows.

Important Notes

  • You must specify project_slug in the where clause to query this table.

Examples

Error details of the pipelines of a project

Discover the segments that contain errors within a specific project's pipelines. This can be useful in quickly identifying and addressing issues to improve project performance and efficiency.

select
id,
number,
errors
from
circleci_pipeline
where
project_slug = 'gh/fluent-cattle/sp-plugin-test'
and errors is not null
and jsonb_array_length(errors) > 0;
select
id,
number,
errors
from
circleci_pipeline
where
project_slug = 'gh/fluent-cattle/sp-plugin-test'
and errors is not null
and json_array_length(errors) > 0;

Number of pipelines per project

Analyze the settings to understand the distribution of pipelines across various projects. This can help in identifying projects with heavy pipeline utilization, aiding in resource allocation and optimization.

select
pr.slug,
count(pl.*)
from
circleci_project pr
join circleci_pipeline pl on pr.slug = pl.project_slug
group by
pr.slug;
select
pr.slug,
count(pl.project_slug)
from
circleci_project pr
join circleci_pipeline pl on pr.slug = pl.project_slug
group by
pr.slug;

Pipelines of a project by state

Explore the distribution of pipeline states within a specific project. This can help in identifying patterns or issues related to the project's pipeline states.

select
state,
count(*)
from
circleci_pipeline
where
project_slug = 'gh/fluent-cattle/sp-plugin-test'
group by
state;
select
state,
count(*)
from
circleci_pipeline
where
project_slug = 'gh/fluent-cattle/sp-plugin-test'
group by
state;

Schema for circleci_pipeline

NameTypeOperatorsDescription
_ctxjsonbSteampipe context in JSON form, e.g. connection_name.
created_attimestamp with time zoneTimestamp of when the pipeline was created.
errorsjsonbA list of errors while executing pipeline's jobs.
idtextUnique key for the pipeline.
numberbigintA second identifier for the pipeline.
project_slugtext=A unique identification for the project in the form of: <vcs_type>/<org_name>/<repo_name>.
statetextThe state of the pipeline.
triggerjsonbWhat triggers the pipeline to run.
trigger_parametersjsonbAny parameter for pipeline triggering.
updated_attimestamp with time zoneTimestamp of when pipeline was updated.
vcsjsonbVersion control system of the pipeline

Export

This table is available as a standalone Exporter CLI. Steampipe exporters are stand-alone binaries that allow you to extract data using Steampipe plugins without a database.

You can download the tarball for your platform from the Releases page, but it is simplest to install them with the steampipe_export_installer.sh script:

/bin/sh -c "$(curl -fsSL https://steampipe.io/install/export.sh)" -- circleci

You can pass the configuration to the command with the --config argument:

steampipe_export_circleci --config '<your_config>' circleci_pipeline