mirror of
https://github.com/woodpecker-ci/woodpecker.git
synced 2025-01-19 14:05:31 +00:00
modifying cancel logic
This commit is contained in:
parent
e573d66b91
commit
c27a5dd0b4
1 changed files with 13 additions and 0 deletions
|
@ -135,6 +135,19 @@ func DeleteBuild(c *gin.Context) {
|
|||
return
|
||||
}
|
||||
|
||||
if job.Status != model.StatusRunning {
|
||||
c.String(400, "Cannot cancel a non-running build")
|
||||
return
|
||||
}
|
||||
|
||||
job.Status = model.StatusKilled
|
||||
job.Finished = time.Now().Unix()
|
||||
if job.Started == 0 {
|
||||
job.Started = job.Finished
|
||||
}
|
||||
job.ExitCode = 137
|
||||
store.UpdateBuildJob(c, build, job)
|
||||
|
||||
bus.Publish(c, bus.NewEvent(bus.Cancelled, repo, build, job))
|
||||
c.String(204, "")
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue