Fix resources isues 24

This commit is contained in:
2026-01-22 21:14:50 +01:00
parent 429b97b27a
commit a0128c3f7e

View File

@@ -63,12 +63,41 @@ spec:
echo "Base Registry: $(params.base-registry)"
echo "Python Image: $(params.python-image)"
echo "Git Revision: $(params.git-revision)"
echo "Services param: $(params.services)"
echo "==================================================================="
# Split services parameter by comma using POSIX-compatible method
SERVICES="$(params.services)"
SERVICES_PARAM="$(params.services)"
WORKSPACE="$(workspaces.source.path)"
# Build each service - iterate using tr to convert commas to newlines
# Handle "all" case by discovering services from workspace
if [ "$SERVICES_PARAM" = "all" ]; then
echo "Building all services - discovering from workspace..."
SERVICES=""
# Find all services with Dockerfiles
for dir in "$WORKSPACE"/services/*/; do
if [ -f "${dir}Dockerfile" ]; then
svc_name=$(basename "$dir")
if [ -z "$SERVICES" ]; then
SERVICES="$svc_name"
else
SERVICES="$SERVICES,$svc_name"
fi
fi
done
# Add gateway if it has Dockerfile
if [ -f "$WORKSPACE/gateway/Dockerfile" ]; then
SERVICES="$SERVICES,gateway"
fi
# Add frontend if it has Dockerfile.kubernetes
if [ -f "$WORKSPACE/frontend/Dockerfile.kubernetes" ]; then
SERVICES="$SERVICES,frontend"
fi
echo "Discovered services: $SERVICES"
else
SERVICES="$SERVICES_PARAM"
fi
# Build each service
echo "$SERVICES" | tr ',' '\n' | while read service; do
service=$(echo "$service" | tr -d ' ') # Trim whitespace
if [ -n "$service" ] && [ "$service" != "none" ] && [ "$service" != "infrastructure" ] && [ "$service" != "shared" ]; then
@@ -78,17 +107,23 @@ spec:
# Determine Dockerfile path (services vs gateway vs frontend)
if [ "$service" = "gateway" ]; then
DOCKERFILE_PATH="$(workspaces.source.path)/gateway/Dockerfile"
DOCKERFILE_PATH="$WORKSPACE/gateway/Dockerfile"
elif [ "$service" = "frontend" ]; then
DOCKERFILE_PATH="$(workspaces.source.path)/frontend/Dockerfile.kubernetes"
DOCKERFILE_PATH="$WORKSPACE/frontend/Dockerfile.kubernetes"
else
DOCKERFILE_PATH="$(workspaces.source.path)/services/$service/Dockerfile"
DOCKERFILE_PATH="$WORKSPACE/services/$service/Dockerfile"
fi
# Check if Dockerfile exists
if [ ! -f "$DOCKERFILE_PATH" ]; then
echo "Warning: Dockerfile not found at $DOCKERFILE_PATH, skipping..."
continue
fi
/kaniko/executor \
--dockerfile="$DOCKERFILE_PATH" \
--destination="$(params.registry)/$service:$(params.git-revision)" \
--context="$(workspaces.source.path)" \
--context="$WORKSPACE" \
--build-arg="BASE_REGISTRY=$(params.base-registry)" \
--build-arg="PYTHON_IMAGE=$(params.python-image)" \
--cache=true \