@@ -477,7 +477,7 @@ func composeFileAsByteReader(ctx context.Context, filePath string, project *type
477477 if err != nil {
478478 return nil , fmt .Errorf ("failed to open compose file %s: %w" , filePath , err )
479479 }
480- model , err := loader . LoadModelWithContext ( ctx , types.ConfigDetails {
480+ configDetails := types.ConfigDetails {
481481 WorkingDir : project .WorkingDir ,
482482 Environment : project .Environment ,
483483 ConfigFiles : []types.ConfigFile {
@@ -486,18 +486,29 @@ func composeFileAsByteReader(ctx context.Context, filePath string, project *type
486486 Content : composeFile ,
487487 },
488488 },
489- }, func (options * loader.Options ) {
489+ }
490+ loadOptions := func (options * loader.Options ) {
490491 options .SkipValidation = true
491492 options .SkipExtends = true
492493 options .SkipConsistencyCheck = true
493494 options .ResolvePaths = true
494495 options .SkipInterpolation = true
495496 options .SkipResolveEnvironment = true
496- })
497+ }
498+
499+ base , err := loader .LoadWithContext (ctx , configDetails , loadOptions )
500+ if err == nil {
501+ in , err := base .MarshalYAML ()
502+ if err != nil {
503+ return nil , err
504+ }
505+ return bytes .NewBuffer (in ), nil
506+ }
507+
508+ model , err := loader .LoadModelWithContext (ctx , configDetails , loadOptions )
497509 if err != nil {
498510 return nil , err
499511 }
500-
501512 in , err := yaml .Marshal (model )
502513 if err != nil {
503514 return nil , err
0 commit comments