Only fetch latest commit instead of full history. Reduces checkout time and bandwidth. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
189 lines
6.7 KiB
YAML
189 lines
6.7 KiB
YAML
# Shallow clone - only fetch latest commit (faster checkout)
|
|
clone:
|
|
git:
|
|
depth: 1
|
|
|
|
steps:
|
|
# ===========================================
|
|
# PR VALIDATION: Parallel type checks (PRs only)
|
|
# ===========================================
|
|
typecheck-backend:
|
|
image: node:22
|
|
volumes:
|
|
- npm-cache:/root/.npm
|
|
commands:
|
|
- cd backend
|
|
- npm ci --prefer-offline --cache /root/.npm
|
|
- npx tsc --noEmit
|
|
depends_on: []
|
|
when:
|
|
event: pull_request
|
|
|
|
typecheck-cannaiq:
|
|
image: node:22
|
|
volumes:
|
|
- npm-cache:/root/.npm
|
|
commands:
|
|
- cd cannaiq
|
|
- npm ci --prefer-offline --cache /root/.npm
|
|
- npx tsc --noEmit
|
|
depends_on: []
|
|
when:
|
|
event: pull_request
|
|
|
|
typecheck-findadispo:
|
|
image: node:22
|
|
volumes:
|
|
- npm-cache:/root/.npm
|
|
commands:
|
|
- cd findadispo/frontend
|
|
- npm ci --prefer-offline --cache /root/.npm
|
|
- npx tsc --noEmit 2>/dev/null || true
|
|
depends_on: []
|
|
when:
|
|
event: pull_request
|
|
|
|
typecheck-findagram:
|
|
image: node:22
|
|
volumes:
|
|
- npm-cache:/root/.npm
|
|
commands:
|
|
- cd findagram/frontend
|
|
- npm ci --prefer-offline --cache /root/.npm
|
|
- npx tsc --noEmit 2>/dev/null || true
|
|
depends_on: []
|
|
when:
|
|
event: pull_request
|
|
|
|
# ===========================================
|
|
# AUTO-MERGE: Merge PR after all checks pass
|
|
# ===========================================
|
|
auto-merge:
|
|
image: alpine:latest
|
|
environment:
|
|
GITEA_TOKEN:
|
|
from_secret: gitea_token
|
|
commands:
|
|
- apk add --no-cache curl
|
|
- |
|
|
echo "Merging PR #${CI_COMMIT_PULL_REQUEST}..."
|
|
curl -s -X POST \
|
|
-H "Authorization: token $GITEA_TOKEN" \
|
|
-H "Content-Type: application/json" \
|
|
-d '{"Do":"merge"}' \
|
|
"https://git.spdy.io/api/v1/repos/Creationshop/cannaiq/pulls/${CI_COMMIT_PULL_REQUEST}/merge"
|
|
depends_on:
|
|
- typecheck-backend
|
|
- typecheck-cannaiq
|
|
- typecheck-findadispo
|
|
- typecheck-findagram
|
|
when:
|
|
event: pull_request
|
|
|
|
# ===========================================
|
|
# DOCKER: Multi-stage builds with layer caching
|
|
# ===========================================
|
|
docker-backend:
|
|
image: gcr.io/kaniko-project/executor:debug
|
|
commands:
|
|
- /kaniko/executor
|
|
--context=/woodpecker/src/git.spdy.io/Creationshop/cannaiq/backend
|
|
--dockerfile=/woodpecker/src/git.spdy.io/Creationshop/cannaiq/backend/Dockerfile
|
|
--destination=10.100.9.70:5000/cannaiq/backend:latest
|
|
--destination=10.100.9.70:5000/cannaiq/backend:sha-${CI_COMMIT_SHA:0:8}
|
|
--build-arg=APP_BUILD_VERSION=sha-${CI_COMMIT_SHA:0:8}
|
|
--build-arg=APP_GIT_SHA=${CI_COMMIT_SHA}
|
|
--build-arg=APP_BUILD_TIME=${CI_PIPELINE_CREATED}
|
|
--registry-mirror=mirror.gcr.io
|
|
--insecure-registry=10.100.9.70:5000
|
|
--cache=true
|
|
--cache-repo=10.100.9.70:5000/cannaiq/cache-backend
|
|
--cache-ttl=168h
|
|
depends_on: []
|
|
when:
|
|
branch: [master, develop]
|
|
event: push
|
|
|
|
docker-cannaiq:
|
|
image: gcr.io/kaniko-project/executor:debug
|
|
commands:
|
|
- /kaniko/executor
|
|
--context=/woodpecker/src/git.spdy.io/Creationshop/cannaiq/cannaiq
|
|
--dockerfile=/woodpecker/src/git.spdy.io/Creationshop/cannaiq/cannaiq/Dockerfile
|
|
--destination=10.100.9.70:5000/cannaiq/frontend:latest
|
|
--destination=10.100.9.70:5000/cannaiq/frontend:sha-${CI_COMMIT_SHA:0:8}
|
|
--registry-mirror=mirror.gcr.io
|
|
--insecure-registry=10.100.9.70:5000
|
|
--cache=true
|
|
--cache-repo=10.100.9.70:5000/cannaiq/cache-cannaiq
|
|
--cache-ttl=168h
|
|
depends_on: []
|
|
when:
|
|
branch: [master, develop]
|
|
event: push
|
|
|
|
docker-findadispo:
|
|
image: gcr.io/kaniko-project/executor:debug
|
|
commands:
|
|
- /kaniko/executor
|
|
--context=/woodpecker/src/git.spdy.io/Creationshop/cannaiq/findadispo/frontend
|
|
--dockerfile=/woodpecker/src/git.spdy.io/Creationshop/cannaiq/findadispo/frontend/Dockerfile
|
|
--destination=10.100.9.70:5000/cannaiq/findadispo:latest
|
|
--destination=10.100.9.70:5000/cannaiq/findadispo:sha-${CI_COMMIT_SHA:0:8}
|
|
--registry-mirror=mirror.gcr.io
|
|
--insecure-registry=10.100.9.70:5000
|
|
--cache=true
|
|
--cache-repo=10.100.9.70:5000/cannaiq/cache-findadispo
|
|
--cache-ttl=168h
|
|
depends_on: []
|
|
when:
|
|
branch: [master, develop]
|
|
event: push
|
|
|
|
docker-findagram:
|
|
image: gcr.io/kaniko-project/executor:debug
|
|
commands:
|
|
- /kaniko/executor
|
|
--context=/woodpecker/src/git.spdy.io/Creationshop/cannaiq/findagram/frontend
|
|
--dockerfile=/woodpecker/src/git.spdy.io/Creationshop/cannaiq/findagram/frontend/Dockerfile
|
|
--destination=10.100.9.70:5000/cannaiq/findagram:latest
|
|
--destination=10.100.9.70:5000/cannaiq/findagram:sha-${CI_COMMIT_SHA:0:8}
|
|
--registry-mirror=mirror.gcr.io
|
|
--insecure-registry=10.100.9.70:5000
|
|
--cache=true
|
|
--cache-repo=10.100.9.70:5000/cannaiq/cache-findagram
|
|
--cache-ttl=168h
|
|
depends_on: []
|
|
when:
|
|
branch: [master, develop]
|
|
event: push
|
|
|
|
# ===========================================
|
|
# DEPLOY: Pull from local registry
|
|
# ===========================================
|
|
deploy:
|
|
image: bitnami/kubectl:latest
|
|
environment:
|
|
KUBECONFIG_CONTENT:
|
|
from_secret: kubeconfig_data
|
|
commands:
|
|
- mkdir -p ~/.kube
|
|
- echo "$KUBECONFIG_CONTENT" | base64 -d > ~/.kube/config
|
|
- chmod 600 ~/.kube/config
|
|
- kubectl set image deployment/scraper scraper=10.100.9.70:5000/cannaiq/backend:sha-${CI_COMMIT_SHA:0:8} -n cannaiq
|
|
- kubectl rollout status deployment/scraper -n cannaiq --timeout=300s
|
|
- REPLICAS=$(kubectl get deployment scraper-worker -n cannaiq -o jsonpath='{.spec.replicas}'); if [ "$REPLICAS" = "0" ]; then kubectl scale deployment/scraper-worker --replicas=5 -n cannaiq; fi
|
|
- kubectl set image deployment/scraper-worker worker=10.100.9.70:5000/cannaiq/backend:sha-${CI_COMMIT_SHA:0:8} -n cannaiq
|
|
- kubectl set image deployment/cannaiq-frontend cannaiq-frontend=10.100.9.70:5000/cannaiq/frontend:sha-${CI_COMMIT_SHA:0:8} -n cannaiq
|
|
- kubectl set image deployment/findadispo-frontend findadispo-frontend=10.100.9.70:5000/cannaiq/findadispo:sha-${CI_COMMIT_SHA:0:8} -n cannaiq
|
|
- kubectl set image deployment/findagram-frontend findagram-frontend=10.100.9.70:5000/cannaiq/findagram:sha-${CI_COMMIT_SHA:0:8} -n cannaiq
|
|
- kubectl rollout status deployment/cannaiq-frontend -n cannaiq --timeout=120s
|
|
depends_on:
|
|
- docker-backend
|
|
- docker-cannaiq
|
|
- docker-findadispo
|
|
- docker-findagram
|
|
when:
|
|
branch: [master, develop]
|
|
event: push
|