All checks were successful
ci/woodpecker/push/woodpecker Pipeline was successful
- Changed heredoc from 'KUBEEOF' (quoted) to KUBEEOF (unquoted) - This allows shell variable expansion of $K8S_TOKEN directly - Removed sed replacement step that was failing due to YAML escaping issues
196 lines
7.5 KiB
YAML
196 lines
7.5 KiB
YAML
steps:
|
|
# ===========================================
|
|
# PR VALIDATION: Parallel type checks (PRs only)
|
|
# ===========================================
|
|
typecheck-backend:
|
|
image: node:22
|
|
commands:
|
|
- cd backend
|
|
- npm ci --prefer-offline
|
|
- npx tsc --noEmit
|
|
depends_on: []
|
|
when:
|
|
event: pull_request
|
|
|
|
typecheck-cannaiq:
|
|
image: node:22
|
|
commands:
|
|
- cd cannaiq
|
|
- npm ci --prefer-offline
|
|
- npx tsc --noEmit
|
|
depends_on: []
|
|
when:
|
|
event: pull_request
|
|
|
|
typecheck-findadispo:
|
|
image: node:22
|
|
commands:
|
|
- cd findadispo/frontend
|
|
- npm ci --prefer-offline
|
|
- npx tsc --noEmit 2>/dev/null || true
|
|
depends_on: []
|
|
when:
|
|
event: pull_request
|
|
|
|
typecheck-findagram:
|
|
image: node:22
|
|
commands:
|
|
- cd findagram/frontend
|
|
- npm ci --prefer-offline
|
|
- 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:
|
|
K8S_TOKEN:
|
|
from_secret: k8s_token
|
|
commands:
|
|
- mkdir -p ~/.kube
|
|
- |
|
|
cat > ~/.kube/config << KUBEEOF
|
|
apiVersion: v1
|
|
kind: Config
|
|
clusters:
|
|
- cluster:
|
|
certificate-authority-data: LS0tLS1CRUdJTiBDRVJUSUZJQ0FURS0tLS0tCk1JSUJkakNDQVIyZ0F3SUJBZ0lCQURBS0JnZ3Foa2pPUFFRREFqQWpNU0V3SHdZRFZRUUREQmhyTTNNdGMyVnkKZG1WeUxXTmhRREUzTmpVM05UUTNPRE13SGhjTk1qVXhNakUwTWpNeU5qSXpXaGNOTXpVeE1qRXlNak15TmpJegpXakFqTVNFd0h3WURWUVFEREJock0zTXRjMlZ5ZG1WeUxXTmhRREUzTmpVM05UUTNPRE13V1RBVEJnY3Foa2pPClBRSUJCZ2dxaGtqT1BRTUJCd05DQUFRWDRNdFJRTW5lWVJVV0s2cjZ3VEV2WjAxNnV4T3NUR3JJZ013TXVnNGwKajQ1bHZ6ZkM1WE1NY1pESnUxZ0t1dVJhVGxlb0xVOVJnSERIUUI4TUwzNTJvMEl3UURBT0JnTlZIUThCQWY4RQpCQU1DQXFRd0R3WURWUjBUQVFIL0JBVXdBd0VCL3pBZEJnTlZIUTRFRmdRVXIzNDZpNE42TFhzaEZsREhvSlU0CjJ1RjZseGN3Q2dZSUtvWkl6ajBFQXdJRFJ3QXdSQUlnVUtqdWRFQWJyS1JDVHROVXZTc1Rmb3FEaHFSeDM5MkYKTFFSVWlKK0hCVElDSUJqOFIxbG1zSnFSRkRHMEpwMGN4OG5ZZnFCaElRQzh6WWdRdTdBZmR4L3IKLS0tLS1FTkQgQ0VSVElGSUNBVEUtLS0tLQo=
|
|
server: https://10.100.6.10:6443
|
|
name: spdy-k3s
|
|
contexts:
|
|
- context:
|
|
cluster: spdy-k3s
|
|
namespace: cannaiq
|
|
user: cannaiq-admin
|
|
name: cannaiq
|
|
current-context: cannaiq
|
|
users:
|
|
- name: cannaiq-admin
|
|
user:
|
|
token: $K8S_TOKEN
|
|
KUBEEOF
|
|
- 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
|