do not restart errored build

This commit is contained in:
Brad Rydzewski 2017-09-14 15:33:12 -07:00
parent 63ba6af242
commit 45357681a6

View file

@ -474,6 +474,16 @@ func PostBuild(c *gin.Context) {
return
}
switch build.Status {
case model.StatusPending,
model.StatusRunning,
model.StatusDeclined,
model.StatusBlocked,
model.StatusError:
c.String(500, "cannot restart a build with status %s", build.Status)
return
}
// if the remote has a refresh token, the current access token
// may be stale. Therefore, we should refresh prior to dispatching
// the job.