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

@ -87,6 +87,19 @@ fn main() {
env_logger::init(); env_logger::init();
let args = Args::parse(); let args = Args::parse();
let mut result: Vec<ExecResult> = Vec::new(); let mut result: Vec<ExecResult> = Vec::new();
if !args.no_sync {
info!("syncing helm repositories");
let res = match args.kind {
Kinds::Argo => Argo::init().sync_repos(),
Kinds::Helm => Helm::init().sync_repos(),
Kinds::Helmfile => Helmfile::init(args.path.clone(), args.helmfile_environment.clone()).sync_repos(),
};
match res {
Ok(_) => info!("helm repos are synced"),
Err(err) => error!("couldn't sync repos', {}", err),
}
}
let charts = match args.kind { let charts = match args.kind {
Kinds::Argo => Argo::init().get_app(), Kinds::Argo => Argo::init().get_app(),
@ -95,19 +108,6 @@ fn main() {
} }
.unwrap(); .unwrap();
if !args.no_sync {
info!("syncing helm repositories");
let res = match args.kind {
Kinds::Argo => Argo::init().sync_repos(),
Kinds::Helm => Helm::init().sync_repos(),
Kinds::Helmfile => Helmfile::init(args.path, args.helmfile_environment).sync_repos(),
};
match res {
Ok(_) => info!("helm repos are synced"),
Err(err) => error!("couldn't sync repos', {}", err),
}
}
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();