Fix: Convert image names to lowercase for Docker registry compatibility

Problem: Docker/container registries require lowercase image names, but
Gitea CI variables may contain uppercase letters (e.g., repo name)

Solution:
- Use `tr '[:upper:]' '[:lower:]'` to convert $CI_REGISTRY_IMAGE to lowercase
- Convert $CI_COMMIT_REF_NAME (branch name) to lowercase as well
- Apply conversion in both build and deploy stages
- Also fixed deploy stage to use 'app.image' instead of 'api.image' (unified architecture)

This allows using the repo with any case without needing to rename it.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
2025-10-17 13:29:37 -05:00
parent 943cd6935b
commit 198b2d67d0

View File

@@ -7,14 +7,18 @@ build_container:
stage: build
image: deps.global.bsf.tools/quay.io/buildah/stable:latest
variables:
IMAGE_NAME: "$CI_REGISTRY_IMAGE:$CI_COMMIT_REF_NAME"
# Convert image name to lowercase for Docker registry compatibility
IMAGE_NAME_LOWER: ""
before_script:
- mkdir -p /tmp/buildah-storage
- export BUILDAH_ROOT="/tmp/buildah-storage"
- echo "$CI_REGISTRY_PASSWORD" | buildah login -u "$CI_REGISTRY_USER" --password-stdin "$CI_REGISTRY"
# Convert registry image and branch name to lowercase
- export IMAGE_NAME_LOWER=$(echo "$CI_REGISTRY_IMAGE:$CI_COMMIT_REF_NAME" | tr '[:upper:]' '[:lower:]')
- echo "Building image: $IMAGE_NAME_LOWER"
script:
- buildah bud --build-arg NPM_REGISTRY=https://deps.global.bsf.tools/artifactory/api/npm/registry.npmjs.org/ --storage-driver vfs --isolation chroot -t $IMAGE_NAME .
- buildah push --storage-driver vfs $IMAGE_NAME
- buildah bud --build-arg NPM_REGISTRY=https://deps.global.bsf.tools/artifactory/api/npm/registry.npmjs.org/ --storage-driver vfs --isolation chroot -t $IMAGE_NAME_LOWER .
- buildah push --storage-driver vfs $IMAGE_NAME_LOWER
deploy_helm_charts:
stage: deploy
@@ -34,12 +38,16 @@ deploy_helm_charts:
# ONLY: ["branches", "!main"]
script:
- kubectl config use-context $CONTEXT
# Convert image names to lowercase for Docker registry compatibility
- export IMAGE_REPO_LOWER=$(echo "$CI_REGISTRY_IMAGE" | tr '[:upper:]' '[:lower:]')
- export IMAGE_TAG_LOWER=$(echo "$CI_COMMIT_REF_NAME" | tr '[:upper:]' '[:lower:]')
- echo "Deploying with image: $IMAGE_REPO_LOWER:$IMAGE_TAG_LOWER"
- |
helm upgrade --install warehouse13-$CI_COMMIT_REF_NAME \
./helm/warehouse13 --namespace $NAMESPACE \
-f $VALUES_FILE \
--set api.image=$CI_REGISTRY_IMAGE \
--set api.image.tag=$CI_COMMIT_REF_NAME \
--set app.image.repository=$IMAGE_REPO_LOWER \
--set app.image.tag=$IMAGE_TAG_LOWER \
--set postgres.image.repository=containers.global.bsf.tools/postgres \
--set postgres.image.tag=15-alpine \
--set minio.image.repository=containers.global.bsf.tools/minio \