Update the custom command mirror
This commit is contained in:
@ -73,4 +73,10 @@ impl RepositoryImpl for GitRepo {
|
||||
fn get_url(&self) -> String {
|
||||
self.url.clone()
|
||||
}
|
||||
|
||||
fn get_version(&self, chart_path: String) -> Result<String, Box<dyn Error>> {
|
||||
let cmd = "helm show chart . | yq '.version'".to_string();
|
||||
let version = cli_exec_from_dir(cmd, chart_path.clone())?;
|
||||
Ok(version)
|
||||
}
|
||||
}
|
||||
|
@ -30,6 +30,12 @@ impl RepositoryImpl for HelmRepo {
|
||||
fn get_url(&self) -> String {
|
||||
self.url.clone()
|
||||
}
|
||||
|
||||
fn get_version(&self, chart_path: String) -> Result<String, Box<dyn Error>> {
|
||||
let cmd = "helm show chart . | yq '.version'".to_string();
|
||||
let version = cli_exec_from_dir(cmd, chart_path.clone())?;
|
||||
Ok(version)
|
||||
}
|
||||
}
|
||||
|
||||
pub(crate) enum RepoKind {
|
||||
@ -54,7 +60,7 @@ impl HelmRepo {
|
||||
}
|
||||
}
|
||||
|
||||
fn pull_oci(&self, chart: Chart, workdir_path: String) -> Result<String, Box<dyn Error>> {
|
||||
fn pull_oci(&self, mut chart: Chart, workdir_path: String) -> Result<String, Box<dyn Error>> {
|
||||
let args = match chart.version.as_str() {
|
||||
LATEST_VERSION => "".to_string(),
|
||||
_ => format!("--version {}", chart.version.clone()),
|
||||
@ -85,13 +91,11 @@ impl HelmRepo {
|
||||
Err(err) => return Err(Box::from(err)),
|
||||
};
|
||||
|
||||
// TODO: Do we really need it?
|
||||
let cmd = "helm show chart . | yq '.version'".to_string();
|
||||
let _version = cli_exec_from_dir(cmd, new_dir_name.clone())?;
|
||||
Ok(new_dir_name)
|
||||
}
|
||||
|
||||
fn pull_default(&self, chart: Chart, workdir_path: String) -> Result<String, Box<dyn Error>> {
|
||||
|
||||
fn pull_default(&self, mut chart: Chart, workdir_path: String) -> Result<String, Box<dyn Error>> {
|
||||
// Add repo and update
|
||||
let repo_local_name = general_purpose::STANDARD_NO_PAD.encode(self.get_url());
|
||||
let cmd = format!("helm repo add {} {}", repo_local_name, self.get_url());
|
||||
@ -125,9 +129,6 @@ impl HelmRepo {
|
||||
let cmd = format!("helm repo remove {}", repo_local_name);
|
||||
cli_exec(cmd)?;
|
||||
|
||||
// TODO: Do we really need it?
|
||||
let cmd = "helm show chart . | yq '.version'".to_string();
|
||||
let _version = cli_exec_from_dir(cmd, new_dir_name.clone())?;
|
||||
Ok(new_dir_name)
|
||||
}
|
||||
}
|
||||
|
@ -27,6 +27,7 @@ pub(crate) enum RepositoryKind {
|
||||
|
||||
pub trait RepositoryImpl {
|
||||
fn pull_chart(&self, chart: Chart, workdir_path: String) -> Result<String, Box<dyn Error>>;
|
||||
fn get_version(&self, chart_path: String) -> Result<String, Box<dyn Error>>;
|
||||
fn get_url(&self) -> String;
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user