Skip to content

Commit 2145e21

Browse files
committed
feat: allow space after the comma
1 parent a02440d commit 2145e21

File tree

2 files changed

+3
-3
lines changed

2 files changed

+3
-3
lines changed

pkg/argocd/argocd.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -420,7 +420,7 @@ func SetHelmImage(app *v1alpha1.Application, newImage *image.ContainerImage) err
420420
if hpImageName != "" {
421421
// Here is the case value1,value2
422422
if strings.Contains(hpImageName, ",") {
423-
var parameters = strings.Split(hpImageName, ",")
423+
var parameters = strings.Split(strings.ReplaceAll(hpImageName, " ", ""), ",")
424424
for _, parameterName := range parameters {
425425
p := v1alpha1.HelmParameter{Name: parameterName, Value: newImage.GetFullNameWithoutTag(), ForceString: true}
426426
mergeParams = append(mergeParams, p)
@@ -433,7 +433,7 @@ func SetHelmImage(app *v1alpha1.Application, newImage *image.ContainerImage) err
433433
if hpImageTag != "" {
434434
// Here is the case value1,value2
435435
if strings.Contains(hpImageTag, ",") {
436-
var parameters = strings.Split(hpImageTag, ",")
436+
var parameters = strings.Split(strings.ReplaceAll(hpImageTag, " ", ""), ",")
437437
for _, parameterName := range parameters {
438438
p := v1alpha1.HelmParameter{Name: parameterName, Value: newImage.GetTagWithDigest(), ForceString: true}
439439
mergeParams = append(mergeParams, p)

pkg/argocd/argocd_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1053,7 +1053,7 @@ func Test_SetHelmImage(t *testing.T) {
10531053
Namespace: "testns",
10541054
Annotations: map[string]string{
10551055
fmt.Sprintf(common.HelmParamImageNameAnnotation, "foobar"): "foobar.image.name,foobar2.image.name",
1056-
fmt.Sprintf(common.HelmParamImageTagAnnotation, "foobar"): "foobar.image.tag, foobar2.image.tag",
1056+
fmt.Sprintf(common.HelmParamImageTagAnnotation, "foobar"): "foobar.image.tag, foobar2.image.tag", // Space is expected
10571057
},
10581058
},
10591059
Spec: v1alpha1.ApplicationSpec{

0 commit comments

Comments
 (0)