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

Method download_https_chart

lib-engine/src/cmd/helm.rs:754–878  ·  view source on GitHub ↗
(
        &self,
        repository_url_with_credentials: &Url,
        chart_name: &str,
        chart_version: &str,
        target_directory: &Path,
        skip_tls_verification: bool,
        env

Source from the content-addressed store, hash-verified

752 }
753
754 pub fn download_https_chart(
755 &self,
756 repository_url_with_credentials: &Url,
757 chart_name: &str,
758 chart_version: &str,
759 target_directory: &Path,
760 skip_tls_verification: bool,
761 envs: &[(&str, &str)],
762 cmd_killer: &CommandKiller,
763 ) -> Result<(), HelmError> {
764 // Try to use the parent directory to create a tmp dir, because later moving directory
765 // does work across mount point. In test, on our laptop, /tmp is always on a separate mount point using tmpfs
766 // So use same target dir, to avoid issues
767 let tmpdir = Self::get_temp_dir(target_directory, chart_name, FETCH)?;
768
769 // Clean repository url from password otherwise it will appear on logs sent to core
770 let repository_url_without_credentials = {
771 let mut url = repository_url_with_credentials.clone();
772 let _ = url.set_password(None);
773 url
774 };
775
776 // Mandatory helm arguments
777 let mut helm_args = vec![
778 "fetch",
779 "--debug", // there is no debug log but if someday they appear
780 "--repo",
781 repository_url_without_credentials.as_str(),
782 chart_name,
783 "--version",
784 chart_version,
785 "--untar",
786 "--untardir",
787 tmpdir.path().to_str().unwrap_or_default(),
788 ];
789
790 if skip_tls_verification {
791 helm_args.push("--insecure-skip-tls-verify");
792 }
793
794 // Extract login & password from url
795 let repository_username = repository_url_with_credentials.username();
796 let login = urlencoding::decode(repository_url_with_credentials.username()).unwrap_or_default();
797 let password = repository_url_with_credentials
798 .password()
799 .map(|password| urlencoding::decode(password).unwrap_or_default());
800
801 // Handle 3 different cases
802 match (repository_username.is_empty(), &password) {
803 (false, None) => {
804 // If the --password arg is not set, the fetch will fail
805 helm_args.extend_from_slice(&["--pass-credentials", "--username", &login, "--password", ""]);
806 }
807 (false, Some(password)) => {
808 helm_args.extend_from_slice(&["--pass-credentials", "--username", &login, "--password", password]);
809 }
810 (true, Some(password)) => {
811 helm_args.extend_from_slice(&["--pass-credentials", "--password", password]);

Callers 1

download_chartMethod · 0.80

Calls 6

helm_exec_with_outputFunction · 0.85
TimeoutEnum · 0.85
pushMethod · 0.80
cloneMethod · 0.45
get_all_envsMethod · 0.45
pathMethod · 0.45

Tested by

no test coverage detected