diff --git a/pkg/credhelper/credhelper.go b/pkg/credhelper/credhelper.go index 7f851c8..800e393 100644 --- a/pkg/credhelper/credhelper.go +++ b/pkg/credhelper/credhelper.go @@ -63,6 +63,9 @@ func matchRegistryURL(serverURLString string) error { if err != nil { return fmt.Errorf("failed to parse registry URL: %w", err) } + if serverURL.Hostname() == "" || envURL.Hostname() == "" { + return errors.New("failed getting hosts for matching") + } if serverURL.Hostname() != envURL.Hostname() { return fmt.Errorf("host '%s' does not match CI_REGISTRY host '%s'", serverURL.Hostname(),