Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
jkandasa opened this issue Apr 13, 2023 · 2 comments · May be fixed by #2017
Open

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

jkandasa opened this issue Apr 13, 2023 · 2 comments · May be fixed by #2017
Labels
kind/bug Categorizes issue or PR as related to a bug.
Milestone

Comments

@jkandasa
Copy link
Member

jkandasa commented Apr 13, 2023

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
@pratap0007
Copy link
Contributor

/assign

@vinamra28 vinamra28 added this to the 0.31.0 milestone Apr 25, 2023
@jkandasa
Copy link
Member Author

@pratap0007 have you started working on this issue? if not shall I take this one?

pratap0007 added a commit to pratap0007/cli that referenced this issue May 3, 2023
This patch fix the tkn pr delete command for --keep and --keep-since
now both flags are working together and --keep-since has the higher priority

fixes : tektoncd#1990

Signed-off-by: Shiv Verma <[email protected]>
pratap0007 added a commit to pratap0007/cli that referenced this issue May 3, 2023
This patch fix the tkn pr delete command for --keep and --keep-since
now both flags are working together and --keep-since has the higher priority

fixes : tektoncd#1990

Signed-off-by: Shiv Verma <[email protected]>
@pratap0007 pratap0007 linked a pull request May 3, 2023 that will close this issue
4 tasks
pratap0007 added a commit to pratap0007/cli that referenced this issue May 5, 2023
This patch fix the tkn pr delete command for --keep and --keep-since
now both flags are working together and --keep-since has the higher priority
and also does unit test refactor for pipelinerun delete command

fixes : tektoncd#1990

Signed-off-by: Shiv Verma <[email protected]>
pratap0007 added a commit to pratap0007/cli that referenced this issue May 6, 2023
This patch fix the tkn pr delete command for --keep and --keep-since
now both flags are working together and --keep-since has the higher priority
and also does unit test refactor for pipelinerun delete command

fixes : tektoncd#1990

Signed-off-by: Shiv Verma <[email protected]>
pratap0007 added a commit to pratap0007/cli that referenced this issue May 8, 2023
This patch fix the tkn pr delete command for --keep and --keep-since
now both flags are working together and --keep-since has the higher priority
and also does unit test refactor for pipelinerun delete command

fixes : tektoncd#1990

Signed-off-by: Shiv Verma <[email protected]>
@piyush-garg piyush-garg modified the milestones: 0.31.0, 0.31.1 May 9, 2023
pratap0007 added a commit to pratap0007/cli that referenced this issue May 11, 2023
This patch fix the tkn pr delete command for --keep and --keep-since
now both flags are working together and --keep-since has the higher priority
and also does unit test refactor for pipelinerun delete command

fixes : tektoncd#1990

Signed-off-by: Shiv Verma <[email protected]>
@vinamra28 vinamra28 removed this from the 0.31.1 milestone May 23, 2023
@piyush-garg piyush-garg added this to the 0.32.0 milestone Jun 13, 2023
@piyush-garg piyush-garg modified the milestones: 0.32.0, 0.33.0 Aug 29, 2023
@piyush-garg piyush-garg modified the milestones: 0.33.0, 0.34.0 Nov 21, 2023
@vinamra28 vinamra28 modified the milestones: 0.34.0, v0.35.0 Jan 9, 2024
@piyush-garg piyush-garg modified the milestones: 0.35.0, 0.36.0 Feb 8, 2024
@piyush-garg piyush-garg modified the milestones: 0.36.0, 0.37.0 May 8, 2024
@piyush-garg piyush-garg modified the milestones: 0.37.0, 0.38.0 May 8, 2024
@piyush-garg piyush-garg modified the milestones: 0.38.0, 0.39.0 Aug 22, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
kind/bug Categorizes issue or PR as related to a bug.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants