Pipedash
Resources

Plugin development

Adding a CI/CD provider to Pipedash. Covers the scaffold command, generated files, metadata, registration, local IDs, backend presentation, the Plugin trait, health and HTTP hooks, run log hooks, shared helpers, contract tests and the retry policy.

A provider in Pipedash is a Rust crate that implements the Plugin trait from pipedash-plugin-api. It requires 7 methods and provides defaults for optional capabilities.

Plugin boundaries

The plugin owns the provider's API calls, the mapping to Pipedash types, the config schema and the provider-specific copy. The core owns scheduling, caching, filtering, sorting, pagination, validation and action policy.

Provider-specific behavior stays in the provider crate. Core code, transports, TypeScript, Swift and Kotlin do not branch on provider names.

Plugins compile into the application. Pipedash does not load provider crates at runtime, so a new provider requires a new build.

Scaffold a provider

Run the interactive generator from the repository:

mise run new:plugin

For a noninteractive REST plugin:

mise run new:plugin -- \
  --id sample-ci \
  --name "Sample CI" \
  --description "Monitor and trigger Sample CI pipelines" \
  --archetype rest \
  --id-shape numeric \
  --capabilities trigger,cancel,logs \
  --no-input

--no-input requires --id and --description. Without a terminal, the generator also uses noninteractive mode.

ArgumentDefaultDescription
--idRequired in noninteractive modeLowercase kebab-case provider ID
--nameTitle-cased IDDisplay name
--descriptionRequired in noninteractive modeManifest description, also shown in the interface
--archetyperestrest or kubernetes
--id-shapenumeric for REST, namespaced for Kubernetesnumeric, path or namespaced
--capabilitiestrigger,cancel,logsComma-separated capabilities
--read-onlyOffDisables all three generated capabilities. Conflicts with --capabilities
--aliasesEmptyComma-separated alternate provider names for the structure guard
--token-prefixesEmptyComma-separated token prefixes that let Pipedash recognize token-shaped values. REST only
--token-labelAPI TokenToken field label. REST only
--token-helpAPI token from your <name> account settingsToken field help. REST only
--ping-path/api/userAbsolute GET path for credential validation. REST only
--iconGenerated placeholder SVGPath to an SVG file
--no-inputOffDisables prompts
--yes, -yOffSkips the final interactive confirmation
--dry-runOffPrints proposed file paths and the dependency line without writing them

IDs and aliases cannot reuse an existing provider ID, alias or plugin crate name. --yes does not fill missing noninteractive arguments.

The generated operations contain todo! calls. Replace them with the provider implementation before enabling or submitting the plugin. The generator does not create a finished integration.

Generated files

The generator creates these files in crates/pipedash-plugin-<id>/:

FilePurpose
Cargo.tomlPackage metadata, dependencies and workspace lint settings
assets/icon.svgEmbedded provider icon
src/lib.rsModules and register_plugin!
src/metadata.rsConfig schema, capabilities and provider metadata
src/schema.rsTable schema
src/config.rsConnection config and local ID parsing
src/config/tests.rsConfig and ID parser tests
src/plugin.rsPlugin implementation and provider operations
src/client.rsREST client. REST archetype only

The REST archetype produces 9 files and Kubernetes produces 8, including the icon. The generator also adds the dependency to crates/pipedash-plugins/Cargo.toml and formats the new crate. It checks for new structure-guard name collisions when the initial audit passes.

Providers add further files as they need them. Examples are mapper.rs for the conversion between provider API data and domain models, types.rs for provider-specific types, permissions.rs in the GitHub crate and health.rs in the FluxCD crate.

mise run new:plugin

Provider crate

Registry dependency line

Implement provider operations

Generated registration

Unit and contract tests

Metadata and registration

metadata() returns a PluginMetadata. The plugin builds it once and stores it.

PluginMetadata::new(name, config_schema, table_schema, capabilities) initializes permissions and features as empty lists. It creates default presentation data and a default history policy.

