Compare commits
	
		
			No commits in common. "7f50c36f11a18171446903947f8ae8b0bafc86c9" and "9b889f71da125814b14b8482af34079b03be182f" have entirely different histories.
		
	
	
		
			7f50c36f11
			...
			9b889f71da
		
	
		
| @ -4,7 +4,8 @@ use harmony::{ | |||||||
|     inventory::Inventory, |     inventory::Inventory, | ||||||
|     modules::{ |     modules::{ | ||||||
|         application::{ |         application::{ | ||||||
|             ApplicationScore, RustWebFramework, RustWebapp, features::rhob_monitoring::Monitoring, |             ApplicationScore, RustWebFramework, RustWebapp, | ||||||
|  |             features::rhob_monitoring::RHOBMonitoring, | ||||||
|         }, |         }, | ||||||
|         monitoring::alert_channel::discord_alert_channel::DiscordWebhook, |         monitoring::alert_channel::discord_alert_channel::DiscordWebhook, | ||||||
|     }, |     }, | ||||||
| @ -28,7 +29,7 @@ async fn main() { | |||||||
| 
 | 
 | ||||||
|     let app = ApplicationScore { |     let app = ApplicationScore { | ||||||
|         features: vec![ |         features: vec![ | ||||||
|             Box::new(Monitoring { |             Box::new(RHOBMonitoring { | ||||||
|                 application: application.clone(), |                 application: application.clone(), | ||||||
|                 alert_receiver: vec![Box::new(discord_receiver)], |                 alert_receiver: vec![Box::new(discord_receiver)], | ||||||
|             }), |             }), | ||||||
|  | |||||||
| @ -5,7 +5,7 @@ use harmony::{ | |||||||
|     modules::{ |     modules::{ | ||||||
|         application::{ |         application::{ | ||||||
|             ApplicationScore, RustWebFramework, RustWebapp, |             ApplicationScore, RustWebFramework, RustWebapp, | ||||||
|             features::{Monitoring, PackagingDeployment}, |             features::{ContinuousDelivery, Monitoring}, | ||||||
|         }, |         }, | ||||||
|         monitoring::alert_channel::{ |         monitoring::alert_channel::{ | ||||||
|             discord_alert_channel::DiscordWebhook, webhook_receiver::WebhookReceiver, |             discord_alert_channel::DiscordWebhook, webhook_receiver::WebhookReceiver, | ||||||
| @ -36,7 +36,7 @@ async fn main() { | |||||||
| 
 | 
 | ||||||
|     let app = ApplicationScore { |     let app = ApplicationScore { | ||||||
|         features: vec![ |         features: vec![ | ||||||
|             Box::new(PackagingDeployment { |             Box::new(ContinuousDelivery { | ||||||
|                 application: application.clone(), |                 application: application.clone(), | ||||||
|             }), |             }), | ||||||
|             Box::new(Monitoring { |             Box::new(Monitoring { | ||||||
|  | |||||||
| @ -3,7 +3,7 @@ use harmony::{ | |||||||
|     modules::{ |     modules::{ | ||||||
|         application::{ |         application::{ | ||||||
|             ApplicationScore, RustWebFramework, RustWebapp, |             ApplicationScore, RustWebFramework, RustWebapp, | ||||||
|             features::{PackagingDeployment, rhob_monitoring::Monitoring}, |             features::{ContinuousDelivery, Monitoring, rhob_monitoring::RHOBMonitoring}, | ||||||
|         }, |         }, | ||||||
|         monitoring::alert_channel::discord_alert_channel::DiscordWebhook, |         monitoring::alert_channel::discord_alert_channel::DiscordWebhook, | ||||||
|     }, |     }, | ||||||
| @ -21,19 +21,14 @@ async fn main() { | |||||||
|         service_port: 8080, |         service_port: 8080, | ||||||
|     }); |     }); | ||||||
| 
 | 
 | ||||||
|     let discord_webhook = DiscordWebhook { |  | ||||||
|         name: "harmony_demo".to_string(), |  | ||||||
|         url: hurl!("http://not_a_url.com"), |  | ||||||
|     }; |  | ||||||
| 
 |  | ||||||
|     let app = ApplicationScore { |     let app = ApplicationScore { | ||||||
|         features: vec![ |         features: vec![ | ||||||
|             Box::new(PackagingDeployment { |             Box::new(ContinuousDelivery { | ||||||
|                 application: application.clone(), |                 application: application.clone(), | ||||||
|             }), |             }), | ||||||
|             Box::new(Monitoring { |             Box::new(RHOBMonitoring { | ||||||
|                 application: application.clone(), |                 application: application.clone(), | ||||||
|                 alert_receiver: vec![Box::new(discord_webhook)], |                 alert_receiver: vec![], | ||||||
|             }), |             }), | ||||||
|         ], |         ], | ||||||
|         application, |         application, | ||||||
|  | |||||||
| @ -3,7 +3,7 @@ use harmony::{ | |||||||
|     modules::{ |     modules::{ | ||||||
|         application::{ |         application::{ | ||||||
|             ApplicationScore, RustWebFramework, RustWebapp, |             ApplicationScore, RustWebFramework, RustWebapp, | ||||||
|             features::{PackagingDeployment, rhob_monitoring::Monitoring}, |             features::{ContinuousDelivery, Monitoring, rhob_monitoring::RHOBMonitoring}, | ||||||
|         }, |         }, | ||||||
|         monitoring::alert_channel::discord_alert_channel::DiscordWebhook, |         monitoring::alert_channel::discord_alert_channel::DiscordWebhook, | ||||||
|     }, |     }, | ||||||
| @ -28,10 +28,10 @@ async fn main() { | |||||||
| 
 | 
 | ||||||
|     let app = ApplicationScore { |     let app = ApplicationScore { | ||||||
|         features: vec![ |         features: vec![ | ||||||
|             Box::new(PackagingDeployment { |             Box::new(ContinuousDelivery { | ||||||
|                 application: application.clone(), |                 application: application.clone(), | ||||||
|             }), |             }), | ||||||
|             Box::new(Monitoring { |             Box::new(RHOBMonitoring { | ||||||
|                 application: application.clone(), |                 application: application.clone(), | ||||||
|                 alert_receiver: vec![Box::new(discord_receiver)], |                 alert_receiver: vec![Box::new(discord_receiver)], | ||||||
|             }), |             }), | ||||||
|  | |||||||
| @ -1,10 +1,9 @@ | |||||||
| use async_trait::async_trait; | use async_trait::async_trait; | ||||||
| use derive_new::new; | use derive_new::new; | ||||||
| use serde::{Deserialize, Serialize}; |  | ||||||
| 
 | 
 | ||||||
| use super::{HelmCommand, PreparationError, PreparationOutcome, Topology}; | use super::{HelmCommand, PreparationError, PreparationOutcome, Topology}; | ||||||
| 
 | 
 | ||||||
| #[derive(new, Clone, Debug, Serialize, Deserialize)] | #[derive(new)] | ||||||
| pub struct LocalhostTopology; | pub struct LocalhostTopology; | ||||||
| 
 | 
 | ||||||
| #[async_trait] | #[async_trait] | ||||||
|  | |||||||
| @ -47,11 +47,11 @@ use crate::{ | |||||||
| /// - ArgoCD to install/upgrade/rollback/inspect k8s resources
 | /// - ArgoCD to install/upgrade/rollback/inspect k8s resources
 | ||||||
| /// - Kubernetes for runtime orchestration
 | /// - Kubernetes for runtime orchestration
 | ||||||
| #[derive(Debug, Default, Clone)] | #[derive(Debug, Default, Clone)] | ||||||
| pub struct PackagingDeployment<A: OCICompliant + HelmPackage> { | pub struct ContinuousDelivery<A: OCICompliant + HelmPackage> { | ||||||
|     pub application: Arc<A>, |     pub application: Arc<A>, | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
| impl<A: OCICompliant + HelmPackage> PackagingDeployment<A> { | impl<A: OCICompliant + HelmPackage> ContinuousDelivery<A> { | ||||||
|     async fn deploy_to_local_k3d( |     async fn deploy_to_local_k3d( | ||||||
|         &self, |         &self, | ||||||
|         app_name: String, |         app_name: String, | ||||||
| @ -139,7 +139,7 @@ impl<A: OCICompliant + HelmPackage> PackagingDeployment<A> { | |||||||
| impl< | impl< | ||||||
|     A: OCICompliant + HelmPackage + Clone + 'static, |     A: OCICompliant + HelmPackage + Clone + 'static, | ||||||
|     T: Topology + HelmCommand + MultiTargetTopology + K8sclient + Ingress + 'static, |     T: Topology + HelmCommand + MultiTargetTopology + K8sclient + Ingress + 'static, | ||||||
| > ApplicationFeature<T> for PackagingDeployment<A> | > ApplicationFeature<T> for ContinuousDelivery<A> | ||||||
| { | { | ||||||
|     async fn ensure_installed( |     async fn ensure_installed( | ||||||
|         &self, |         &self, | ||||||
| @ -5,8 +5,8 @@ pub use endpoint::*; | |||||||
| mod monitoring; | mod monitoring; | ||||||
| pub use monitoring::*; | pub use monitoring::*; | ||||||
| 
 | 
 | ||||||
| mod packaging_deployment; | mod continuous_delivery; | ||||||
| pub use packaging_deployment::*; | pub use continuous_delivery::*; | ||||||
| 
 | 
 | ||||||
| mod helm_argocd_score; | mod helm_argocd_score; | ||||||
| pub use helm_argocd_score::*; | pub use helm_argocd_score::*; | ||||||
|  | |||||||
| @ -27,7 +27,7 @@ use harmony_types::net::Url; | |||||||
| use log::{debug, info}; | use log::{debug, info}; | ||||||
| 
 | 
 | ||||||
| #[derive(Debug, Clone)] | #[derive(Debug, Clone)] | ||||||
| pub struct Monitoring { | pub struct RHOBMonitoring { | ||||||
|     pub application: Arc<dyn Application>, |     pub application: Arc<dyn Application>, | ||||||
|     pub alert_receiver: Vec<Box<dyn AlertReceiver<RHOBObservability>>>, |     pub alert_receiver: Vec<Box<dyn AlertReceiver<RHOBObservability>>>, | ||||||
| } | } | ||||||
| @ -43,7 +43,7 @@ impl< | |||||||
|         + Ingress |         + Ingress | ||||||
|         + std::fmt::Debug |         + std::fmt::Debug | ||||||
|         + PrometheusApplicationMonitoring<RHOBObservability>, |         + PrometheusApplicationMonitoring<RHOBObservability>, | ||||||
| > ApplicationFeature<T> for Monitoring | > ApplicationFeature<T> for RHOBMonitoring | ||||||
| { | { | ||||||
|     async fn ensure_installed( |     async fn ensure_installed( | ||||||
|         &self, |         &self, | ||||||
|  | |||||||
| @ -10,7 +10,7 @@ use dockerfile_builder::Dockerfile; | |||||||
| use dockerfile_builder::instruction::{CMD, COPY, ENV, EXPOSE, FROM, RUN, USER, WORKDIR}; | use dockerfile_builder::instruction::{CMD, COPY, ENV, EXPOSE, FROM, RUN, USER, WORKDIR}; | ||||||
| use dockerfile_builder::instruction_builder::CopyBuilder; | use dockerfile_builder::instruction_builder::CopyBuilder; | ||||||
| use futures_util::StreamExt; | use futures_util::StreamExt; | ||||||
| use log::{debug, error, info, log_enabled, trace, warn}; | use log::{debug, info, log_enabled}; | ||||||
| use serde::Serialize; | use serde::Serialize; | ||||||
| use tar::{Builder, Header}; | use tar::{Builder, Header}; | ||||||
| use walkdir::WalkDir; | use walkdir::WalkDir; | ||||||
| @ -162,7 +162,7 @@ impl RustWebapp { | |||||||
|         &self, |         &self, | ||||||
|         image_name: &str, |         image_name: &str, | ||||||
|     ) -> Result<String, Box<dyn std::error::Error>> { |     ) -> Result<String, Box<dyn std::error::Error>> { | ||||||
|         info!("Generating Dockerfile for '{}'", self.name); |         debug!("Generating Dockerfile for '{}'", self.name); | ||||||
|         let dockerfile = self.get_or_build_dockerfile(); |         let dockerfile = self.get_or_build_dockerfile(); | ||||||
|         let quiet = !log_enabled!(log::Level::Debug); |         let quiet = !log_enabled!(log::Level::Debug); | ||||||
|         match dockerfile |         match dockerfile | ||||||
| @ -194,41 +194,8 @@ impl RustWebapp { | |||||||
|                     Some(body_full(tar_data.into())), |                     Some(body_full(tar_data.into())), | ||||||
|                 ); |                 ); | ||||||
| 
 | 
 | ||||||
|                 while let Some(mut msg) = image_build_stream.next().await { |                 while let Some(msg) = image_build_stream.next().await { | ||||||
|                     trace!("Got bollard msg {msg:?}"); |                     debug!("Message: {msg:?}"); | ||||||
|                     match msg { |  | ||||||
|                         Ok(mut msg) => { |  | ||||||
|                             if let Some(progress) = msg.progress_detail { |  | ||||||
|                                 info!( |  | ||||||
|                                     "Build progress {}/{}", |  | ||||||
|                                     progress.current.unwrap_or(0), |  | ||||||
|                                     progress.total.unwrap_or(0) |  | ||||||
|                                 ); |  | ||||||
|                             } |  | ||||||
| 
 |  | ||||||
|                             if let Some(mut log) = msg.stream { |  | ||||||
|                                 if log.ends_with('\n') { |  | ||||||
|                                     log.pop(); |  | ||||||
|                                     if log.ends_with('\r') { |  | ||||||
|                                         log.pop(); |  | ||||||
|                                     } |  | ||||||
|                                 } |  | ||||||
|                                 info!("{log}"); |  | ||||||
|                             } |  | ||||||
| 
 |  | ||||||
|                             if let Some(error) = msg.error { |  | ||||||
|                                 warn!("Build error : {error:?}"); |  | ||||||
|                             } |  | ||||||
| 
 |  | ||||||
|                             if let Some(error) = msg.error_detail { |  | ||||||
|                                 warn!("Build error : {error:?}"); |  | ||||||
|                             } |  | ||||||
|                         } |  | ||||||
|                         Err(e) => { |  | ||||||
|                             error!("Build failed : {e}"); |  | ||||||
|                             return Err(format!("Build failed : {e}").into()); |  | ||||||
|                         } |  | ||||||
|                     } |  | ||||||
|                 } |                 } | ||||||
| 
 | 
 | ||||||
|                 Ok(image_name.to_string()) |                 Ok(image_name.to_string()) | ||||||
|  | |||||||
		Loading…
	
		Reference in New Issue
	
	Block a user