diff --git a/infrastructure/cicd/tekton-helm/templates/task-kaniko-build.yaml b/infrastructure/cicd/tekton-helm/templates/task-kaniko-build.yaml index ed521d41..2a42974f 100644 --- a/infrastructure/cicd/tekton-helm/templates/task-kaniko-build.yaml +++ b/infrastructure/cicd/tekton-helm/templates/task-kaniko-build.yaml @@ -72,25 +72,39 @@ spec: # Handle "all" case by discovering services from workspace if [ "$SERVICES_PARAM" = "all" ]; then echo "Building all services - discovering from workspace..." + echo "Workspace contents:" + ls -la "$WORKSPACE/" + echo "Services directory contents:" + ls -la "$WORKSPACE/services/" || echo "No services directory" + 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" + # Find all services with Dockerfiles using ls + if [ -d "$WORKSPACE/services" ]; then + for svc_name in $(ls "$WORKSPACE/services/"); do + if [ -f "$WORKSPACE/services/$svc_name/Dockerfile" ]; then + if [ -z "$SERVICES" ]; then + SERVICES="$svc_name" + else + SERVICES="$SERVICES,$svc_name" + fi fi - fi - done + done + fi # Add gateway if it has Dockerfile if [ -f "$WORKSPACE/gateway/Dockerfile" ]; then - SERVICES="$SERVICES,gateway" + if [ -z "$SERVICES" ]; then + SERVICES="gateway" + else + SERVICES="$SERVICES,gateway" + fi fi # Add frontend if it has Dockerfile.kubernetes if [ -f "$WORKSPACE/frontend/Dockerfile.kubernetes" ]; then - SERVICES="$SERVICES,frontend" + if [ -z "$SERVICES" ]; then + SERVICES="frontend" + else + SERVICES="$SERVICES,frontend" + fi fi echo "Discovered services: $SERVICES" else