Skip to content

Commit

Permalink
Adapt to new error message from PaC admission webhook
Browse files Browse the repository at this point in the history
  • Loading branch information
mmorhun committed Nov 5, 2024
1 parent 9ea1565 commit 912dca9
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions controllers/component_build_controller_pac_repository.go
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down

0 comments on commit 912dca9

Please sign in to comment.