@@ -363,7 +363,9 @@ func packageApp(ctx context.Context, source v1alpha1.ApplicationSource, refs []v
363
363
src := filepath .Join (appPath , valueFile )
364
364
dst := filepath .Join (tempAppDir , valueFile )
365
365
if err = copyFile (src , dst ); err != nil {
366
- return "" , errors .Wrapf (err , "failed to copy file: %q" , valueFile )
366
+ if ! ignoreValuesFileCopyError (source , valueFile , err ) {
367
+ return "" , errors .Wrapf (err , "failed to copy file: %q" , valueFile )
368
+ }
367
369
}
368
370
}
369
371
}
@@ -401,10 +403,7 @@ func processValueReference(
401
403
src := filepath .Join (refRepo .Directory , refPath )
402
404
dst := filepath .Join (tempDir , refPath )
403
405
if err = copyFile (src , dst ); err != nil {
404
- // handle source.spec.helm.ignoreMissingValues = true
405
- if errors .Is (err , os .ErrNotExist ) && source .Helm .IgnoreMissingValueFiles {
406
- log .Debug ().Str ("valueFile" , valueFile ).Msg ("ignore missing values file, because source.Helm.IgnoreMissingValueFiles is true" )
407
- } else {
406
+ if ! ignoreValuesFileCopyError (source , valueFile , err ) {
408
407
return "" , errors .Wrapf (err , "failed to copy referenced value file: %q" , valueFile )
409
408
}
410
409
}
@@ -416,6 +415,15 @@ func processValueReference(
416
415
return relPath , nil
417
416
}
418
417
418
+ func ignoreValuesFileCopyError (source v1alpha1.ApplicationSource , valueFile string , err error ) bool {
419
+ if errors .Is (err , os .ErrNotExist ) && source .Helm .IgnoreMissingValueFiles {
420
+ log .Debug ().Str ("valueFile" , valueFile ).Msg ("ignore missing values file, because source.Helm.IgnoreMissingValueFiles is true" )
421
+ return true
422
+ }
423
+
424
+ return false
425
+ }
426
+
419
427
var valueRef = regexp .MustCompile (`^\$([^/]+)/(.*)$` )
420
428
var ErrInvalidSourceRef = errors .New ("invalid value ref" )
421
429
0 commit comments