Skip to content

issue with keep and keep-since in taskrun and in pipelinerun #1990

Open
@jkandasa

Description

tkn version: 0.30.1

keep and keep-since support is introduced in #1533
though, when we supply keep and keep-since simultaneously
the out come always equivalent to keep, keep-since ignored

Pipelinerun:

func keepPipelineRunsByAgeAndNumber(pipelineRuns *v1.PipelineRunList, since int, keep int, ignoreRunning bool) ([]string, []string) {
var todelete, tokeep []string
todelete, tokeep = keepPipelineRunsByAge(pipelineRuns, since, ignoreRunning)
if len(tokeep) != keep {
todelete, tokeep = keepPipelineRunsByNumber(pipelineRuns, keep)
}
return todelete, tokeep
}

taskrun:

func keepTaskRunsByAgeAndNumber(taskRuns *v1.TaskRunList, since int, keep int, ignoreRunning bool) ([]string, []string) {
var todelete, tokeep []string
todelete, tokeep = keepTaskRunsByAge(taskRuns, since, ignoreRunning)
if len(tokeep) != keep {
todelete, tokeep = keepTaskRunsByNumber(taskRuns, keep)
}
return todelete, tokeep
}

Expected behavior

  • tkn taskrun delete --keep=5 --keep-since=30
  • after executed the above command, remaining taskruns will be as count <= 5 and start-time <= 30 minutes
  • this is applicable for pipelineruns too

Metadata

Assignees

No one assigned

    Labels

    kind/bugCategorizes issue or PR as related to a bug.

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions