1
0
mirror of https://github.com/woodpecker-ci/woodpecker.git synced 2025-07-12 22:21:40 +02:00

Add DeletePipeline API (#3506)

This is just a first step, the final goal is to have an API endpoint to
prune Repo Pipelines older than the given date.

@woodpecker-ci/maintainers Can I get some feedback if this is the right
direction?

---------

Co-authored-by: 6543 <m.huber@kithara.com>
This commit is contained in:
Robert Kaussow
2024-04-25 10:59:17 +02:00
committed by GitHub
parent 9972c24924
commit d0057736f1
5 changed files with 141 additions and 4 deletions

View File

@ -64,3 +64,14 @@ func refreshUserToken(c *gin.Context, user *model.User) {
}
forge.Refresh(c, _forge, _store, user)
}
// pipelineDeleteAllowed checks if the given pipeline can be deleted based on its status.
// It returns a bool indicating if delete is allowed, and the pipeline's status.
func pipelineDeleteAllowed(pl *model.Pipeline) bool {
switch pl.Status {
case model.StatusRunning, model.StatusPending, model.StatusBlocked:
return false
}
return true
}