Add support for after_success and after_failure to email notifications

This allows you to restrict email notifications to only be sent after the build changes from success to failure or failure to success.  It errs on the side of sending the notification; if the build is in another state (hung, for instance) or there was no previous build on the branch the email will also be sent.

Since the notify plugin shouldn't really have any responsibility for querying the database to find the previous commit's status, we store it on the commit when we save it.
This commit is contained in:
Michael Nutt
2014-12-30 11:37:57 -05:00
parent 4693b1f526
commit e8b993e7da
6 changed files with 143 additions and 8 deletions

View File

@@ -8,6 +8,7 @@ type Commit struct {
ID int64 `meddler:"commit_id,pk" json:"id"`
RepoID int64 `meddler:"repo_id" json:"-"`
Status string `meddler:"commit_status" json:"status"`
PriorStatus string `meddler:"commit_prior_status" json:"prior_status"`
Started int64 `meddler:"commit_started" json:"started_at"`
Finished int64 `meddler:"commit_finished" json:"finished_at"`
Duration int64 `meddler:"commit_duration" json:"duration"`