Merge pull request #1235 from rhatdan/hooks
Report an warning when no stages are defined for a hook
This commit is contained in:
commit
b8d2482b26
1 changed files with 7 additions and 3 deletions
|
@ -54,11 +54,15 @@ func readHook(hookPath string) (HookParams, error) {
|
|||
return hook, errors.Wrapf(err, "invalid cmd regular expression %q defined in hook config %q", cmd, hookPath)
|
||||
}
|
||||
}
|
||||
if len(hook.Stage) == 0 {
|
||||
logrus.Warnf("No stage defined in hook config %q, hook will never run", hookPath)
|
||||
} else {
|
||||
for _, stage := range hook.Stage {
|
||||
if !validStage[stage] {
|
||||
return hook, errors.Wrapf(err, "unknown stage %q defined in hook config %q", stage, hookPath)
|
||||
}
|
||||
}
|
||||
}
|
||||
return hook, nil
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue