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

Fix --keep with TaskRun and PipelineRun Delete when Using --task or --pipeline Flags #990

Merged
merged 1 commit into from
Jun 10, 2020

Conversation

danielhelfand
Copy link
Member

Closes #965

This pull request makes --keep compatible with tkn tr delete --task and tkn pr delete --pipeline. With these changes, tkn tr delete --task taskName --keep 2 would filter TaskRuns by a Task name and keep the most recent 2 TaskRuns associated with the Task taskName.

Deletion confirmation messages have been updated for this case as follows:

$ tkn pr delete --pipeline pipelineName --keep 2

Are you sure you want to delete all pipelineruns related to pipeline "pipelineName" keeping 2 pipelineruns (y/n): 
All but 2 PipelineRuns associated with Pipeline "pipelineName" deleted in namespace "ns"

$ tkn pr delete --pipeline pipelineName 

Are you sure you want to delete all pipelineruns related to pipeline "pipelineName" (y/n): 
All PipelineRuns associated with Pipeline "pipelineName" deleted in namespace "ns"

This pull request also fixes tests associated with --keep with TaskRun, which had no Task test data set up for the test. This resulted in the tests not adequately testing if the correct output was received.

Submitter Checklist

These are the criteria that every PR should meet, please check them off as you
review them:

  • Includes tests (if functionality changed/added)
  • Run the code checkers with make check
  • Regenerate the manpages, docs and go formatting with make generated
  • Commit messages follow commit message best practices

Release Notes

Make --keep compatible with --task and --pipeline flag for taskrun and pipelinerun delete

@tekton-robot tekton-robot added the size/L Denotes a PR that changes 100-499 lines, ignoring generated files. label May 21, 2020
@tekton-robot
Copy link
Contributor

The following is the coverage report on the affected files.
Say /test pull-tekton-cli-go-coverage to re-run this coverage report

File Old Coverage New Coverage Delta
pkg/cmd/pipelinerun/delete.go 90.0% 93.0% 3.0
pkg/cmd/taskrun/delete.go 87.1% 93.0% 5.8
pkg/options/delete.go 92.6% 93.3% 0.7

@danielhelfand danielhelfand added this to the 0.10.0 🐅 milestone May 26, 2020
@vdemeester vdemeester modified the milestones: 0.10.0 🐅, 0.11.0 Jun 2, 2020
@piyush-garg piyush-garg removed this from the 0.11.0 milestone Jun 2, 2020
@vdemeester
Copy link
Member

@danielhelfand needs a rebase 😅

@tekton-robot
Copy link
Contributor

The following is the coverage report on the affected files.
Say /test pull-tekton-cli-go-coverage to re-run this coverage report

File Old Coverage New Coverage Delta
pkg/cmd/pipelinerun/delete.go 90.0% 93.0% 3.0
pkg/cmd/taskrun/delete.go 87.1% 93.0% 5.8
pkg/options/delete.go 92.6% 93.3% 0.7

@danielhelfand
Copy link
Member Author

/test pull-tekton-cli-integration-tests-0_10

@danielhelfand
Copy link
Member Author

@danielhelfand needs a rebase 😅

@vdemeester Rebased. If it looks good, would be great to still consider for v0.10.0 if not too late.

Copy link
Member

@vdemeester vdemeester left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@tekton-robot
Copy link
Contributor

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: vdemeester

The full list of commands accepted by this bot can be found here.

The pull request process is described here

Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@tekton-robot tekton-robot added the approved Indicates a PR has been approved by an approver from all required OWNERS files. label Jun 5, 2020
@chmouel
Copy link
Member

chmouel commented Jun 10, 2020

/lgtm

very nice thanks,

(i wasn't able to test this directly but the code and tests looks good)

@tekton-robot tekton-robot added the lgtm Indicates that a PR is ready to be merged. label Jun 10, 2020
@tekton-robot tekton-robot merged commit b1c668f into tektoncd:master Jun 10, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
approved Indicates a PR has been approved by an approver from all required OWNERS files. lgtm Indicates that a PR is ready to be merged. size/L Denotes a PR that changes 100-499 lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

tkn pr delete -p <pipeline-name> --keep n neglects the -p <pipeline-name> flag
5 participants