You've already forked woodpecker
mirror of
https://github.com/woodpecker-ci/woodpecker.git
synced 2025-09-16 08:46:30 +02:00
modifying cancel logic
This commit is contained in:
@@ -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, "")
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user