From 45357681a6b0cd27aad3d1eafc1c356fbfdc391f Mon Sep 17 00:00:00 2001 From: Brad Rydzewski Date: Thu, 14 Sep 2017 15:33:12 -0700 Subject: [PATCH] do not restart errored build --- server/build.go | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/server/build.go b/server/build.go index 0ac7ceca6..245467edc 100644 --- a/server/build.go +++ b/server/build.go @@ -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.