Skip to main content

pipedash_core/plugins/
mod.rs

1use pipedash_plugin_api::{
2    Plugin as PluginTrait,
3    PluginMetadata,
4    PluginRegistry,
5};
6
7pub fn create_plugin_registry() -> PluginRegistry {
8    let mut registry = PluginRegistry::new();
9
10    registry.register(Box::new(pipedash_plugin_github::GitHubPlugin::new()));
11    registry.register(Box::new(pipedash_plugin_gitea::GiteaPlugin::new()));
12    registry.register(Box::new(pipedash_plugin_gitlab::GitLabPlugin::new()));
13    registry.register(Box::new(pipedash_plugin_bitbucket::BitbucketPlugin::new()));
14    registry.register(Box::new(pipedash_plugin_buildkite::BuildkitePlugin::new()));
15    registry.register(Box::new(pipedash_plugin_jenkins::JenkinsPlugin::new()));
16    registry.register(Box::new(pipedash_plugin_tekton::TektonPlugin::new()));
17    registry.register(Box::new(pipedash_plugin_argocd::ArgocdPlugin::new()));
18
19    registry
20}
21
22pub fn get_all_plugin_metadata() -> Vec<PluginMetadata> {
23    let registry = create_plugin_registry();
24    registry
25        .provider_types()
26        .iter()
27        .filter_map(|provider_type| registry.get(provider_type))
28        .map(|p| p.metadata().clone())
29        .collect()
30}
31
32pub fn create_plugin(provider_type: &str) -> Option<Box<dyn PluginTrait>> {
33    match provider_type {
34        "github" => Some(Box::new(pipedash_plugin_github::GitHubPlugin::new())),
35        "gitea" => Some(Box::new(pipedash_plugin_gitea::GiteaPlugin::new())),
36        "gitlab" => Some(Box::new(pipedash_plugin_gitlab::GitLabPlugin::new())),
37        "bitbucket" => Some(Box::new(pipedash_plugin_bitbucket::BitbucketPlugin::new())),
38        "buildkite" => Some(Box::new(pipedash_plugin_buildkite::BuildkitePlugin::new())),
39        "jenkins" => Some(Box::new(pipedash_plugin_jenkins::JenkinsPlugin::new())),
40        "tekton" => Some(Box::new(pipedash_plugin_tekton::TektonPlugin::new())),
41        "argocd" => Some(Box::new(pipedash_plugin_argocd::ArgocdPlugin::new())),
42        _ => None,
43    }
44}