fix: make sure demo works on both local & remote target (#107)
* define Ntfy ingress (naive implementation) based on current target * use patched Ntfy Helm Chart * create Ntfy main user only if needed * add info logs * better error bubbling * instrument feature installations * upgrade prometheus alerting charts if already installed * harmony_composer params to control deployment `target` and `profile` Co-authored-by: Ian Letourneau <letourneau.ian@gmail.com> Co-authored-by: Jean-Gabriel Gill-Couture <jg@nationtech.io> Reviewed-on: #107
This commit is contained in:
@@ -1,10 +1,16 @@
|
||||
use harmony::{
|
||||
instrumentation::{self, HarmonyEvent},
|
||||
modules::application::ApplicationFeatureStatus,
|
||||
topology::TopologyStatus,
|
||||
};
|
||||
use indicatif::MultiProgress;
|
||||
use indicatif_log_bridge::LogWrapper;
|
||||
use std::sync::{Arc, Mutex};
|
||||
use log::error;
|
||||
use std::{
|
||||
sync::{Arc, Mutex},
|
||||
thread,
|
||||
time::Duration,
|
||||
};
|
||||
|
||||
use crate::progress::{IndicatifProgressTracker, ProgressTracker};
|
||||
|
||||
@@ -58,6 +64,7 @@ async fn handle_events(base_progress: MultiProgress) {
|
||||
&format!("\n{} Harmony completed\n\n", crate::theme::EMOJI_HARMONY),
|
||||
);
|
||||
progress_tracker.add_section("harmony-finished", "\n\n");
|
||||
thread::sleep(Duration::from_millis(200));
|
||||
return false;
|
||||
}
|
||||
HarmonyEvent::TopologyStateChanged {
|
||||
@@ -156,10 +163,40 @@ async fn handle_events(base_progress: MultiProgress) {
|
||||
_ => progress_tracker.fail_task(&task_key, &outcome.message),
|
||||
},
|
||||
Err(err) => {
|
||||
error!("Interpret error: {err}");
|
||||
progress_tracker.fail_task(&task_key, &err.to_string());
|
||||
}
|
||||
}
|
||||
}
|
||||
HarmonyEvent::ApplicationFeatureStateChanged {
|
||||
topology: _,
|
||||
application,
|
||||
feature,
|
||||
status,
|
||||
} => {
|
||||
if let Some(score) = &(*current_score) {
|
||||
let section_key = score_key(score);
|
||||
let task_key = app_feature_key(&application, &feature);
|
||||
|
||||
match status {
|
||||
ApplicationFeatureStatus::Installing => {
|
||||
let message = format!("Feature '{}' installing...", feature);
|
||||
progress_tracker.add_task(§ion_key, &task_key, &message);
|
||||
}
|
||||
ApplicationFeatureStatus::Installed => {
|
||||
let message = format!("Feature '{}' installed", feature);
|
||||
progress_tracker.finish_task(&task_key, &message);
|
||||
}
|
||||
ApplicationFeatureStatus::Failed { details } => {
|
||||
let message = format!(
|
||||
"Feature '{}' installation failed: {}",
|
||||
feature, details
|
||||
);
|
||||
progress_tracker.fail_task(&task_key, &message);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
true
|
||||
}
|
||||
@@ -175,3 +212,7 @@ fn topology_key(topology: &str) -> String {
|
||||
fn score_key(score: &str) -> String {
|
||||
format!("score-{score}")
|
||||
}
|
||||
|
||||
fn app_feature_key(application: &str, feature: &str) -> String {
|
||||
format!("app-{application}-{feature}")
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user