Documentation
¶
Overview ¶
Package circleci implements the CircleCI v2 API connector. It populates `builds` and `build_jobs` for repos configured in xray.toml.
Project mapping: the connector reads [connectors.circleci.projects] — a map of CircleCI project slug ("gh/<owner>/<name>") to GitHub repo slug, the same pattern as the sentry and bugsnag connectors. The map is required; omitting it is a validation error.
Simplifications versus the spec:
- CircleCI does not classify pipeline triggers as cleanly as GitHub Actions does. Every emitted Build sets Event="push".
- CircleCI's rerun model is more granular than the canonical (Attempt, RerunOfID) pair; the connector emits Attempt=1 and RerunOfID="" rather than synthesise misleading lineage.
- PRNumber is left nil; recovering it requires correlating webhook payloads not exposed by the public v2 endpoints used here.
- Job DurationSeconds is computed from started_at/stopped_at on the workflow job summary when both are present; otherwise nil. The connector deliberately does not fan out to per-job detail to avoid a request-per-job multiplier.
Index ¶
Constants ¶
const DefaultBaseURL = "https://circleci.com/api/v2"
DefaultBaseURL is the CircleCI v2 API base URL.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Connector ¶
type Connector struct {
// contains filtered or unexported fields
}
Connector implements connector.Connector against CircleCI v2.
func New ¶
New builds a Connector wired to the rate-limit transport. It is an error to construct a Connector without a token; the token is the only authentication CircleCI v2 exposes for these endpoints.
func (*Connector) BudgetSnapshot ¶ added in v0.4.4
func (c *Connector) BudgetSnapshot() map[string]ratelimit.BudgetState
BudgetSnapshot returns the current rate-limit budget for this connector.
func (*Connector) Extract ¶
func (c *Connector) Extract(ctx context.Context, repo connector.Repo, window connector.Window, sink connector.Sink) connector.Provenance
Extract pulls workflows + jobs for the configured repo within window and emits canonical Build / BuildJob rows via the typed sink. A repo whose project_slug is inaccessible to the token is recorded in Provenance.Endpoints rather than producing a hard error — per spec, inaccessible-vs-absent is a meaningful distinction.