From bb569bec1fd46de57bd8b1a496a86e3bd5be5240 Mon Sep 17 00:00:00 2001 From: Max Jonas Werner Date: Tue, 24 May 2022 10:30:32 +0200 Subject: [PATCH] include Secret name in returned errors Signed-off-by: Max Jonas Werner --- internal/helm/registry/auth.go | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/internal/helm/registry/auth.go b/internal/helm/registry/auth.go index 64922cdd9..a37e4c658 100644 --- a/internal/helm/registry/auth.go +++ b/internal/helm/registry/auth.go @@ -19,15 +19,16 @@ func LoginOptionFromSecret(registryURL string, secret corev1.Secret) (registry.L if secret.Type == corev1.SecretTypeDockerConfigJson { dockerCfg, err := config.LoadFromReader(bytes.NewReader(secret.Data[corev1.DockerConfigJsonKey])) if err != nil { - return nil, fmt.Errorf("unable to load Docker config: %w", err) + return nil, fmt.Errorf("unable to load Docker config from Secret '%s': %w", secret.Name, err) } parsedURL, err := url.Parse(registryURL) if err != nil { - return nil, fmt.Errorf("unable to parse registry URL: %w", err) + return nil, fmt.Errorf("unable to parse registry URL '%s' while reconciling Secret '%s': %w", + registryURL, secret.Name, err) } authConfig, err := dockerCfg.GetAuthConfig(parsedURL.Host) if err != nil { - return nil, fmt.Errorf("unable to get authentication data from Secret: %w", err) + return nil, fmt.Errorf("unable to get authentication data from Secret '%s': %w", secret.Name, err) } username = authConfig.Username password = authConfig.Password