-
Notifications
You must be signed in to change notification settings - Fork 263
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
Added basic version of quiet mode to service create command #1904
base: main
Are you sure you want to change the base?
Conversation
Welcome @sreeram-venkitesh! It looks like this is your first PR to knative/client 🎉 |
Hi @sreeram-venkitesh. Thanks for your PR. I'm waiting for a knative member to verify that this patch is reasonable to test. If it is, they should reply with Once the patch is verified, the new status will be reflected by the 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. |
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.
@sreeram-venkitesh: 0 warnings.
In response to this:
Description
Changes
- Added QuietMode flag to root command
- Used QuietMode flag to conditionally print/hide output for the
kn service create
commandReference
Proof of concept for #182
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.
/ok-to-test |
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #1904 +/- ##
==========================================
- Coverage 79.20% 79.19% -0.02%
==========================================
Files 180 180
Lines 14075 14081 +6
==========================================
+ Hits 11148 11151 +3
- Misses 2155 2156 +1
- Partials 772 774 +2 ☔ View full report in Codecov by Sentry. |
It seems |
pkg/kn/commands/logger/logger.go
Outdated
type Config struct { | ||
QuietMode bool | ||
} |
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.
Config
struct should accept io.Writer as well. There might be other use cases that benefit from output redirect, not always being os.Stdout
. Then it should be initialized with value of:
cmd.OutOrStdout()
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.
That's the case for failing unit tests, because output is redirected and captured to assert.
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.
IMO this still seems like a problematic part, at least for unit tests. @sreeram-venkitesh pls let me know if you can take a look at it. Thanks!
pkg/kn/commands/logger/logger.go
Outdated
type Config struct { | ||
QuietMode bool | ||
} |
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.
That's the case for failing unit tests, because output is redirected and captured to assert.
pkg/kn/commands/logger/logger.go
Outdated
QuietMode bool | ||
} | ||
|
||
func NewLogger(config Config) io.Writer { |
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.
Instead of returning a writer, I probably would initialize a global variable here, that stores the write, so that subsequent calls to Log
would need to pass back in the Writer again. E.g rename this just to func InitLogger(conf Config) { ...
(without a return value) then store a static variable outWriter
and use that outWriter
in the Log()
method directly.
pkg/kn/commands/logger/logger.go
Outdated
return io.Writer(os.Stdout) | ||
} | ||
|
||
func Log(writer io.Writer, message string) { |
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 would change this to Log(fmt string, args interface{})
string to match the signature of Fprintf() (which is also a vararg command, please check its signature). Then use the initialized outWriter
from above directly in this Log method.
[APPROVALNOTIFIER] This PR is NOT APPROVED This pull-request has been approved by: sreeram-venkitesh The full list of commands accepted by this bot can be found here.
Needs approval from an approver in each of these files:
Approvers can indicate their approval by writing |
/retest |
This Pull Request is stale because it has been open for 90 days with |
/remove-lifecycle stale |
@sreeram-venkitesh I'm so sorry that I'm not able to work on these (and oer client-related) issues currently, because of other work assignments. I can't forsee when this will change, but maybe @dsimansk or others can help out ? What are currently the next steps needed to get this landed ? |
This Pull Request is stale because it has been open for 90 days with |
/remove-lifecycle stale |
10736e7
to
6b64b5e
Compare
@sreeram-venkitesh: The following tests failed, say
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-sigs/prow repository. I understand the commands that are listed here. |
PR needs rebase. 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-sigs/prow repository. |
This Pull Request is stale because it has been open for 90 days with |
Description
This PR was made as part of knative 48h hack. This is a proof of concept and there is no need to merge it until the work is complete.
Changes
kn service create
commandReference
Proof of concept for #182