Skip to content

Commit

Permalink
WIP - Parse Devfiles without flattening
Browse files Browse the repository at this point in the history
When flattening, the Devfile parser seems to
set the default values for unset fields (like deployByDefault or autoBuild).
This makes it hard to determine cases where the component needs to be applied
automatically (e.g., deployByDefault not set and component not referenced by any Apply commands).

However, this also creates other issues when handling child Devfiles with Parents.

So needs to be discussed..
  • Loading branch information
rm3l committed Mar 13, 2023
1 parent c319b8a commit 055f71a
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions pkg/devfile/devfile.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,11 @@ package devfile

import (
"fmt"

"strings"

"github.com/devfile/library/v2/pkg/devfile"
"github.com/devfile/library/v2/pkg/devfile/parser"
"k8s.io/utils/pointer"

"github.com/redhat-developer/odo/pkg/devfile/validate"
"github.com/redhat-developer/odo/pkg/log"
Expand Down Expand Up @@ -44,7 +44,10 @@ func parseDevfile(args parser.ParserArgs) (parser.DevfileObj, error) {
// ParseAndValidateFromFile reads, parses and validates devfile from a file
// if there are warning it logs them on stdout
func ParseAndValidateFromFile(devfilePath string) (parser.DevfileObj, error) {
return parseDevfile(parser.ParserArgs{Path: devfilePath})
return parseDevfile(parser.ParserArgs{
Path: devfilePath,
FlattenedDevfile: pointer.Bool(false),
})
}

// ParseAndValidateFromFileWithVariables reads, parses and validates devfile from a file
Expand All @@ -54,6 +57,7 @@ func ParseAndValidateFromFileWithVariables(devfilePath string, variables map[str
return parseDevfile(parser.ParserArgs{
Path: devfilePath,
ExternalVariables: variables,
FlattenedDevfile: pointer.Bool(false),
})
}

Expand Down

0 comments on commit 055f71a

Please sign in to comment.