Print better error message when config is not found
@@ -18,6 +18,7 @@ package cmd
import (
"context"
+ "fmt"
"os"
configutil "github.com/GoogleContainerTools/skaffold/cmd/skaffold/app/cmd/config"
@@ -52,13 +53,14 @@ func withRunner(ctx context.Context, action func(runner.Runner, *latest.Skaffold
func createNewRunner(opts *config.SkaffoldOptions) (runner.Runner, *latest.SkaffoldConfig, error) {
parsed, err := schema.ParseConfig(opts.ConfigurationFile, true)
if err != nil {
+ if os.IsNotExist(errors.Cause(err)) {
+ return nil, nil, fmt.Errorf("[%s] not found. You might need to run `skaffold init`", opts.ConfigurationFile)
+ }
+
// If the error is NOT that the file doesn't exist, then we warn the user
// that maybe they are using an outdated version of Skaffold that's unable to read
// the configuration.
- if !os.IsNotExist(err) {
warnIfUpdateIsAvailable()
- }
-
return nil, nil, errors.Wrap(err, "parsing skaffold config")
}
