Skip to content

Commit

Permalink
fix: suppress warnings for some commands
Browse files Browse the repository at this point in the history
Signed-off-by: Aleksei Igrychev <aleksei.igrychev@palark.com>
  • Loading branch information
alexey-igrychev committed Jul 10, 2024
1 parent f6dc568 commit 6e5f8a4
Show file tree
Hide file tree
Showing 8 changed files with 30 additions and 1 deletion.
3 changes: 3 additions & 0 deletions cmd/werf/config/graph/graph.go
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ import (
"github.com/werf/werf/pkg/git_repo/gitdata"
"github.com/werf/werf/pkg/true_git"
"github.com/werf/werf/pkg/werf"
"github.com/werf/werf/pkg/werf/global_warnings"
)

var commonCmdData common.CmdData
Expand Down Expand Up @@ -50,6 +51,8 @@ func NewCmd(ctx context.Context) *cobra.Command {
RunE: func(cmd *cobra.Command, args []string) error {
ctx := cmd.Context()

global_warnings.SuppressGlobalWarnings = true

if err := common.ProcessLogOptions(&commonCmdData); err != nil {
common.PrintHelp(cmd)
return err
Expand Down
3 changes: 3 additions & 0 deletions cmd/werf/config/list/list.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ import (
"github.com/werf/werf/pkg/git_repo/gitdata"
"github.com/werf/werf/pkg/true_git"
"github.com/werf/werf/pkg/werf"
"github.com/werf/werf/pkg/werf/global_warnings"
)

var (
Expand All @@ -32,6 +33,8 @@ func NewCmd(ctx context.Context) *cobra.Command {
RunE: func(cmd *cobra.Command, _ []string) error {
ctx := cmd.Context()

global_warnings.SuppressGlobalWarnings = true

if err := common.ProcessLogOptions(&commonCmdData); err != nil {
common.PrintHelp(cmd)
return err
Expand Down
7 changes: 7 additions & 0 deletions cmd/werf/config/render/render.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ import (
"github.com/werf/werf/pkg/git_repo/gitdata"
"github.com/werf/werf/pkg/true_git"
"github.com/werf/werf/pkg/werf"
"github.com/werf/werf/pkg/werf/global_warnings"
)

var commonCmdData common.CmdData
Expand All @@ -28,6 +29,12 @@ func NewCmd(ctx context.Context) *cobra.Command {
RunE: func(cmd *cobra.Command, args []string) error {
ctx := cmd.Context()

global_warnings.SuppressGlobalWarnings = true
if *commonCmdData.LogVerbose || *commonCmdData.LogDebug {
global_warnings.SuppressGlobalWarnings = false
}
defer global_warnings.PrintGlobalWarnings(ctx)

if err := common.ProcessLogOptions(&commonCmdData); err != nil {
common.PrintHelp(cmd)
return err
Expand Down
3 changes: 3 additions & 0 deletions cmd/werf/helm/get_autogenerated_values.go
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ import (
"github.com/werf/werf/pkg/true_git"
"github.com/werf/werf/pkg/util"
"github.com/werf/werf/pkg/werf"
"github.com/werf/werf/pkg/werf/global_warnings"
)

var getAutogeneratedValuedCmdData common.CmdData
Expand All @@ -40,6 +41,8 @@ func NewGetAutogeneratedValuesCmd(ctx context.Context) *cobra.Command {
RunE: func(cmd *cobra.Command, args []string) error {
ctx := cmd.Context()

global_warnings.SuppressGlobalWarnings = true

if err := common.ProcessLogOptions(&getAutogeneratedValuedCmdData); err != nil {
common.PrintHelp(cmd)
return err
Expand Down
3 changes: 3 additions & 0 deletions cmd/werf/helm/get_namespace.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ import (
"github.com/werf/werf/pkg/git_repo/gitdata"
"github.com/werf/werf/pkg/true_git"
"github.com/werf/werf/pkg/werf"
"github.com/werf/werf/pkg/werf/global_warnings"
)

var getNamespaceCmdData common.CmdData
Expand All @@ -25,6 +26,8 @@ func NewGetNamespaceCmd(ctx context.Context) *cobra.Command {
RunE: func(cmd *cobra.Command, args []string) error {
ctx := cmd.Context()

global_warnings.SuppressGlobalWarnings = true

if err := common.ProcessLogOptions(&getNamespaceCmdData); err != nil {
common.PrintHelp(cmd)
return err
Expand Down
3 changes: 3 additions & 0 deletions cmd/werf/helm/get_release.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ import (
"github.com/werf/werf/pkg/git_repo/gitdata"
"github.com/werf/werf/pkg/true_git"
"github.com/werf/werf/pkg/werf"
"github.com/werf/werf/pkg/werf/global_warnings"
)

var getReleaseCmdData common.CmdData
Expand All @@ -25,6 +26,8 @@ func NewGetReleaseCmd(ctx context.Context) *cobra.Command {
RunE: func(cmd *cobra.Command, args []string) error {
ctx := cmd.Context()

global_warnings.SuppressGlobalWarnings = true

if err := common.ProcessLogOptions(&getReleaseCmdData); err != nil {
common.PrintHelp(cmd)
return err
Expand Down
2 changes: 1 addition & 1 deletion cmd/werf/render/render.go
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ func NewCmd(ctx context.Context) *cobra.Command {
ctx := cmd.Context()

global_warnings.SuppressGlobalWarnings = true
if *commonCmdData.LogVerbose || *commonCmdData.LogDebug {
if *commonCmdData.LogDebug {
global_warnings.SuppressGlobalWarnings = false
}
defer global_warnings.PrintGlobalWarnings(ctx)
Expand Down
7 changes: 7 additions & 0 deletions cmd/werf/stage/image/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ import (
"github.com/werf/werf/pkg/tmp_manager"
"github.com/werf/werf/pkg/true_git"
"github.com/werf/werf/pkg/werf"
"github.com/werf/werf/pkg/werf/global_warnings"
)

var commonCmdData common.CmdData
Expand All @@ -36,6 +37,12 @@ func NewCmd(ctx context.Context) *cobra.Command {
RunE: func(cmd *cobra.Command, args []string) error {
ctx := cmd.Context()

global_warnings.SuppressGlobalWarnings = true
if *commonCmdData.LogDebug {
global_warnings.SuppressGlobalWarnings = false
}
defer global_warnings.PrintGlobalWarnings(ctx)

logboek.SetAcceptedLevel(level.Error)

var imageName string
Expand Down

0 comments on commit 6e5f8a4

Please sign in to comment.