pub async fn template_vs_git(svc: &str, conf: &Config, region: &Region) -> Result<bool> {
    let afterpth = Path::new(".").join("after.shipcat.gen.yml");
    let mf_after = shipcat_filebacked::load_manifest(svc, conf, region)
        .await?
        .stub(region)
        .await?;
    let _after = helm::template(&mf_after, Some(afterpth.clone())).await?;

    // move git to get before state:
    let merge_base = git::merge_base()?;
    git::checkout(merge_base.as_str())?;

    let needs_stash = git::needs_stash();
    if needs_stash {
        git::stash_push()?;
    }

    // compute old state:
    let (before_conf, before_region) = Config::new(ConfigState::Base, &region.name).await?;

    let beforepth = Path::new(".").join("before.shipcat.gen.yml");
    let mf_before = shipcat_filebacked::load_manifest(svc, &before_conf, &before_region)
        .await?
        .stub(region)
        .await?;
    let _before = helm::template(&mf_before, Some(beforepth.clone())).await?;

    // move git back
    if needs_stash {
        git::stash_pop()?;
    }
    git::checkout("-")?;

    // display diff
    // doesn't reuse shell_diff because we already have files from direct::template
    let args = ["-u", "before.shipcat.gen.yml", "after.shipcat.gen.yml"];
    debug!("diff {}", args.join(" "));
    let s = Command::new("diff").args(&args).status()?;
    // cleanup
    fs::remove_file(beforepth)?;
    fs::remove_file(afterpth)?;
    Ok(s.success())
}
/// Fast local git compare of shipcat template
///
/// Because this uses the template in master against local state,
/// we don't resolve secrets for this (would compare equal values anyway).
Fast local git compare of shipcat template
Because this uses the template in master against local state,
we don't resolve secrets for this (would compare equal values anyway).
Fast local git compare of shipcat template Because this uses the template in master against local state we don ' t resolve secrets for this ( would compare equal values anyway ) .
pub async fn template_vs_git(svc: &str, conf: &Config, region: &Region) -> Result<bool> {
    let afterpth = Path::new(".").join("after.shipcat.gen.yml");
    let mf_after = shipcat_filebacked::load_manifest(svc, conf, region)
        .await?
        .stub(region)
        .await?;
    let _after = helm::template(&mf_after, Some(afterpth.clone())).await?;
    // move git to get before state:
    let merge_base = git::merge_base()?;
    git::checkout(merge_base.as_str())?;
    let needs_stash = git::needs_stash();
    if needs_stash {
        git::stash_push()?;
    }
    // compute old state:
    let (before_conf, before_region) = Config::new(ConfigState::Base, &region.name).await?;
    let beforepth = Path::new(".").join("before.shipcat.gen.yml");
    let mf_before = shipcat_filebacked::load_manifest(svc, &before_conf, &before_region)
        .await?
        .stub(region)
        .await?;
    let _before = helm::template(&mf_before, Some(beforepth.clone())).await?;
    // move git back
    if needs_stash {
        git::stash_pop()?;
    }
    git::checkout("-")?;
    // display diff
    // doesn't reuse shell_diff because we already have files from direct::template
    let args = ["-u", "before.shipcat.gen.yml", "after.shipcat.gen.yml"];
    debug!("diff {}", args.join(" "));
    let s = Command::new("diff").args(&args).status()?;
    // cleanup
    fs::remove_file(beforepth)?;
    fs::remove_file(afterpth)?;
    Ok(s.success())
}
pub async fn template_vs_git ( svc : & str , conf : & Config , region : & Region ) -> Result < bool > { let afterpth = Path :: new ( " " ) . join ( " " ) ; let mf_after = shipcat_filebacked :: load_manifest ( svc , conf , region ) . await ? . stub ( region ) . await ? ; let _after = helm :: template ( & mf_after , Some ( afterpth . clone ( ) ) ) . await ? ; // move git to get before state: let merge_base = git :: merge_base ( ) ? ; git :: checkout ( merge_base . as_str ( ) ) ? ; let needs_stash = git :: needs_stash ( ) ; if needs_stash { git :: stash_push ( ) ? ; } // compute old state: let ( before_conf , before_region ) = Config :: new ( ConfigState :: Base , & region . name ) . await ? ; let beforepth = Path :: new ( " " ) . join ( " " ) ; let mf_before = shipcat_filebacked :: load_manifest ( svc , & before_conf , & before_region ) . await ? . stub ( region ) . await ? ; let _before = helm :: template ( & mf_before , Some ( beforepth . clone ( ) ) ) . await ? ; // move git back if needs_stash { git :: stash_pop ( ) ? ; } git :: checkout ( " " ) ? ; // display diff // doesn't reuse shell_diff because we already have files from direct::template let args = [ " " , " " , " " ] ; debug ! ( " " args join ( " " ) ) ; let s = Command :: new ( " " ) . args ( & args ) . status ( ) ? ; // cleanup fs :: remove_file ( beforepth ) ? ; fs :: remove_file ( afterpth ) ? ; Ok ( s . success ( ) ) }
Fast local git compare of shipcat template
Because this uses the template in master against local state,
we don't resolve secrets for this (would compare equal values anyway).
Fast local git compare of shipcat template Because this uses the template in master against local state we don ' t resolve secrets for this ( would compare equal values anyway ) .
svc
&str
conf
&Config
region
&Region
svc
&str
conf
&Config
region
&Region