@@ -1471,6 +1471,109 @@ replicas: 1
1471
1471
assert .Equal (t , strings .TrimSpace (strings .ReplaceAll (expected , "\t " , " " )), strings .TrimSpace (string (yaml )))
1472
1472
})
1473
1473
1474
+ t .Run ("Valid Helm source with Helm values file with multiple aliases" , func (t * testing.T ) {
1475
+ expected := `
1476
+ foo.image.name: nginx
1477
+ foo.image.tag: v1.0.0
1478
+ bar.image.name: nginx
1479
+ bar.image.tag: v1.0.0
1480
+ bbb.image.name: nginx
1481
+ bbb.image.tag: v1.0.0
1482
+ replicas: 1
1483
+ `
1484
+ app := v1alpha1.Application {
1485
+ ObjectMeta : v1.ObjectMeta {
1486
+ Name : "testapp" ,
1487
+ Annotations : map [string ]string {
1488
+ "argocd-image-updater.argoproj.io/image-list" : "foo=nginx, bar=nginx, bbb=nginx" ,
1489
+ "argocd-image-updater.argoproj.io/write-back-method" : "git" ,
1490
+ "argocd-image-updater.argoproj.io/write-back-target" : "helmvalues:./test-values.yaml" ,
1491
+ "argocd-image-updater.argoproj.io/foo.helm.image-name" : "foo.image.name" ,
1492
+ "argocd-image-updater.argoproj.io/foo.helm.image-tag" : "foo.image.tag" ,
1493
+ "argocd-image-updater.argoproj.io/bar.helm.image-name" : "bar.image.name" ,
1494
+ "argocd-image-updater.argoproj.io/bar.helm.image-tag" : "bar.image.tag" ,
1495
+ "argocd-image-updater.argoproj.io/bbb.helm.image-name" : "bbb.image.name" ,
1496
+ "argocd-image-updater.argoproj.io/bbb.helm.image-tag" : "bbb.image.tag" ,
1497
+ },
1498
+ },
1499
+ Spec : v1alpha1.ApplicationSpec {
1500
+ Sources : []v1alpha1.ApplicationSource {
1501
+ {
1502
+ Chart : "my-app" ,
1503
+ Helm : & v1alpha1.ApplicationSourceHelm {
1504
+ ReleaseName : "my-app" ,
1505
+ ValueFiles : []string {"$values/some/dir/values.yaml" },
1506
+ Parameters : []v1alpha1.HelmParameter {
1507
+ {
1508
+ Name : "foo.image.name" ,
1509
+ Value : "nginx" ,
1510
+ ForceString : true ,
1511
+ },
1512
+ {
1513
+ Name : "foo.image.tag" ,
1514
+ Value : "v1.0.0" ,
1515
+ ForceString : true ,
1516
+ },
1517
+ {
1518
+ Name : "bar.image.name" ,
1519
+ Value : "nginx" ,
1520
+ ForceString : true ,
1521
+ },
1522
+ {
1523
+ Name : "bar.image.tag" ,
1524
+ Value : "v1.0.0" ,
1525
+ ForceString : true ,
1526
+ },
1527
+ {
1528
+ Name : "bbb.image.name" ,
1529
+ Value : "nginx" ,
1530
+ ForceString : true ,
1531
+ },
1532
+ {
1533
+ Name : "bbb.image.tag" ,
1534
+ Value : "v1.0.0" ,
1535
+ ForceString : true ,
1536
+ },
1537
+ },
1538
+ },
1539
+ RepoURL : "https://example.com/example" ,
1540
+ TargetRevision : "main" ,
1541
+ },
1542
+ {
1543
+ Ref : "values" ,
1544
+ RepoURL : "https://example.com/example2" ,
1545
+ TargetRevision : "main" ,
1546
+ },
1547
+ },
1548
+ },
1549
+ Status : v1alpha1.ApplicationStatus {
1550
+ SourceTypes : []v1alpha1.ApplicationSourceType {
1551
+ v1alpha1 .ApplicationSourceTypeHelm ,
1552
+ "" ,
1553
+ },
1554
+ Summary : v1alpha1.ApplicationSummary {
1555
+ Images : []string {
1556
+ "nginx:v0.0.0" ,
1557
+ },
1558
+ },
1559
+ },
1560
+ }
1561
+
1562
+ originalData := []byte (`
1563
+ foo.image.name: nginx
1564
+ foo.image.tag: v0.0.0
1565
+ bar.image.name: nginx
1566
+ bar.image.tag: v0.0.0
1567
+ bbb.image.name: nginx
1568
+ bbb.image.tag: v0.0.0
1569
+ replicas: 1
1570
+ ` )
1571
+ yaml , err := marshalParamsOverride (& app , originalData )
1572
+ require .NoError (t , err )
1573
+ assert .NotEmpty (t , yaml )
1574
+ assert .Equal (t , strings .TrimSpace (strings .ReplaceAll (expected , "\t " , " " )), strings .TrimSpace (string (yaml )))
1575
+ })
1576
+
1474
1577
t .Run ("Failed to setValue image parameter name" , func (t * testing.T ) {
1475
1578
expected := `
1476
1579
image:
0 commit comments