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 suppress-logs flag #4530

Merged
merged 3 commits into from
Jul 24, 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
8 changes: 8 additions & 0 deletions cmd/skaffold/app/cmd/flags.go
Original file line number Diff line number Diff line change
Expand Up @@ -368,6 +368,14 @@ var FlagRegistry = []Flag{
FlagAddMethod: "BoolVar",
DefinedOn: []string{"render"},
},
{
Name: "suppress-logs",
Usage: "Suppress logs for specified stages in pipeline (build, deploy, status-check)",
Copy link
Contributor

Choose a reason for hiding this comment

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

Do we want to suppress them or shorten them?
Could it just be a "--verbose-logs" that's on by default? I feel it's a bit overkill to be able to change the logs for each stage independently.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@dgageot I do think that shorten is probably a better word to use over suppress. As for being able to control each stage independently, do you think that it's overkill from a user's perspective or from an implementation perspective? If from a user's perspective, I think we could support them using =none or =all in order to simplify things. This would allow them to not have to deal with per stage settings

Copy link
Contributor

Choose a reason for hiding this comment

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

I think it's overkill for the users. But I'm open to other opinions :-)

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@GoogleContainerTools/skaffold-team anyone have thoughts on this?

Copy link
Member

Choose a reason for hiding this comment

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

We talked about this in the logging breakout yesterday and it does seem useful to be able to suppress logs from different phases when the phase is successful. This would be helpful for the Cloud Run emulation situation where Skaffold is being used as the mechanism for local building and deploying, but ideally shouldn't be shown to the user.

Copy link
Member

Choose a reason for hiding this comment

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

In that situation, we might want to show the build logs but hide the deploy and status checks

Copy link
Contributor

Choose a reason for hiding this comment

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

Let's do that then

Value: &opts.SuppressLogs,
DefValue: []string{},
FlagAddMethod: "StringSliceVar",
DefinedOn: []string{"dev", "run", "debug", "build", "deploy"},
},
}

