CI and source-control provider adapters
Provider adapters connect Pipedash to external CI, source-control, and deployment systems. Each adapter turns one provider's API, data model, settings, permissions, and log format into the shared provider view used by the rest of the product. This page complements provider integrations, the plugin platform, and core domain and persistence.
Adapter model
The adapter model gives every external system one common contract. A registered plugin owns provider-specific work, while the core wraps it as a domain provider and exposes the same pipeline, run, action, health, and log concepts to the application. This includes provider actions such as rerunning a whole run or one job when the plugin supports them.
Provider lifecycle
The provider service creates a plugin from a provider type, gives it the saved settings and an HTTP client, then keeps the running instance available for refresh and user actions. The adapter passes results into the domain model and translates plugin errors into core errors, so provider differences do not spread into higher layers.
flowchart LR
C[Provider configuration] --> S[Provider service]
S --> R[Plugin registry]
R --> P[Concrete provider plugin]
P --> A[Plugin adapter]
A --> D[Shared domain provider]
D --> U[Refresh, dashboard, actions, and logs]
The plugin API makes support for a capability explicit. A provider can report whether it supports pipeline runs, triggers, cancellation, logs, agents, artifacts, queues, or sign-in. Unsupported operations return a common “not supported” result rather than requiring a special interface for each provider.
References: crates/…/provider_service.rs• L227-269 crates/…/plugin_adapter.rs• L158-345 crates/…/plugin.rs• L71-131
Provider registration
The registry is the source of truth for the concrete adapters available to the running application. Each registered type has metadata for discovery and a factory path for creating a fresh plugin instance.
| Provider type | Product name | Main system role |
|---|---|---|
github | GitHub Actions | Repository workflows and run actions |
gitea | Gitea Actions | Self-hosted repository workflows |
gitlab | GitLab CI | Projects and CI pipelines |
bitbucket | Bitbucket Pipelines | Repository pipelines |
azure-devops | Azure DevOps | YAML and classic Azure Pipelines |
buildkite | Buildkite | Builds, agents, and artifacts |
jenkins | Jenkins | Jobs, builds, and pipelines |
circleci | CircleCI | Cloud or server pipelines |
woodpecker | Woodpecker CI | Self-hosted CI pipelines |
tekton | Tekton CD | Kubernetes-native pipelines |
argocd | ArgoCD | Kubernetes applications and deployments |
fluxcd | FluxCD | Kubernetes resources and reconciliation history |
prow | Prow | Kubernetes Prow jobs |
coolify | Coolify | Application deployments |
komodo | Komodo | Stack deployments |
The first nine entries focus on source-control or hosted CI systems. The remaining entries use the same contract for Kubernetes and deployment systems, which lets the dashboard present their work beside standard CI runs.
References: crates/…/mod.rs• L7-61 crates/…/registry.rs• L5-35
Client boundaries
Each adapter owns the rules for talking to its external system. Its client handles authentication, endpoint selection, pagination, retries, rate limits, and provider-specific API errors. The core supplies a shared HTTP client and lets the plugin request client options such as TLS or proxy behavior.
External API access
The client layer hides provider wire formats from the plugin contract. The plugin uses it to discover selectable repositories or resources, fetch pipelines and runs, perform actions, and read logs. This keeps provider API changes inside one adapter while the dashboard continues to consume shared objects.
Buildkite shows how a client can combine related provider calls. It reads the latest build with the pipeline data when possible, then uses the pipeline endpoint when a pipeline has no builds yet. Missing selected pipelines can be skipped while rate-limit failures remain visible to the refresh, so an absent resource does not look like a temporary service failure.
Bitbucket illustrates the boundary clearly. Its client discovers workspaces and repositories, follows provider pagination, finds runs by build number, and sends trigger or stop actions. It also streams step logs through the provider's API or redirected storage URL. Authentication stays on the API request and is not sent to redirected log storage. crates/…/client.rs• L35-59, crates/…/client.rs• L61-139, crates/…/client.rs• L160-268
References: crates/…/plugin.rs• L94-207 crates/…/client.rs• L35-59 crates/…/client.rs• L61-139 crates/…/client.rs• L160-268 crates/…/client.rs• L56-75 crates/…/client.rs• L97-173 crates/…/tests.rs• L470-498
Error and quota boundaries
Plugins classify failures such as bad credentials, denied access, rate limits, network faults, missing resources, and service outages. The adapter maps these failures to the domain error set. The provider service can then apply common health, freshness, retry, and quota behavior across all providers.
References: crates/…/plugin.rs• L71-92 crates/…/plugin_adapter.rs• L48-90 crates/…/provider_service.rs• L1239-1273
Configuration boundaries
Provider configuration describes how to reach a system and which resources to monitor. The adapter publishes a schema for connection fields, credentials, optional settings, validation, and supported sign-in modes. The core stores the configuration and resolves credentials before plugin initialization.
Resource selection
Adapters map saved selections to provider resource identifiers. A selection can be a repository, project, organization, namespace, job source, or deployment stack. During provider updates, the core asks the plugin which selected resources still contain CI work when that check is available. This prevents a saved selection from silently producing an empty dashboard.
Bitbucket treats a repository as selected work when it has a pipeline run or a bitbucket-pipelines.yml file. It checks only the saved repositories during a scoped refresh, while an unscoped refresh discovers all repositories that have either signal. This lets a configured repository appear before its first run.
References: crates/…/catalog.rs• L14-49 crates/…/catalog.rs• L65-89 crates/…/catalog.rs• L148-207
Authentication modes
Most adapters use a token or key. Prow and some Kubernetes-facing adapters can also use sign-in or cluster credentials. The shared schema tells the product which mode and fields to show, while the plugin decides how to turn those fields into authenticated requests.
References: crates/…/schema.rs• L22-93 crates/…/provider.rs• L33-63 crates/…/provider_service.rs• L281-293 crates/…/metadata.rs• L59-181
Data mapping
Mapping is the adapter responsibility that makes unlike provider models look alike. A plugin turns provider resources into pipelines, runs, statuses, metadata, and log nodes without hiding provider facts that are useful to the product.
Pipeline and run identity
Each adapter creates stable identifiers that let later requests find the same pipeline or run. The adapter adds provider context to local plugin identifiers before it returns them to the core. It removes that context again for provider requests. This keeps identifiers distinct across configured providers while preserving the IDs expected by each external system.
References: crates/…/plugin_adapter.rs• L93-103 crates/…/plugin_adapter.rs• L105-171 crates/…/client.rs• L511-555 crates/…/config.rs• L12-30 crates/…/mapper.rs• L1-150
Status and metadata
Provider status values do not use one vocabulary. Adapters map them to shared states such as success, failed, running, pending, cancelled, skipped, or degraded. They also attach provider facts that drive product actions, such as whether a workflow can be enabled, a run awaits review, or failed jobs can be rerun.
GitHub maps completed conclusions such as success, failure, timeout, cancellation, and skip to finished shared states. It maps queued work to pending and active work to running. A workflow disabled by inactivity, manual action, or fork policy becomes a disabled resource with a reason and an enable action instead of showing only its old run status. A waiting run stays pending and carries review metadata.
The mapping keeps important provider meaning. Bitbucket distinguishes paused or halted work from active work and preserves custom pipeline selectors so a rerun can use the same custom pipeline. Buildkite keeps a failing build in the running state when the build is still active. CircleCI combines pipeline errors with the latest workflow attempts and records whether cancellation or rerun actions are valid.
References: crates/…/tests.rs• L3-61 crates/…/tests.rs• L372-382 crates/…/tests.rs• L819-856 crates/…/mapper.rs• L16-41 crates/…/mapper.rs• L106-161 crates/…/mapper.rs• L18-41 crates/…/mapper.rs• L118-172 crates/…/mapper.rs• L174-242 crates/…/plugin_adapter.rs• L125-140
Resource shape
The shared log model supports stages, jobs, and steps. An adapter chooses the shape that best matches its source. GitHub exposes jobs with child steps, GitLab groups jobs under stages, and other providers may expose a flatter job list or a deployment resource tree.
The concrete adapters show three useful shapes. Bitbucket presents pipeline steps as flat job nodes. Buildkite presents current script jobs as log nodes and keeps provider job data for retry and parallel-run decisions. CircleCI presents workflows as stages with their jobs as children, while approval jobs can remain visible without a log.
References: crates/…/plugin_adapter.rs• L359-378 crates/…/tests.rs• L1388-1501 crates/…/mapper.rs• L44-73 crates/…/mapper.rs• L44-87 crates/…/types.rs• L35-55 crates/…/mapper.rs• L57-109
Metadata and capabilities
Metadata is the adapter's product contract. It names the provider, describes its purpose, supplies its icon and configuration schema, and declares the operations and permissions that the product can present.
Capability declarations
The capability set controls which common actions and views are meaningful for a provider. The declarations cover these broad areas:
- Pipeline and run monitoring.
- Triggering, cancellation, review, whole-run or single-job reruns, or enablement.
- Logs, agents, artifacts, and queues.
- Run-history retention.
- Interactive sign-in.
The registry exposes this metadata for provider selection. The core also uses it to decide whether health checks, status sources, and retained history apply to a provider.
GitHub also guards actions with mapped run facts. Waiting runs expose review only when there are environments that the token can approve. Failed or timed-out completed runs can offer a failed-job rerun. Any completed run can offer a single-job rerun, while force cancellation is a separate provider capability. These rules keep the UI action set aligned with what the provider can accept.
CircleCI adds a provider-specific action guard on top of the shared capability set. It allows cancellation only while a workflow is active and exposes rerun choices from the mapped workflow facts. The plugin also declares its log dialect as part of its metadata-facing behavior.
References: crates/…/plugin.rs• L34-69 crates/…/tests.rs• L545-620 crates/…/tests.rs• L293-369 crates/…/tests.rs• L461-542 crates/…/plugin.rs• L44-75 crates/…/plugin.rs• L121-123 crates/…/provider_service.rs• L227-241 crates/…/provider_service.rs• L778-785 crates/…/plugin_adapter.rs• L323-345
Permission and feature declarations
Some adapters report a simple required permission set. Others describe named features and the permissions each feature needs. GitHub adds a second mapping because classic and fine-grained tokens express access in different terms. The result lets the product show partial access instead of treating the whole provider as all-or-nothing.
References: crates/…/plugin.rs• L301-345 crates/…/metadata.rs• L58-140 crates/…/plugin.rs• L633-684 crates/…/tests.rs• L988-1087
Log dialects
A log dialect is the provider-specific rule set that turns raw log lines into readable events. It can identify timestamps, commands, sections, warnings, errors, and step starts so the common log viewer can render different CI formats in one way.
Log retrieval
The plugin first exposes the provider's log nodes. It then reads the selected node through a stream and returns a cursor when the source supports incremental reads. The core adapter converts provider log nodes to the shared node shape and passes log reads through without changing their stream behavior.
The adapters preserve the source's useful hierarchy and read state. Bitbucket can expose a step before its log is ready and can resume a growing log by byte offset. Buildkite returns the complete job log on the first read, then reads only new output when the source grows. If the source shrinks or a cursor names another job, it replaces the old output instead of appending unsafe data. CircleCI exposes workflow and job links, while only numbered jobs provide readable output.
References: crates/…/plugin.rs• L115-131 crates/…/plugin_adapter.rs• L359-387 crates/…/client.rs• L186-236 crates/…/tests.rs• L324-444 crates/…/types.rs• L41-55 crates/…/mapper.rs• L70-109 crates/…/plugin.rs• L121-123
Log parsing
The default dialect treats every line as plain text. Providers with structured output replace it with a dialect suited to their wire format:
| Provider family | Log responsibility |
|---|---|
| GitHub Actions | Parse Actions group markers through the shared Actions dialect |
| GitLab CI | Parse runner headers and section_start or section_end markers |
| Bitbucket Pipelines | Mark non-empty + script lines as commands |
| Buildkite | Parse timestamps, group headers, commands, warnings, and errors |
| CircleCI | Use the provider log dialect for CircleCI output while mapping workflow and job nodes separately |
| Jenkins | Parse pipeline stages, shell commands, and explicit failure lines |
| Other adapters | Use their own dialect when their source has a distinct log format; otherwise use plain lines |
These rules affect presentation only. They do not change the provider's run status or the raw source of the log.
References: crates/…/logs.rs• L59-183 crates/…/log_dialect.rs• L1-97 crates/…/log_dialect.rs• L17-65 crates/…/log_dialect.rs• L26-59 crates/…/log_dialect.rs• L16-62
Change checklist
When these files or sections are changed, remember to consider these:
- A new provider type must be present in both registry discovery and plugin creation paths.
- A changed provider identifier must stay compatible with run lookup, action requests, and cached pipeline records.
- A changed capability or feature name must still match the UI action and permission mapping that consumes it.
- A changed log cursor or node identifier must remain valid across refreshes and resumed log reads.
- A changed config key must stay aligned with the metadata schema, saved provider settings, and plugin initialization.
- A changed status mapping must preserve the shared status used by freshness, health, and action guards.
- A new provider action, such as single-job rerun, must stay aligned across the shared plugin contract, adapter forwarding, provider implementation, and capability metadata.
- A changed provider state or workflow-attempt rule must stay aligned with log-node status, run completion time, and action availability.
- A changed provider pagination or resource-presence rule must preserve both selected-resource refreshes and discovery of configured resources with no run history.
- A changed redirected log or resume rule must keep credentials out of storage requests and keep cursor offsets tied to the same provider log node.
- A changed Buildkite job model must preserve the link between displayed log nodes, current attempts, and provider job IDs.
- A changed GitHub workflow or run state must preserve the reason shown for disabled resources and the eligibility rules for review, rerun, enable, and cancellation actions.
Important failure modes
| Trigger | Consequence | Guard |
|---|---|---|
| Provider type is registered in discovery but not in the factory | The provider can appear selectable but cannot load | Keep the two registration paths in crates/…/mod.rs aligned |
| Required credential or endpoint setting is absent | Plugin initialization fails before refresh or actions | Mark the field required in metadata and validate it during initialization |
| Provider status is mapped to the wrong shared state | Dashboard state and refresh freshness become misleading | Keep status mapping beside provider data mapping and verify provider terminal states |
| Log node ID or cursor no longer matches the external source | Log reads fail or duplicate output | Treat node IDs and cursor contents as a stable adapter contract |
| Permission names do not match feature requirements | The UI enables an action that the provider rejects | Update metadata permission declarations and provider-specific permission mapping together |
| A provider does not implement a newly exposed action | The common action reaches the plugin and returns an unsupported or incorrect result | Keep the adapter forwarder, plugin default, concrete provider behavior, and capability declaration consistent |
| A provider treats an active or retried unit as terminal or current | Run status, log output, and available actions disagree | Map provider states and attempt selection together before exposing the shared run |
| A provider resource has no run yet but has CI configuration | The resource disappears from selection or monitoring | Use the provider's configuration-presence check as well as run discovery |
| A log redirect or cursor is handled as an ordinary API request | Credentials may reach storage or resumed output may duplicate or restart incorrectly | Keep redirect handling and node-specific cursor validation inside the provider client |
| Buildkite has no build and the pipeline fallback is not used | A configured pipeline appears to be missing | Keep the latest-build path and pipeline-detail fallback aligned |
| GitHub exposes an action without checking the run state or permission | The action fails after the user selects it or affects the wrong run | Derive action metadata from the selected run and check provider permissions before posting |
Key files
| File | Why to read it |
|---|---|
| crates/…/mod.rs | Lists every concrete adapter and its provider type |
| crates/…/plugin.rs | Defines the shared plugin contract, metadata, capabilities, and default behavior |
| crates/…/plugin_adapter.rs | Shows how plugin results become domain provider results and how provider actions cross the boundary |
| crates/…/provider_service.rs | Shows plugin discovery, configuration, loading, health, and refresh ownership |
| crates/…/plugin.rs | Illustrates a source-control CI adapter with actions, permissions, and workflow inputs |
| crates/…/metadata.rs | Illustrates capability and feature declarations for a provider |
| crates/…/plugin.rs | Illustrates project mapping, run history, job logs, and resumable reads |
| crates/…/catalog.rs | Shows repository discovery, selection filtering, and the rule for configured repositories with no runs |
| crates/…/client.rs | Shows paginated repository and run access plus streamed and redirected step logs |
| crates/…/mapper.rs | Shows Bitbucket status, custom-pipeline, and flat step mapping |
| crates/…/client.rs | Shows Buildkite resource lookup, build actions, and the no-build pipeline fallback |
| crates/…/types.rs | Defines the Buildkite data needed for build status, job mapping, retries, and parallel jobs |
| crates/…/mapper.rs | Shows build and latest script-job status and log-node mapping |
| crates/…/mapper.rs | Shows workflow aggregation, action facts, and stage-to-job log shape |
| crates/…/plugin.rs | Shows CircleCI action exposure, client setup, and log-dialect selection |
| crates/…/logs.rs | Defines shared log nodes, cursors, streams, and dialect behavior |
| crates/…/lib.rs | Defines shared GitHub Actions workflow input and log support |