From fd5fccb9f78610f3542c51a3bffbff6aedf54283 Mon Sep 17 00:00:00 2001 From: Armel Soro Date: Tue, 24 Oct 2023 10:12:13 +0200 Subject: [PATCH] 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 --- pkg/devfile/parser/context/context.go | 15 --------------- 1 file changed, 15 deletions(-) diff --git a/pkg/devfile/parser/context/context.go b/pkg/devfile/parser/context/context.go index 97ab49d3..4fc66759 100644 --- a/pkg/devfile/parser/context/context.go +++ b/pkg/devfile/parser/context/context.go @@ -16,11 +16,7 @@ package parser import ( - "fmt" "net/url" - "os" - "path/filepath" - "strings" "github.com/devfile/library/v2/pkg/testingutil/filesystem" "github.com/devfile/library/v2/pkg/util" @@ -96,17 +92,6 @@ func (d *DevfileCtx) populateDevfile() (err error) { // Populate fills the DevfileCtx struct with relevant context info func (d *DevfileCtx) Populate() (err error) { - if !strings.HasSuffix(d.relPath, ".yaml") { - if _, err := os.Stat(filepath.Join(d.relPath, "devfile.yaml")); os.IsNotExist(err) { - if _, err := os.Stat(filepath.Join(d.relPath, ".devfile.yaml")); os.IsNotExist(err) { - 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) - } else { - d.relPath = filepath.Join(d.relPath, ".devfile.yaml") - } - } else { - d.relPath = filepath.Join(d.relPath, "devfile.yaml") - } - } if err := d.SetAbsPath(); err != nil { return err }