fix: show error if missing jobs.

This commit is contained in:
Bo-Yi Wu
2017-01-16 15:04:12 +08:00
parent 4ce3a1e347
commit 7ba6170e12
2 changed files with 24 additions and 1 deletions
+8 -1
View File
@@ -36,13 +36,20 @@ func (p Plugin) Exec() error {
return errors.New("missing jenkins config")
}
jobs := trimElement(p.Job)
if len(jobs) == 0 {
return errors.New("missing jenkins job")
}
auth := &Auth{
Username: p.Username,
Token: p.Token,
}
jenkins := NewJenkins(auth, p.BaseURL)
for _, value := range trimElement(p.Job) {
for _, value := range jobs {
jenkins.trigger(value, nil)
}