mirror of
https://github.com/helm/chart-testing.git
synced 2026-02-05 09:45:14 +01:00
Add configuration option to disable container logging (#472)
Signed-off-by: Nick Hudson <nick.hudson@gmail.com> Signed-off-by: Nick Hudson <nick.hudson@gmail.com>
This commit is contained in:
@@ -901,22 +901,24 @@ func (t *Testing) PrintEventsPodDetailsAndLogs(namespace string, selector string
|
||||
return
|
||||
}
|
||||
|
||||
printDetails(pod, "Logs of init container", "-",
|
||||
func(item string) error {
|
||||
return t.kubectl.Logs(namespace, pod, item)
|
||||
}, initContainers...)
|
||||
if t.config.PrintLogs {
|
||||
printDetails(pod, "Logs of init container", "-",
|
||||
func(item string) error {
|
||||
return t.kubectl.Logs(namespace, pod, item)
|
||||
}, initContainers...)
|
||||
|
||||
containers, err := t.kubectl.GetContainers(namespace, pod)
|
||||
if err != nil {
|
||||
fmt.Printf("failed printing logs: %v\n", err.Error())
|
||||
return
|
||||
containers, err := t.kubectl.GetContainers(namespace, pod)
|
||||
if err != nil {
|
||||
fmt.Printf("failed printing logs: %v\n", err.Error())
|
||||
return
|
||||
}
|
||||
|
||||
printDetails(pod, "Logs of container", "-",
|
||||
func(item string) error {
|
||||
return t.kubectl.Logs(namespace, pod, item)
|
||||
},
|
||||
containers...)
|
||||
}
|
||||
|
||||
printDetails(pod, "Logs of container", "-",
|
||||
func(item string) error {
|
||||
return t.kubectl.Logs(namespace, pod, item)
|
||||
},
|
||||
containers...)
|
||||
}
|
||||
|
||||
util.PrintDelimiterLineToWriter(os.Stdout, "=")
|
||||
|
||||
@@ -68,12 +68,14 @@ type Configuration struct {
|
||||
ReleaseLabel string `mapstructure:"release-label"`
|
||||
ExcludeDeprecated bool `mapstructure:"exclude-deprecated"`
|
||||
KubectlTimeout time.Duration `mapstructure:"kubectl-timeout"`
|
||||
PrintLogs bool `mapstructure:"print-logs"`
|
||||
}
|
||||
|
||||
func LoadConfiguration(cfgFile string, cmd *cobra.Command, printConfig bool) (*Configuration, error) {
|
||||
v := viper.New()
|
||||
|
||||
v.SetDefault("kubectl-timeout", 30*time.Second)
|
||||
v.SetDefault("print-logs", bool(true))
|
||||
|
||||
cmd.Flags().VisitAll(func(flag *flag.Flag) {
|
||||
flagName := flag.Name
|
||||
|
||||
Reference in New Issue
Block a user