mirror of
https://github.com/woodpecker-ci/woodpecker.git
synced 2025-08-18 03:41:39 +00:00
modifying cancel logic
This commit is contained in:
parent
e573d66b91
commit
c27a5dd0b4
@ -135,6 +135,19 @@ func DeleteBuild(c *gin.Context) {
|
|||||||
return
|
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))
|
bus.Publish(c, bus.NewEvent(bus.Cancelled, repo, build, job))
|
||||||
c.String(204, "")
|
c.String(204, "")
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user