Skip to content

Commit fd5fccb

Browse files
committed
Do not make any assumption on the file name when parsing
The parser should act generically, and be able to parse any file it is provided, regardless of name and file extension. Signed-off-by: Armel Soro <[email protected]>
1 parent 3d5e045 commit fd5fccb

File tree

1 file changed

+0
-15
lines changed

1 file changed

+0
-15
lines changed

pkg/devfile/parser/context/context.go

Lines changed: 0 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -16,11 +16,7 @@
1616
package parser
1717

1818
import (
19-
"fmt"
2019
"net/url"
21-
"os"
22-
"path/filepath"
23-
"strings"
2420

2521
"github.com/devfile/library/v2/pkg/testingutil/filesystem"
2622
"github.com/devfile/library/v2/pkg/util"
@@ -96,17 +92,6 @@ func (d *DevfileCtx) populateDevfile() (err error) {
9692

9793
// Populate fills the DevfileCtx struct with relevant context info
9894
func (d *DevfileCtx) Populate() (err error) {
99-
if !strings.HasSuffix(d.relPath, ".yaml") {
100-
if _, err := os.Stat(filepath.Join(d.relPath, "devfile.yaml")); os.IsNotExist(err) {
101-
if _, err := os.Stat(filepath.Join(d.relPath, ".devfile.yaml")); os.IsNotExist(err) {
102-
return fmt.Errorf("the provided path is not a valid yaml filepath, and devfile.yaml or .devfile.yaml not found in the provided path : %s", d.relPath)
103-
} else {
104-
d.relPath = filepath.Join(d.relPath, ".devfile.yaml")
105-
}
106-
} else {
107-
d.relPath = filepath.Join(d.relPath, "devfile.yaml")
108-
}
109-
}
11095
if err := d.SetAbsPath(); err != nil {
11196
return err
11297
}

0 commit comments

Comments
 (0)