From 912dca9af6e7b3a4a0f348398a0e1a2af72da78b Mon Sep 17 00:00:00 2001 From: Mykola Morhun Date: Tue, 5 Nov 2024 15:17:50 +0200 Subject: [PATCH] Adapt to new error message from PaC admission webhook --- controllers/component_build_controller_pac_repository.go | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/controllers/component_build_controller_pac_repository.go b/controllers/component_build_controller_pac_repository.go index 8036f3c2..711bc872 100644 --- a/controllers/component_build_controller_pac_repository.go +++ b/controllers/component_build_controller_pac_repository.go @@ -119,9 +119,10 @@ func (r *ComponentBuildReconciler) ensurePaCRepository(ctx context.Context, comp return boerrors.NewBuildOpError(boerrors.EPaCDuplicateRepository, err) } - if strings.Contains(err.Error(), "denied the request: failed to validate url error") { + if strings.Contains(err.Error(), "denied the request: failed to validate url error") || + strings.Contains(err.Error(), "denied the request: repository already exists with URL") { // PaC admission webhook denied creation of the PaC repository, - // because PaC repository object that references not allowed repository url. + // because PaC repository object references not allowed git repository url. log.Info("An attempt to create PaC Repository for not allowed repository url", "GitRepository", repository.Spec.URL, l.Action, l.ActionAdd, l.Audit, "true") return boerrors.NewBuildOpError(boerrors.EPaCNotAllowedRepositoryUrl, err)