| 1034 | } |
| 1035 | |
| 1036 | pub fn upgrade( |
| 1037 | &self, |
| 1038 | chart: &ChartInfo, |
| 1039 | envs: &[(&str, &str)], |
| 1040 | cmd_killer: &CommandKiller, |
| 1041 | ) -> Result<(), HelmError> { |
| 1042 | // Due to crash or error it is possible that the release is under an helm lock |
| 1043 | // Try to un-stuck the situation first if needed |
| 1044 | // We don't care if the rollback failed, as it is a best effort to remove the lock |
| 1045 | // and to re-launch an upgrade just after |
| 1046 | let unlock_ret = self.unlock_release(chart, envs); |
| 1047 | info!("Helm lock status: {:?}", unlock_ret); |
| 1048 | |
| 1049 | let timeout_string = format!("{}s", &chart.timeout_in_seconds); |
| 1050 | |
| 1051 | let mut args_string: Vec<String> = vec![ |
| 1052 | "upgrade".to_string(), |
| 1053 | "--create-namespace".to_string(), |
| 1054 | "--cleanup-on-fail".to_string(), |
| 1055 | "--install".to_string(), |
| 1056 | "--debug".to_string(), |
| 1057 | "--timeout".to_string(), |
| 1058 | timeout_string.as_str().to_string(), |
| 1059 | "--history-max".to_string(), |
| 1060 | HELM_MAX_HISTORY.to_string(), |
| 1061 | "--namespace".to_string(), |
| 1062 | chart.get_namespace_string(), |
| 1063 | ]; |
| 1064 | |
| 1065 | // warn: don't add debug or json output won't work |
| 1066 | if chart.atomic { |
| 1067 | args_string.push("--atomic".to_string()) |
| 1068 | } |
| 1069 | if chart.force_upgrade { |
| 1070 | args_string.push("--force".to_string()) |
| 1071 | } |
| 1072 | if chart.recreate_pods { |
| 1073 | args_string.push("--recreate-pods".to_string()) |
| 1074 | } |
| 1075 | if chart.dry_run { |
| 1076 | args_string.push("--dry-run".to_string()) |
| 1077 | } |
| 1078 | if chart.wait { |
| 1079 | args_string.push("--wait".to_string()) |
| 1080 | } |
| 1081 | |
| 1082 | append_engine_post_renderer_args(&mut args_string, chart); |
| 1083 | |
| 1084 | // overrides and files overrides |
| 1085 | for value in &chart.values { |
| 1086 | args_string.push("--set".to_string()); |
| 1087 | args_string.push(format!("{}={}", value.key, value.value)); |
| 1088 | } |
| 1089 | for value in &chart.values_string { |
| 1090 | args_string.push("--set-string".to_string()); |
| 1091 | args_string.push(format!("{}={}", value.key, value.value)); |
| 1092 | } |
| 1093 | for value in &chart.values_json { |