Skip to content

Commit

Permalink
feat: allow space after the comma
Browse files Browse the repository at this point in the history
  • Loading branch information
Tchoupinax committed Jul 22, 2024
1 parent a02440d commit 2145e21
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
4 changes: 2 additions & 2 deletions pkg/argocd/argocd.go
Original file line number Diff line number Diff line change
Expand Up @@ -420,7 +420,7 @@ func SetHelmImage(app *v1alpha1.Application, newImage *image.ContainerImage) err
if hpImageName != "" {
// Here is the case value1,value2
if strings.Contains(hpImageName, ",") {
var parameters = strings.Split(hpImageName, ",")
var parameters = strings.Split(strings.ReplaceAll(hpImageName, " ", ""), ",")
for _, parameterName := range parameters {
p := v1alpha1.HelmParameter{Name: parameterName, Value: newImage.GetFullNameWithoutTag(), ForceString: true}
mergeParams = append(mergeParams, p)
Expand All @@ -433,7 +433,7 @@ func SetHelmImage(app *v1alpha1.Application, newImage *image.ContainerImage) err
if hpImageTag != "" {
// Here is the case value1,value2
if strings.Contains(hpImageTag, ",") {
var parameters = strings.Split(hpImageTag, ",")
var parameters = strings.Split(strings.ReplaceAll(hpImageTag, " ", ""), ",")
for _, parameterName := range parameters {
p := v1alpha1.HelmParameter{Name: parameterName, Value: newImage.GetTagWithDigest(), ForceString: true}
mergeParams = append(mergeParams, p)
Expand Down
2 changes: 1 addition & 1 deletion pkg/argocd/argocd_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -1053,7 +1053,7 @@ func Test_SetHelmImage(t *testing.T) {
Namespace: "testns",
Annotations: map[string]string{
fmt.Sprintf(common.HelmParamImageNameAnnotation, "foobar"): "foobar.image.name,foobar2.image.name",
fmt.Sprintf(common.HelmParamImageTagAnnotation, "foobar"): "foobar.image.tag, foobar2.image.tag",
fmt.Sprintf(common.HelmParamImageTagAnnotation, "foobar"): "foobar.image.tag, foobar2.image.tag", // Space is expected
},
},
Spec: v1alpha1.ApplicationSpec{
Expand Down

0 comments on commit 2145e21

Please sign in to comment.