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(cli): exit when calling subcommand node without args #5556

Merged
merged 1 commit into from
Mar 31, 2021

Conversation

book987
Copy link
Contributor

@book987 book987 commented Mar 31, 2021

Checklist:

argo node without args didn't exit after displaying help docs, which cause an index out of range panic in next line.

pls take a look @alexec

λ argo node
perform action on a node in a workflow

Usage:
  argo node ACTION WORKFLOW FLAGS [flags]

Examples:
# Set outputs to a node within a workflow:

  argo node set my-wf --output-parameter parameter-name="Hello, world!" --node-field-selector displayName=approve

# Set the message of a node within a workflow:

  argo node set my-wf --message "We did it!"" --node-field-selector displayName=approve


Flags:
  -h, --help                           help for node
  -m, --message string                 Set the message of a node, eg: --message "Hello, world!"
      --node-field-selector string     Selector of node to set, eg: --node-field-selector inputs.paramaters.myparam.value=abc
  -p, --output-parameter stringArray   Set a "supplied" output parameter of node, eg: --output-parameter parameter-name="Hello, world!"
      --phase string                   Phase to set the node to, eg: --phase Succeeded

Global Flags:
      --argo-base-href string          An path to use with HTTP client (e.g. due to BASE_HREF). Defaults to the ARGO_BASE_HREF environment variable.
      --argo-http1                     If true, use the HTTP client. Defaults to the ARGO_HTTP1 environment variable.
  -s, --argo-server host:port          API server host:port. e.g. localhost:2746. Defaults to the ARGO_SERVER environment variable.
      --as string                      Username to impersonate for the operation
      --as-group stringArray           Group to impersonate for the operation, this flag can be repeated to specify multiple groups.
      --certificate-authority string   Path to a cert file for the certificate authority
      --client-certificate string      Path to a client certificate file for TLS
      --client-key string              Path to a client key file for TLS
      --cluster string                 The name of the kubeconfig cluster to use
      --context string                 The name of the kubeconfig context to use
      --gloglevel int                  Set the glog logging level
      --insecure-skip-tls-verify       If true, the server's certificate will not be checked for validity. This will make your HTTPS connections insecure
  -k, --insecure-skip-verify           If true, the Argo Server's certificate will not be checked for validity. This will make your HTTPS connections insecure. Defaults to the ARGO_INSECURE_SKIP_VERIFY environment variable.
      --instanceid string              submit with a specific controller's instance id label. Default to the ARGO_INSTANCEID environment variable.
      --kubeconfig string              Path to a kube config. Only required if out-of-cluster
      --loglevel string                Set the logging level. One of: debug|info|warn|error (default "info")
  -n, --namespace string               If present, the namespace scope for this CLI request
      --password string                Password for basic authentication to the API server
      --request-timeout string         The length of time to wait before giving up on a single server request. Non-zero values should contain a corresponding time unit (e.g. 1s, 2m, 3h). A value of zero means don't timeout requests. (default "0")
  -e, --secure                         Whether or not the server is using TLS with the Argo Server. Defaults to the ARGO_SECURE environment variable.
      --server string                  The address and port of the Kubernetes API server
      --token string                   Bearer token for authentication to the API server
      --user string                    The name of the kubeconfig user to use
      --username string                Username for basic authentication to the API server
  -v, --verbose                        Enabled verbose logging, i.e. --loglevel debug
panic: runtime error: index out of range [0] with length 0

goroutine 1 [running]:
github.com/argoproj/argo/v2/cmd/argo/commands.NewNodeCommand.func1(0xc0001e8000, 0x4d8ac80, 0x0, 0x0)
	/Users/sbeharyutk/go/src/github.com/argoproj/argo/cmd/argo/commands/node.go:47 +0x8ee
github.com/spf13/cobra.(*Command).execute(0xc0001e8000, 0x4d8ac80, 0x0, 0x0, 0xc0001e8000, 0x4d8ac80)
	/Users/sbeharyutk/go/pkg/mod/github.com/spf13/cobra@v1.0.0/command.go:846 +0x2aa
github.com/spf13/cobra.(*Command).ExecuteC(0xc000154580, 0xc00007c750, 0xc00087ff50, 0x100545f)
	/Users/sbeharyutk/go/pkg/mod/github.com/spf13/cobra@v1.0.0/command.go:950 +0x349
github.com/spf13/cobra.(*Command).Execute(...)
	/Users/sbeharyutk/go/pkg/mod/github.com/spf13/cobra@v1.0.0/command.go:887
main.main()
	/Users/sbeharyutk/go/src/github.com/argoproj/argo/cmd/argo/main.go:13 +0x2b

Signed-off-by: BOOK <book78987book@gmail.com>
@codecov
Copy link

codecov bot commented Mar 31, 2021

Codecov Report

Merging #5556 (17ff222) into master (20f0047) will decrease coverage by 0.04%.
The diff coverage is 0.00%.

❗ Current head 17ff222 differs from pull request most recent head d00cc4e. Consider uploading reports for the commit d00cc4e to get more accurate results
Impacted file tree graph

@@            Coverage Diff             @@
##           master    #5556      +/-   ##
==========================================
- Coverage   47.04%   47.00%   -0.05%     
==========================================
  Files         240      240              
  Lines       15012    15013       +1     
==========================================
- Hits         7063     7057       -6     
- Misses       7051     7057       +6     
- Partials      898      899       +1     
Impacted Files Coverage Δ
cmd/argo/commands/node.go 0.00% <0.00%> (ø)
cmd/argoexec/commands/emissary.go 48.43% <0.00%> (-1.57%) ⬇️
cmd/argo/commands/get.go 56.00% <0.00%> (-1.34%) ⬇️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 20f0047...d00cc4e. Read the comment docs.

Copy link
Member

@simster7 simster7 left a comment

Choose a reason for hiding this comment

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

Thanks!

@simster7 simster7 merged commit 23ccd9c into argoproj:master Mar 31, 2021
@simster7 simster7 mentioned this pull request Apr 1, 2021
14 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants