fix(ci): stagger builds in stages and add retry for Harbor load

Split 5 parallel build jobs into 3 stages (2+2+1) to avoid
overwhelming Harbor with concurrent image pulls. Add retry: 2
for transient failures.

Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
Chever John 2026-06-17 10:20:08 +08:00
parent 475589b23f
commit 75f8dca36b
No known key found for this signature in database
GPG Key ID: 2894D52ED1211DF0

View File

@ -1,5 +1,7 @@
stages: stages:
- build - build-1
- build-2
- build-3
variables: variables:
HARBOR_REGISTRY: harbor-in-k3s.cheverjohn.me HARBOR_REGISTRY: harbor-in-k3s.cheverjohn.me
@ -10,10 +12,10 @@ variables:
DOCKER_CERT_PATH: /certs/client DOCKER_CERT_PATH: /certs/client
.build-template: &build-template .build-template: &build-template
stage: build
image: docker:27 image: docker:27
services: services:
- docker:27-dind - docker:27-dind
retry: 2
before_script: before_script:
- until docker info >/dev/null 2>&1; do echo "Waiting for Docker daemon..."; sleep 2; done - until docker info >/dev/null 2>&1; do echo "Waiting for Docker daemon..."; sleep 2; done
- echo "$HARBOR_PASSWORD" | docker login $HARBOR_REGISTRY -u "$HARBOR_USER" --password-stdin - echo "$HARBOR_PASSWORD" | docker login $HARBOR_REGISTRY -u "$HARBOR_USER" --password-stdin
@ -32,30 +34,35 @@ variables:
build-gateway: build-gateway:
<<: *build-template <<: *build-template
stage: build-1
variables: variables:
IMAGE_NAME: iloom-gateway IMAGE_NAME: iloom-gateway
DOCKERFILE_PATH: gateway/Dockerfile DOCKERFILE_PATH: gateway/Dockerfile
build-auth-service: build-auth-service:
<<: *build-template <<: *build-template
stage: build-1
variables: variables:
IMAGE_NAME: iloom-auth-service IMAGE_NAME: iloom-auth-service
DOCKERFILE_PATH: auth-service/Dockerfile DOCKERFILE_PATH: auth-service/Dockerfile
build-purchaser-service: build-purchaser-service:
<<: *build-template <<: *build-template
stage: build-2
variables: variables:
IMAGE_NAME: iloom-purchaser-service IMAGE_NAME: iloom-purchaser-service
DOCKERFILE_PATH: purchaser-service/Dockerfile DOCKERFILE_PATH: purchaser-service/Dockerfile
build-textile-service: build-textile-service:
<<: *build-template <<: *build-template
stage: build-2
variables: variables:
IMAGE_NAME: iloom-textile-service IMAGE_NAME: iloom-textile-service
DOCKERFILE_PATH: textile-service/Dockerfile DOCKERFILE_PATH: textile-service/Dockerfile
build-washing-service: build-washing-service:
<<: *build-template <<: *build-template
stage: build-3
variables: variables:
IMAGE_NAME: iloom-washing-service IMAGE_NAME: iloom-washing-service
DOCKERFILE_PATH: washing-service/Dockerfile DOCKERFILE_PATH: washing-service/Dockerfile