@@ -493,7 +493,7 @@ func createNewBundle(
493
493
}
494
494
495
495
if destDir == "" {
496
- destDir = wc . HelmChart .Metadata .Name
496
+ destDir = chrt .Metadata .Name
497
497
}
498
498
499
499
if err := os .RemoveAll (destDir ); err != nil {
@@ -517,11 +517,11 @@ func createNewBundle(
517
517
}
518
518
}
519
519
520
- if wc . HelmChart .Metadata == nil {
520
+ if chrt .Metadata == nil {
521
521
panic ("unexpected condition" )
522
522
}
523
523
524
- bundleMetadata := * wc . HelmChart .Metadata
524
+ bundleMetadata := * chrt .Metadata
525
525
// Force api v2
526
526
bundleMetadata .APIVersion = chart .APIVersionV2
527
527
bundleMetadata .Version = chartVersion
@@ -533,9 +533,9 @@ func createNewBundle(
533
533
return nil , fmt .Errorf ("unable to write %q: %w" , chartYamlFile , err )
534
534
}
535
535
536
- if wc . HelmChart .Lock != nil {
536
+ if chrt .Lock != nil {
537
537
chartLockFile := filepath .Join (destDir , "Chart.lock" )
538
- if data , err := json .Marshal (wc . HelmChart .Lock ); err != nil {
538
+ if data , err := json .Marshal (chrt .Lock ); err != nil {
539
539
return nil , fmt .Errorf ("unable to prepare Chart.lock data: %w" , err )
540
540
} else if err := ioutil .WriteFile (chartLockFile , append (data , []byte ("\n " )... ), os .ModePerm ); err != nil {
541
541
return nil , fmt .Errorf ("unable to write %q: %w" , chartLockFile , err )
@@ -547,7 +547,7 @@ func createNewBundle(
547
547
return nil , fmt .Errorf ("unable to create dir %q: %w" , templatesDir , err )
548
548
}
549
549
550
- for _ , f := range wc . HelmChart .Templates {
550
+ for _ , f := range chrt .Templates {
551
551
if err := writeChartFile (ctx , destDir , f .Name , f .Data ); err != nil {
552
552
return nil , fmt .Errorf ("error writing chart template: %w" , err )
553
553
}
@@ -568,7 +568,7 @@ func createNewBundle(
568
568
}
569
569
570
570
WritingFiles:
571
- for _ , f := range wc . HelmChart .Files {
571
+ for _ , f := range chrt .Files {
572
572
for _ , ignoreValuesFile := range ignoreChartValuesFiles {
573
573
if f .Name == ignoreValuesFile {
574
574
continue WritingFiles
@@ -580,7 +580,7 @@ WritingFiles:
580
580
}
581
581
}
582
582
583
- for _ , dep := range wc . HelmChart .Metadata .Dependencies {
583
+ for _ , dep := range chrt .Metadata .Dependencies {
584
584
var depPath string
585
585
586
586
switch {
@@ -592,7 +592,7 @@ WritingFiles:
592
592
depPath = fmt .Sprintf ("charts/%s-%s.tgz" , dep .Name , dep .Version )
593
593
}
594
594
595
- for _ , f := range wc . HelmChart .Raw {
595
+ for _ , f := range chrt .Raw {
596
596
if strings .HasPrefix (f .Name , depPath ) {
597
597
if err := writeChartFile (ctx , destDir , f .Name , f .Data ); err != nil {
598
598
return nil , fmt .Errorf ("error writing subchart file: %w" , err )
@@ -601,12 +601,12 @@ WritingFiles:
601
601
}
602
602
}
603
603
604
- if wc . HelmChart .Schema != nil {
604
+ if chrt .Schema != nil {
605
605
schemaFile := filepath .Join (destDir , "values.schema.json" )
606
- if err := writeChartFile (ctx , destDir , "values.schema.json" , wc . HelmChart .Schema ); err != nil {
606
+ if err := writeChartFile (ctx , destDir , "values.schema.json" , chrt .Schema ); err != nil {
607
607
return nil , fmt .Errorf ("error writing chart values schema: %w" , err )
608
608
}
609
- if err := ioutil .WriteFile (schemaFile , wc . HelmChart .Schema , os .ModePerm ); err != nil {
609
+ if err := ioutil .WriteFile (schemaFile , chrt .Schema , os .ModePerm ); err != nil {
610
610
return nil , fmt .Errorf ("unable to write %q: %w" , schemaFile , err )
611
611
}
612
612
}
0 commit comments