This commit is contained in:
admju
2024-09-09 07:38:43 +00:00
parent da9aab90eb
commit 53a614bd7e
9 changed files with 123 additions and 45 deletions

View File

@@ -21,6 +21,8 @@ type InstallClass struct {
tools []tool.ToolData
toolsBin map[string]string
charts []chart.ChartRepoData
commandHelm helm.HelmCommandInterface
}
func (this *InstallClass) NewInstall() (string, error) {
@@ -61,22 +63,22 @@ func (this *InstallClass) NewInstall() (string, error) {
return dst, err
}
bin_path, _ := this.getToolBin("helm")
fmt.Println("Install 67 bin_path", bin_path)
return dst, nil
}
func (this *InstallClass) ChartRepo() (error) {
bin_path, _ := this.getToolBin("helm")
for _, v := range this.charts {
if v.Repository.Name != "" {
log.Log().Info().Msg(fmt.Sprintf(" >> Helm Repo : %s", v.Repository.Name))
repo := helm.HelmRepo{Bin: bin_path,
Name: v.Repository.Name,
Repository: v.Repository.Url,
ForceUpdate: v.Repository.ForceUpdate}
res, err := repo.AddRepository()
repo := helm.HelmRepo{Name: v.Repository.Name,
Repository: v.Repository.Url,
ForceUpdate: v.Repository.ForceUpdate}
res, err := this.commandHelm.AddRepository(repo)
if err != nil {
log.Log().Info().Msg(fmt.Sprintf(" << %s ", err))
return err