|
1 | 1 | package shared
|
2 | 2 |
|
3 | 3 | import (
|
| 4 | + "github.com/argoproj/argo-cd/v2/pkg/apis/application/v1alpha1" |
4 | 5 | "time"
|
5 | 6 |
|
6 | 7 | "github.com/argoproj/argo-cd/v2/reposerver/apiclient"
|
@@ -28,24 +29,32 @@ type AppDetail struct {
|
28 | 29 | Directory *apiclient.DirectoryAppSpec
|
29 | 30 | }
|
30 | 31 |
|
31 |
| -type CustomHelmAppSpec apiclient.HelmAppSpec |
| 32 | +type CustomHelmAppSpec struct { |
| 33 | + HelmAppSpec apiclient.HelmAppSpec |
| 34 | + HelmParameterOverrides []v1alpha1.HelmParameter |
| 35 | +} |
32 | 36 |
|
33 | 37 | func (has CustomHelmAppSpec) GetParameterValueByName(Name string) string {
|
34 |
| - var value string |
35 |
| - for i := range has.Parameters { |
36 |
| - if has.Parameters[i].Name == Name { |
37 |
| - value = has.Parameters[i].Value |
38 |
| - break |
| 38 | + // Check in overrides first |
| 39 | + for i := range has.HelmParameterOverrides { |
| 40 | + if has.HelmParameterOverrides[i].Name == Name { |
| 41 | + return has.HelmParameterOverrides[i].Value |
| 42 | + } |
| 43 | + } |
| 44 | + |
| 45 | + for i := range has.HelmAppSpec.Parameters { |
| 46 | + if has.HelmAppSpec.Parameters[i].Name == Name { |
| 47 | + return has.HelmAppSpec.Parameters[i].Value |
39 | 48 | }
|
40 | 49 | }
|
41 |
| - return value |
| 50 | + return "" |
42 | 51 | }
|
43 | 52 |
|
44 | 53 | func (has CustomHelmAppSpec) GetFileParameterPathByName(Name string) string {
|
45 | 54 | var path string
|
46 |
| - for i := range has.FileParameters { |
47 |
| - if has.FileParameters[i].Name == Name { |
48 |
| - path = has.FileParameters[i].Path |
| 55 | + for i := range has.HelmAppSpec.FileParameters { |
| 56 | + if has.HelmAppSpec.FileParameters[i].Name == Name { |
| 57 | + path = has.HelmAppSpec.FileParameters[i].Path |
49 | 58 | break
|
50 | 59 | }
|
51 | 60 | }
|
|
0 commit comments