Skip to content

Commit

Permalink
fix KO_CONFIG_PATH pointing to a file
Browse files Browse the repository at this point in the history
  • Loading branch information
imjasonh committed Jan 10, 2023
1 parent 7bf3626 commit 7e77346
Showing 1 changed file with 4 additions and 12 deletions.
16 changes: 4 additions & 12 deletions pkg/commands/options/build.go
Original file line number Diff line number Diff line change
Expand Up @@ -108,21 +108,13 @@ func (bo *BuildOptions) LoadConfig() error {
if err != nil {
return fmt.Errorf("error looking for config file: %w", err)
}
var path string
if file.IsDir() {
path = filepath.Join(override, configName+".yaml")
file, err = os.Stat(path)
if err != nil {
return fmt.Errorf("error looking for config file: %w", err)
}
v.AddConfigPath(override) // add this dir to the set of places we'll look for .ko.yaml
} else if file.Mode().IsRegular() {
v.SetConfigFile(override) // only look at exactly this file path
} else {
path = override
}

if !file.Mode().IsRegular() {
return fmt.Errorf("config file %s is not a regular file", path)
return fmt.Errorf("config file %s is not a regular file", override)
}
v.AddConfigPath(override)
}
v.AddConfigPath(bo.WorkingDirectory)

Expand Down

0 comments on commit 7e77346

Please sign in to comment.