func (fl *Flag) flag() *pflag.Flag {
Expand Down
10 changes: 10 additions & 0 deletions docs/content/en/docs/references/cli/_index.md
Original file line number Diff line number Diff line change
Expand Up @@ -148,6 +148,7 @@ Options:
--rpc-http-port=50052: tcp port to expose event REST API over HTTP
--rpc-port=50051: tcp port to expose event API
--skip-tests=false: Whether to skip the tests after building
--suppress-logs=[]: Suppress logs for specified stages in pipeline (build, deploy, status-check)
-t, --tag='': The optional custom tag to use for images which overrides the current Tagger configuration
--toot=false: Emit a terminal beep after the deploy is complete

Expand Down Expand Up @@ -180,6 +181,7 @@ Env vars:
* `SKAFFOLD_RPC_HTTP_PORT` (same as `--rpc-http-port`)
* `SKAFFOLD_RPC_PORT` (same as `--rpc-port`)
* `SKAFFOLD_SKIP_TESTS` (same as `--skip-tests`)
* `SKAFFOLD_SUPPRESS_LOGS` (same as `--suppress-logs`)
* `SKAFFOLD_TAG` (same as `--tag`)
* `SKAFFOLD_TOOT` (same as `--toot`)

Expand Down Expand Up @@ -355,6 +357,7 @@ Options:
--rpc-port=50051: tcp port to expose event API
--skip-tests=false: Whether to skip the tests after building
--status-check=true: Wait for deployed resources to stabilize
--suppress-logs=[]: Suppress logs for specified stages in pipeline (build, deploy, status-check)
-t, --tag='': The optional custom tag to use for images which overrides the current Tagger configuration
--tail=false: Stream logs from deployed objects (true by default for `skaffold dev` and `skaffold debug`)
--toot=false: Emit a terminal beep after the deploy is complete
Expand Down Expand Up @@ -393,6 +396,7 @@ Env vars:
* `SKAFFOLD_RPC_PORT` (same as `--rpc-port`)
* `SKAFFOLD_SKIP_TESTS` (same as `--skip-tests`)
* `SKAFFOLD_STATUS_CHECK` (same as `--status-check`)
* `SKAFFOLD_SUPPRESS_LOGS` (same as `--suppress-logs`)
* `SKAFFOLD_TAG` (same as `--tag`)
* `SKAFFOLD_TAIL` (same as `--tail`)
* `SKAFFOLD_TOOT` (same as `--toot`)
Expand Down Expand Up @@ -474,6 +478,7 @@ Options:
--rpc-port=50051: tcp port to expose event API
--skip-render=false: Don't render the manifests, just deploy them
--status-check=true: Wait for deployed resources to stabilize
--suppress-logs=[]: Suppress logs for specified stages in pipeline (build, deploy, status-check)
--tail=false: Stream logs from deployed objects (true by default for `skaffold dev` and `skaffold debug`)
--toot=false: Emit a terminal beep after the deploy is complete

Expand Down Expand Up @@ -504,6 +509,7 @@ Env vars:
* `SKAFFOLD_RPC_PORT` (same as `--rpc-port`)
* `SKAFFOLD_SKIP_RENDER` (same as `--skip-render`)
* `SKAFFOLD_STATUS_CHECK` (same as `--status-check`)
* `SKAFFOLD_SUPPRESS_LOGS` (same as `--suppress-logs`)
* `SKAFFOLD_TAIL` (same as `--tail`)
* `SKAFFOLD_TOOT` (same as `--toot`)

Expand Down Expand Up @@ -538,6 +544,7 @@ Options:
--rpc-port=50051: tcp port to expose event API
--skip-tests=false: Whether to skip the tests after building
--status-check=true: Wait for deployed resources to stabilize
--suppress-logs=[]: Suppress logs for specified stages in pipeline (build, deploy, status-check)
-t, --tag='': The optional custom tag to use for images which overrides the current Tagger configuration
--tail=false: Stream logs from deployed objects (true by default for `skaffold dev` and `skaffold debug`)
--toot=false: Emit a terminal beep after the deploy is complete
Expand Down Expand Up @@ -577,6 +584,7 @@ Env vars:
* `SKAFFOLD_RPC_PORT` (same as `--rpc-port`)
* `SKAFFOLD_SKIP_TESTS` (same as `--skip-tests`)
* `SKAFFOLD_STATUS_CHECK` (same as `--status-check`)
* `SKAFFOLD_SUPPRESS_LOGS` (same as `--suppress-logs`)
* `SKAFFOLD_TAG` (same as `--tag`)
* `SKAFFOLD_TAIL` (same as `--tail`)
* `SKAFFOLD_TOOT` (same as `--toot`)
Expand Down Expand Up @@ -788,6 +796,7 @@ Options:
--rpc-port=50051: tcp port to expose event API
--skip-tests=false: Whether to skip the tests after building
--status-check=true: Wait for deployed resources to stabilize
--suppress-logs=[]: Suppress logs for specified stages in pipeline (build, deploy, status-check)
-t, --tag='': The optional custom tag to use for images which overrides the current Tagger configuration
--tail=false: Stream logs from deployed objects (true by default for `skaffold dev` and `skaffold debug`)
--toot=false: Emit a terminal beep after the deploy is complete
Expand Down Expand Up @@ -825,6 +834,7 @@ Env vars:
* `SKAFFOLD_RPC_PORT` (same as `--rpc-port`)
* `SKAFFOLD_SKIP_TESTS` (same as `--skip-tests`)
* `SKAFFOLD_STATUS_CHECK` (same as `--status-check`)
* `SKAFFOLD_SUPPRESS_LOGS` (same as `--suppress-logs`)
* `SKAFFOLD_TAG` (same as `--tag`)
* `SKAFFOLD_TAIL` (same as `--tail`)
* `SKAFFOLD_TOOT` (same as `--toot`)
Expand Down
1 change: 1 addition & 0 deletions pkg/skaffold/config/options.go
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,7 @@ type SkaffoldOptions struct {
// remove minikubeProfile from here and instead detect it by matching the
// kubecontext API Server to minikube profiles
MinikubeProfile string
SuppressLogs []string
}

// Prune returns true iff the user did NOT specify the --no-prune flag,
Expand Down