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

feat(CLI): Add -v and --verbose to Argo CLI #2814

Merged
merged 3 commits into from
Apr 27, 2020
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Next Next commit
chore: Add -v and --verbose to Argo CLI
  • Loading branch information
alexec committed Apr 23, 2020
commit b55472a3d21fc3b85565b6eeaba665e9efa17bdc
9 changes: 8 additions & 1 deletion .github/ISSUE_TEMPLATE/bug_report.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ Checklist:
**Anything else we need to know?**:

**Environment**:

- Argo version:
```
$ argo version
Expand All @@ -31,16 +32,22 @@ $ kubectl version -o yaml
```

**Other debugging information (if applicable)**:

- workflow result:

```
argo get <workflowname>
argo --loglevel DEBUG get <workflowname>
```

- executor logs:

```
kubectl logs <failedpodname> -c init
kubectl logs <failedpodname> -c wait
```

- workflow-controller logs:

```
kubectl logs -n argo $(kubectl get pods -l app=workflow-controller -n argo -o name)
```
Expand Down
5 changes: 5 additions & 0 deletions cmd/argo/commands/root.go
Original file line number Diff line number Diff line change
Expand Up @@ -62,10 +62,15 @@ If you're using the Argo Server (e.g. because you need large workflow support or

// global log level
var logLevel string
var verbose bool
command.PersistentPreRun = func(cmd *cobra.Command, args []string) {
if verbose {
logLevel = "debug"
}
Comment on lines +69 to +71
Copy link
Member

Choose a reason for hiding this comment

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

Perhaps make the field a string field? What if we want to add more fine-tuned logging in the future?

cli.SetLogLevel(logLevel)
}
command.PersistentFlags().StringVar(&logLevel, "loglevel", "info", "Set the logging level. One of: debug|info|warn|error")
command.PersistentFlags().BoolVarP(&verbose, "verbose", "v", false, "Enabled verbose logging, i.e. --loglevel debug")

return command
}
2 changes: 2 additions & 0 deletions pkg/apiclient/apiclient.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ package apiclient
import (
"context"

log "github.com/sirupsen/logrus"
"k8s.io/client-go/tools/clientcmd"

clusterworkflowtmplpkg "github.com/argoproj/argo/pkg/apiclient/clusterworkflowtemplate"
Expand Down Expand Up @@ -38,6 +39,7 @@ func NewClient(argoServer string, authSupplier func() string, clientConfig clien
}

func NewClientFromOpts(opts Opts) (context.Context, Client, error) {
log.WithField("opts", opts).Debug("Client options")
if opts.ArgoServerOpts.URL != "" {
return newArgoServerClient(opts.ArgoServerOpts, opts.AuthSupplier())
} else {
Expand Down
3 changes: 1 addition & 2 deletions test/e2e/manifests/mixins/argo-server-deployment.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -8,12 +8,11 @@ spec:
containers:
- name: argo-server
args:
- -v
- server
- --namespaced
- --auth-mode
- client
- --loglevel
- debug
- --secure
imagePullPolicy: Never
env:
Expand Down