Skip to content
This repository has been archived by the owner on Oct 19, 2024. It is now read-only.

Commit

Permalink
fix: repo.GetAppDetails().Helm.GetParameterValueByName not get helm.v…
Browse files Browse the repository at this point in the history
…alues
  • Loading branch information
ss75710541 committed Apr 27, 2022
1 parent aeac7c9 commit ab0ecf2
Show file tree
Hide file tree
Showing 2 changed files with 32 additions and 30 deletions.
4 changes: 2 additions & 2 deletions expr/shared/helmappspec.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,9 @@ import (
type HelmAppSpec struct {
Name string
ValueFiles []string
Parameters []v1alpha1.HelmParameter
Parameters []*v1alpha1.HelmParameter
Values string
FileParameters []v1alpha1.HelmFileParameter
FileParameters []*v1alpha1.HelmFileParameter
}

func (has HelmAppSpec) GetParameterValueByName(Name string) string {
Expand Down
58 changes: 30 additions & 28 deletions shared/argocd/service.go
Original file line number Diff line number Diff line change
Expand Up @@ -118,8 +118,13 @@ func (svc *argoCDService) GetAppDetails(ctx context.Context, appSource *v1alpha1
if err != nil {
return nil, err
}
appDetail.Helm.GetParameters()
var has *shared.HelmAppSpec
if appDetail.Helm != nil {

fmt.Sprintf(" ------- appSource.Helm.Parameters: %v\n", appSource.Helm.Parameters)
fmt.Sprintf(" ------- appDetail.Helm.Parameters: %v\n", appDetail.Helm.Parameters)

if appSource.Helm.Parameters != nil {
for _, overrideParam := range appSource.Helm.Parameters {
for _, defaultParam := range appDetail.Helm.Parameters {
Expand All @@ -131,43 +136,40 @@ func (svc *argoCDService) GetAppDetails(ctx context.Context, appSource *v1alpha1
}
}

// if appSource.Helm.Values != "" {
//if appSource.Helm.Values != "" {
//
// fmt.Printf("-------start output\n")
// output := map[string]string{}
// valuesMap := make(map[interface{}]interface{})
// if err := yaml.Unmarshal([]byte(appSource.Helm.Values), valuesMap); err != nil {
// return nil, fmt.Errorf("failed to parse : %s, appSource.Helm.Values: %v", err, appSource.Helm.Values)
// }
// flatVals(valuesMap, output)
// fmt.Printf("-------start output\n")
// output := map[string]string{}
// valuesMap := make(map[interface{}]interface{})
// appSource.Helm.Unmarshal([]byte(appSource.Helm.Values))
//
// fmt.Printf("-------flatVals output\n")
// //for i := range appDetail.Helm.Parameters {
// // if v, ok := output[has.Parameters[i].Name]; ok {
// // has.Parameters[i].Value = v
// // //delete(output, has.Parameters[i].Name)
// // break
// // }
// //}
// fmt.Printf("-------flatVals output\n")
// //for i := range appDetail.Helm.Parameters {
// // if v, ok := output[has.Parameters[i].Name]; ok {
// // has.Parameters[i].Value = v
// // //delete(output, has.Parameters[i].Name)
// // break
// // }
// //}
//
// fmt.Printf("-------after delete output: %v\n", output)
// for i := range appDetail.Helm.Parameters {
// if v, ok := output[appDetail.Helm.Parameters[i].Name]; ok {
// parameter := &v1alpha1.HelmParameter{Name: appDetail.Helm.Parameters[i].Name, Value: v}
// appDetail.Helm.Parameters[i] = parameter
// }
// fmt.Printf("-------after delete output: %v\n", output)
// for i := range appDetail.Helm.Parameters {
// if v, ok := output[appDetail.Helm.Parameters[i].Name]; ok {
// parameter := &v1alpha1.HelmParameter{Name: appDetail.Helm.Parameters[i].Name, Value: v}
// appDetail.Helm.Parameters[i] = parameter
// }
//
// fmt.Printf("-------appSource.Helm.Parameters: %v\n", appSource.Helm.Parameters)
// fmt.Printf("-------appDetail.Helm.Parameters: %v\n", appDetail.Helm.Parameters)
// }
//
// fmt.Printf("-------appSource.Helm.Parameters: %v\n", appSource.Helm.Parameters)
// fmt.Printf("-------appDetail.Helm.Parameters: %v\n", appDetail.Helm.Parameters)
//}

has = &shared.HelmAppSpec{
Name: appDetail.Helm.Name,
ValueFiles: appSource.Helm.ValueFiles,
Parameters: appSource.Helm.Parameters,
ValueFiles: appDetail.Helm.ValueFiles,
Parameters: appDetail.Helm.Parameters,
Values: appSource.Helm.Values,
FileParameters: appSource.Helm.FileParameters,
FileParameters: appDetail.Helm.FileParameters,
}
}
return &shared.AppDetail{
Expand Down

0 comments on commit ab0ecf2

Please sign in to comment.