mirror of
https://github.com/redhat-developer/odo.git
synced 2025-10-19 03:06:19 +03:00
Recognize devfile.yml and .devfile.yml as Devfiles (#7130)
This commit is contained in:
@@ -24,7 +24,7 @@ func (o *DevfileState) GetContent() (DevfileContent, error) {
|
||||
if err != nil {
|
||||
return DevfileContent{}, errors.New("error writing file")
|
||||
}
|
||||
result, err := o.FS.ReadFile("/devfile.yaml")
|
||||
result, err := o.FS.ReadFile(o.Devfile.Ctx.GetAbsPath())
|
||||
if err != nil {
|
||||
return DevfileContent{}, errors.New("error reading file")
|
||||
}
|
||||
|
||||
@@ -9,6 +9,7 @@ import (
|
||||
"github.com/devfile/library/v2/pkg/devfile/parser"
|
||||
context "github.com/devfile/library/v2/pkg/devfile/parser/context"
|
||||
"github.com/devfile/library/v2/pkg/testingutil/filesystem"
|
||||
|
||||
. "github.com/redhat-developer/odo/pkg/apiserver-gen/go"
|
||||
|
||||
"k8s.io/utils/pointer"
|
||||
@@ -42,7 +43,7 @@ func (o *DevfileState) SetDevfileContent(content string) (DevfileContent, error)
|
||||
return DevfileContent{}, fmt.Errorf("error parsing devfile YAML: %w", err)
|
||||
}
|
||||
o.Devfile = devfile
|
||||
o.Devfile.Ctx = context.FakeContext(o.FS, "/devfile.yaml")
|
||||
o.Devfile.Ctx = context.FakeContext(o.FS, o.Devfile.Ctx.GetAbsPath())
|
||||
return o.GetContent()
|
||||
}
|
||||
|
||||
|
||||
@@ -8,8 +8,8 @@ import (
|
||||
"github.com/redhat-developer/odo/pkg/util"
|
||||
)
|
||||
|
||||
// possibleDevfileNames contains possivle devfile name that should be checked in the context dir.
|
||||
var possibleDevfileNames = [...]string{"devfile.yaml", ".devfile.yaml"}
|
||||
// possibleDevfileNames contains possible devfile name that should be checked in the context dir.
|
||||
var possibleDevfileNames = [...]string{"devfile.yaml", ".devfile.yaml", "devfile.yml", ".devfile.yml"}
|
||||
|
||||
// DevfileFilenamesProvider checks if the context dir contains devfile with possible names from possibleDevfileNames variable,
|
||||
// else it returns "devfile.yaml" as default value.
|
||||
|
||||
Reference in New Issue
Block a user