diff --git a/pkg/argocd/argocd.go b/pkg/argocd/argocd.go index 8f9755d8..8ad85d55 100644 --- a/pkg/argocd/argocd.go +++ b/pkg/argocd/argocd.go @@ -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) @@ -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) diff --git a/pkg/argocd/argocd_test.go b/pkg/argocd/argocd_test.go index 943f51c4..87ec54f9 100644 --- a/pkg/argocd/argocd_test.go +++ b/pkg/argocd/argocd_test.go @@ -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{