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 21, 2023
1 parent cb836f7 commit 683389a
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 683389a

Please sign in to comment.