register_plugin! supplies provider_type, version, description, author and icon from the crate manifest and assets/icon.svg. The provider ID is the crate name without pipedash-plugin-. The icon becomes an embedded SVG data URL. Do not duplicate these values in metadata.rs.

Add alternate provider spellings under [package.metadata.pipedash] aliases = [...]. These names extend the structure guard. They do not add registry IDs.

A provider builds its metadata like this:

pub fn create_metadata() -> PluginMetadata {
    PluginMetadata::new(
        "Sample CI",
        create_config_schema(),
        schema::create_table_schema(),
        PluginCapabilities::standard(),
    )
}
FieldType
nameString
provider_typeString
versionString
descriptionString
authorOption<String>
iconOption<String>
config_schemaConfigSchema
table_schemaTableSchema
capabilitiesPluginCapabilities
required_permissionsVec<Permission>, default empty
featuresVec<Feature>, default empty
run_historyRunHistoryPolicy
token_prefixesVec<String>, default empty
presentationPluginPresentation

PluginCapabilities has 8 Boolean fields: trigger, cancel, force_cancel, retains_run_history, logs, sign_in, uses_http_proxy and async_trigger.

PluginCapabilities::default() sets every field to false. PluginCapabilities::standard() enables trigger, cancel, logs and uses_http_proxy.

The default history policy sets bounded = false, order = RunNumber and tracks_overdue = true. A plugin can use StartedAt ordering and override whether a missing history record can be archived through can_archive_run.

token_prefixes lists the prefixes of the provider's tokens. Pipedash uses them to recognize token-shaped values. Literal tokens in config.toml are still accepted, and the security page describes the safe forms.

ConfigSchema holds fields, an auth_modes map and a no_auth flag. Each field declares a ConfigSection: Authentication, Connection or Settings. Settings appear under Advanced settings in the Provider step. Connection and authentication fields appear in Credentials.

Use add_auth_field to associate a field with AuthMode::Token, AuthMode::SignIn or several modes. The wizard only renders and validates fields for the selected mode. allow_no_auth() adds the No auth choice. A connection with auth_mode = "none" is read-only. The core blocks its mutating actions and rejects mutation requests independently of the interface.

ConfigField fieldType
keyString
labelString
descriptionOption<String>
field_typeConfigFieldType
requiredbool
default_valueOption<serde_json::Value>
optionsOption<Vec<String>>
validation_regexOption<String>
validation_messageOption<String>
sectionConfigSection

ConfigFieldType has 7 values: Text, Password, TextArea, Boolean, Select, MultiSelect and Number.

Registration

A new provider adds one crate and one dependency line in crates/pipedash-plugins/Cargo.toml. mise run new:plugin creates both.

