Merge pull request #9 from drone/improve_err

Log error if dockerfile does not exist at provided path
This commit is contained in:
Shubham Agrawal 2021-01-29 14:41:19 +05:30 committed by GitHub
commit b33681a9b9
Signed by: GitHub
GPG Key ID: 4AEE18F83AFDEB23

@ -31,6 +31,10 @@ func (p Plugin) Exec() error {
return fmt.Errorf("repository name to publish image must be specified") return fmt.Errorf("repository name to publish image must be specified")
} }
if _, err := os.Stat(p.Build.Dockerfile); os.IsNotExist(err) {
return fmt.Errorf("dockerfile does not exist at path: %s", p.Build.Dockerfile)
}
cmdArgs := []string{ cmdArgs := []string{
fmt.Sprintf("--dockerfile=%s", p.Build.Dockerfile), fmt.Sprintf("--dockerfile=%s", p.Build.Dockerfile),
fmt.Sprintf("--context=dir://%s", p.Build.Context), fmt.Sprintf("--context=dir://%s", p.Build.Context),