lmrc_pipeline/
lib.rs

1//! # lmrc-pipeline
2//!
3//! Pipeline orchestration library for LMRC Stack projects.
4//!
5//! This library provides reusable pipeline steps for common tasks in Rust projects:
6//! - Building with cargo
7//! - Running tests
8//! - Code formatting and linting
9//! - Building Docker images
10//! - Provisioning infrastructure
11//! - Deploying to Kubernetes
12//!
13//! ## Dynamic Pipeline Steps
14//!
15//! The library includes a dynamic pipeline step registry that automatically builds
16//! pipeline steps based on the services configured in `lmrc.toml`. When users add
17//! or remove services from their infrastructure configuration, the pipeline
18//! automatically includes or excludes the corresponding setup steps.
19//!
20//! ## Example
21//!
22//! ```rust,no_run
23//! use lmrc_pipeline::{Pipeline, PipelineContext, StepRegistry};
24//! use lmrc_pipeline::steps::{BuildStep, TestStep, DeployStep};
25//! use lmrc_config_validator::{LmrcConfig, ProjectConfig, ProviderConfig, AppsConfig, InfrastructureConfig};
26//!
27//! # async fn example() -> Result<(), Box<dyn std::error::Error>> {
28//! // Create full LMRC configuration
29//! let config = LmrcConfig {
30//!     project: ProjectConfig {
31//!         name: "my-project".to_string(),
32//!         description: "My awesome project".to_string(),
33//!     },
34//!     providers: ProviderConfig {
35//!         server: "hetzner".to_string(),
36//!         kubernetes: "k3s".to_string(),
37//!         database: "postgres".to_string(),
38//!         queue: "rabbitmq".to_string(),
39//!         dns: "cloudflare".to_string(),
40//!         git: "gitlab".to_string(),
41//!     },
42//!     apps: AppsConfig { applications: vec![] },
43//!     infrastructure: InfrastructureConfig {
44//!         provider: "hetzner".to_string(),
45//!         network: None,
46//!         servers: vec![],
47//!         k3s: None,
48//!         postgres: None,
49//!         rabbitmq: None,
50//!         vault: None,
51//!         dns: None,
52//!         gitlab: None,
53//!         load_balancer: None,
54//!     },
55//! };
56//!
57//! // Create pipeline context
58//! let context = PipelineContext::new(config.clone())?;
59//!
60//! // Build and run pipeline with static steps
61//! let report = Pipeline::new(context)
62//!     .add_step(BuildStep::new().release())
63//!     .add_step(TestStep::new())
64//!     .add_step(DeployStep::new())
65//!     .run()
66//!     .await?;
67//!
68//! println!("Pipeline completed in {:?}", report.total_duration);
69//!
70//! // Or use dynamic registry for config-driven steps
71//! let registry = StepRegistry::default();
72//! let setup_steps = registry.build_setup_steps(&config);
73//! // Add setup_steps to pipeline as needed
74//!
75//! # Ok(())
76//! # }
77//! ```
78
79pub mod context;
80pub mod error;
81pub mod factory;
82pub mod pipeline;
83pub mod registry;
84pub mod registry_builder;
85pub mod secret_store;
86pub mod server_mapping;
87pub mod step;
88pub mod steps;
89
90// Re-exports for convenience
91pub use context::PipelineContext;
92pub use error::{PipelineError, Result};
93pub use factory::{ProviderFactory, Providers};
94pub use pipeline::{Pipeline, PipelineReport};
95pub use registry::{StepBuilder, StepRegistry};
96pub use registry_builder::{RegistryBuilder, StepCategory};
97pub use step::{PipelineStep, StepOutput};