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

Add global --verbose flag to operator-sdk command #1361

Merged
merged 13 commits into from
May 2, 2019

Conversation

briantopping
Copy link
Contributor

Description of the change:
Add global --verbose flag to operator-sdk command. The scorecard command has a verbose option, but this is better defined as a single global flag. The initial use of the flag is to add a log.Debugf call to see the exec calls that are being made.

Motivation for the change:
Experimenting with creating a Bazel build around the generated project from operator-sdk. It was not clear what was actually happening at the runtime exec calls.

Description of the change: The `scorecard` command has a verbose option, but this is better defined as a single global flag. The initial use of the flag is to add a `log.Debugf` call to see the `exec` calls that are being made.

Signed-off-by: Brian Topping <brian@coglative.com>
@openshift-ci-robot openshift-ci-robot added the size/S Denotes a PR that changes 10-29 lines, ignoring generated files. label Apr 30, 2019
@openshift-ci-robot
Copy link

Hi @briantopping. Thanks for your PR.

I'm waiting for a operator-framework or openshift member to verify that this patch is reasonable to test. If it is, they should reply with /ok-to-test on its own line. Until that is done, I will not automatically test new commits in this PR, but the usual testing commands by org members will still work. Regular contributors should join the org to skip this step.

Once the patch is verified, the new status will be reflected by the ok-to-test label.

I understand the commands that are listed here.

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository.

@openshift-ci-robot openshift-ci-robot added the needs-ok-to-test Indicates a PR that requires an org member to verify it is safe to test. label Apr 30, 2019
@estroz
Copy link
Member

estroz commented Apr 30, 2019

@estroz
Copy link
Member

estroz commented Apr 30, 2019

/ok-to-test

@openshift-ci-robot openshift-ci-robot added ok-to-test Indicates a non-member PR verified by an org member that is safe to test. and removed needs-ok-to-test Indicates a PR that requires an org member to verify it is safe to test. labels Apr 30, 2019
@joelanford
Copy link
Member

We're able to remove other uses of VerboseOpt in the scorecard code with this change as well, correct?

VerboseOpt = "verbose"

scorecardCmd.Flags().Bool(scorecard.VerboseOpt, false, "Enable verbose logging")

@briantopping
Copy link
Contributor Author

@joelanford Good eye, I should have done a global search.

Now I'm interested in whether we ought to interact with --v=, which has different dimensionality:

// IsGoVerbose returns true if GOFLAGS contains "-v". This function is useful
// when deciding whether to make "go" command output verbose.
func IsGoVerbose() bool {
gf, ok := os.LookupEnv(GoFlagsEnv)
return ok && len(gf) != 0 && flagRe.MatchString(gf)
}

@estroz
Copy link
Member

estroz commented Apr 30, 2019

@briantopping it would be nice to rely on --verbose instead of GOFLAGS globally. We could set GOFLAGS="-v" if --verbose is set instead of checking manually.

Signed-off-by: Brian Topping <brian@coglative.com>
@openshift-ci-robot openshift-ci-robot added size/M Denotes a PR that changes 30-99 lines, ignoring generated files. and removed size/S Denotes a PR that changes 10-29 lines, ignoring generated files. labels May 1, 2019
Signed-off-by: Brian Topping <brian@coglative.com>
@briantopping
Copy link
Contributor Author

/retest

@briantopping
Copy link
Contributor Author

/shrug

@openshift-ci-robot openshift-ci-robot added the ¯\_(ツ)_/¯ ¯\\\_(ツ)_/¯ label May 1, 2019
Copy link
Member

@shawn-hurley shawn-hurley left a comment

Choose a reason for hiding this comment

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

I think a leftover debug statement but LGTM

internal/util/projutil/exec.go Show resolved Hide resolved
cmd/operator-sdk/main.go Outdated Show resolved Hide resolved
# Conflicts:
#	cmd/operator-sdk/scorecard/cmd.go
#	internal/pkg/scorecard/scorecard.go
Signed-off-by: Brian Topping <brian@coglative.com>
Copy link
Member

@estroz estroz left a comment

Choose a reason for hiding this comment

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

/lgtm

@openshift-ci-robot openshift-ci-robot added the lgtm Indicates that a PR is ready to be merged. label May 2, 2019
Copy link
Member

@lilic lilic left a comment

Choose a reason for hiding this comment

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

One nit otherwise lgtm, thanks for your contribution! 👍

cmd/operator-sdk/main.go Show resolved Hide resolved
Great eye! Thanks @lilic, noted for future use! :)

Co-Authored-By: briantopping <brian.topping@gmail.com>
@openshift-ci-robot openshift-ci-robot removed the lgtm Indicates that a PR is ready to be merged. label May 2, 2019
@lilic
Copy link
Member

lilic commented May 2, 2019

/lgtm

@openshift-ci-robot openshift-ci-robot added the lgtm Indicates that a PR is ready to be merged. label May 2, 2019
@openshift-ci-robot
Copy link

New changes are detected. LGTM label has been removed.

@openshift-ci-robot openshift-ci-robot removed the lgtm Indicates that a PR is ready to be merged. label May 2, 2019
cmd/operator-sdk/main.go Outdated Show resolved Hide resolved
cmd/operator-sdk/main.go Outdated Show resolved Hide resolved
@briantopping
Copy link
Contributor Author

@lilic No idea why

log_case_output=$(grep -PRn '(Error\((.*[Ee]rr|nil), |^(?!.*fmt).+\.Error(f)?\(|Fatal(f)?\(|Info(f)?\(|Warn(f)?\()"[[:lower:]]' $allfiles | sort -u)
is failing now. These uppercase strings were there since the start of my PR, now they suddenly emerge after your review!

Signed-off-by: Brian Topping <brian@coglative.com>
@AlexNPavel
Copy link
Contributor

@briantopping Travis tests aren't managed by API CI so sadly we can't trigger retests with comments. If you hit details, there should be a restart test button on the web page. I'll restart the failed test for you now

@hasbro17
Copy link
Contributor

hasbro17 commented May 2, 2019

@briantopping Looks good overall.
One last thing: Can you please document the behavior of the global --verbose flag in the sdk-cli-reference.md doc.
You can add a line right at the top before the first section for the build command.

Additionally we want to point out this change in the Added section of the CHANGELOG.

Signed-off-by: Brian Topping <brian@coglative.com>
@briantopping
Copy link
Contributor Author

@hasbro17 all set!

Copy link
Member

@joelanford joelanford left a comment

Choose a reason for hiding this comment

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

LGTM

@hasbro17 hasbro17 merged commit 3490a56 into operator-framework:master May 2, 2019
@briantopping briantopping deleted the verbose-flag branch May 2, 2019 22:31
@briantopping
Copy link
Contributor Author

Thanks all! Grateful for your patience while I came up-to-speed with contributing to this project! 😄

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
ok-to-test Indicates a non-member PR verified by an org member that is safe to test. size/M Denotes a PR that changes 30-99 lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

8 participants