pub async fn secret_presence_git(conf: &Config, regions: Vec<String>) -> Result<()> {
    for r in regions {
        info!("validating secrets in {}", r);
        let reg = conf.get_region(&r)?; // verifies region or region alias exists
        reg.verify_secrets_exist().await?; // verify secrets for the region

        // Try to find services changed by git:
        let svcs = match git_diff_changes() {
            Ok(svcs) => svcs,
            // if that for some reason fails, then do all services for that region
            Err(e) => {
                warn!("Error from git: {}", e);
                warn!("Falling back to a full validate");
                shipcat_filebacked::available(conf, &reg)
                    .await?
                    .into_iter()
                    .map(|s| s.base.name)
                    .collect()
            }
        };
        for svc in svcs {
            if let Ok(mf) = shipcat_filebacked::load_manifest(&svc, conf, &reg).await {
                if !mf.regions.contains(&r) {
                    debug!("ignoring {} for {} (not deployed there)", svc, r);
                    continue;
                }
                debug!("validating secrets for {} in {}", &svc, r);
                mf.verify_secrets_exist(&reg.vault).await?;
            }
        }
    }
    Ok(())
}
/// Validate secrets exists in all regions, but only for services touched in git
Validate secrets exists in all regions, but only for services touched in git
Validate secrets exists in all regions but only for services touched in git
pub async fn secret_presence_git(conf: &Config, regions: Vec<String>) -> Result<()> {
    for r in regions {
        info!("validating secrets in {}", r);
        let reg = conf.get_region(&r)?; // verifies region or region alias exists
        reg.verify_secrets_exist().await?; // verify secrets for the region
        // Try to find services changed by git:
        let svcs = match git_diff_changes() {
            Ok(svcs) => svcs,
            // if that for some reason fails, then do all services for that region
            Err(e) => {
                warn!("Error from git: {}", e);
                warn!("Falling back to a full validate");
                shipcat_filebacked::available(conf, &reg)
                    .await?
                    .into_iter()
                    .map(|s| s.base.name)
                    .collect()
            }
        };
        for svc in svcs {
            if let Ok(mf) = shipcat_filebacked::load_manifest(&svc, conf, &reg).await {
                if !mf.regions.contains(&r) {
                    debug!("ignoring {} for {} (not deployed there)", svc, r);
                    continue;
                }
                debug!("validating secrets for {} in {}", &svc, r);
                mf.verify_secrets_exist(&reg.vault).await?;
            }
        }
    }
    Ok(())
}
pub async fn secret_presence_git ( conf : & Config , regions : Vec < String > ) -> Result < ( ) > { for r in regions { info ! ( " " r ) ; let reg = conf . get_region ( & r ) ? ; // verifies region or region alias exists reg . verify_secrets_exist ( ) . await ? ; // verify secrets for the region // Try to find services changed by git: let svcs = match git_diff_changes ( ) { Ok ( svcs ) => svcs , // if that for some reason fails, then do all services for that region Err ( e ) => { warn ! ( " " e ) ; warn ! ( " " ) ; shipcat_filebacked :: available ( conf , & reg ) . await ? . into_iter ( ) . map ( | s | s . base . name ) . collect ( ) } } ; for svc in svcs { if let Ok ( mf ) = shipcat_filebacked :: load_manifest ( & svc , conf , & reg ) . await { if ! mf . regions . contains ( & r ) { debug ! ( " " svc r ) ; continue ; } debug ! ( " " svc r ) ; mf . verify_secrets_exist ( & reg . vault ) . await ? ; } } } Ok ( ( ) ) }
Validate secrets exists in all regions, but only for services touched in git
Validate secrets exists in all regions but only for services touched in git
conf
&Config
regions
Vec<String>
conf
&Config
regions
Vec<String>