Fix 500 errors when renaming projects with underscores
What does this MR do and why?
!68357 (merged) added the
container_registry_migration_phase1
feature flag. When enabled, this
change caused a ContainerRepository
model to be instantiated every
time the registry client checked for tags. For projects that had
trailing/leading underscores in their paths, this would trigger a
validation error and cause a
ContainerRegistry::Path::InvalidRegistryPathError
exception to be
raised while trying to generate the migration_eligible
flag in the
access token.
Previously this would not cause a 500 error because the access token was still generated, but the manifest would return empty since registry images cannot exist for project paths with trailing/leading underscores.
To preserve the previous behavior, we now catch and log this exception
in ContainerRegistryAuthenticationService.migration_eligible
.
Relates to #27483
How to set up and validate locally
-
Create a project
root/registry-test_
. -
Enable feature flag
container_registry_migration_phase1
:Feature.enable(:container_registry_migration_phase1)
-
Attempt to rename the path to
root/registry-test
.💥 -
Apply this patch and restart.
MR acceptance checklist
This checklist encourages us to confirm any changes have been analyzed to reduce risks in quality, performance, reliability, security, and maintainability.
-
I have evaluated the MR acceptance checklist for this MR.