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
feat(cli): add selector and field-selector option to the stop command. #4853
Conversation
cde5b74
to
c09acbe
Compare
@@ -784,6 +784,54 @@ func (s *CLISuite) TestWorkflowRetry() { | |||
}) | |||
} | |||
|
|||
func (s *CLISuite) TestWorkflowStop() { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this is the first time anyone new to the project has submitted complete tests!
@@ -33,29 +58,55 @@ func NewStopCommand() *cobra.Command { | |||
argo stop @latest | |||
`, | |||
Run: func(cmd *cobra.Command, args []string) { | |||
if len(args) == 0 && !o.isList() { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
it should be ok to have no args, e.g. if you were to do
kubectl get wf -o name | xargs argo stop
That should be fine, even if kubectl returned zero workflows.
What happens with both list options AND args? Should that be an error?
Is this consistent with argo list
and argo delete
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
When we use the xargs
command it works fine, because the xargs
command generates and executes lines. Indeed, kubectl get wf -o name | xargs argo stop
works, but argo stop
returns the help message.
At now it works only with the list option when we use both list options and args, and it is not consistent with argo delete
, so I need to fix it. But in my opinion, Argo should block using both because it makes the user confused. In kubectl
it returns the error when we use both list options and args like the below.
k get pods -l selector=true foo
error: name cannot be provided when a selector is specified
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I've fixed it to be consistent with the delete
& list
command.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
See comments.
Signed-off-by: hanjunlee <opsdownn@gmail.com>
Signed-off-by: hanjunlee <opsdownn@gmail.com>
Signed-off-by: hanjunlee <opsdownn@gmail.com>
Signed-off-by: hanjunlee <opsdownn@gmail.com>
d802059
to
6381751
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
@hanjunlee this is failing builds on master, so I'm going to use admin privileges to revert this merge. Can you please re-submit the PR?:
|
Checklist:
I add the
selector
andfield-selector
option to thestop
command, it can stop workflows that are matched by labels and field. it is related to #3962.