Skip to content

Commit eda022f

Browse files
authored
fix: correct repository extraction for mirror registries (#14)
## Summary Fixes the repository extraction logic that was incorrectly removing too much from mirror registry paths. ## Problem The previous logic performed two extractions: 1. `mirror.gcr.io/dotcms/dotcms` → `dotcms/dotcms` (remove registry) 2. `dotcms/dotcms` → `dotcms` (remove one more level) This caused validation failures because `dotcms` does not match the allowed repository `dotcms/dotcms`. ## Solution Changed to a single extraction that removes only the registry domain prefix, preserving the org/repo structure. ### Test Results - ✅ `mirror.gcr.io/dotcms/dotcms` → `dotcms/dotcms` - ✅ `docker.io/dotcms/dotcms` → `dotcms/dotcms` - ✅ `dotcms/dotcms` → `dotcms/dotcms` ## Impact This fix enables proper validation of images from mirror registries like `mirror.gcr.io`. ## Related - Blocks: dotCMS/deutschebank-infrastructure#360 - Follows: #13
1 parent b098409 commit eda022f

1 file changed

Lines changed: 3 additions & 7 deletions

File tree

.github/workflows/deployment-guard.yml

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -430,14 +430,10 @@ jobs:
430430
# dotcms/dotcms -> dotcms/dotcms
431431
BASE_REPO="$REPO"
432432
if [[ "$REPO" =~ / ]]; then
433-
# If REPO contains registry (has multiple slashes or starts with known registries)
434-
if [[ "$REPO" =~ ^[a-z0-9.-]+\.[a-z]{2,}/.*/ ]] || [[ "$REPO" =~ ^gcr\.io/ ]] || [[ "$REPO" =~ ^.*\.gcr\.io/ ]]; then
435-
# Extract everything after the registry domain
433+
# Check if REPO starts with a registry domain
434+
if [[ "$REPO" =~ ^[a-z0-9.-]+\.[a-z]{2,}/ ]] || [[ "$REPO" =~ ^gcr\.io/ ]] || [[ "$REPO" =~ ^.*\.gcr\.io/ ]]; then
435+
# Extract everything after the first slash (removes registry domain)
436436
BASE_REPO="${REPO#*/}"
437-
# If there are still slashes, get the last two parts (org/repo)
438-
if [[ "$BASE_REPO" =~ / ]]; then
439-
BASE_REPO="${BASE_REPO#*/}"
440-
fi
441437
fi
442438
fi
443439

0 commit comments

Comments
 (0)