# Peikarband Platform - Woodpecker CI/CD Pipeline # Harbor registry: hub.peikarband.ir (مطابق با values-prd.yaml) steps: # مرحله Clone (برای debug و مشاهده لاگ‌ها) clone: image: plugins/git settings: depth: 50 when: event: [push, tag, manual] # مرحله ساخت با Kaniko Executor build-and-push: image: gcr.io/kaniko-project/executor:latest secrets: - harbor_username - harbor_password environment: # استفاده از secrets به عنوان environment variables HARBOR_USERNAME: from_secret: harbor_username HARBOR_PASSWORD: from_secret: harbor_password commands: # نمایش اطلاعات برای debug - echo "Building for commit: ${CI_COMMIT_SHA}" - echo "Working directory: $(pwd)" - ls -la # ساخت Docker config برای Harbor (با استفاده از base64 encoding) - mkdir -p /kaniko/.docker - | AUTH=$(echo -n "${HARBOR_USERNAME}:${HARBOR_PASSWORD}" | base64 -w 0) echo "{\"auths\":{\"hub.peikarband.ir\":{\"auth\":\"${AUTH}\"}}}" > /kaniko/.docker/config.json # نمایش config (بدون password) - cat /kaniko/.docker/config.json | sed 's/"auth":"[^"]*"/"auth":"***"/g' # Build و Push به Harbor - /kaniko/executor --dockerfile=Dockerfile --context=dir://. --destination=hub.peikarband.ir/peikarband/landing:latest --destination=hub.peikarband.ir/peikarband/landing:${CI_COMMIT_SHA:0:8} --insecure=false --skip-tls-verify=false --digest-file=/kaniko/digest-file --verbosity=info when: event: [push, tag, manual]