mirror of
https://github.com/redhat-developer/odo.git
synced 2025-10-19 03:06:19 +03:00
Do not return an error in odo analyze if current directory contains an invalid Devfile (#6905)
* Add unit test highliging the issue * Fix 'delete' unit tests * Pass the filesystem object where it is relevant * Add a way for CLI commands to indicate whether of not they require a valid Devfile For the 'analyze' command, this is not required, so Devfile parsing will be ignored completely. * Make the fake filesystem return an absolute current dir Otherwise, some code will assume it is relative, and try to prepend the current physical directory
This commit is contained in:
@@ -435,7 +435,7 @@ func (o RegistryClient) retrieveDevfileDataFromRegistry(ctx context.Context, reg
|
||||
}
|
||||
|
||||
// Get the devfile yaml file from the directory
|
||||
devfileYamlFile := location.DevfileFilenamesProvider(tmpFile)
|
||||
devfileYamlFile := location.DevfileFilenamesProvider(o.fsys, tmpFile)
|
||||
|
||||
// Parse and validate the file and return the devfile data
|
||||
devfileObj, err := devfile.ParseAndValidateFromFile(path.Join(tmpFile, devfileYamlFile), "", true)
|
||||
|
||||
@@ -3,10 +3,11 @@ package registry
|
||||
import (
|
||||
"errors"
|
||||
"fmt"
|
||||
"github.com/redhat-developer/odo/pkg/testingutil/filesystem"
|
||||
"os"
|
||||
"path/filepath"
|
||||
|
||||
"github.com/redhat-developer/odo/pkg/testingutil/filesystem"
|
||||
|
||||
devfilev1 "github.com/devfile/api/v2/pkg/apis/workspaces/v1alpha2"
|
||||
parsercommon "github.com/devfile/library/v2/pkg/devfile/parser/data/v2/common"
|
||||
"github.com/go-git/go-git/v5"
|
||||
@@ -50,7 +51,7 @@ func DownloadStarterProject(fs filesystem.Filesystem, starterProject *devfilev1.
|
||||
}
|
||||
|
||||
// We will check to see if the project has a valid directory
|
||||
err = util.IsValidProjectDir(path, location.DevfileLocation(""), fs)
|
||||
err = util.IsValidProjectDir(path, location.DevfileLocation(fs, ""), fs)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user