From 6daeb6bb01b66e2e95cdde579ea6f6cc08c652c7 Mon Sep 17 00:00:00 2001 From: Tchoupinax Date: Mon, 22 Jul 2024 19:35:48 +0200 Subject: [PATCH] feat: allow space after the comma Signed-off-by: Tchoupinax --- pkg/argocd/argocd.go | 4 ++-- pkg/argocd/argocd_test.go | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) 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{