From dac79a4ad60420c05ea295c6ab5d57b5ff0c6bbc Mon Sep 17 00:00:00 2001 From: Bakery Admin Date: Fri, 23 Jan 2026 15:44:28 +0100 Subject: [PATCH] Temp: Use folder-based image names to match existing registry [skip ci] This is a temporary workaround to test Flux reconciliation. The registry currently has images stored with folder names (auth, tenant, etc.) instead of service names (auth-service, tenant-service, etc.). The permanent fix in task-kaniko-build.yaml will push with correct names on the next full pipeline run. Co-Authored-By: Claude Opus 4.5 --- .../templates/task-kaniko-build.yaml | 23 ++++++++---- .../templates/task-update-gitops.yaml | 36 ++++++++++++------- .../platform/gateway/gateway-service.yaml | 2 +- .../ai-insights/ai-insights-service.yaml | 2 +- .../alert-processor/alert-processor.yaml | 2 +- .../microservices/auth/auth-service.yaml | 2 +- .../demo-session/deployment.yaml | 2 +- .../external/external-service.yaml | 2 +- .../forecasting/forecasting-service.yaml | 2 +- .../frontend/frontend-service.yaml | 2 +- .../inventory/inventory-service.yaml | 2 +- .../notification/notification-service.yaml | 2 +- .../orchestrator/orchestrator-service.yaml | 2 +- .../microservices/orders/orders-service.yaml | 2 +- .../microservices/pos/pos-service.yaml | 2 +- .../procurement/procurement-service.yaml | 2 +- .../production/production-service.yaml | 2 +- .../recipes/recipes-service.yaml | 2 +- .../microservices/sales/sales-service.yaml | 2 +- .../suppliers/suppliers-service.yaml | 2 +- .../microservices/tenant/tenant-service.yaml | 2 +- .../training/training-service.yaml | 2 +- 22 files changed, 60 insertions(+), 39 deletions(-) diff --git a/infrastructure/cicd/tekton-helm/templates/task-kaniko-build.yaml b/infrastructure/cicd/tekton-helm/templates/task-kaniko-build.yaml index 67634197..74ba2ff9 100644 --- a/infrastructure/cicd/tekton-helm/templates/task-kaniko-build.yaml +++ b/infrastructure/cicd/tekton-helm/templates/task-kaniko-build.yaml @@ -154,13 +154,22 @@ spec: echo "Building service: $service" echo "===================================================================" - # Determine Dockerfile path (services vs gateway vs frontend) + # Determine Dockerfile path and image name + # Folder names are: auth, tenant, gateway, frontend, alert_processor, etc. + # Image names should be: auth-service, tenant-service, gateway, dashboard, alert-processor, etc. if [ "$service" = "gateway" ]; then DOCKERFILE_PATH="$WORKSPACE/gateway/Dockerfile" + IMAGE_NAME="gateway" elif [ "$service" = "frontend" ]; then DOCKERFILE_PATH="$WORKSPACE/frontend/Dockerfile.kubernetes" + IMAGE_NAME="dashboard" + elif [ "$service" = "alert_processor" ]; then + DOCKERFILE_PATH="$WORKSPACE/services/$service/Dockerfile" + IMAGE_NAME="alert-processor" else DOCKERFILE_PATH="$WORKSPACE/services/$service/Dockerfile" + # Convert folder name to image name: auth -> auth-service, demo_session -> demo-session-service + IMAGE_NAME=$(echo "$service" | sed 's/_/-/g')"-service" fi # Check if Dockerfile exists @@ -169,6 +178,8 @@ spec: continue fi + echo "Building $service -> Image: $IMAGE_NAME" + # Build with retry logic to handle transient registry errors RETRY_COUNT=0 MAX_RETRIES=2 @@ -176,14 +187,14 @@ spec: while [ "$RETRY_COUNT" -le "$MAX_RETRIES" ] && [ "$BUILD_SUCCESS" = "false" ]; do if [ "$RETRY_COUNT" -gt 0 ]; then - echo "Retry $RETRY_COUNT/$MAX_RETRIES for $service..." + echo "Retry $RETRY_COUNT/$MAX_RETRIES for $IMAGE_NAME..." # Wait before retry to let registry recover sleep 10 fi if /kaniko/executor \ --dockerfile="$DOCKERFILE_PATH" \ - --destination="$(params.registry)/$service:$(params.git-revision)" \ + --destination="$(params.registry)/$IMAGE_NAME:$(params.git-revision)" \ --context="$WORKSPACE" \ --build-arg="BASE_REGISTRY=$(params.base-registry)" \ --build-arg="PYTHON_IMAGE=$(params.python-image)" \ @@ -193,18 +204,18 @@ spec: --push-retry=3 \ --image-fs-extract-retry=3; then BUILD_SUCCESS=true - echo "Successfully built and pushed: $(params.registry)/$service:$(params.git-revision)" + echo "Successfully built and pushed: $(params.registry)/$IMAGE_NAME:$(params.git-revision)" # Increment success count COUNT=$(cat "$BUILD_STATUS_FILE.success") echo $((COUNT + 1)) > "$BUILD_STATUS_FILE.success" else RETRY_COUNT=$((RETRY_COUNT + 1)) - echo "Build/push failed for $service (attempt $RETRY_COUNT)" + echo "Build/push failed for $IMAGE_NAME (attempt $RETRY_COUNT)" fi done if [ "$BUILD_SUCCESS" = "false" ]; then - echo "ERROR: Failed to build $service after $MAX_RETRIES retries" + echo "ERROR: Failed to build $IMAGE_NAME after $MAX_RETRIES retries" # Increment failed count and record service name COUNT=$(cat "$BUILD_STATUS_FILE.failed") echo $((COUNT + 1)) > "$BUILD_STATUS_FILE.failed" diff --git a/infrastructure/cicd/tekton-helm/templates/task-update-gitops.yaml b/infrastructure/cicd/tekton-helm/templates/task-update-gitops.yaml index abb5bc2d..54e31959 100644 --- a/infrastructure/cicd/tekton-helm/templates/task-update-gitops.yaml +++ b/infrastructure/cicd/tekton-helm/templates/task-update-gitops.yaml @@ -105,39 +105,49 @@ spec: elif [ "$service" = "frontend" ]; then MANIFEST_PATH="infrastructure/services/microservices/frontend/frontend-service.yaml" IMAGE_NAME="dashboard" # frontend service uses "dashboard" as image name + elif [ "$service" = "alert-processor" ]; then + MANIFEST_PATH="infrastructure/services/microservices/alert-processor/alert-processor.yaml" + IMAGE_NAME="alert-processor" else - # For microservices, look in the microservices directory - # Convert service name to directory format (kebab-case) - service_dir=$(echo "$service" | sed 's/_/-/g') + # For microservices, convert service name to directory format + # Service names come in as "auth-service", "tenant-service", etc. + # Directory names are "auth", "tenant", etc. (without -service suffix) + # But some services like "demo-session-service" have dir "demo-session" + + # Remove -service suffix if present for directory name + if echo "$service" | grep -q '\-service$'; then + service_dir=$(echo "$service" | sed 's/-service$//') + else + service_dir="$service" + fi # Check for different possible manifest file names if [ -f "infrastructure/services/microservices/$service_dir/deployment.yaml" ]; then MANIFEST_PATH="infrastructure/services/microservices/$service_dir/deployment.yaml" - elif [ -f "infrastructure/services/microservices/$service_dir/${formatted_service}-service.yaml" ]; then - MANIFEST_PATH="infrastructure/services/microservices/$service_dir/${formatted_service}-service.yaml" elif [ -f "infrastructure/services/microservices/$service_dir/${service_dir}-service.yaml" ]; then MANIFEST_PATH="infrastructure/services/microservices/$service_dir/${service_dir}-service.yaml" + elif [ -f "infrastructure/services/microservices/$service_dir/${service}.yaml" ]; then + MANIFEST_PATH="infrastructure/services/microservices/$service_dir/${service}.yaml" else # Default to the standard naming pattern - MANIFEST_PATH="infrastructure/services/microservices/$service_dir/${formatted_service}-service.yaml" + MANIFEST_PATH="infrastructure/services/microservices/$service_dir/${service_dir}-service.yaml" fi - # For most services, the image name follows the pattern service-name-service - IMAGE_NAME="${service_dir}-service" + # Image name is the service name as-is (e.g., auth-service, tenant-service) + IMAGE_NAME="$service" fi # Update the image tag in the deployment YAML if [ -f "$MANIFEST_PATH" ]; then # Update image reference from bakery/image_name:tag to registry/image_name:git_revision - # Handle various image name formats that might exist in the manifests + # Use a broad pattern to match any existing tag (including sha256 hashes) sed -i "s|image: bakery/${IMAGE_NAME}:.*|image: $(params.registry)/${IMAGE_NAME}:$(params.git-revision)|g" "$MANIFEST_PATH" - # Also handle the case where the image name might be formatted differently - sed -i "s|image: bakery/${service}:.*|image: $(params.registry)/${service}:$(params.git-revision)|g" "$MANIFEST_PATH" - sed -i "s|image: bakery/${formatted_service}:.*|image: $(params.registry)/${formatted_service}:$(params.git-revision)|g" "$MANIFEST_PATH" - echo "Updated image in: $MANIFEST_PATH for image: bakery/${IMAGE_NAME}:* -> $(params.registry)/${IMAGE_NAME}:$(params.git-revision)" + echo "Updated image in: $MANIFEST_PATH -> $(params.registry)/${IMAGE_NAME}:$(params.git-revision)" else echo "Warning: Manifest file not found: $MANIFEST_PATH" + echo " Tried: $MANIFEST_PATH" + echo " Service: $service, service_dir: $service_dir, IMAGE_NAME: $IMAGE_NAME" fi fi done diff --git a/infrastructure/platform/gateway/gateway-service.yaml b/infrastructure/platform/gateway/gateway-service.yaml index e9021dee..ee74b832 100644 --- a/infrastructure/platform/gateway/gateway-service.yaml +++ b/infrastructure/platform/gateway/gateway-service.yaml @@ -21,7 +21,7 @@ spec: spec: containers: - name: gateway - image: registry.bakewise.ai/bakery-admin/gateway:c23d00dd929cc710f3b5d83ad01a965a3b561ba8 + image: registry.bakewise.ai/bakery-admin/gateway:6f282eff4c253e49a5ed4e8ba8be8b1e57280f8c ports: - containerPort: 8000 name: http diff --git a/infrastructure/services/microservices/ai-insights/ai-insights-service.yaml b/infrastructure/services/microservices/ai-insights/ai-insights-service.yaml index 2da0a01e..405327bc 100644 --- a/infrastructure/services/microservices/ai-insights/ai-insights-service.yaml +++ b/infrastructure/services/microservices/ai-insights/ai-insights-service.yaml @@ -88,7 +88,7 @@ spec: key: AI_INSIGHTS_DB_USER containers: - name: ai-insights-service - image: registry.bakewise.ai/bakery-admin/ai-insights-service:c23d00dd929cc710f3b5d83ad01a965a3b561ba8 + image: registry.bakewise.ai/bakery-admin/ai_insights:6f282eff4c253e49a5ed4e8ba8be8b1e57280f8c ports: - containerPort: 8000 name: http diff --git a/infrastructure/services/microservices/alert-processor/alert-processor.yaml b/infrastructure/services/microservices/alert-processor/alert-processor.yaml index 485dc81c..b8e7306c 100644 --- a/infrastructure/services/microservices/alert-processor/alert-processor.yaml +++ b/infrastructure/services/microservices/alert-processor/alert-processor.yaml @@ -82,7 +82,7 @@ spec: key: ALERT_PROCESSOR_DB_USER containers: - name: alert-processor - image: registry.bakewise.ai/bakery-admin/alert-processor:c23d00dd929cc710f3b5d83ad01a965a3b561ba8 + image: registry.bakewise.ai/bakery-admin/alert_processor:6f282eff4c253e49a5ed4e8ba8be8b1e57280f8c command: ["python", "-m", "uvicorn", "app.main:app", "--host", "0.0.0.0", "--port", "8000"] ports: - containerPort: 8000 diff --git a/infrastructure/services/microservices/auth/auth-service.yaml b/infrastructure/services/microservices/auth/auth-service.yaml index 37e5fb6b..61d419d2 100644 --- a/infrastructure/services/microservices/auth/auth-service.yaml +++ b/infrastructure/services/microservices/auth/auth-service.yaml @@ -110,7 +110,7 @@ spec: value: "auth_db" containers: - name: auth-service - image: registry.bakewise.ai/bakery-admin/auth-service:c23d00dd929cc710f3b5d83ad01a965a3b561ba8 + image: registry.bakewise.ai/bakery-admin/auth:6f282eff4c253e49a5ed4e8ba8be8b1e57280f8c ports: - containerPort: 8000 name: http diff --git a/infrastructure/services/microservices/demo-session/deployment.yaml b/infrastructure/services/microservices/demo-session/deployment.yaml index 58c44f03..0c91adf4 100644 --- a/infrastructure/services/microservices/demo-session/deployment.yaml +++ b/infrastructure/services/microservices/demo-session/deployment.yaml @@ -20,7 +20,7 @@ spec: serviceAccountName: demo-session-sa containers: - name: demo-session-service - image: registry.bakewise.ai/bakery-admin/demo-session-service:c23d00dd929cc710f3b5d83ad01a965a3b561ba8 + image: registry.bakewise.ai/bakery-admin/demo_session:6f282eff4c253e49a5ed4e8ba8be8b1e57280f8c ports: - containerPort: 8000 name: http diff --git a/infrastructure/services/microservices/external/external-service.yaml b/infrastructure/services/microservices/external/external-service.yaml index 1ab521bf..0dad83bc 100644 --- a/infrastructure/services/microservices/external/external-service.yaml +++ b/infrastructure/services/microservices/external/external-service.yaml @@ -114,7 +114,7 @@ spec: containers: - name: external-service - image: registry.bakewise.ai/bakery-admin/external-service:c23d00dd929cc710f3b5d83ad01a965a3b561ba8 + image: registry.bakewise.ai/bakery-admin/external:6f282eff4c253e49a5ed4e8ba8be8b1e57280f8c ports: - containerPort: 8000 name: http diff --git a/infrastructure/services/microservices/forecasting/forecasting-service.yaml b/infrastructure/services/microservices/forecasting/forecasting-service.yaml index ea360f7a..47ffe46c 100644 --- a/infrastructure/services/microservices/forecasting/forecasting-service.yaml +++ b/infrastructure/services/microservices/forecasting/forecasting-service.yaml @@ -88,7 +88,7 @@ spec: key: FORECASTING_DB_USER containers: - name: forecasting-service - image: registry.bakewise.ai/bakery-admin/forecasting-service:c23d00dd929cc710f3b5d83ad01a965a3b561ba8 + image: registry.bakewise.ai/bakery-admin/forecasting:6f282eff4c253e49a5ed4e8ba8be8b1e57280f8c ports: - containerPort: 8000 name: http diff --git a/infrastructure/services/microservices/frontend/frontend-service.yaml b/infrastructure/services/microservices/frontend/frontend-service.yaml index 93369be5..0c7651c4 100644 --- a/infrastructure/services/microservices/frontend/frontend-service.yaml +++ b/infrastructure/services/microservices/frontend/frontend-service.yaml @@ -21,7 +21,7 @@ spec: spec: containers: - name: frontend - image: registry.bakewise.ai/bakery-admin/dashboard:c23d00dd929cc710f3b5d83ad01a965a3b561ba8 + image: registry.bakewise.ai/bakery-admin/frontend:6f282eff4c253e49a5ed4e8ba8be8b1e57280f8c imagePullPolicy: Always ports: - containerPort: 3000 diff --git a/infrastructure/services/microservices/inventory/inventory-service.yaml b/infrastructure/services/microservices/inventory/inventory-service.yaml index f02839e9..7e162fc2 100644 --- a/infrastructure/services/microservices/inventory/inventory-service.yaml +++ b/infrastructure/services/microservices/inventory/inventory-service.yaml @@ -88,7 +88,7 @@ spec: key: INVENTORY_DB_USER containers: - name: inventory-service - image: registry.bakewise.ai/bakery-admin/inventory-service:c23d00dd929cc710f3b5d83ad01a965a3b561ba8 + image: registry.bakewise.ai/bakery-admin/inventory:6f282eff4c253e49a5ed4e8ba8be8b1e57280f8c ports: - containerPort: 8000 name: http diff --git a/infrastructure/services/microservices/notification/notification-service.yaml b/infrastructure/services/microservices/notification/notification-service.yaml index a86c815d..8c795d29 100644 --- a/infrastructure/services/microservices/notification/notification-service.yaml +++ b/infrastructure/services/microservices/notification/notification-service.yaml @@ -88,7 +88,7 @@ spec: key: NOTIFICATION_DB_USER containers: - name: notification-service - image: registry.bakewise.ai/bakery-admin/notification-service:c23d00dd929cc710f3b5d83ad01a965a3b561ba8 + image: registry.bakewise.ai/bakery-admin/notification:6f282eff4c253e49a5ed4e8ba8be8b1e57280f8c ports: - containerPort: 8000 name: http diff --git a/infrastructure/services/microservices/orchestrator/orchestrator-service.yaml b/infrastructure/services/microservices/orchestrator/orchestrator-service.yaml index fb4fea08..e96c8c9e 100644 --- a/infrastructure/services/microservices/orchestrator/orchestrator-service.yaml +++ b/infrastructure/services/microservices/orchestrator/orchestrator-service.yaml @@ -88,7 +88,7 @@ spec: key: ORCHESTRATOR_DB_USER containers: - name: orchestrator-service - image: registry.bakewise.ai/bakery-admin/orchestrator-service:c23d00dd929cc710f3b5d83ad01a965a3b561ba8 + image: registry.bakewise.ai/bakery-admin/orchestrator:6f282eff4c253e49a5ed4e8ba8be8b1e57280f8c ports: - containerPort: 8000 name: http diff --git a/infrastructure/services/microservices/orders/orders-service.yaml b/infrastructure/services/microservices/orders/orders-service.yaml index c1c17bee..ebfa7747 100644 --- a/infrastructure/services/microservices/orders/orders-service.yaml +++ b/infrastructure/services/microservices/orders/orders-service.yaml @@ -88,7 +88,7 @@ spec: key: ORDERS_DB_USER containers: - name: orders-service - image: registry.bakewise.ai/bakery-admin/orders-service:c23d00dd929cc710f3b5d83ad01a965a3b561ba8 + image: registry.bakewise.ai/bakery-admin/orders:6f282eff4c253e49a5ed4e8ba8be8b1e57280f8c ports: - containerPort: 8000 name: http diff --git a/infrastructure/services/microservices/pos/pos-service.yaml b/infrastructure/services/microservices/pos/pos-service.yaml index 4f544f61..52fda7f8 100644 --- a/infrastructure/services/microservices/pos/pos-service.yaml +++ b/infrastructure/services/microservices/pos/pos-service.yaml @@ -88,7 +88,7 @@ spec: key: POS_DB_USER containers: - name: pos-service - image: registry.bakewise.ai/bakery-admin/pos-service:c23d00dd929cc710f3b5d83ad01a965a3b561ba8 + image: registry.bakewise.ai/bakery-admin/pos:6f282eff4c253e49a5ed4e8ba8be8b1e57280f8c ports: - containerPort: 8000 name: http diff --git a/infrastructure/services/microservices/procurement/procurement-service.yaml b/infrastructure/services/microservices/procurement/procurement-service.yaml index 1e610ae4..dc2d3053 100644 --- a/infrastructure/services/microservices/procurement/procurement-service.yaml +++ b/infrastructure/services/microservices/procurement/procurement-service.yaml @@ -88,7 +88,7 @@ spec: key: PROCUREMENT_DB_USER containers: - name: procurement-service - image: registry.bakewise.ai/bakery-admin/procurement-service:c23d00dd929cc710f3b5d83ad01a965a3b561ba8 + image: registry.bakewise.ai/bakery-admin/procurement:6f282eff4c253e49a5ed4e8ba8be8b1e57280f8c ports: - containerPort: 8000 name: http diff --git a/infrastructure/services/microservices/production/production-service.yaml b/infrastructure/services/microservices/production/production-service.yaml index 5aff74b9..0767bba2 100644 --- a/infrastructure/services/microservices/production/production-service.yaml +++ b/infrastructure/services/microservices/production/production-service.yaml @@ -88,7 +88,7 @@ spec: key: PRODUCTION_DB_USER containers: - name: production-service - image: registry.bakewise.ai/bakery-admin/production-service:c23d00dd929cc710f3b5d83ad01a965a3b561ba8 + image: registry.bakewise.ai/bakery-admin/production:6f282eff4c253e49a5ed4e8ba8be8b1e57280f8c ports: - containerPort: 8000 name: http diff --git a/infrastructure/services/microservices/recipes/recipes-service.yaml b/infrastructure/services/microservices/recipes/recipes-service.yaml index 3fb67f8c..21330b91 100644 --- a/infrastructure/services/microservices/recipes/recipes-service.yaml +++ b/infrastructure/services/microservices/recipes/recipes-service.yaml @@ -88,7 +88,7 @@ spec: key: RECIPES_DB_USER containers: - name: recipes-service - image: registry.bakewise.ai/bakery-admin/recipes-service:c23d00dd929cc710f3b5d83ad01a965a3b561ba8 + image: registry.bakewise.ai/bakery-admin/recipes:6f282eff4c253e49a5ed4e8ba8be8b1e57280f8c ports: - containerPort: 8000 name: http diff --git a/infrastructure/services/microservices/sales/sales-service.yaml b/infrastructure/services/microservices/sales/sales-service.yaml index c5761739..59576686 100644 --- a/infrastructure/services/microservices/sales/sales-service.yaml +++ b/infrastructure/services/microservices/sales/sales-service.yaml @@ -88,7 +88,7 @@ spec: key: SALES_DB_USER containers: - name: sales-service - image: registry.bakewise.ai/bakery-admin/sales-service:c23d00dd929cc710f3b5d83ad01a965a3b561ba8 + image: registry.bakewise.ai/bakery-admin/sales:6f282eff4c253e49a5ed4e8ba8be8b1e57280f8c ports: - containerPort: 8000 name: http diff --git a/infrastructure/services/microservices/suppliers/suppliers-service.yaml b/infrastructure/services/microservices/suppliers/suppliers-service.yaml index 69e71200..1dea6244 100644 --- a/infrastructure/services/microservices/suppliers/suppliers-service.yaml +++ b/infrastructure/services/microservices/suppliers/suppliers-service.yaml @@ -88,7 +88,7 @@ spec: key: SUPPLIERS_DB_USER containers: - name: suppliers-service - image: registry.bakewise.ai/bakery-admin/suppliers-service:c23d00dd929cc710f3b5d83ad01a965a3b561ba8 + image: registry.bakewise.ai/bakery-admin/suppliers:6f282eff4c253e49a5ed4e8ba8be8b1e57280f8c ports: - containerPort: 8000 name: http diff --git a/infrastructure/services/microservices/tenant/tenant-service.yaml b/infrastructure/services/microservices/tenant/tenant-service.yaml index bc6d865c..374061ff 100644 --- a/infrastructure/services/microservices/tenant/tenant-service.yaml +++ b/infrastructure/services/microservices/tenant/tenant-service.yaml @@ -88,7 +88,7 @@ spec: key: TENANT_DB_USER containers: - name: tenant-service - image: registry.bakewise.ai/bakery-admin/tenant-service:c23d00dd929cc710f3b5d83ad01a965a3b561ba8 + image: registry.bakewise.ai/bakery-admin/tenant:6f282eff4c253e49a5ed4e8ba8be8b1e57280f8c ports: - containerPort: 8000 name: http diff --git a/infrastructure/services/microservices/training/training-service.yaml b/infrastructure/services/microservices/training/training-service.yaml index b458cc5c..d2696828 100644 --- a/infrastructure/services/microservices/training/training-service.yaml +++ b/infrastructure/services/microservices/training/training-service.yaml @@ -88,7 +88,7 @@ spec: key: TRAINING_DB_USER containers: - name: training-service - image: registry.bakewise.ai/bakery-admin/training-service:c23d00dd929cc710f3b5d83ad01a965a3b561ba8 + image: registry.bakewise.ai/bakery-admin/training:6f282eff4c253e49a5ed4e8ba8be8b1e57280f8c ports: - containerPort: 8000 name: http