fix: Sync repos before listing apps

This commit is contained in:
Nikolai Rodionov 2023-05-07 13:08:00 +02:00
parent edbab404e9
commit 52a3be2846
No known key found for this signature in database
GPG Key ID: 19DB54039EBF8F10

View File

@ -88,19 +88,12 @@ fn main() {
let args = Args::parse(); let args = Args::parse();
let mut result: Vec<ExecResult> = Vec::new(); let mut result: Vec<ExecResult> = Vec::new();
let charts = match args.kind {
Kinds::Argo => Argo::init().get_app(),
Kinds::Helm => Helm::init().get_app(),
Kinds::Helmfile => Helmfile::init(args.path.clone(), args.helmfile_environment.clone()).get_app(),
}
.unwrap();
if !args.no_sync { if !args.no_sync {
info!("syncing helm repositories"); info!("syncing helm repositories");
let res = match args.kind { let res = match args.kind {
Kinds::Argo => Argo::init().sync_repos(), Kinds::Argo => Argo::init().sync_repos(),
Kinds::Helm => Helm::init().sync_repos(), Kinds::Helm => Helm::init().sync_repos(),
Kinds::Helmfile => Helmfile::init(args.path, args.helmfile_environment).sync_repos(), Kinds::Helmfile => Helmfile::init(args.path.clone(), args.helmfile_environment.clone()).sync_repos(),
}; };
match res { match res {
Ok(_) => info!("helm repos are synced"), Ok(_) => info!("helm repos are synced"),
@ -108,6 +101,13 @@ fn main() {
} }
} }
let charts = match args.kind {
Kinds::Argo => Argo::init().get_app(),
Kinds::Helm => Helm::init().get_app(),
Kinds::Helmfile => Helmfile::init(args.path.clone(), args.helmfile_environment.clone()).get_app(),
}
.unwrap();
charts.iter().for_each(|a| { charts.iter().for_each(|a| {
debug!("{:?}", a); debug!("{:?}", a);
check_chart(&mut result, a).unwrap(); check_chart(&mut result, a).unwrap();