fix(ci): replace old per-image deploy with S3 binary share deploy

The deploy job was using kubectl set image to stamp per-service Docker
images (api_gateway:<sha>, etc.) — these images no longer exist after
the S3 binary share migration. Replace with kubectl apply + rollout
restart, which picks up YAML changes and triggers initContainers to
fetch latest binaries from S3.

Delete redundant deploy-services job (merged into deploy).

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
jgrusewski
2026-02-28 19:17:24 +01:00
parent e58ce4f585
commit f82144c977

View File

@@ -1410,60 +1410,12 @@ deploy:
kubernetes:
namespace: foxhunt
script:
# Update images to this commit's build
# Format: image_repo:deployment_name:container_name
- |
SERVICES="
trading_service:trading-service:trading-service
api_gateway:api-gateway:api-gateway
broker_gateway_service:broker-gateway:broker-gateway
ml_training_service:ml-training-service:ml-training-service
backtesting_service:backtesting-service:backtesting-service
trading_agent_service:trading-agent-service:trading-agent-service
web-gateway:web-gateway:web-gateway
"
TOTAL=0
FAILED=0
for entry in $SERVICES; do
IMAGE_REPO=$(echo "$entry" | cut -d: -f1)
DEPLOY_NAME=$(echo "$entry" | cut -d: -f2)
CONTAINER_NAME=$(echo "$entry" | cut -d: -f3)
TOTAL=$((TOTAL + 1))
echo "Deploying ${DEPLOY_NAME} (image: ${IMAGE_REPO}:${CI_COMMIT_SHA})..."
if ! kubectl -n foxhunt set image "deployment/${DEPLOY_NAME}" "${CONTAINER_NAME}=${REGISTRY}/${IMAGE_REPO}:${CI_COMMIT_SHA}"; then
echo "WARNING: failed to update ${DEPLOY_NAME} (deployment may not exist yet)"
FAILED=$((FAILED + 1))
fi
done
echo "Deploy complete: $((TOTAL - FAILED))/${TOTAL} services updated"
# Fail if ALL deployments failed (cluster probably unreachable)
[ "$FAILED" -lt "$TOTAL" ]
# --------------------------------------------------------------------------
# Stage 5: Deploy — rolling restart of all service deployments
# --------------------------------------------------------------------------
deploy-services:
stage: deploy
image:
name: bitnami/kubectl:latest
entrypoint: [""]
tags:
- kapsule
- docker
needs:
- job: write-manifest
variables:
KUBERNETES_CPU_REQUEST: "100m"
KUBERNETES_MEMORY_REQUEST: "64Mi"
rules:
- if: $CI_COMMIT_BRANCH == "main" && $CI_PIPELINE_SOURCE == "push"
when: manual
allow_failure: true
- if: $CI_PIPELINE_SOURCE == "web" || $CI_PIPELINE_SOURCE == "api"
when: manual
allow_failure: true
script:
# S3 binary share: services use generic runtime image + initContainer to fetch binaries from S3.
# Deploy = apply K8s manifests (picks up YAML changes) + rollout restart (fetch new binaries).
- echo "Deploying ${CI_COMMIT_SHA}..."
# Apply all service manifests (idempotent — picks up any YAML changes)
- kubectl apply -f infra/k8s/services/ -f infra/k8s/storage/ -f infra/k8s/training/
# Rolling restart triggers initContainers to fetch latest binaries from S3
- |
for svc in trading-service api-gateway broker-gateway \
ml-training-service backtesting-service \
@@ -1477,4 +1429,4 @@ deploy-services:
trading-agent-service data-acquisition-service web-gateway; do
kubectl -n foxhunt rollout status deployment/$svc --timeout=120s
done
- echo "All services deployed"
- echo "All services deployed with S3 binaries"