The root workspace already includes crates/*. The registry build script discovers provider dependencies and generates their registration calls. CI packaging and the release provider matrix discover crates that call register_plugin!. The architecture page shows the generated registry.

The provider crate registers its factory in src/lib.rs:

pipedash_plugin_api::register_plugin!(MyPlugin);

The plugin type implements Default. The macro supplies the crate manifest and embedded SVG icon to PluginRegistry::register.

PluginRegistry exposes register, get, create, metadata, metadata_of, is_registered, provider_types and count.

Local IDs

Plugins receive and return local IDs. They do not compose or parse the global <type>__<provider_id>__<local> prefix.

The core adapter adds and removes that prefix. It fills the domain pipeline's provider_id and provider_type. A local ID can contain __; the adapter preserves it.

Actions and presentation

The backend supplies action eligibility and provider-specific copy. The core Presenter calls the plugin's presentation hooks before returning pipelines and runs.

Start with pipedash_plugin_api::plugin::defaults and change only provider-specific behavior:

  • pipeline_actions sets pipeline actions, rerun strategy, trigger icon and optional target context.
  • run_actions sets run actions and whether the backend watches an active run.
  • run_display sets the run title, message, context fields and start-time label.
  • trigger_values initializes declared trigger parameters from a previous run and parameter defaults.
  • configured_repositories supplies configured repository names for navigation.
  • selection_required controls whether setup requires a selection.
  • can_archive_run decides whether a missing history record can remain as an archived record.

Default run actions allow cancellation for running or pending runs, except runs awaiting review. Force cancellation requires a running run and the capability. Rerun requires a finished run and the trigger capability.

Default run display uses #<run_number>, the label "Started" and nonempty Branch and Actor fields.

Default trigger values replay saved inputs. A previous branch supplies ref when neither branch nor ref has a truthy value. Only declared parameters enter the result.

PluginPresentation supplies terminology, status labels, wizard copy, view copy, trigger and rerun copy, history notices and run-detail labels. A provider does not add frontend branches for these differences.

Resource history with provider-specific state and labels. Desktop and mobile.
The backend supplies resource terminology, run labels and action availability.

The Plugin trait

Plugin: Send + Sync uses #[async_trait]. The trait has 40 methods. Seven require an implementation. Methods marked async use #[async_trait]. NotSupported means Err(PluginError::NotSupported(...)).

SignatureRequired or default
fn metadata(&self) -> &PluginMetadataRequired
fn initialize(&mut self, provider_id: i64, config: HashMap<String, String>, http_client: Option<std::sync::Arc<reqwest::Client>>) -> PluginResult<()>Required
fn client_options(&self, config: &HashMap<String, String>) -> ClientOptionsClientOptions::default()
fn status_source(&self) -> Option<&StatusSource>None
async fn check_health(&self) -> PluginResult<Vec<ComponentHealth>>Ok(Vec::new())
async fn validate_credentials(&self) -> PluginResult<bool>Required
async fn fetch_available_pipelines(&self, params: Option<PaginationParams>) -> PluginResult<PaginatedAvailablePipelines>Ok(PaginatedResponse::empty())
async fn fetch_organizations(&self) -> PluginResult<Vec<Organization>>Ok(Vec::new())
async fn fetch_pipeline_catalog(&self) -> PluginResult<PipelineCatalog>NotSupported: Pipeline catalog not supported by this provider
async fn ids_with_ci(&self, ids: Vec<String>) -> PluginResult<Vec<String>>Ok(ids)
fn log_dialect(&self) -> &'static dyn LogDialect&PlainDialect
fn log_tree_version(&self) -> u320
async fn fetch_log_nodes(&self, run: RunRef<'_>) -> PluginResult<Vec<LogNode>>NotSupported: Run logs not supported by this provider
async fn read_log(&self, run: RunRef<'_>, node_id: &str, from: Option<&LogCursor>, sink: &mut LogSink) -> PluginResult<LogRead>NotSupported: Run logs not supported by this provider
async fn fetch_available_pipelines_filtered(&self, org: Option<String>, search: Option<String>, params: Option<PaginationParams>) -> PluginResult<PaginatedAvailablePipelines>Calls discovery, filters its returned items by organization and search, then rebuilds the pagination metadata
async fn fetch_pipelines(&self) -> PluginResult<Vec<Pipeline>>Required
async fn fetch_run_history(&self, pipeline_id: &str, limit: usize) -> PluginResult<Vec<PipelineRun>>Required
async fn fetch_run_details(&self, pipeline_id: &str, run_number: i64) -> PluginResult<PipelineRun>Required
async fn fetch_recent_runs(&self, pipeline_ids: &[String], limit: usize) -> PluginResult<HashMap<String, Vec<PipelineRun>>>NotSupported: Batched run history not supported by this provider
async fn trigger_pipeline(&self, params: TriggerParams) -> PluginResult<TriggerResult>Required
async fn cancel_run(&self, pipeline_id: &str, run_number: i64) -> PluginResult<()>NotSupported: Run cancellation not supported by this provider
async fn force_cancel_run(&self, pipeline_id: &str, run_number: i64) -> PluginResult<()>NotSupported: Force cancellation not supported by this provider
async fn review_run(&self, pipeline_id: &str, run_number: i64, decision: ReviewDecision) -> PluginResult<()>NotSupported: Run review not supported by this provider
async fn rerun_failed_jobs(&self, pipeline_id: &str, run_number: i64) -> PluginResult<()>NotSupported: Re-running failed jobs not supported by this provider
async fn rerun_run(&self, pipeline_id: &str, run_number: i64) -> PluginResult<()>NotSupported: Re-running runs not supported by this provider
async fn enable_pipeline(&self, pipeline_id: &str) -> PluginResult<()>NotSupported: Enabling pipelines not supported by this provider
async fn fetch_workflow_parameters(&self, workflow_id: &str) -> PluginResult<Vec<WorkflowParameter>>Ok(Vec::new())
async fn fetch_rate_limit(&self) -> PluginResult<Option<RateLimit>>Ok(None)
async fn get_field_options(&self, field_key: &str, config: &HashMap<String, String>) -> PluginResult<Vec<String>>Ok(Vec::new())
async fn sign_in_client(&self, config: &HashMap<String, String>, http_client: &reqwest::Client) -> PluginResult<SignInClient>NotSupported: Sign-in is not supported by this provider
fn sign_in_refresh_rejections(&self) -> &'static [SignInRefreshRejection]&[]
async fn check_permissions(&self) -> PluginResult<PermissionStatus>Marks declared permissions as granted, sets all_granted to true, uses the current time, empty metadata and no credential label
fn get_feature_availability(&self, status: &PermissionStatus) -> Vec<FeatureAvailability>Compares feature requirements with granted permission names
fn can_archive_run(&self, pipeline_metadata: &HashMap<String, serde_json::Value>, run_metadata: &HashMap<String, serde_json::Value>, status: PipelineStatus) -> boolfalse
fn selection_required(&self, config: &HashMap<String, String>) -> booltrue
fn configured_repositories(&self, config: &HashMap<String, String>) -> Vec<String>Comma-separated values from selected_items
fn pipeline_actions(&self, pipeline: &PipelineFacts<'_>) -> PipelineActionStateplugin::defaults::pipeline_actions with the declared capabilities
fn run_actions(&self, pipeline: &PipelineFacts<'_>, run: &RunFacts<'_>) -> RunActionStateplugin::defaults::run_actions with the declared capabilities
fn run_display(&self, pipeline: &PipelineFacts<'_>, run: &RunFacts<'_>) -> RunDisplayplugin::defaults::run_display
fn trigger_values(&self, pipeline: &PipelineFacts<'_>, previous: Option<&RunFacts<'_>>, parameters: &[WorkflowParameter]) -> serde_json::Map<String, serde_json::Value>plugin::defaults::trigger_values

TriggerResult has optional run_id and run_number fields. A trigger can return without either value when the provider accepts the request before it creates a run.

Errors use PluginError, which has the variants AuthenticationFailed, PermissionDenied, ApiError, InvalidConfig, PipelineNotFound, ProviderNotSupported, NetworkError, SerializationError, DatabaseError, NotSupported, Internal, RateLimited, ServiceUnavailable and Tls. RateLimited and ServiceUnavailable carry an optional retry_after duration. The core uses it to schedule the next fetch.

Discovery, selection and history policy

ids_with_ci receives the repositories a user selected and returns those that have CI. The core calls it when it saves a provider and drops the rest. The check is provider-specific. GitHub and Gitea check for workflows, GitLab and Bitbucket check runs and CI configuration, and Azure DevOps checks for build definitions. A check that fails keeps the repository.

fetch_available_pipelines feeds the Pipelines step of the wizard. fetch_available_pipelines_filtered applies the organization filter and the search term. fetch_pipeline_catalog returns organizations and available pipelines together when implemented.

selection_required and configured_repositories tell the core whether setup requires a selection and which names are already configured. can_archive_run and the run_history policy decide how the core treats history records that the provider no longer returns.

fetch_rate_limit returns the remaining API quota. The core pauses a provider whose quota falls under 10% until the reset time.

Health and HTTP hooks

Three methods tell the core how a provider behaves on the network. The core does the polling, caching, backoff and wording.

  • client_options: returns a ClientOptions value with an optional origin URL and an accept_invalid_certs flag. The core shares one HTTP client for each origin and TLS setting. ArgoCD sets accept_invalid_certs for a server with a self-signed certificate.
  • status_source: returns a StatusSource that names the public status page feed of the provider. It holds the page URL, the feed URL, a FeedFormat (Statuspage or StatusIo) and a ComponentFilter. The filter is All or a list of component IDs, and it selects the components that CI depends on.
  • check_health: returns a list of ComponentHealth values for problems the plugin sees on the instance. An example is a Tekton or Flux controller that is down. Each value has a name, a HealthLevel and an optional detail.

HealthLevel has 5 values in order of severity: Operational, Maintenance, Degraded, PartialOutage and MajorOutage.

For a self-hosted instance, status_page_field() returns an optional config field with the key status_page_url. custom_status_source(config) turns its value into a Statuspage source that reads /api/v2/summary.json below that URL. The value must be an https URL without credentials, query or fragment. A plain http URL works only for a literal loopback address.

collect_controller_health merges the results of several controller checks. It reports a permission error when any check hits a permission error. It reports a missing error when every controller is absent. The Tekton and Flux plugins use it with the feature ID controller_health. The provider health page describes what users see.

Run log hooks

A provider shows job logs inside Pipedash when it sets the logs capability and implements the log hooks below. The core does the download bookkeeping, parsing, caching on disk, paging, search and eviction. The Run logs page describes what users see.

  • fetch_log_nodes(run): returns the run's tree as a flat list of LogNode values, parents before children. Each node has a stable id, an optional parent_id and a kind: Stage, Job or Step. It also has a name, status, start and end times, an optional web URL and a log value. log is Some(Ready) for a finished log, Some(Partial) for a growing log or Some(Pending) before output exists. A node without its own log uses None.
  • read_log(run, node_id, from, sink): streams one node's raw bytes into the LogSink and returns LogRead. from holds the previous provider-owned LogCursor, or None for the first read. Return LogReadMode::Append for bytes after that cursor and LogReadMode::Replace for a complete replacement. The returned cursor holds the next position, or None for snapshot reads. sink.pipe(response) copies a reqwest::Response chunk by chunk. It fails with a NetworkError when no chunk arrives for 60 seconds. sink.write(bytes) sends one chunk.
  • log_dialect(): returns the LogDialect that parses each line. Implement parse(line) to return a ParsedLine with an optional timestamp, a LineMarker and the body without the marker. PlainDialect returns the whole line with no timestamp and the marker Plain. is_step_start(line) defaults to false. infers_errors() defaults to true, so the core checks plain lines for common error patterns. Return false when the dialect's own markers should define all errors.

Call sink.restart() before writing bytes when a resumed read must replace the whole log. Calling it after writing fails. The core rejects a read whose returned mode does not match whether ingestion resumed. sink.pipe_range(response, offset) and sink.pipe_resumed(offset, fetch) handle HTTP range reads and fallback to a full read.

LogCursor::new(position) serializes a provider's position into opaque JSON. cursor.parse::<T>() reads it back and returns None when it does not match that type.

LineMarker describes both line styles and sections:

MarkersEffect
PlainPlain output, subject to error inference when the dialect permits it
Error, Warning, Notice, Debug, CommandSet the line style
GroupStart, GroupEndOpen and close nested sections
SectionStart { open }End existing sections and start a section with the requested open state
OpenSectionOpen the current section

Increase log_tree_version() when a plugin change makes a finished run's saved tree incomplete. The core rebuilds an older tree on its next read. Failed listing keeps the previous tree without advancing its version. A refreshed tree keeps saved nodes missing from the new response, so downloaded logs stay accessible.

RunRef carries the pipeline ID, the run number, the run ID and the metadata of the run. Nodes without a log of their own that sit below a node with a log become step sections of its log. The core places them with the step start lines of the dialect, then with their start times. GroupStart and GroupEnd lines become nested sections. A Stage node is a header only.

The model fits each provider shape. GitHub has a job with a log and its steps as sections. GitLab can map stages to headers, jobs to logs and collapsible sections to groups. Tekton and Bitbucket steps can have logs of their own, and Jenkins can return one log for the root node.

Shared Actions helpers

The pipedash-plugin-actions crate holds helpers for plugins that use the GitHub Actions workflow format. The GitHub and Gitea plugins use both dispatch functions.

  • dispatch_inputs(workflow_source): reads the workflow_dispatch inputs of a workflow file and returns them as WorkflowParameter values. Each name receives the prefix inputs.. The label keeps the plain input name.
  • dispatch_body(inputs): builds the dispatch request body. It reads ref from the values and defaults to main. It strips the inputs. prefix from the other names and puts them under inputs.
  • ActionsLogDialect: the LogDialect of Actions logs. It strips the byte order mark and the leading RFC 3339 timestamp and reads the ##[group], ##[endgroup], ##[error], ##[warning], ##[notice], ##[debug], ##[command] and [command] markers. A ##[group]Run … line and the Post job cleanup. line start a step. The GitHub plugin uses it.

Other plugins need only the contract in pipedash-plugin-api and their own provider mapping.

Shared Kubernetes helpers

Enable the kubernetes feature of pipedash-plugin-api for the shared kubeconfig loader.

KubeconfigSource::from_config prefers nonempty pasted content in token. Otherwise it reads the configured path. Without a configured path it reads $KUBECONFIG and then the user's .kube/config.

Path lists use : on Unix and ; on Windows. Paths expand ~ and environment variables. The loader merges files that exist and returns an error when none exists.

available_contexts loads context names on a blocking task, sorts them and removes duplicates. ensure_supported_auth rejects exec credential plugins on mobile. A token or client certificate works there.

Contract tests and checks

crates/pipedash-plugins/tests/ checks every registered provider. The shared tests cover:

  • Registry entries and manifest-owned metadata
  • Embedded icons, table schemas, unique config keys and presentation labels
  • Metadata serialization, validation regexes and auth-mode field references
  • Action availability against declared capabilities
  • Run titles, start-time labels and trigger values
  • Empty repository selection and declared token prefixes
  • Separate plugin instances from the factory
  • Local and global ID round-trips and rejection of foreign IDs
  • Rejection of force cancellation when the capability is off

Run the provider's tests and shared contract tests:

cargo test -p pipedash-plugin-sample-ci -p pipedash-plugins

Provider unit tests cover its API mapping, config parsing and other provider-specific behavior. The shared suite also holds integration tests for provider services, log ingestion and history-order migration. The development page lists the full check sequence before a pull request.

Retry policy

RetryPolicy in pipedash-plugin-api retries an async operation. Its defaults are below.

FieldDefault
max_retries3
initial_delay100 ms
exponential_backofftrue, so the delay doubles after each failed attempt

The policy retries only transient errors: NetworkError, ServiceUnavailable and RateLimited. It skips a retry when the retry_after hint is longer than the current delay. Any other error returns at once.

Next step

The existing plugins serve as references, including Tekton, ArgoCD, FluxCD and Prow. Prow implements shared discovery and run-history batches for Deck. The providers index lists every provider, and the contributing page covers how a change reaches the repository.