MCPcopy Create free account
hub / github.com/Qovery/engine / upgrade_diff

Method upgrade_diff

lib-engine/src/cmd/helm.rs:946–1034  ·  view source on GitHub ↗
(
        &self,
        chart: &ChartInfo,
        envs: &[(&str, &str)],
        stdout_output: &mut impl FnMut(String),
    )

Source from the content-addressed store, hash-verified

944 }
945
946 pub fn upgrade_diff(
947 &self,
948 chart: &ChartInfo,
949 envs: &[(&str, &str)],
950 stdout_output: &mut impl FnMut(String),
951 ) -> Result<(), HelmError> {
952 let mut args_string: Vec<String> = vec![
953 "diff".to_string(),
954 "--output".to_string(),
955 "dyff".to_string(),
956 "upgrade".to_string(),
957 "--install".to_string(),
958 "--namespace".to_string(),
959 chart.get_namespace_string(),
960 ];
961
962 append_engine_post_renderer_args(&mut args_string, chart);
963
964 for value in &chart.values {
965 args_string.push("--set".to_string());
966 args_string.push(format!("{}={}", value.key, value.value));
967 }
968
969 for value in &chart.values_string {
970 args_string.push("--set-string".to_string());
971 args_string.push(format!("{}={}", value.key, value.value));
972 }
973
974 for value in &chart.values_json {
975 args_string.push("--set-json".to_string());
976 args_string.push(format!("{}={}", value.key, value.value));
977 }
978
979 for value_file in &chart.values_files {
980 args_string.push("-f".to_string());
981 args_string.push(value_file.clone());
982 }
983
984 for value_file in &chart.yaml_files_content {
985 let file_path = format!("{}/{}", chart.path, &value_file.filename);
986 let file_create = || -> Result<(), Error> {
987 let mut file = File::create(&file_path)?;
988 file.write_all(value_file.yaml_content.as_bytes())?;
989 Ok(())
990 };
991
992 // no need to validate yaml as it will be done by helm
993 if let Err(e) = file_create() {
994 let cmd_err = errors::CommandError::new(
995 format!("Error while writing yaml content to file `{}`", &file_path),
996 Some(format!("Content\n{}\nError: {}", value_file.yaml_content, e)),
997 Some(
998 envs.iter()
999 .map(|(k, v)| (k.to_string(), v.to_string()))
1000 .collect::<Vec<(String, String)>>(),
1001 ),
1002 );
1003 return Err(CmdError(chart.name.clone(), UPGRADE, cmd_err));

Callers 4

execMethod · 0.80
deploy_chartsMethod · 0.80
test_upgrade_diffFunction · 0.80

Calls 6

helm_exec_with_outputFunction · 0.85
pushMethod · 0.80
cloneMethod · 0.45
as_strMethod · 0.45
get_all_envsMethod · 0.45

Tested by 2

test_upgrade_diffFunction · 0.64