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    registry.register(Box::new(pipedash_plugin_fluxcd::FluxcdPlugin::new()));
19
20    registry
21}
22
23pub fn get_all_plugin_metadata() -> Vec<PluginMetadata> {
24    let registry = create_plugin_registry();
25    registry
26        .provider_types()
27        .iter()
28        .filter_map(|provider_type| registry.get(provider_type))
29        .map(|p| p.metadata().clone())
30        .collect()
31}
32
33pub fn create_plugin(provider_type: &str) -> Option<Box<dyn PluginTrait>> {
34    match provider_type {
35        "github" => Some(Box::new(pipedash_plugin_github::GitHubPlugin::new())),
36        "gitea" => Some(Box::new(pipedash_plugin_gitea::GiteaPlugin::new())),
37        "gitlab" => Some(Box::new(pipedash_plugin_gitlab::GitLabPlugin::new())),
38        "bitbucket" => Some(Box::new(pipedash_plugin_bitbucket::BitbucketPlugin::new())),
39        "buildkite" => Some(Box::new(pipedash_plugin_buildkite::BuildkitePlugin::new())),
40        "jenkins" => Some(Box::new(pipedash_plugin_jenkins::JenkinsPlugin::new())),
41        "tekton" => Some(Box::new(pipedash_plugin_tekton::TektonPlugin::new())),
42        "argocd" => Some(Box::new(pipedash_plugin_argocd::ArgocdPlugin::new())),
43        "fluxcd" => Some(Box::new(pipedash_plugin_fluxcd::FluxcdPlugin::new())),
44        _ => None,
45    }
46}