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 <noreply@anthropic.com>
This commit is contained in:
@@ -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"
|
||||
|
||||
Reference in New Issue
Block a user