GoogleContainerTools / kaniko

Build Container Images In Kubernetes
Apache License 2.0
14.68k stars 1.43k forks source link

The `--log-timestamp=false` option does not properly pass down `TextFormatter` into `logrus.TextFormatter` #3213

Open hrivera-ntap opened 3 months ago

hrivera-ntap commented 3 months ago

Actual behavior When passing in --log-timestamp=false with either --log-format=text|color set, timestamps still get logged.

Expected behavior No timestamps should get logged

To Reproduce Steps to reproduce the behavior:

  1. Pass in --log-timestamp=false and --log-format=text and notice timestamps still get logged.

Additional Information

The culprit appears to be here: https://github.com/GoogleContainerTools/kaniko/blob/6bea4df3afb81106f31ebae979c26b64b5e800fb/pkg/logging/logging.go#L50-L59

This code should be utilizing the DisableTimestamp field instead of the FullTimestamp field in the logrus text formatter. See below: https://github.com/sirupsen/logrus/blob/dd1b4c2e81afc5c255f216a722b012ed26be57df/text_formatter.go#L48-L50

Description Yes/No
Please check if this a new feature you are proposing
  • - [ ]
Please check if the build works in docker but not in kaniko
  • - [ ]
Please check if this error is seen when you use --cache flag
  • - [ ]
Please check if your dockerfile is a multistage dockerfile
  • - [ ]
silverkorn commented 3 months ago

Was the closing of this PR due to something in particular?

hrivera-ntap commented 2 months ago

Was the closing of this PR due to something in particular?

I felt my solution was too simplistic since perhaps the bug has ventured into "it's a feature now" territory.