Skip to content

Commit

Permalink
Do not set default values when parsing a Devfile
Browse files Browse the repository at this point in the history
  • Loading branch information
rm3l committed Apr 4, 2023
1 parent 035e826 commit 0760872
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 6 deletions.
7 changes: 4 additions & 3 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 @@ -52,8 +52,9 @@ func ParseAndValidateFromFile(devfilePath string) (parser.DevfileObj, error) {
// if there are warning it logs them on stdout
func ParseAndValidateFromFileWithVariables(devfilePath string, variables map[string]string) (parser.DevfileObj, error) {
return parseDevfile(parser.ParserArgs{
Path: devfilePath,
ExternalVariables: variables,
Path: devfilePath,
ExternalVariables: variables,
SetBooleanDefaults: pointer.Bool(false),
})
}

Expand Down
6 changes: 5 additions & 1 deletion tests/helper/helper_devfile.go
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,11 @@ func UpdateDevfileContent(path string, handlers []DevfileUpdater) {
return
}

d, err := parser.ParseDevfile(parser.ParserArgs{Path: path, FlattenedDevfile: pointer.Bool(false)})
d, err := parser.ParseDevfile(parser.ParserArgs{
Path: path,
FlattenedDevfile: pointer.Bool(false),
SetBooleanDefaults: pointer.Bool(false),
})
Expect(err).NotTo(HaveOccurred())
for _, h := range handlers {
err = h(&d)
Expand Down
5 changes: 3 additions & 2 deletions tests/integration/cmd_devfile_deploy_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,10 @@ import (
. "github.com/onsi/ginkgo/v2"
. "github.com/onsi/gomega"
"github.com/onsi/gomega/gexec"
"github.com/redhat-developer/odo/pkg/labels"
"k8s.io/utils/pointer"

"github.com/redhat-developer/odo/pkg/labels"

segment "github.com/redhat-developer/odo/pkg/segment/context"
"github.com/redhat-developer/odo/tests/helper"
)
Expand Down Expand Up @@ -728,7 +729,7 @@ CMD ["npm", "start"]
})
})

When("running odo dev with some components referenced in the Devfile", func() {
When("running odo deploy with some components referenced in the Devfile", func() {
var stdout string

BeforeEach(func() {
Expand Down

0 comments on commit 0760872

Please sign in to comment.