Skip to content

Commit

Permalink
WIP - Handle changes done in the Devfile library [1]
Browse files Browse the repository at this point in the history
We'll need to remove this commit and update the Devfile library once [1] is merged.

[1] devfile/library#169
  • Loading branch information
rm3l committed Mar 29, 2023
1 parent 3cfabfe commit eaf492f
Show file tree
Hide file tree
Showing 7 changed files with 29 additions and 157 deletions.
3 changes: 3 additions & 0 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -211,3 +211,6 @@ require (
replace gopkg.in/segmentio/analytics-go.v3 => github.com/segmentio/analytics-go/v3 v3.2.1

replace github.com/apcera/gssapi => github.com/openshift/gssapi v0.0.0-20161010215902-5fb4217df13b

// TODO(rm3l): This is just for testing https://github.com/devfile/library/pull/169
replace github.com/devfile/library/v2 v2.2.1-0.20230323124903-d36e409ff94f => github.com/kim-tsao/library/v2 v2.0.0-20230327215851-415f3504fb8e
148 changes: 2 additions & 146 deletions go.sum

Large diffs are not rendered by default.

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

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions vendor/modules.txt
Original file line number Diff line number Diff line change
Expand Up @@ -146,8 +146,8 @@ github.com/devfile/api/v2/pkg/utils/overriding
github.com/devfile/api/v2/pkg/utils/unions
github.com/devfile/api/v2/pkg/validation
github.com/devfile/api/v2/pkg/validation/variables
# github.com/devfile/library/v2 v2.2.1-0.20230323124903-d36e409ff94f
## explicit; go 1.15
# github.com/devfile/library/v2 v2.2.1-0.20230323124903-d36e409ff94f => github.com/kim-tsao/library/v2 v2.0.0-20230327215851-415f3504fb8e
## explicit; go 1.18
github.com/devfile/library/v2/pkg/devfile
github.com/devfile/library/v2/pkg/devfile/generator
github.com/devfile/library/v2/pkg/devfile/parser
Expand Down

0 comments on commit eaf492f

Please sign in to comment.