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

Method exec

lib-engine/src/helm.rs:646–783  ·  view source on GitHub ↗
(
        &self,
        kubernetes_config: &Path,
        envs: &[(&str, &str)],
        payload: Option<ChartPayload>,
        cmd_killer: &CommandKiller,
    )

Source from the content-addressed store, hash-verified

644 }
645
646 fn exec(
647 &self,
648 kubernetes_config: &Path,
649 envs: &[(&str, &str)],
650 payload: Option<ChartPayload>,
651 cmd_killer: &CommandKiller,
652 ) -> Result<Option<ChartPayload>, HelmChartError> {
653 let chart_info = self.get_chart_info();
654 let helm = match &chart_info.helm_list_cache {
655 Some(cache) => Helm::new_with_cache(Some(kubernetes_config), envs, cache.clone())?,
656 None => Helm::new(Some(kubernetes_config), envs)?,
657 };
658
659 match chart_info.action {
660 Deploy => {
661 if let Err(e) = helm.uninstall_chart_if_breaking_version(chart_info, &[]) {
662 warn!(
663 "error while trying to destroy chart if breaking change is detected: {:?}",
664 e.to_string()
665 );
666 }
667
668 let installed_chart_version = match helm.get_chart_version(
669 &chart_info.name,
670 Some(chart_info.get_namespace_string().as_str()),
671 envs,
672 ) {
673 Ok(versions) => match versions {
674 None => None,
675 Some(versions) => versions.chart_version,
676 },
677 Err(e) => {
678 warn!("error while trying to get installed version: {:?}", e);
679 None
680 }
681 };
682
683 // Allow to skip the deployment if the chart is already installed
684 if chart_info.skip_if_already_installed && installed_chart_version.is_some() {
685 info!(
686 "chart {} is already installed and option to skip it if installed is set to true, skipping",
687 &chart_info.name
688 );
689 return Ok(payload);
690 }
691
692 let upgrade_status = prepare_chart_backup_on_upgrade(
693 kubernetes_config,
694 chart_info.clone(),
695 envs,
696 installed_chart_version,
697 )
698 .unwrap_or_else(|e| {
699 warn!("error while trying to prepare backup: {:?}", e);
700 BackupStatus {
701 is_backupable: false,
702 backup_path: PathBuf::new(),
703 }

Callers

nothing calls this directly

Implementers 1

helm.rslib-engine/src/helm.rs

Calls 15

update_crds_on_upgradeFunction · 0.85
retryFunction · 0.85
apply_chart_backupFunction · 0.85
HelmErrorEnum · 0.85
kubectl_exec_delete_crdFunction · 0.85
get_chart_versionMethod · 0.80
get_namespace_stringMethod · 0.80
upgradeMethod · 0.80

Tested by

no test coverage detected